Datasheet
To force the oscillator to run in Standby mode, the RUNSTDBY bit must be written to one. The oscillator
will then run in Standby mode when requested by a peripheral (ONDEMAND is one). To force an
oscillator to always run in Standby mode, and not only when requested by a peripheral, the ONDEMAND
bit must be written to zero and RUNSTDBY must be written to one.
The next table shows the behavior in the different sleep modes, depending on the settings of
ONDEMAND and RUNSTDBY.
Table 17-2. Behavior in the different sleep modes
Sleep mode ONDEMAND RUNSTDBY Behavior
Idle 0, 1, 2 0 X Run
Idle 0, 1, 2 1 X Run when requested by a peripheral
Standby 0 0 Stop
Standby 0 1 Run
Standby 1 0 Stop
Standby 1 1 Run when requested by a peripheral
Note: This does not apply to the OSCULP32K oscillator, which is always running and cannot be
disabled.
17.6.2 External Multipurpose Crystal Oscillator (XOSC) Operation
The XOSC can operate in two different modes:
• External clock, with an external clock signal connected to the XIN pin
• Crystal oscillator, with an external 0.4-32MHz crystal
The XOSC can be used as a clock source for generic clock generators, as described in the GCLK –
Generic Clock Controller.
At reset, the XOSC is disabled, and the XIN/XOUT pins can be used as General Purpose I/O (GPIO) pins
or by other peripherals in the system. When XOSC is enabled, the operating mode determines the GPIO
usage. When in crystal oscillator mode, the XIN and XOUT pins are controlled by the SYSCTRL, and
GPIO functions are overridden on both pins. When in external clock mode, only the XIN pin will be
overridden and controlled by the SYSCTRL, while the XOUT pin can still be used as a GPIO pin.
The XOSC is enabled by writing a one to the Enable bit in the External Multipurpose Crystal Oscillator
Control register (XOSC.ENABLE). To enable the XOSC as a crystal oscillator, a one must be written to
the XTAL Enable bit (XOSC.XTALEN). If XOSC.XTALEN is zero, external clock input will be enabled.
When in crystal oscillator mode (XOSC.XTALEN is one), the External Multipurpose Crystal Oscillator
Gain (XOSC.GAIN) must be set to match the external crystal oscillator frequency. If the External
Multipurpose Crystal Oscillator Automatic Amplitude Gain Control (XOSC.AMPGC) is one, the oscillator
amplitude will be automatically adjusted, and in most cases result in a lower power consumption.
The XOSC will behave differently in different sleep modes based on the settings of XOSC.RUNSTDBY,
XOSC.ONDEMAND and XOSC.ENABLE:
XOSC.RUNSTDBY XOSC.ONDEMAND XOSC.ENABLE Sleep Behavior
- - 0 Disabled
SAM D21 Family
SYSCTRL – System Controller
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40001882D-page 177