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

Why an Epson RTC-7301 Timer Can Interrupt After Being Disabled

Writing zero to the timer enable bit, TE, on an Epson RTC-7301SF/DG does not mean the last decrement is already over when the bus write completes. The manufacturer's timer diagram places that action at a subsequent falling edge of the timer source clock. The accompanying one-minute example says the final decrement can be delayed by up to one source period; if that decrement brings the timer to expiry, an interrupt can still occur. Diagnose unwanted wake-ups by separating when the counter stops, whether the RTC is permitted to request an interrupt, and whether the host still accepts an earlier event.

A Source Clock Period Is Not a Bus Cycle

TE starts and stops the timer. The source clock makes the counter decrement. The timing diagram places the first decrement after TE changes from zero to one, and the final decrement after it changes from one to zero, on the subsequent relevant falling edge. Register writes and counter actions therefore occur at different times. The end of the bus write, a readback of zero or a normal function return is not evidence that the last source edge has passed.

Suppose the source provides one tick per minute and the disable request arrives five seconds after a falling edge. In this illustrative case the next nominal falling edge is about 55 seconds away. Writing just after the earlier edge can leave almost a full minute, whereas writing just before the following edge leaves less time. These figures illustrate how much source-clock phase remains. They are neither measured results nor an additional device guarantee.

This is about clearing TE on a running timer. It is not about stopping calendar updates with STOP, changing the crystal oscillator frequency, or imposing a one-minute software wait everywhere. A board using a faster timer source should not be described using the one-minute example. A bench test under a fast source does not prove all configurations stop within a few milliseconds.

Why a Final Wake-Up Occurs on Some Boards

Whether the last decrement creates an event depends on how much count remained before writing TE. If several steps remain, one decrement need not expire the timer. If there is one step left, treat that last decrement as a possible expiry. Boards with the same driver and source can show both outcomes because the stop requests land at different counter values. A random test that never covered the expiry boundary cannot prove another interrupt is impossible.

The timer event, timer interrupt permission and system wake-up are separate. Epson's stop discussion advises setting TIE appropriately when an interrupt is unwanted. TIE controls permission to request the timer interrupt, not whether the counter decrements. Record host masking, any pending host interrupt and other sources sharing the line independently. No host wake-up does not prove the counter made no final decrement. A late wake-up does not prove the timer caused it.

Condition around stopWhat can happenWhat to verify
Running timer, TE written zeroA falling source edge can produce a final decrementSelected source, write time and edge
Several steps remainThe last decrement need not expire the timerRemaining count before disable
Expiry can fall on the last edgeA timer event and interrupt are still possibleTIE, timer flag and external signal
Host must not accept this wake-upManage output permission and old host eventsRouting, masking and pending state

If old firmware masks the interrupt in cleanup code after issuing stop, the last edge can land in the intervening window and leave a pending request. On re-enabling the wake path, it may be mistaken for premature expiry of the new timer run. Writing TE again does not identify which layer retained that event.

Make the Disable API Match the Caller's Requirement

If the user action means no more timer wake-ups, protect the window in which the host can accept one. Depending on system policy, mask the relevant host entry temporarily, manage the RTC's TIE, and write TE to zero. If other devices or the alarm share the interrupt line, do not mask the entire line and ignore the remaining sources. Identify the source according to the design and decide which requests must be retained. In particular, don't clear a valid old expiry that the product is supposed to process just to obtain a quiet waveform.

If the requirement is to confirm that counting has stopped before reconfiguring, plan the wait or verification around the current source period and the edge in the manufacturer's diagram. A hard-coded few milliseconds can pass a one-off test with a fast source and reveal nothing about a one-minute source. Conversely, rejecting a wake-up does not necessarily require keeping the host active for an entire source period while waiting for the final counter step. Those are separate guarantees for an API to make.

Log the disable write, the last attributable state change, and when the host unmasks or re-enables the interrupt. Indicate whether these times come from the capture instrument or scheduler. Avoid labeling all three “stop complete.” On restart, test the handover between the old run and the new one as its own case.

Capture the Actual Last Tick on a Bench Board

First repeat the test with a documented faster source to move the TE-write phase conveniently; then repeat with the source used in production, including the one-minute option if the project uses it. Start the timer, then create two scenarios: several steps remaining before clearing TE, and a possible expiry at the final source edge. The first checks stopping itself. The second checks protection against a late event. Record the TE write, source selection, timer flag and relevant interrupt line or host state rather than only the count of interrupts reported by the application.

If the source edge is not directly observable, use measurable decrements or the event cadence as a reference and label the result as indirect evidence. Do not substitute a clock output configured for a different function and call it the timer source. Document any additional interrupt sources you bypass on the bench; a quiet isolated test is not evidence the actual product still handles shared requests. Observe for a full source period so a single trailing action can be distinguished from another cycle.

The goal is not to make every board stop at one absolute millisecond. Demonstrate that the last action agrees with the source-period boundary at different write phases, and that the system accepts or rejects it according to requirements. Keep synchronized traces and register snapshots for failures instead of attributing a write-phase-dependent event to frequency error.

Frequently Asked Questions

Do I still need to prevent a wake-up after TE reads zero?

Yes, if the product forbids a timer wake-up after the disable request. TE readback confirms the stop request was written; it cannot establish that the last decrement has passed. Handle TIE, host masking and pending state according to the design.

Is one minute the waiting time for every configuration?

No. One minute is Epson's example for that source option. The general issue is that stopping can wait for the next falling edge of the selected source. Base verification on the actual source and write phase rather than extrapolating from a bench configured differently.

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.