An industrial switch board uses a 25 MHz active oscillator as its LAN9354 reference. The controller periodically reads the device's free-running counter to add local intervals to a log. After extended operation, a large counter value is followed by a small one. Before rejecting the replacement oscillator, check the counter width and elapsed time. A stable clock will drive a finite counter all the way around to its starting value. Treating both rollover and reset as oscillator failures obscures their different evidence.
Calculate how often the counter repeats
Microchip specifies a fixed 25 MHz reference. A single-ended external source can drive OSCI with OSCO unconnected, and the reference must remain continuous during normal operation. The data sheet separately defines a nominal 25 MHz, 32-bit FREE_RUN counter. At about 40 ns per count, a full set of 32-bit states takes approximately 171.799 seconds, or just under two minutes and fifty-two seconds. The actual frequency sets the actual period. Compare a decreasing reading with elapsed time, reset events, and the reference trace rather than using it as proof that the clock stopped.
For an arithmetic example, suppose the reads are hexadecimal FFFFFFF0 and 00000014. Subtract modulo the 32-bit range to obtain 36 counts, about 1.44 microseconds. A comparison using signed values or a simple ordering test can report the wrong direction. This interval illustrates the arithmetic; it does not promise that a management bus can obtain two reads that quickly. Verify actual bus overhead. A slower live test can also use values farther apart on each side of rollover to establish byte order and conversion.
Sparse sampling loses entire wraps
Modulo subtraction recovers forward elapsed counts if the device stayed in one valid epoch and less than a full counter range elapsed. Suppose the controller reads nothing for 200 seconds. With a perfect 25 MHz clock, that is one complete wrap plus about 28.201 seconds. The two readings alone can only report this remainder. More precise endpoint readings cannot reconstruct an unobserved full wrap. For long accumulation, keep the worst polling interval well below rollover and add the deltas to a wider software counter. Include network or process stalls and suspension in the interval budget.
Reset also invalidates the previous baseline. Microchip's reset table identifies effects on the free-running counter from power-on, external, and digital reset. Start a new measurement epoch after such an event and record its origin. A small forward delta does not prove no reset occurred when the previous value was close to the end of its range. For allowed low-power clock stops, distinguish device running time from total wall time. Verify the mode on the actual board before treating a counter interval as elapsed wall time.
Test rollover, reset, and the received clock independently
Run a real device through a complete wrap and capture its readings, controller times, and reference. Perform a planned reset and verify a new software baseline. Feed representative boundary values into the arithmetic separately to catch signed or byte-order issues. Keep the original driver readings to distinguish arithmetic from delayed or reordered records. If a reported interval suddenly approaches a full wrap, investigate how long the reader was stalled before recalibrating the oscillator.
The IEEE 1588 timer documented by Microchip is separate. A roughly 40 ns local count interval is not a statement of synchronization accuracy across devices. For packet timestamping, use the supported timestamping configuration and reference. Keep timebase names explicit in logs. A replacement 25 MHz active oscillator still requires a valid OSCI waveform. Correct software over rollover has its own repeatable tests, including longer runs in the intended assembly.
If a count increment is used to estimate frequency, consider when the management interface actually samples the register. Request timing and device sampling can differ, and they may differ at the start and end. Short host-timed intervals can report scheduling error as oscillator offset. Check frequency separately at the input with a suitable time reference, then verify count accounting over a longer interval. Those records can distinguish actual frequency change from rollover or an inaccurate software timestamp.
An independent monotonic clock at the controller can guard against excessively long poll intervals. If a nominal one-second task was suspended or restarted, check the actual elapsed interval before continuing accumulation. Preserve the raw 32-bit readings, computed delta, and invalidation reason to expose accidental signed conversion. A bus that transfers the value in multiple pieces also needs a coherent read according to the device's access rules before subtraction.
