Using RTC Wake up ISR as OS Systick
Due to low power requirements, I would like to use a different source to generate the 1ms or 10ms OS tick. The internal RTC, using a 32768Hz external crystal as it's clock source, is able to generate interrupts at ~61us increments if the wake up ISR is setup to auto interrupt periodically. In our STM32L152xD device, I was able to setup the interrupt and see that it jumps to the ISR, but it seems it is happening a lot faster that expected based on the Asynchronous/Synchronous pre-scaler registers. What values would I need to write to these registers to get a 1ms interrupt? I programmed them with 2, and 10 to give (2+1)*(10+1) = 33, then 32768/33 = ~993 Hz. I declared a unsigned long variable which is incremented each time interrupt takes place, but the values I read after placing a break point in the code are in the millions! Not even possible in the lowest interval of 63us. The WUTF bit in the RTC->ISR register is cleared in the ISR as the first line of code.
Any suggestions? Thanks Galan #stm32l152-rtc-configuration