English
Language : 

SAM7X256_14 Datasheet, PDF (69/662 Pages) ATMEL Corporation – ARM-based Flash MCU
14. Real-time Timer (RTT)
14.1 Overview
The Real-time Timer is built around a 32-bit counter and used to count elapsed seconds. It generates a periodic interrupt
or/and triggers an alarm on a programmed value.
14.2 Block Diagram
Figure 14-1. Real-time Timer
RTT_MR
RTTRST
RTT_MR
RTPRES
SLCK
reload
16-bit
Divider
RTT_MR
RTTRST
0
10
32-bit
Counter
RTT_VR
CRTV
RTT_AR
ALMV
RTT_SR
set
RTTINC
reset
read
RTT_SR
RTT_SR
=
reset
ALMS
set
RTT_MR
RTTINCIEN
RTT_MR
ALMIEN
rtt_int
rtt_alarm
14.3
Functional Description
The Real-time Timer is used to count elapsed seconds. It is built around a 32-bit counter fed by Slow Clock divided by a
programmable 16-bit value. The value can be programmed in the field RTPRES of the Real-time Mode Register
(RTT_MR).
Programming RTPRES at 0x00008000 corresponds to feeding the real-time counter with a 1 Hz signal (if the Slow Clock
is 32.768 Hz). The 32-bit counter can count up to 232 seconds, corresponding to more than 136 years, then roll over to 0.
The Real-time Timer can also be used as a free-running timer with a lower time-base. The best accuracy is achieved by
writing RTPRES to 3. Programming RTPRES to 1 or 2 is possible, but may result in losing status events because the
status register is cleared two Slow Clock cycles after read. Thus if the RTT is configured to trigger an interrupt, the
interrupt occurs during 2 Slow Clock cycles after reading RTT_SR. To prevent several executions of the interrupt
handler, the interrupt must be disabled in the interrupt handler and re-enabled when the status register is clear.
The Real-time Timer value (CRTV) can be read at any time in the register RTT_VR (Real-time Value Register). As this
value can be updated asynchronously from the Master Clock, it is advisable to read this register twice at the same value
to improve accuracy of the returned value.
SAM7X Series [DATASHEET] 69
6120K–ATARM–11-Feb-14