AT91F40416 ATMEL Corporation, AT91F40416 Datasheet - Page 4

no-image

AT91F40416

Manufacturer Part Number
AT91F40416
Description
At91 Arm(r) Thumb(r) Microcontroller
Manufacturer
ATMEL Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AT91F40416
Manufacturer:
ATMEL
Quantity:
79
Timing
Alarm
Error Checking
Updating
Time/Calendar
4
RTC
The RTC is updated in real time at one second intervals in normal mode for the seconds
counter, at 1 minute intervals for the minutes counter and so on.
Due to the asynchronous operation of the RTC with respect to the rest of the chip, to be cer-
tain that the values 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 is required.
The RTC has four programmable fields: date, hours, minutes and seconds. Each of these
fields can be enabled or disabled to match the alarm condition.
A verification of user interface data is performed when accessing the century, year, month,
date, day, hours, minutes, seconds and alarms. A check is performed for illegal BCD entries
such as illegal date of the month with regards 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. This flag cannot be reset by the user. It is reset as soon as an
acceptable value is programmed. This avoids any further side effects in the hardware. The
same procedure is done for the alarm.
The following checks are performed:
1. Century (check if it is in range 19-20)
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. The order of the following steps can be random.
6. Day (check range 1-7)
7. Hour (BCD check, check range 00-23)
8. Minute (check BCD and range 00-59)
9. Second (check BCD and range 00-59)
To update any of the time/calendar fields, the user must first stop the RTC by setting the corre-
sponding field in the Control Register (RTC_CR). Bit UPDTIM must be set to update time
fields (hour, minute, second) and bit UPDCAL must be set to update calendar fields (century,
year, month, date, day).
Then the user must poll or wait for the interrupt (if enabled) of bit ACKUPD in the Status Reg-
ister. Once the bit reads 1, the user can write to the appropriate register.
Once the update is finished, the user must reset (0) UPDTIM and/or UPDCAL in the control
register.
When programming the calendar fields, the time fields remain enabled. This avoids a time slip
in case the user stays in the calendar update phase for several tens of seconds or more.
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 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.
1302B–07/01

Related parts for AT91F40416