cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding RTC Alarm Interrupt

san123
Associate

Hello STM32 Community,

I'm currently working with the RTC peripheral on an STM32F4 device, and I have a question regarding RTC alarm events.

I've been able to generate interrupts at specific intervals, such as 250ms or 500ms etc, using the RTC alarm feature. However, I'm now seeking a method to generate a fixed millisecond interrupt, approximately 333msec, using the RTC alarm subsecond functionality (e.g., RTC_ALARMSUBSECONDMASK_SS14).

Could anyone provide insights or suggestions on how to achieve this?

Thank you in advance for your assistance.

1 REPLY 1
Sarra.S
ST Employee

Hello @san123,

 

The subsecond value is loaded into the RTC_SPRE register and counts down from this value to zero 

Since the subsecond counter counts down, you must determine what value to start from to get 333ms before it hits zero. The subsecond value is effectively the number of ticks remaining in the current second when the alarm should trigger.

Check this thread on how to implement this in an example! 

Also, please check the Alarm sub-second mask combinations with each example result in AN3371 (Table 6.) 

Here are the available API that you can use: 

  •  To configure the RTC alarm sub-second, use the RTC_AlarmSubSecondConfig() function
  • To read the RTC alarm sub-second, use the RTC_GetAlarmSubSecond() function

I hope that helps!

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.