granularity function micros() arm

Hello everyone !

I want to know information about the micro () function under arm, SysTick->VAL is loaded at 84000 and decremented at 0, which is equal to 1ms, but what is the granularity, 11.9ns? Because if I do a calculation it is 84000 / 0.084 = 1000000ns (1ms) .. I don't understand too much can you explain to me thank you.

Second, what's is SysTick->CTRL ?

Thanks !

I don't know about your environment, but in mine, 1ms is the default SysTick interval. Why would SysTick have anything to do with micros()?

SysTick is use in micros functions under Arduino Due. I just want to know how is decrement SysTick-> VAL

Oh, I see. SysTick uses micros()? But I am not sure I understand your granularity question. 84000 is probably derived from an 84 MHz clock frequency (84000000/84000 = 1000), so the nominal granularity should be one 84 MHz clock cycle.

The actual granularity of micros() is system dependant, so you have to dig into the code and/or documentation to get the right answer. I think it depends on interrupt response latency.

aarg:
Oh, I see. SysTick uses micros()?

No, micros() uses SysTick.

I not find the granularity of micros(), someone say me it's 11.9ns but, nothing in documentations.

You have a informations about SysTick->CTRL ?

Thanks,

pandorfr:
I not find the granularity of micros(), someone say me it's 11.9ns but, nothing in documentations.

You misunderstood. 11.9ns would be the granuality of SysTick given an 84 MHz Clock

You have a informations about SysTick->CTRL ?

It's probably the ARM SysTick Control and Status Register. Check the Architecture Reference Manual for the particular ARM variant used in your processor.

SysTick is an ARM "standard" peripheral. It's a "simple" timer that continuously counts down, causes an interrupt when it crosses zero, and reloads the configured value from SysTick->LOAD. If you set SysTick->LOAD to 84000 on an 84MHz ARM chip (Arduino Due) it will interrupt every millisecond (giving you millis()), and loading the count itself gives you additional resolution of 1/84MHz (11.9ns), so micros() does something like "millis() + ((LOAD-COUNT)/(ticksPerMicrosecond))"
SysTick->CTRL is the control bits for the timer, which controls whether its enabled, whether it geneates interrupts, and whether it uses an alternate clock source.

Note that since the counter decrements at the CPU clock frequency, and most instructions and especially C functions will take more than a single clock cycle, there will be some error between the calculations and the actual time. (OTOH, 48 to 84 or more clocks per microsecond...)