Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / Passive Crystals and Oscillator Circuits

Why does an S32K144 one-second timer measure two or five seconds with a healthy 8 MHz crystal?

An S32K144 test board toggles a pin on each LPIT timeout. A report expects one second, but an oscilloscope shows a two-second waveform period. Another firmware revision shows five seconds between adjacent edges. Those are different cases. The 8 MHz quartz crystal supplies the external oscillator, while LPIT can use a selected functional clock. The instrument can also measure a full cycle while the requirement describes each transition.

Trace the functional clock

NXP's AN5413 example uses the board's 8 MHz crystal and a system PLL to obtain 160 MHz, from which it configures an 80 MHz core clock. A PLL-derived 40 MHz functional clock drives LPIT0. The board's module bus clock is also 40 MHz in this configuration. Being able to access the LPIT registers does not establish that the timer is using that same rate. The internal 40 MHz node does not require a separate active 40 MHz oscillator. Where a board has such an oscillator, follow its physical destination before using it in an LPIT calculation.

Read the oscillator and PLL status and then inspect the LPIT source selection and its divisor. NXP also shows an 8 MHz external oscillator branch and branches derived from internal oscillators. Compare planned values in the configuration tool with the running register fields. Record values after reset, just after peripheral initialization and before the first timeout. Later initialization code can overwrite an earlier setting. If a clock is exported for measurement, record which internal node it represents.

Distinguish a timeout from a waveform period

The application example loads 40 million clocks. At 40 MHz that yields about one second per timeout. Toggling once on each timeout puts a falling edge between successive rising edges. Adjacent transitions are one second apart, while rising edges are two seconds apart. Write both intervals on the test sheet before interpreting the scope's automatic period measurement.

Keeping the 40 million count and selecting an 8 MHz functional path with unity division instead makes the timeout about five seconds. With one toggle per timeout, a full waveform cycle lasts about ten seconds. Observe the first output transition and three consecutive transitions in both configurations. If the specification calls for a one-second full waveform cycle, set a half-second toggle interval or use an explicit hardware waveform mode. Check the count and reload convention for that mode. A single abnormally long interval calls for capturing timer status, interrupt masking and scheduling. Treat a stable ratio and a rare service delay as separate test cases.

For scale, a hypothetical 8 MHz crystal that is 20 ppm high is about 160 Hz high. Fixed PLL and divider ratios preserve that fractional offset. A nominal one-second timeout is approximately 20 microseconds early. That is a different scale from a difference of one or several seconds. Check the configured source and count before qualifying a tighter part.

Use two observations to qualify a production board

A software-polled output includes scheduling and service timing. Capture a diagnostic event for timeout and a separate indication of completion where possible. AN5413 also gives a hardware compare and capture example using FTM. A hardware path can help remove software service delay from the observation if the design permits it. Use an independent timebase for absolute accuracy. Two observations derived from the same 8 MHz source can confirm a ratio without confirming its accuracy.

A useful bench control is to change only the count from 40 million to 20 million. The timeout should change from about one second to one-half second on the 40 MHz path, or from five seconds to two and one-half seconds on the 8 MHz path. Both halve, so that fact alone does not identify the path. Compare the measured intervals with both calculations. Use a permissible stop window, and keep the test settings distinct from production firmware.

Procurement should retain the complete crystal part number, loading, temperature grade and ESR. Engineering can retain the LPIT input, divider, reload value, measured edge and firmware revision. If a design uses an active oscillator as an external input, recheck the supported mode, electrical levels and startup sequence. Reconstruct the actual counter clock before choosing between a component and a firmware change.

References

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.