Page 1 of 1

How to confirm core freq

Posted: Tue Sep 25, 2018 11:18 pm
by whoyoume
Hello All.

Could anybody tell me how?

I use DevKitC, and I hope 240MHz.

Thank you.

Re: How to confirm core freq

Posted: Wed Sep 26, 2018 2:53 pm
by whoyoume
Thank you people, I've got it using a code shown below.

register uint32_t t0, t;
register uint32_t n = 64000;
register uint8_t* pdata = new uint8_t[n];
uint32_t usec0 = micros();
asm volatile ("rsr %0, ccount" : "=r"(t0));
register uint32_t k = 0;
for(; k < n; k++) {
pdata[k] = (uint8_t)((*preg >> 11) & 0xff);
}
asm volatile ("rsr %0, ccount" : "=r"(t));
uint32_t usec = micros();
delete [] pdata;

printf("%u (%u, %u)\n", t - t0, t0, t);
printf("%u (%u, %u) usec\n", usec - usec0, usec0, usec);