cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4xx RTC questions

tba10596
Associate II
Posted on September 21, 2015 at 16:49

All:

First, I have been able to ''setdatetime'' and ''getdatetime'' using excellent example code. In fact, I wait until after powered up to receive a ''setdatetime'' command (via UART). Using the HSE on F4 Discovery board (presently LSE is not populated), I was able to see only a 5 second deviation in 16 hours of run time.

Is there a way to set the alarms independently of the date and time?

For instance, can I create a ''setalarm'' command that would do this? 

Or does everything RTC-related need to be initialized at the same time?

Regards,

Todd Anderson
3 REPLIES 3
Posted on September 21, 2015 at 17:25

You should be able to set, enable and disable them any time you want. Probably want to set up the interrupts and handlers once, but the typical use case is to read the current time/date and advance that X hours/minutes/seconds into the future, or set things to fire are specific times, like 23:30 or what ever.

I somewhat prefer the 32-bit UNIX time method of the STM32F1 over the calendaring , but it just takes some care to validate the solution.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tba10596
Associate II
Posted on September 22, 2015 at 19:36

Thanks for your reply. I was able to create a separate function to set an alarm after setting up the initial calendar mode. There is a a lot of flexibility with the RTC, but I did demonstrate creating an alarm that would go off 1 minute after the initial calendar setting, by adding a 0x1 to the value of minutes. I was able to also create the interrupt handler for that alarm and see that I got into the interrupt handler. So far, so good - my initial questions have been answered.

tba10596
Associate II
Posted on September 23, 2015 at 20:29

Is it possible to update AN3371 Application Note with some specifics on setting up the RTC using the STM32F4xx_StdPeriph_Driver library?

Specifically, I would like information on how RTC_AlarmStructure is used.

For instance, what does RTC_AlarmMask mean and how is that set up?

Also, the same goes for using RTC_AlarmDateWeekDaySel and RTC_AlarmDateWeekDay.

I am sure there are other structures associated with other RTC functions that could use some further explanation, like Wake-up, Tamper, and Timestamp. I have not worked with those features (yet).

Regards,

Todd Anderson