18.7.6 External Multipurpose Crystal Oscillator Control

Name: XOSCCTRL
Offset: 0x14 + n*0x04 [n=0..1]
Reset: 0x00000080
Property: PAC Write-Protection

Bit 3130292827262524 
     CFDPRESC[3:0] 
Access R/WR/WR/WR/W 
Reset 0000 
Bit 2322212019181716 
 STARTUP[3:0]  SWBENCFDEN 
Access R/WR/WR/WR/WR/WR/W 
Reset 000000 
Bit 15141312111098 
 ENALCIMULT[3:0]IPTAT[1:0]LOWBUFGAIN 
Access R/WR/WR/WR/WR/WR/WR/WR/W 
Reset 00000000 
Bit 76543210 
 ONDEMANDRUNSTDBY   XTALENENABLE  
Access R/WR/WR/WR/W 
Reset 1000 

Bits 27:24 – CFDPRESC[3:0] Clock Failure Detector Prescaler

These bits select the prescaler for the clock failure detector.

The DFLL48 oscillator is used to clock the CFD prescaler.

The CFD safe clock frequency is the DFLL48 frequency divided by 2^CFDPRESC.

Bits 23:20 – STARTUP[3:0] Start-Up Time

These bits select start-up time for the oscillator XOSCn according to the table below.

The OSCULP32K oscillator is used to clock the start-up counter.

Table 18-6. Start-UpTime for External Multipurpose Crystal Oscillator
STARTUP[3:0] Number of OSCULP32K Clock Cycles Number of XOSC Clock Cycles Approximate Equivalent Time(
0x0 1 3 31µs
0x1 2 3 61μs
0x2 4 3 122μs
0x3 8 3 244μs
0x4 16 3 488μs
0x5 32 3 977μs
0x6 64 3 1953μs
0x7 128 3 3906μs
0x8 256 3 7813μs
0x9 512 3 15625μs
0xA 1024 3 31250μs
0xB 2048 3 62500μs
0xC 4096 3 125000μs
0xD 8192 3 250000μs
0xE 16384 3 500000μs
0xF 32768 3 1000000μs

Bit 17 – SWBEN Xosc Clock Switch Enable

This bit controls the XOSCn output clock switch back to the external clock or crystal oscillator in case of clock recovery :

0: The clock switch back is disabled.

1: The clock switch back is enabled. This bit is reset once the XOSCn output clock is switched back to the external clock or crystal oscillator.

Bit 16 – CFDEN Clock Failure Detector Enable

This bit controls the XOSCn clock failure detector :

0: the Clock Failure Detector is disabled.

1: the Clock Failure Detector is enabled.

Bit 15 – ENALC Automatic Loop Control Enable

This bit controls the XOSCn automatic loop control :

0: the automatic loop control is disabled.

1: the automatic loop control is enabled. Oscillator's amplitude will be automatically adjusted during Crystal Oscillator operation.

Bits 10:9 – IPTAT[1:0] Oscillator Current Reference

These bits select the current reference for the oscillator XOSCn, given in table below.

Table 18-7. External Multipurpose Crystal Oscillator Current Settings
Frequency Range Current Setting
IMULT[3:0] IPTAT[1:0]
>24MHz to 48MHz 6 3
>16MHz to 24MHz 5 3
>8MHz to 16MHz 4 3
8MHz 3 2

For relatively small CLOAD in a frequency range, the setting for the lower frequency range can be used to preserve current consumption.

Bit 8 – LOWBUFGAIN Low Buffer Gain Enable

0: The low buffer gain of oscillator XOSCn is disabled.

1: The low buffer gain of oscillator XOSCn is enabled.

When XOSCCTRLn.ENALC=0 this bit has no effect.

When XOSCCTRLn.ENALC=1, this bit is used to adjust the oscillator's amplitude in automatic loop control.

The default value of LOWBUFGAIN=0 should be used to allow operating with a low amplitude oscillator. Use this setting except to solve stability issues.

Setting LOWBUFGAIN=1 will increase the oscillator's amplitude by a factor of approximately 2. Use this setting to solve stability issues.

Bit 7 – ONDEMAND On Demand Control

The On Demand operation mode allows the oscillator XOSCn to be enabled or disabled, depending on peripheral clock requests.

If On Demand is set, the oscillator will be running only when requested by a peripheral and enabled (XOSCCTRLn. ENABLE=1). If there is no peripheral requesting the oscillator’s clock source, the oscillator will be in a disabled state.

If On Demand is cleared, the oscillator will always be running when enabled (XOSCCTRLn.ENABLE=1). In standby sleep mode, the On Demand operation is still active.

0: The oscillator is always on.

1: The oscillator is running when a peripheral is requesting the oscillator to be used as a clock source. The oscillator is not running if no peripheral is requesting the clock source.

Bit 6 – RUNSTDBY Run in Standby

This bit controls how the XOSCn behaves during standby sleep mode:

0: The XOSCn is not running in standby sleep mode if no peripheral requests the clock.

1: The XOSCn is running in standby sleep mode. If ONDEMAND is one, the XOSCn will be running when a peripheral is requesting the clock. If ONDEMAND is zero, the clock source will always be running in standby sleep mode.

Bit 2 – XTALEN Crystal Oscillator Enable

This bit controls the connections between the I/O pads and the external clock or crystal oscillator XOSCn:

0: External clock connected on XIN. XOUT can be used as general-purpose I/O.

1: Crystal connected to XIN/XOUT.

Bit 1 – ENABLE Oscillator Enable

0: The oscillator XOSCn is disabled.

1: The oscillator XOSCn is enabled.