Skip to content
Commit 400dc793 authored by Holman Greenhand's avatar Holman Greenhand Committed by Kumar Gala
Browse files

timer: cortex_m: Fix the discontinuous readings of the cycle counter.



On a stm32, When we use the k_busy_wait function to wait a
delay (500us) just after an idle tickless period the delay could be
lower than the requested one. Consecutive readings of the cycle counter
made with the function k_cycle_get_32 juste after tickeless period
provides erroneous values (value jump) after some time (100 us).

To fix this issue we needs:

- Add the update of clock_accumulated_count value in the
_timer_idle_exit function.

- Treat the case in the get_elapsed_count function when the reload value
of the timer is set to a remaining value to wait until end of tick (see
_timer_idle_exit) . In this case the time elapsed until the systick
timer restart was not yet added to clock_accumulated_count. To retrieve
a correct cycle count we must therefore consider the number of cycle
since current tick period start and not only the cycle number since the
timer restart.

Fixes #6164

Signed-off-by: default avatarHolman Greenhand <greenhandholman@gmail.com>
parent 71703392
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment