13.4.2.2 XOSC32K - External 32.768 kHz Crystal Oscillator Operation

The XOSC32K operates in two different modes:

  • External clock mode, with an external clock signal connected to the XTAL32K1 pin
  • Crystal oscillator mode, with an external 32.768 kHz crystal connected between the XTAL32K1 and XTAL32K2 pins

XOSC32K is enabled by setting the ENABLE bit in the XOSC32KCTRL register (XOSC32KCTRL.ENABLE) to ‘1’. XOSC32K is disabled by clearing the Enable bit. When disabling XOSC32K, it is important to write the Enable bit to ‘0’ before additional changes are made to the XOSC32K register.

To enable XOSC32K as an external crystal oscillator, the XTALEN bit in the XOSC32KCTRL register (XOSC32KCTRL.XTALEN) must be set to ‘1’. If XTALEN is ‘0’, XOSC32K is configured for external clock mode and the external clock input signal on XTAL32K1 will be enabled.

The XOSC32K is disabled after any reset.

It is possible to lock the XOSC32K configuration by setting the Write Lock bit in the OSC32KCTRL register (OSC32KCTRL.WRTLOCK) to ‘1’. The XOSC32K configuration will remain locked until a Device Reset occurs.

The XTAL32K1 and XTAL32K2 pins can be used as General Purpose Input/Output (GPIO) pins or by other peripherals in the system. When XOSC32K is enabled, the operating mode determines the pin configuration. In External Crystal (XTAL) mode, the XTAL23K1 and XTAL32K2 pins are controlled by OSC32KCTRL, and the GPIO functions are overridden on both pins. In External Clock (EXTCLK) mode, only the XTAL32K1 pin is overridden and controlled by OSC32KCTRL, while the XTAL32K2 pin may be used as a GPIO pin.

XOSC32K can be used as a source for the RTC. A clock request for XOSC32K is automatically generated when the RTC peripheral is enabled. Before enabling the RTC peripheral, the corresponding oscillator output must be selected in the RTC Clock Source Selection bit field in the RTC Control register (RTCCTRL.RTCSEL). Also, the XOSC32K oscillator must be configured in the XOSC32KCTRL register in order to ensure proper operation. For details on RTC clock configuration, refer to the Real-Time Counter Clock Selection section.

XOSC32K can be used as a source for the GCLK or for other modules through a generic clock request interface implemented in hardware. Requests on this interface will start the oscillator if it is not already running. Before enabling the module that will generate a clock request, the oscillator must be configured and enabled (XOSC32KCTRL) in order to ensure proper operation.