Arduino Due micros() resolution

I haven't been able to find a definitive answer to this question. If the prescaler is 64 in the stock Arduino code, thereby making the micros() resolution on 16Mhz boards 4uS, would that make the 84Mhz Due micros() resolution about 0.762uS or 1uS?

One can only assume that the guys writing the code got it right and a function called micros() actually has a resolution of 1uS. If that was not the case I'm sure we would have heard about it by now.

if the prescaler is 64 in the stock Arduino code,

I'm not familiar with the code but the hardware is totally different, any prescaler referred to in AVR code will have no bearing on ARM code. On an ARM I would think they are reading the systick counter directly.


Rob

Graynomad:
any prescaler referred to in AVR code will have no bearing on ARM code

I hadn't even considered that, very good point!

Anybody out there with a Due that can verify micros() returning values other than multiples of 4?

same question was already answered in this forum a couple of month ago... micros() step size with due improved? - #3 by schwingkopf - Arduino Due - Arduino Forum

micros() returns values that are multiples of 1us

If you want to have more preciesely timing, you can better use:

asm("nop");

It's equal to 1/84000000 seconds.

My apologies for being redundant. I was unable to find the answer with my searches.

Thanks to all who replied.

There is SoC specific code in Arduino libs, all I used was git clone the repo and "git grep micros":

Gericom:
If you want to have more preciesely timing, you can better use:

asm("nop");

It's equal to 1/84000000 seconds.

Err... assuming that NOP instruction in program takes exactly 1 tick of core is really brave, and surely OPcodes shouldn't be used for timing purposes without calibrating it to some timer. NOP might even get optimised out during runtime by the core caching mechanism, or it can take few cpu cycles to fetch and "execute" it.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489e/Cjafcggi.html
So yeah - been there, done that, so you don't have to. :stuck_out_tongue:

//edit, as a sidenote:
While micros does loop checking system clock tick counter, there's also Sleep function for longer delays (1ms resolution), using Wait For Interrupt - Arduino/timetick.c at 1.5.2 · arduino/Arduino · GitHub
In embedded machines using the second one is better practice (whenever you don't need better resolution than 1ms) as WFI does put ARM core into sleep, decreasing the power consumption as core is being awaken every 1ms and then being put back to sleep until required delay passes.