21.4.1 Initialization
To initialize and run the RTC in basic 32-bit counter mode, follow these steps:
- Configure and enable the RTC input clock signal as described in the Real-Time Counter (RTC) Clock Selection section of the OSC32KCTRL - 32.768 kHz Oscillators Controller chapter.
- Configure the RTC mode of operation to 32-bit counter (CTRLA.MODE).
- Enable continuous read resynchronization of the counter and wait for the operation to complete (CTRLA.COUNTSYNC and SYNCBUSY.COUNTSYNC).
- Configure the counter value (COUNT.COUNT).
- Enable the Overflow interrupt (INTENSET.OVF).
- Enable the RTC and wait for the operation to complete (CTRLA.ENABLE and SYNCBUSY.ENABLE).
- Wait for the Overflow interrupt flag to be set when the RTC has overflowed (INTFLAG.OVF).
