cancel
Showing results for 
Search instead for 
Did you mean: 

RTC subsecond interrupt does not work

squin
Associate II
Posted on February 08, 2016 at 19:33

I have written some code to generate an interrupt from the RTC alarm. This includes sub seconds. This works well for times in excess of 1 second. The alarm time, including subseconds is calculated and displayed. When the interrupt is hit the time is read again and the difference is only a few subsecond counts. However when a short time (less than 1 second) is tried it will fail if the only thing that changes are the subseconds. Then the interrupt is not triggered. This does not seem expected behaviour, any workarounds out there?

#interrupt #rtc #stm32l152
2 REPLIES 2
Posted on February 08, 2016 at 19:45

Generally speaking for the STM32 parts, you need to deal with things +1 second out.

For sub-second stuff perhaps you can consider using other timers, or SysTick?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
squin
Associate II
Posted on February 09, 2016 at 12:39

I should read the manual more closely, the sub second register is a down counter. This meant I was not setting the correct time. So I would read the time and see it was say 2000 (max was 16384). I would add say 8000 giving a result of 10000. However the counter then down counts from 2000 to 0 at which point the seconds are incremented and the interrupt does not fire as the seconds are now not correct.

Doh!