Skip to main content
Explorer
August 5, 2024
Question

STM32 sleepmode problem

  • August 5, 2024
  • 1 reply
  • 609 views

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)."

    This topic has been closed for replies.

    1 reply

    Super User
    August 5, 2024

    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.