2024-08-05 02:52 AM
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)."
2024-08-05 06:14 AM
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.