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

A DS1340 with a 32.768 kHz crystal runs 20 ppm fast. Why not write 20 as the calibration code?

A fast clock needs negative correction, and the two step sizes differ

For a measured +20 ppm error, DS1340 negative trim is approximately −2.034 ppm per step, so ten steps are a candidate. Positive trim is about +4.068 ppm per step. Do not write the ppm value directly or assume equal steps in both directions. The S bit is 1 for positive and 0 for negative correction. Verify the setting on the actual assembled board.

Setting the displayed time and trimming its subsequent rate are different. Establish a baseline against an independent reference. Distinguish constant error, temperature drift and repeated time writes before changing the calibration.

Keep the direction, magnitude and measurement separate

ItemDS1340 specificationUse
Positive correction, S=1About +4.068 ppm per stepSpeed up a slow clock
Negative correction, S=0About −2.034 ppm per stepSlow down a fast clock
CAL[4:0]Magnitude 0 to 31Not a direct ppm field
FT/OUT test modeNominal 512 Hz, unaffected by trimMeasure original oscillator error

How does +20 ppm become about ten steps?

An FT reading of 512.01024 Hz is about +20 ppm relative to 512 Hz with an accurate reference. Choose negative trim; 20/2.034 is about 9.83, so ten steps give about −20.34 ppm. The approximate residual is −0.34 ppm and requires measurement. An otherwise comparable −20 ppm clock instead suggests around five positive steps. The magnitude is not symmetrical. At magnitude 31 the approximate limits are +126.1 ppm and −63.1 ppm. If an error exceeds the useful range, check loading, instrument accuracy and startup before using an endpoint. Room-temperature data do not establish performance over temperature.

Why a short window can misrepresent the correction

The DS1340 organizes correction over 64 minutes. A magnitude of one modifies the first two minutes, and six modifies the first 12. The effect is not necessarily uniform in every short window. Verify timekeeping over a full cycle or multiples instead of relying on a few seconds.

A write to the control register resets the divider chain. Repeated writes during a measurement mix reset events into the observation. Keep the write timestamp, the initial observation and the full test-window result separate. A display update is also not a reliable measure of reference-clock behavior.

Validate the crystal and calendar independently

The external DS1340 calls for 32.768 kHz, 12.5 pF and ESR up to 80 kΩ. The DS1340C integrates a crystal and is not wired like the external version. Epson's MC-306 brief gives a standard 12.5 pF option and a 50 kΩ maximum as a purchasing example, not a verified circuit match. Verify final-board startup and timekeeping and keep interference and intrusive probe loading away from the oscillator loop.

Keep the pre-trim FT measurement separate from post-trim timekeeping

Record FT/OUT with the correct pull-up and receiver setup for an open-drain output. Then compare calendar timing before and after trim using the same reference and controlled conditions. FT can intentionally show the same value after trim. Look for improvement in long-term count instead. If it is absent, check code, window, temperature and other time writes rather than treating unchanged FT as proof of failure.

What belongs on the purchase and calibration records?

Specify external-crystal DS1340 or integrated DS1340C and verify the assembled version. For external parts, record full ordering code, nominal frequency, load and ESR. For each calibrated board record initial code, applied sign and magnitude, temperature, interval and measured residual. Do not copy one unit's trim to all boards without qualifying the practice. Release with verified timekeeping rather than merely a successful register write.

At 512 Hz, one ppm is 0.000512 Hz. A simple integer-cycle count over one minute has a one-count step of roughly 0.0167 Hz, coarser than the example +20 ppm shift. A suitable time-interval method or longer window can improve resolution, but the reference must be accurate and the unit thermally stable.

Capture an untrimmed run under main power. If backup accuracy matters, test it independently and read the retained time after restoration but before firmware sets it. Register access and timekeeping during backup are not equivalent. A display jump after restoration may come from host initialization, not a stopped oscillator.

Identify the full installed model before borrowing a trace or procedure from the integrated or external version. Verify the observation pin is in frequency-test mode rather than ordinary logic-output mode. Preserve unrelated control fields when enabling FT and account for a divider reset. Restore production settings when finished.

Document original oscillator error and corrected timekeeping separately. If they differ unexpectedly, audit the start and end references and whether host correction is being added to or canceling RTC trim.

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.