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

Why a one-second logger misses samples: separate oscillator error from scheduling delays

A logger that reads a sensor, processes and saves its result, then waits a full second starts successive runs more than a second apart. Processing and queueing can grow the interval even with an accurate reference oscillator. Specify whether the requirement is a delay after completion or a schedule tied to one-second target times. A timer's nominal frequency alone says nothing about the rate of fresh records.

This example uses existing offline data and synthetic timelines for a low-voltage environmental logger. It is not a real-time guarantee or a procedure for modifying an in-service system or forcing missed work to run.

A relative delay and a fixed deadline schedule define different cadences

A relative delay starts at the actual wait call. Sensor reads, formatting and buffer writes before the call remain in the start-to-start interval. This makes sense when a minimum one-second rest is required after each completed job. A precise clock will wait that second accurately and will not subtract the processing time.

Fixed deadlines target a grid such as 0, 1, 2 and 3 s. They keep ordinary work time from accumulating into the target schedule, but do not guarantee execution at those instants. Long processing, higher-priority work and blocked storage can still prevent on-time runs. Define whether a miss is skipped, late or tracked another approved way. Backfilled records should not appear to be original on-time acquisitions.

Wall-clock corrections, time zones, clock changes after a restart and timer frequency are separate. A monotonic reference can be accurate while relative waiting adds process overhead. Real frequency error can coexist. Identify actual start, finish and next deadline in the logs before investigating the reference.

A one-second wait can produce only 240 records

Suppose a fictional recorder starts at 0 s. Every run needs 250 ms for processing and storage before a 1 s wait. The first four starts are 0, 1.25, 2.5 and 3.75 s. In the half-open interval from 0 to 300 s, excluding the endpoint, there are 240 starts. The last is at 298.75 s and completes at 299 s, also inside the window.

In the fixed schedule, starts are 0, 1 and 2 s and continue once per second with no additional queueing. The window contains 300 starts. The last starts at 299 s and completes at 299.25 s. With identical work and clocks, the two cases differ by 60 records. Treating that difference as oscillator error would be misleading.

If one formatting run takes 1.3 s, it overruns the next one-second deadline. A serial task cannot complete both acquisitions on the original schedule. A later entry is not a fresh acquisition at the missed time. Distinguish planned deadline, actual measurement and log time.

Existing records should show which stage was late

Record planned time, measurement start, processing or save completion, and whether the sensor supplied a new result. A display refresh is not proof of a new reading. Upload timestamp also includes communication and buffering. Compare intervals in a verified time domain and keep calendar adjustments separate.

Use a representative read-only interval and compare neighboring starts with the prior run's processing duration. A start interval near processing time plus the fixed wait supports the relative-delay explanation. If processing is steady but starts vary, check scheduling, power state, sensor availability or missing logs. For batched uploads, use actual measurements in the local record rather than reconstructing work from arrival order.

Record count and temporal resolution differ. Starting 300 times can reuse cached results. Define sequence numbers or freshness flags and check them. Use a synthetic comparison to verify how the reporting system counts, then review actual read-only samples.

Define which boundary must operate every second

Specify whether one second applies to measurement, storage, upload or display. Define acceptable misses, first availability, busy behavior and timestamps. Request a repeatable export under matched load. Aggregation may work for long-term trending. Completeness reporting must show gaps and cached results explicitly.

For a custom logger whose timing really derives from an RTC reference, the NDK NX1610SA 32.768 kHz passive crystal is a candidate. Verify load, ESR, drive, temperature and startup capability. The task could use a separate host timer. Confirm the path before tightening the ppm requirement. If start intervals remain processing plus a wait, tighter crystal tolerance cannot fix that delay.

Frequently asked questions

Why specify deadlines instead of saying “repeat in one second”? State when the interval starts. The two expressions agree only if processing time is negligible or accounted for.

Does a fixed schedule guarantee punctual sampling? Deadlines remain fixed, while actual work depends on resources, priority and load. Validate actual measurement times and misses.

Does an equal average rate imply an equal cadence? Bursts and uniform intervals can have the same average. Check adjacent intervals, source sequence and timestamps.

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.