cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 RTC interrupts

matas
Associate II
Posted on September 09, 2015 at 07:22

Hello, I had a quick question is it possible to setup the RTC to trigger Alarm interrupt and Wakeup counter interrupt in the same program. This is needed because I use Standby for long sleep (~1s) and Stop mode for short sleep (6-8ms) while the external sensor is converting measurements. I was only successful of doing this only if the RTC is fully restarted, but because of that it resets the time. If I do not reset the RTC fully, I get the Alarm trigger to work only once. I tried adding all the function that I use in RTC initialization with Alarm to the main program, but still no luck.

Foo Bar
1 REPLY 1
matas
Associate II
Posted on September 09, 2015 at 11:09

I found the error. I needed the Alarm to set off every 6-9ms, so I only adjusted the subsecond config: 

RTC_AlarmSubSecondConfig(RTC_Alarm_A, 0x00000001, RTC_AlarmSubSecondMask_SS14_1);

I did not even call the RTC_SetAlarm, because its minimum parameter was every second and that was to long for me. And so the interrupt worked only once

The SOLUTION was to add the RTC_SetAlarm and set it to every second (RTC_AlarmStructure.RTC_AlarmMask = 0x80808080;) my interrupt started working. 

Foo Bar