18.7.6 External Multipurpose Crystal Oscillator Control A

Table 18-9. Register Bit Attribute Legend
SymbolDescriptionSymbolDescriptionSymbolDescription
RReadable bitHCCleared by Hardware(Grey cell)Unimplemented
WWritable bitHSSet by HardwareXBit is unknown at Reset
KWrite to clearSSoftware settable bit
Name: XOSCCTRLA
Offset: 0x14
Reset: 0x00000D00
Property: PAC Write-Protection

Bit 3130292827262524 
 WRTLOCK     USBHSDIV[1:0] 
Access R/WR/WR/W 
Reset 000 
Bit 2322212019181716 
     CFDPRESC[3:0] 
Access R/WR/WR/WR/W 
Reset 0000 
Bit 15141312111098 
     STARTUP[3:0] 
Access R/WR/WR/WR/W 
Reset 0000 
Bit 76543210 
 ONDEMAND SWBENCFDENXTALENAGCENABLE  
Access R/WR/WR/WR/WR/WR/W 
Reset 000000 

Bit 31 – WRTLOCK Write Lock for CTRLA register

Note: Once the WRTLOCK bit is set, it can only be cleared by a reset.
ValueDescription
0The XOSCCTRLA register can be modified by a system write.
1The XOSCCTRLA (except XOSCCTRLA.SWBEN) register is write protected.

Bits 25:24 – USBHSDIV[1:0] USBHS Reference Clock Division

These bits select the XOSC division factor for the USBHS PLL reference clock. These bits are XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE=1.

ValueNameDescription
0x0DISUSBHSPLL reference XOSC clock is disabled
0x1DIV1USBHSPLL reference XOSC clock is divided by 1
0x2DIV2USBHSPLL reference XOSC clock is divided by 2
0x3DIV4USBHSPLL reference XOSC clock is divided by 4

Bits 19:16 – CFDPRESC[3:0] Clock Failure Detector Prescaler

These bits select the DFLL48oscillator post scaler for the clock fail detector. The CFD safe clock frequency is the DFLL48 frequency divided by 2^CFDPRESC. These bits are XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE=1

Bits 11:8 – STARTUP[3:0] Start-Up Time for External Multipurpose Crystal Oscillator

These bits select start-up time for the oscillator XOSC according to the table below before a clock fail is acknowledged. The OSCULP32K oscillator is used to clock the start-up counter. These bits are XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE = 1.

STARTUP[3:0]Number of OSCULP32KClock CyclesApproximate Equivalent Time
0x0131µs
0x1261μs
0x24122μs
0x38244μs
0x416488μs
0x532977μs
0x6641953μs
0x71283906μs
0x82567813μs
0x951215625μs
0xA102431250μs
0xB204862500μs
0xC4096125000μs
0xD (Default)8192250000μs
0xE16384500000μs
0xF327681000000μs
Note:
  1. It is critical when using AGC to allow ample startup time to avoid spurious CFD events.
  2. When using AGC BW = 0x0, the minimum startup time is 6.25 ms.

Bit 7 – ONDEMAND On Demand Control

The ONDEMAND operation mode allows the XOSC to be enabled or disabled depending on peripheral clock requests.

Note: The XOSC is not running if no peripheral is requesting the clock source.

If ONDEMAND is set, the XOSC will only be running when requested by a peripheral and enabled (XOSCTRLA.ENABLE = 1). If there is no peripheral requesting the XOSC’s clock source, the XOSC will be in a disabled state. If ONDEMAND is disabled, the XOSC will always be running when enabled (XOSCTRLA.ENABLE = 1). In Standby Sleep mode, the ONDEMAND operation is still active. This bit is XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE = 1.

ValueDescription
0The XOSC is always on.
1The XOSC is running when a peripheral is requesting the XOSC to be used as a clock source.

Bit 5 – SWBEN XOSC Clock Switch Back Enable

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

Note: The SWBEN bit is also cleared when the Clock Failure Detector is disabled (CFDEN = 0).
ValueDescription
0The clock switch back is disabled.
1The clock switch back is enabled. This bit is reset once the XOSC output clock is switched back to the external clock or crystal oscillator.

Bit 4 – CFDEN Clock Failure Detector Enable

This bit controls the XOSC clock failure detector and is enable protected

Note: After setting CFDEN to enable clock failure detection, STATUS.CLKFAIL will always be set. This first detection must be ignored. Subsequent setting of this bit will indicate actual clock failure events.
ValueDescription
0Clock Failure Detector is disabled.
1Clock Failure Detector is enabled.

Bit 3 – XTALEN Crystal Oscillator Enable

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

Note:
  1. If XOSCCTRLA.XTALEN = 0 then XOSCCTRLA.AGC = 1 is not permitted.
  2. This bit is XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE = 1.
  3. If XOSCCTRLA.XTALEN = 0 then XOSCCTRLB.GMAN (User Manual Gain control) bits are ignored.
ValueDescription
0External clock oscillator connected on XIN. XOUT can be used as general-purpose I/O.
1Crystal connected to XIN and XOUT.

Bit 2 – AGC Auto Gain Control Loop Enable

Note:
  • If XOSCCTRLA.XTALEN = 0 then XOSCCTRLA.AGC = 1 is not permitted.
  • This bit is XOSCCTRLA.ENABLE protected and cannot be updated if XOSCCTRLA.ENABLE = 1.
  • If AGC is enabled, XOSCCTRLB.GMAN (User Manual Gain control) bits are ignored.
  • When the XOSCCTRLA.AGC = 1, the Primary Oscillator will automatically do a linear search to find the lowest power/gain setting to guarantee stable oscillation with the user’s crystal.
ValueDescription
0The oscillator auto gain control loop is disabled.
1The oscillator auto gain control loop is enabled.

Bit 1 – ENABLE Oscillator Enable

ValueDescription
0The oscillator XOSC is disabled.
1The oscillator XOSC is enabled.