k_sleep() expires sooner than expected on STM32F4 (Cortex M4) #15216
Labels
area: Timer
Timer
bug
The issue is a bug, or the PR is fixing a bug
priority: medium
Medium impact/importance bug
Milestone
Description
I'm adding support for a new sensor shield (shield-iks01a3) which should be plugged
on Nucleo board (for example F411RE, which is based on Cortex M4).
I have a sample thread that reads sensor data every 2 secs using a k_sleep().
The sensors are programmed to generate triggers at 100hz or 200hz.
I see that k_sleep() very often takes less than 2secs.
I opened a PR (#15024) with a temptative fix that make disappear the issue.
My observation is that there is a much higher rate of z_clock_set_timeout() calls with
last_load < CYC_PER_TICK. If I force last_load to be at least CYC_PER_TICK the issue
again disappear.
To Reproduce
I'm currently not able to reproduce it w/o a proper h/w.
Only using Nucleo board plus x_nucleo_iks01a3 shield.
I can try to find an easy way.
Expected behavior
k_sleep() should wait the proper amount of time in all conditions.
Impact
Bug is annoying but not really severe for my development.
Screenshots or console output
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: