Atmel Xplained Pro Evaluation Kit ATSAM4E-XPRO ATSAM4E-XPRO Data Sheet

Product codes
ATSAM4E-XPRO
Page of 1506
SAM4E [DATASHEET]
Atmel-11157D-ATARM-SAM4E16-SAM4E8-Datasheet_12-Jun-14
332
Due to the asynchronous operation of the RTC with respect to the rest of the chip, to be certain that the value read
in the RTC registers (century, year, month, date, day, hours, minutes, seconds) are valid and stable, it is
necessary to read these registers twice. If the data is the same both times, then it is valid. Therefore, a minimum of
two and a maximum of three accesses are required.
16.5.3 Alarm
The RTC has five programmable fields: month, date, hours, minutes and seconds.
Each of these fields can be enabled or disabled to match the alarm condition:
If all the fields are enabled, an alarm flag is generated (the corresponding flag is asserted and an interrupt 
generated if enabled) at a given month, date, hour/minute/second.
If only the “seconds” field is enabled, then an alarm is generated every minute.
Depending on the combination of fields enabled, a large number of possibilities are available to the user ranging
from minutes to 365/366 days.
Hour, minute and second matching alarm (SECEN, MINEN, HOUREN) can be enabled independently of SEC,
MIN, HOUR fields.
Note:
To change one of the SEC, MIN, HOUR, DATE, MONTH fields, it is recommended to disable the field before changing 
the value and then re-enable it after the change has been made. This requires up to three accesses to the 
RTC_TIMALR or RTC_CALALR. The first access clears the enable corresponding to the field to change (SECEN, 
MINEN, HOUREn, DATEEN, MTHEN). If the field is already cleared, this access is not required. The second access 
performs the change of the value (SEC, MIN, HOUR, DATE, MONTH). The third access is required to re-enable the 
field by writing 1 in SECEN, MINEN, HOUREn, DATEEN, MTHEN fields.
16.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:
If the 12-hour mode is selected by means of the 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.
16.5.5 RTC Internal Free Running Counter Error Checking 
To improve the reliability and security of the RTC, a permanent check is performed on the internal free running
counters to report non-BCD or invalid date/time values.
An error is reported by TDERR bit in the status register (RTC_SR) if an incorrect value has been detected. The
flag can be cleared by programming the TDERRCLR in the RTC status clear control register (RTC_SCCR).