Atmel ARM-Based Evaluation Kit AT91SAM9N12-EK AT91SAM9N12-EK Data Sheet

Product codes
AT91SAM9N12-EK
Page of 1104
173
SAM9N12/SAM9CN11/SAM9CN12 [DATASHEET]
11063K–ATARM–05-Nov-13
21.5.1  12 MHz Fast RC Oscillator
After reset, the 12 MHz Fast RC Oscillator is enabled and it is selected as the source of MCK. MCK is the default clock
selected to start up the system. 
Please refer to the “DC Characteristics” section of the product datasheet.
The software can disable or enable the 12 MHz Fast RC Oscillator with the MOSCRCEN bit in the Clock Generator Main
Oscillator Register (CKGR_MOR).
When disabling the Main Clock by clearing the MOSCRCEN bit in CKGR_MOR, the MOSCRCS bit in the Power
Management Controller Status Register (PMC_SR) is automatically cleared, indicating the Main Clock is off.
Setting the MOSCRCS bit in the Power Management Controller Interrupt Enable Register (PMC_IER) can trigger an
interrupt to the processor.
21.5.2  3 to 20 MHz Crystal Oscillator
After reset, the 3 to 20 MHz Crystal Oscillator is disabled and it is not selected as the source of MAINCK.
The user can select the 3 to 20 MHz crystal oscillator to be the source of MAINCK, as it provides a more accurate
frequency. The software enables or disables the main oscillator so as to reduce power consumption by clearing the
MOSCXTEN bit in the Main Oscillator Register (CKGR_MOR). 
When disabling the main oscillator by clearing the MOSCXTEN bit in CKGR_MOR, the MOSCXTS bit in PMC_SR
is automatically cleared, indicating the Main Clock is off.
When enabling the main oscillator, the user must initiate the main oscillator counter with a value corresponding to
the startup time of the oscillator. This startup time depends on the crystal frequency connected to the oscillator.
When the MOSCXTEN bit and the MOSCXTCNT are written in CKGR_MOR to enable the main oscillator,
the MOSCXTS bit in the Power Management Controller Status Register (PMC_SR) is cleared and the counter starts
counting down on the slow clock divided by 8 from the MOSCXTCNT value. Since the MOSCXTCNT value is coded with
8 bits, the maximum startup time is about 62 ms.
When the counter reaches 0, the MOSCXTS bit is set, indicating that the main clock is valid. Setting the MOSCXTS bit in
PMC_IMR can trigger an interrupt to the processor.
21.5.3 Main 
Clock 
Oscillator Selection
The user can select either the 12 MHz Fast RC Oscillator or the 3 to 20 MHz Crystal Oscillator to be the source of Main
Clock.
The advantage of the 12 MHz Fast RC Oscillator is fast start-up, that is why it is selected by default to start the system up
and when entering wait mode.
The advantage of the 3 to 20 MHz Crystal Oscillator is that it is very accurate.
The selection is made by writing the MOSCSEL bit in the Main Oscillator Register (CKGR_MOR). The switch of the Main
Clock source is glitch free, so there is no need to run out of SLCK, PLLACK or UPLLCK in order to change the selection.
The MOSCSELS bit of the Power Management Controller Status Register (PMC_SR) indicates when the switch
sequence is done.
Setting the MOSCSELS bit in PMC_IMR can trigger an interrupt to the processor.
21.5.4  Switching Main Clock between the Main RC Oscillator and Fast Crystal Oscillator
Both sources must be enabled during the switch operation. Only after completion can the unused oscillator be disabled.
If switching to Fast Crystal Oscillator, the clock presence must first be checked according to what is described in 
 because the source may not be reliable (crystal
failure or bypass on a non-existent clock).