27.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:

  1. Century (check if it is in range 19–20 or 13–14 in Persian mode)
  2. Year (BCD entry check)
  3. Date (check range 01–31)
  4. Month (check if it is in BCD range 01–12, check validity regarding “date”)
  5. Day (check range 1–7)
  6. 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)
  7. Minute (check BCD and range 00–59)
  8. Second (check BCD and range 00–59)
Note:
  1. 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.
  2. In UTC mode, no check is performed on the entries. The RTC does not report any failure.