- RTC (Real Time Clock):
The RTC is an independent BCD timer/counter. The RTC provides a calendar clock, two programmable alarm interrupts, and a periodic programmable wake-up flag with interrupt function.
Two 32-bit registers contain seconds, minutes, hours (12 or 24 hour clock), day of week, date, month and year in binary coded decimal format (BCD).
The system can automatically compensate the number of days in the month to 28, 29 (leap year), 30, 31 days. And it can also perform daylight saving time compensation.



You can get a precise 1 second period (1 Hz frequency) by using a 15 stage binary counter.







RTC calendar configuration steps:
- Enable RTC clock :RCM_EnableAPB1PeriphClock(RCM_APB1_PERIPH_PMU);
- Enable RTC backup registers: PMU_EnableBackupAccess();
- Enable the LSI OSC:RCM_EnableLSI();
- Reset RTC:Reset RTC();
- Config RTC:RTC_Init();
- Set Time:RTC_CalendarConfig();
RTC Alarm configuration steps:
- Enable RTC clock :RCM_EnableAPB1PeriphClock(RCM_APB1_PERIPH_PMU);
- Enable RTC backup registers: PMU_EnableBackupAccess();
- Enable the LSI OSC:RCM_EnableLSI();
- Reset RTC:Reset RTC();
- Config RTC:RTC_Init();
- Config Alarm:RTC_AlarmsConfig();
- Alarm Enable: RTC_EnableAlarmA();

