The procedure for using an external oscillator connected to the X1 pin is similar to the procedure for using a crystal or resonator:
- Clear the XTALCR.OSCOFF bit.
- Set the XTALCR.SE bit to enable single-ended mode.
- Clear the X1 counter by writing a 1 to X1CNT.CLR
and keep clearing until the X1 counter value in the X1CNT register is no longer
saturated 2047 (0x7FF).
- Wait for the X1 counter value in the X1CNT
register to reach 2047 (0x7FF).
- Repeat steps 3-4 three additional times.
- Select XTAL as the OSCCLK source by writing a 1 to CLKSRCCTL1.OSCCLKSRCSEL.
- Check the MCLKSTS bit in the MCDCR register. If
the bit set, either the external oscillator or the device has failed.
- If MCLKSTS is clear, the switch to the external clock is a success. The system clock is now derived from XTAL.