Datasheet

531
SAM3X / SAM3A [DATASHEET]
Atmel-11057C-ATARM-SAM3X-SAM3A-Datasheet_23-Mar-15
The user interface does not provide any status for Fast Startup, but the user can easily recover this information by
reading the PIO Controller, and the status registers of the RTC, RTT and USB Controller.
28.11 Main Crystal Clock Failure Detector
The clock failure detector monitors the 3 to 20 MHz Crystal or Ceramic Resonator-based oscillator to identify an
eventual defect of this oscillator (for example, if the crystal is unconnected).
The clock failure detector can be enabled or disabled by means of the CFDEN bit in the PMC Clock Generator
Main Oscillator Register (CKGR_MOR). After reset, the detector is disabled. However, if the 3 to 20 MHz Crystal or
Ceramic Resonator-based Oscillator is disabled, the clock failure detector is disabled too.
A failure is detected by means of a counter incrementing on the 3 to 20 MHz Crystal oscillator or Ceramic
Resonator-based oscillator clock edge and timing logic clocked on the slow clock RC oscillator controlling the
counter. The counter is cleared when the slow clock RC oscillator signal is low and enabled when the slow clock
RC oscillator is high. Thus the failure detection time is 1 slow clock RC oscillator clock period. If, during the high
level period of the slow clock RC oscillator, less than 8 fast crystal oscillator clock periods have been counted, then
a failure is declared.
If a failure of the 3 to 20 MHz Crystal or Ceramic Resonator-based oscillator clock is detected, the CFDEV flag is
set in the PMC Status Register (PMC_SR), and generates an interrupt if it is not masked. The interrupt remains
active until a read operation in the PMC_SR register. The user can know the status of the clock failure detector at
any time by reading the CFDS bit in the PMC_SR register.
If the 3 to 20 MHz Crystal or Ceramic Resonator-based oscillator clock is selected as the source clock of MAINCK
(MOSCSEL = 1), and if the Master Clock Source is PLLACK or UPLLCK (CSS = 2 or 3), a clock failure detection
automatically forces MAINCK to be the source clock for the master clock (MCK).Then, regardless of the PMC
configuration, a clock failure detection automatically forces the 4/8/12 MHz Fast RC oscillator to be the source
clock for MAINCK. If the Fast RC oscillator is disabled when a clock failure detection occurs, it is automatically re-
enabled by the clock failure detection mechanism.
It takes 2 slow clock RC oscillator cycles to detect and switch from the 3 to 20 MHz Crystal, or Ceramic Resonator-
based oscillator, to the 4/8/12 MHz Fast RC Oscillator if the Master Clock source is Main Clock, or 3 slow clock RC
oscillator cycles if the Master Clock source is PLLACK or UPLLCK.
A clock failure detection activates a fault output that is connected to the Pulse Width Modulator (PWM) Controller.
With this connection, the PWM controller is able to force its outputs and to protect the driven device, if a clock
failure is detected. This fault output remains active until the defect is detected and until it is cleared by the bit
FOCLR in the PMC Fault Output Clear Register (PMC_FOCR).
The user can know the status of the fault output at any time by reading the FOS bit in the PMC_SR register.
28.12 Programming Sequence
1. Enabling the Main Oscillator:
The main oscillator is enabled by setting the MOSCXTEN field in the Main Oscillator Register
(CKGR_MOR). The user can define a start-up time. This can be achieved by writing a value in the
MOSCXTST field in CKGR_MOR. Once this register has been correctly configured, the user must wait for
MOSCXTS field in the PMC_SR register to be set. This can be done either by polling the status register, or
by waiting the interrupt line to be raised if the associated interrupt to MOSCXTS has been enabled in the
PMC_IER register.
Start Up Time = 8 * MOSCXTST / SLCK = 56 Slow Clock Cycles.
The main oscillator will be enabled (MOSCXTS bit set) after 56 Slow Clock Cycles.
2. Checking the Main Oscillator Frequency (Optional):