cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 sleepmode problem

tonbaebae
Associate II

Hi. everyone
"I've found that when I enter sleep mode, my uwtick stops counting, which causes issues with calculating the DataCollect time after waking up with the RTC. Is there a way to resolve this?"

while(1){
    if(HAL_GetTick() >= Tcmd1_dataCollect_ts) {
        Tcmd1_dataCollect_ts = HAL_GetTick() + 10000;
        Tcmd1_DataCollect();
    }
    if(HAL_GetTick() >= Tcmd2_dataCollect_ts) {
        Tcmd2_dataCollect_ts = HAL_GetTick() + 60000;
        Tcmd2_DataCollect();
    }
    osDelay(1000);
}
"I have tried using the RTC time for calculations, but I found that it can only measure to the nearest second (I need milliseconds)."

1 REPLY 1
TDK
Guru

RTC can measure to less than a second. Not necessarily milliseconds, but close.

You can also keep SysTick enabled while going to sleep and let it wake up every ms, but that's not a very power efficient solution.

If you feel a post has answered your question, please click "Accept as Solution".