zephyr/tests/kernel/timer/timer_behavior
Tomasz Moń c55266a925 tests: kernel: timer_behavior: Decrease tick rate for nRF
Nordic targets use 24-bit RTC peripheral for system clock. Nordic system
clock timeout implementation relies on RTC CC (capture compare) when
the timeout is in future. Nordic system clock driver allows setting
alarm only to 3 or more counts from current counter value due to silicon
limitation (to ensure that CC event triggers before counter overflow).

RTC CC limitation does not have much impact on normal applications where
there is no need to schedule such short timeouts, but is problematic in
a timer test that expects being able to repeatedly schedule timeouts on
subsequent ticks.

Reduce system tick rate to 8192 on nRF targets to allow setting CC to
the very next tick. With system tick rate being 4 times less than the
hardware tick rate, it is always possible to schedule timeout to happen
in the next tick because ticks are 4 counts apart, i.e. current timer
value + 3 never runs past the next tick.

Fixes: #54211

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-04-05 08:30:15 +02:00
..
src tests: timer_behavior: accuracy improvements 2023-03-02 21:14:52 +01:00
CMakeLists.txt
Kconfig tests: kernel: timer_behavior: Decrease tick rate for nRF 2023-04-05 08:30:15 +02:00
prj.conf tests: kernel: timer_behavior: improve timer_tick_train output 2023-02-19 20:34:37 -05:00
README test: timer_behavior: Rename readme.md to readme 2022-09-06 17:54:52 -04:00
testcase.yaml yamllint: fix all yamllint line-length errors 2023-01-04 01:16:45 +09:00

# Test a timer implementations variance and long term drift

Records and calculates statistical values against a timer validating that.

1. Timer variance and standard deviation is below defined acceptable values.
2. Periodic timers do not drift in either direction from expected total time.

Timers are meant to be precise and accurate. This test validates an implementation is both.