21.4.1 Initialization

To initialize and run the RTC in basic 32-bit counter mode, follow these steps:

  1. 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.
  2. Configure the RTC mode of operation to 32-bit counter (CTRLA.MODE).
  3. Enable continuous read resynchronization of the counter and wait for the operation to complete (CTRLA.COUNTSYNC and SYNCBUSY.COUNTSYNC).
  4. Configure the counter value (COUNT.COUNT).
  5. Enable the Overflow interrupt (INTENSET.OVF).
  6. Enable the RTC and wait for the operation to complete (CTRLA.ENABLE and SYNCBUSY.ENABLE).
  7. Wait for the Overflow interrupt flag to be set when the RTC has overflowed (INTFLAG.OVF).