•
Seconds
•
Minutes
•
Hours
Hours can be represented in either 12- or 24-hour format, selected by the Clock Representation bit in the
Control A register (CTRLA.CLKREP). This bit can be changed only while the RTC is disabled.
The date is represented in this form:
•
Day as the numeric day of the month (starting at 1)
•
Month as the numeric month of the year (1 = January, 2 = February, etc.)
•
Year as a value from 0x00 to 0x3F. This value must be added to a user-defined reference year. The
reference year must be a leap year (2016, 2020 etc). Example: the year value 0x2D, added to a
reference year 2016, represents the year 2061.
The RTC will increment until it reaches the top value of 23:59:59 December 31 of year value 0x3F, and
then wrap to 00:00:00 January 1 of year value 0x00. This will set the Overflow Interrupt flag in the
Interrupt Flag Status and Clear registers (INTFLAG.OVF).
The clock value is continuously compared with the 32-bit Alarm register (ALARM0). When an alarm
match occurs, the Alarm 0 Interrupt flag in the Interrupt Flag Status and Clear registers
(INTFLAG.ALARM0) is set on the next 0-to-1 transition of CLK_RTC_CNT.
A valid alarm match depends on the setting of the Alarm Mask Selection bits in the Alarm 0 Mask register
(MASK0.SEL). These bits determine which time/date fields of the clock and alarm values are valid for
comparison and which are ignored.
If the Clear on Match bit in the Control A register (CTRLA.MATCHCLR) is set, the counter is cleared on
the next counter cycle when an alarm match with ALARM0 occurs. This allows the RTC to generate
periodic interrupts or events with longer periods than it would be possible with the prescaler events only
(see
Note:
When CTRLA.MATCHCLR is 1, INTFLAG.ALARM0 and INTFLAG.OVF will both be set
simultaneously on an alarm match with ALARM0.
25.6.3. DMA Operation
The RTC generates the following DMA request:
•
Tamper (TAMPER): The request is set on capture of the timestamp. The request is cleared when
the Timestamp register is read.
If the CPU accesses the registers which are source for DMA request set/clear condition, the DMA request
can be lost or the DMA transfer can be corrupted, if enabled.
25.6.4. Interrupts
The RTC has the following interrupt sources:
•
Overflow (OVF): Indicates that the counter has reached its top value and wrapped to zero.
•
Tamper (TAMPER): Indicates detection of valid signal on a tamper input pin or tamper event input.
•
Compare (CMPn): Indicates a match between the counter value and the compare register.
•
Alarm (ALARMn): Indicates a match between the clock value and the alarm register.
•
Period n (PERn): The corresponding bit in the prescaler has toggled. Refer to
details.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status
and Clear (INTFLAG) register is set when the interrupt condition occurs. Each interrupt can be individually
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
337