STM32F4xx IRQ on on wake up has incorrect system time

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
dast_1961951
Level 4
Level 4
10 likes received First like received

System time is not updated upon exit from stm32f4xx stop mode until return from stop_mode_power_down_hook().   Global interrupts enable prior to return, so this can cause execution of IRQs before updating this system time.

This can cause IRQs that call host_rtos_get_time() to receive the wrong time.

In ThreadX, tx_time_get() is noted to be allowed from ISRs, so this is a very valid use case.

0 Likes
1 Reply
dast_1961951
Level 4
Level 4
10 likes received First like received

workaround:

with threadx, one can call tx_time_increment() prior to returning from stop_mode_power_down_hook() and return 0 from this function.