4.9.5.4 Error Checking when Programming
Verification on user interface data is performed when accessing the century, year, month, date, day, hours, minutes, seconds and alarms. A check is performed on illegal BCD entries such as illegal date of the month with regard to the year and century configured.
If one of the time fields is not correct, the data is not loaded into the register/counter and a flag is set in the validity register. The user can not reset this flag. It is reset as soon as an acceptable value is programmed. This avoids any further side effects in the hardware. The same procedure is followed for the alarm.
The following checks are performed:
- Century (check if it is in range 19–20)
- Year (BCD entry check)
- Date (check range 01–31)
- Month (check if it is in BCD range 01–12, check validity regarding “date”)
- Day (check range 1–7)
- Hour (BCD checks: in 24-hour mode, check range 00–23 and check that AM/PM flag is not set if RTC is set in 24-hour mode; in 12-hour mode check range 01–12)
- Minute (check BCD and range 00–59)
- Second (check BCD and range 00–59)
- If the 12-hour mode is selected by means of the Mode register (RTC_MR), a 12-hour value can be programmed and the returned value on RTC_TIMR will be the corresponding 24-hour value. The entry control checks the value of the AM/PM indicator (bit 22 of RTC_TIMR) to determine the range to be checked.
- In UTC mode, no check is performed on the entries. The RTC does not report any failure.