32.5.3 Main Clock Source Selection
The source of the Main clock can be selected from the following:
- embedded 12 MHz RC oscillator
- 8 to 24 MHz crystal oscillator
- an XRCGB crystal resonator
The advantage of the Main RC oscillator is its fast start-up time. By default, this oscillator is selected to start the system and it must be selected prior to entering ULP1 mode.
The advantage of the Main crystal oscillator is its high level of accuracy.
The selection is made by writing CKGR_MOR.MOSCSEL. The switch of the Main clock source is glitch-free. PMC_SR.MOSCSELS indicates when the switch sequence is done.
Setting PMC_IMR.MOSCSELS triggers an interrupt to the processor.
The 8 to 24 MHz crystal oscillator can be bypassed by setting CKGR_MOR.MOSCXTBY to accept an external Main clock on XIN (see 32.5.4 Bypassing the 8 to 24 MHz Crystal Oscillator).
MOSCRCEN, MOSCSEL, MOSCXTEN and MOSCXTBY bits are located in the PMC Clock Generator Main Oscillator Register (CKGR_MOR).
After a VDDBU power-on reset, the default configuration is MOSCRCEN = 1, MOSCXTEN = 0 and MOSCSEL = 0, allowing the 12 MHz RC oscillator to start as Main clock.