Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to see the frequency pic are using?
01-05-2013, 11:11 PM, (This post was last modified: 02-05-2013, 03:33 AM by TuxD3v.)
#1
how to see the frequency pic are using?
Hi guys,

I want to print to using for example CDC, the real frequency that my 26j50 are clocked.

does any one know how can i calculate it using pinguino ide?

regards
tux
Reply
02-05-2013, 09:47 AM,
#2
RE: how to see the frequency pic are using?
CDC.printf("Fosc=%lu\r\n", System.getCpuFrequency() );


(01-05-2013, 11:11 PM)TuxD3v Wrote: Hi guys,

I want to print to using for example CDC, the real frequency that my 26j50 are clocked.

does any one know how can i calculate it using pinguino ide?

regards
tux
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
03-05-2013, 02:10 PM,
#3
RE: how to see the frequency pic are using?
Code:
CDC.printf("CPU: %lu -=- Clock: %lu\r\n", cpu_freq, sys_clock);

Yields:

CPU: 8000000 -=- Clock: 2726035149

So it looks like the CPU is using its internal oscillator at 8MHz ?

No idea what the system clock represents... a 2.7THz cpu :-)
Reply
03-05-2013, 03:25 PM,
#4
RE: how to see the frequency pic are using?
What's the data type of sys_clock and does it match %lu?

John
Reply
04-05-2013, 02:57 AM,
#5
RE: how to see the frequency pic are using?
The data type of sys_clock is unsigned long so, yes, it matches %lu
Reply
04-05-2013, 08:28 AM,
#6
RE: how to see the frequency pic are using?
So has it been initialised and updated properly?

It'll be easier for you to figure than me to ask questions...

John
Reply
05-05-2013, 04:48 AM,
#7
RE: how to see the frequency pic are using?
Thanks Wink

my 26j50 says:
Fosc=83163561

it seems to be at 83MHZ with a oscillator of 20MHZ is it normal?

thanks guys.

regards
tux
Reply
09-05-2013, 06:37 PM,
#8
RE: how to see the frequency pic are using?
With :
cpu_freq = System.getCpuFrequency();
sys_clock = System.getPeripheralFrequency();
I get 48.000.000 and 12.000.000 ...
Huh
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
10-05-2013, 09:21 AM,
#9
RE: how to see the frequency pic are using?
rev813

Code:
unsigned long cpu_freq;
unsigned long sys_clock;

void setup() {
    //run once:
    pinMode(USERLED, OUTPUT);
    }

void loop() {
    
    //run repeatedly:
    digitalWrite(USERLED, HIGH);
    cpu_freq = System.getCpuFrequency();
    CDC.printf("CPU: %lu -=- Clock: %lu\r\n", cpu_freq, sys_clock);

    delay(200);  
  
    digitalWrite(USERLED, LOW);
    sys_clock = System.getPeripheralFrequency();
    CDC.printf("CPU: %lu -=- Clock: %lu\r\n", cpu_freq, sys_clock);    
  
    delay(200);  
  }

Well the LED flashes, the device node /dev/cu.usbmodem247411 is created, but there's no output Sad
Reply
10-05-2013, 01:11 PM, (This post was last modified: 10-05-2013, 01:13 PM by regis.)
#10
RE: how to see the frequency pic are using?
It works perfectly for me (Linux/IDE rev.813/Pinguino 26j50) ...
   
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)