English
Language : 

SAM4L Datasheet, PDF (157/1185 Pages) ATMEL Corporation – ATSAM ARM-based Flash MCU
ATSAM4L4/L2
ated on a zero-to-one transition on PCLKSR.OSC32RDY if the OSC32RDY bit in the Interrupt
Mask Register (IMR.OSC32RDY) is set. This bit is set by writing a one to the corresponding bit
in the Interrupt Enable Register (IER.OSC32RDY).
As a crystal oscillator usually requires a very long start-up time (up to 1 second), the 32KHz
oscillator will keep running across resets, except a Power-on Reset (POR).
The current driven into the crystal can be adjusted according to the component specification
requirements via the SELCURR bitfield in the OSC32CTRL register (OSC32CTRL.SELCURR).
The 32KHz oscillator also has a 1KHz output (CLK_1K). This is enabled by writing a one to the
Enable 1KHz output bit in the OSCCTRL32 register (OSCCTRL32.EN1K). If the 32KHz output
clock is not needed when the CLK_1K is enabled, this can be disabled by writing a zero to the
Enable 32KHz output bit in the OSCCTRL32 register (OSCCTRL32.EN32K).
OSCCTRL32.EN32K is set after a POR. The CLK_1K output is only usable when XIN32 is con-
nected to a crystal, and not when an external digital clock is applied on XIN32.
12.6.2
32 KHz RC Oscillator (RC32K)
Rev: 1.0.0.1
The RC32K oscillator provides a tunable, low speed, low-power clock source. The RC32K is
enabled by default as a system clock, except in Static mode. The RC32K is enabled as a
32 KHz Generic clock source by writing a one to the enable bit in the RC32K Control Register
(RC32KCR.EN). It is disabled by writing a zero to RC32KCR.EN. The RC32K is also available
for direct use as a 32 KHz clock, enabled by writing a one to the Enable 32KHz bit
(RC32KCR.EN32K). A 1 KHz clock output can be enabled by writing a one to the Enable 1kHz
bit (RC32KCR.EN1K).
The RC32K oscillator supports temperature compensation, which can be enabled for a more
stable frequency. The temperature compensation is enabled by writing a one to the Tempera-
ture Compensation Enable bit (RC32KCR.TCEN), and disabled by writing a zero.
The frequency of the RC32K oscillator is controlled by two values in the RC32K Tuning Register
RC32KTUNE.COARSE and RC32KTUNE.FINE. COARSE is loaded by the fuses, and compen-
sates for process variation, while FINE is used to keep the frequency accurate over the
temperature range. The COARSE value can be overridden by the user by writing to the
COARSE field. The FINE value can be tuned in two different modes, selected by the
RC32KCR.MODE bit where a zero is open loop mode and a one is closed loop mode.
In open loop mode the user can tune the frequency by writing to the RC32KTUNE register.
When writing to RC32KTUNE, the user must wait for the PCLKSR.RC32KRDY bit to go high
before the value has been committed to the oscillator. See Section 42.6 ”Oscillator Characteris-
tics” on page 1125 for how FINE and COARSE affects the frequency.
In closed loop mode the RC32K automatically tunes FINE to synchronize the RC32K oscillator
with an external 32768 Hz reference. The reference source is selected by the Reference Select
bit (RC32KCR.REF). In closed loop mode, the RC32K does a binary search on the FINE field to
converge towards the reference. When the RC32K has converged on the reference frequency,
the RC32K lock bit (PCLKSR.RC32KLOCK) is set, and the RC32K continues to measure and
track the reference frequency. If the user switches from closed loop mode to open loop mode
and back to closed loop again, RC32K will restart the synchronization procedure, disregarding
previous locks.
42023C–SAM–02/2013
157