Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / System Validation and Replacement

Why the first ATtiny1616 PIT interrupt can arrive in under a second

The first ATtiny1616 PIT interrupt can arrive in less than one second even with a correct 32.768 kHz clock. The RTC and PIT share the internal prescaler count. While either function runs, the prescaler advances. Enabling PIT later does not establish a new phase origin. Microchip says the first interrupt can occur anywhere from almost immediately to one complete period after enable.

For example, a suitable legacy SaRonix-eCera KN 3.3 V, 32.768 kHz oscillator can feed TOSC1 using the external input option of XOSC32K. Select the intended RTC clock source and the CYC32768 PIT period. In steady operation, 32,768 reference cycles give a nominal one-second interval. If the RTC was already running and the shared counter is 4,096 cycles short of the next selected boundary, the first interrupt can appear after about 125 ms. Synchronizer and interrupt-service delay can affect the observed timing; the illustration is not a fixed offset.

If the application needs a full interval, use the first confirmed PIT event to establish a phase marker and start counting complete intervals from it. If the origin must be the enable command itself, provide an explicit timing origin and calculate a compare target rather than assuming the shared prescaler restarts. Check the relevant synchronization-busy flags in RTC.STATUS and RTC.PITSTATUS as required. Their deassertion does not guarantee the prescaler phase.

Test by leaving RTC running and enabling PIT at varying phases. Record enable-to-first-event timing and subsequent periods as two separate measurements. Confirm actual clock selection and the TOSC1 waveform. A varying first interval followed by stable one-second periods calls for checking shared-divider behavior, not rejecting the oscillator on frequency grounds.

Related selection guide: MERLIN Crystal Timing: Deriving a true second from the SAM D21 1024 Hz RTC clock and 32.768 kHz crystal

Resource link: https://www.mecxtal.com.cn/en/handbook/samd21-32768khz-crystal-rtc-1024hz.html

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.