Calibration and compensation of MC9S08MG64 real-time clock

The MC9S08MG64 is a semi-SoC chip from Freescale Semiconductor for single-phase electric meters. It integrates an on-chip LCD driver and real-time clock module, as well as a variety of communication interfaces. When used in smart meter design, with the external energy metering chip, a single-phase meter design with good cost performance can be completed. The integrated real-time clock module (iRTC) in this microcontroller has timekeeping and calendaring capabilities. The error caused by the frequency offset and temperature drift of the crystal itself can be corrected by the compensation function of the real-time clock itself. This article discusses how to calibrate and compensate the real-time clock to meet the standards required by the national network (with an error of less than 5ppm).

Crystal characteristics

1.1 Influence of load capacitance

Generally speaking, the oscillation frequency of the crystal is very stable, but we also know that the oscillation frequency of the crystal is affected by the load capacitance and temperature change. The example shown in the figure below is a crystal with a load capacitance of 12.5pF. The following characteristics of the oscillation frequency deviation when the load capacitance changes.

The oscillation circuit matches the dispersion of the capacitor and the temperature drift, and the distributed capacitance of the board affects the oscillation frequency. For the MC9S08MG64, the oscillator can be configured in two configurations when using a 32.768kHz crystal. When using the low power mode (RANG = 0, HGO = 0), the load capacitance, feedback resistor, and serial resistor are already integrated inside the microcontroller, and only the crystal needs to be added outside. This configuration consumes less power and can offset the effects of the above error factors. When using the high gain mode (RANG = 0, HGO = 1), load capacitance, feedback, and serial resistance are applied externally. This configuration has a strong anti-interference capability, but external components have an impact on the accuracy of the oscillation frequency. For the frequency drift caused by the load capacitance, we can reduce the influence by selecting a capacitor with a small temperature drift coefficient (such as COG capacitor).

1.2 Temperature drift

The figure above is a curve of the tuning fork crystal oscillation frequency as a function of temperature, which can be described by a parabolic equation as:

Fdev = B (T - TQ)2 + K

among them:

It can be seen from the above analysis that for a crystal oscillation circuit, the factors affecting the oscillation frequency error are:

Load capacitance

Frequency deviation K of the crystal at the turning temperature point

Warm drift Fdev

Therefore, in order for the iRTC to accurately time, the errors caused by the above factors must be eliminated. The load capacitance can be guaranteed by the selection of the oscillating circuit components. The latter two must be calibrated and compensated by software.

Horizontal Fiber Optic Splice Closure

Fiber Optical Splice Closure

Fiber optic splice closures are made of excellent engineering plastics. Sijee supply different ports types, fittings and different fiber optic core numbers for horizontal and dome fiber optic splice closures.


Sijee's Splice Closure is suitable for protecting optical fiber splices in straight through and branching applications, and can be used in aerial, duct and direct buried fiber optic cable projects.

Fiber Optic Splice Closure BoxFiber Joint Closure

Horizontal Fiber Optic Splice Closure,New Horizontal Fiber Optic Splice Closure

Ningbo Bwinners Optical Tech Co., Ltd , https://www.sijee-optical.com