Timer stops working after exiting sleep

Hi, I have a STM32F105 uC running FreeRTOS v10.0.1 and all my timers work until I enter low-power mode (standby) and exit. I use a timer to synchronize a task and after exiting the sleep mode, the callback is no longer called. My thread waits on a semaphore with portMAX_DELAY. When a timeout occurs, the callback gives the semaphore and allows the thread to run. I realized the problem because I use an event group to kick the watchdog, but the uC keeps resetting due to the watchdog which means the semaphore was never given. I have placed breakpoints and I know the thread is waiting on the Semaphore (which should be given by the timer). I have another task that uses the same strategy (timer and a callback with a semaphore give) and that works. I have tried using different power modes thinking that the RAM retention might have something to do with it, but I get the same results in all modes. When I remove the sleep altogether, everything works. How can I check what state the timer service or the state of a specific timer so I know why it is not firing? As far as I can tell, the timer in question is Active (I used xTimerIsTimerActive and it returns pdTRUE). I don’t see any button allowing me to attachf iles, however, if you need to see it, give me an email address so I can forward it. I am just wondering what I am doing wrong which causes the timer to not work anymore. Regards, Michel

Timer stops working after exiting sleep

I found what the problem was. When the uC goes into low-power mode, the external crystal is turned off and needs to be restarted after exiting the sleep period. So my uC was running at 8MHz on the internal RC oscillator instead of the xtal and PLLs at 72MHz Hence, the perception of only one timer not running, but in fact it was (9 times) too slow to kick the watchdog before resetting. I hope this can help other people that might run into a similar issue. Regards, Michel