cancel
Showing results for 
Search instead for 
Did you mean: 

In my project I cannot enable SysTick to save power but I have the RTC available. Now the HAL_GetTIck always returns 0 and this is bad for I2C drivers that use HAL_GetTick to measure timeouts. How can implement HAL_GetTick using only RTC?

adibacco9
Associate
 
1 REPLY 1
Jack Peacock_2
Senior III

On some STM32s the RTC has a subseconds register. You can configure one of the RTC Alarms to generate a periodic interrupt based on the subseconds count, which is the prescaler count for the 1Hz RTC seconds tick.

I use it to create a one second timebase, setting the alarm at all subseconds bits on. Turn off day, hour, minute and second masks, and enable subseconds alarm mask.

Jack Peacock