2013-05-28 05:15 AM
Hi! All,
I want to set RTC alarm for specific date and time can any one help me in this regard? i use STM32l151vbt6.Thank You, #stm32l1-rtc-alarm2013-05-28 07:11 AM
Not sure it's that flexible, you can't just pluck any specific date off the calender.
You should be able to do a time, and day of week, Or time and day of month (current/next). So you might be able to generate an Alarm for 09:09 AM Day 29, it will fire at that specific time/day every month (09:09:00 29-May, 09:09:00 29-June, .. ), and you'd need to determine if it was the right month and go back to sleep if not.2013-05-28 09:19 AM
Using the functions in <time.h> fill in a 'tm' structure with the current date and time. Use mktime to get a time_t from it. A time_t is a 1Hz counter with zero based way back in 1970. Set the RTC ticker from this value so your clock is sync'd with Unix time. Do the same for your desired alarm value and that should do it.
Remember to run your RTC off an accurate source such as an LSE. The STM32 LSI is far from accurate, as I've discovered.2013-05-28 10:18 AM
The L1 is a calendered device, the F1 could have used a 32-bit hertz counter which you could apply any date zero basis you want. That could be set to Alarm quite distant and singular dates in the future.
The STM32 series will ONLY maintain the RTC ticking using an external LSE crystal, in STANDBY mode. The internal LSI is neither accurate, nor functional from the backup power domain.