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

Why can a board with an 8 MHz crystal miss external pulses below 4 MHz?

An external clock on the ATmega328P’s T1 pin advances the timer by edge, but the input is still sampled and synchronized internally. The datasheet requires each half-cycle of the external clock to exceed one system-clock period and provides a more conservative recommendation accounting for frequency and duty-cycle variation. An 8 MHz MCU clock does not guarantee that every pulse train below 4 MHz can be counted.

Measure the shortest high and low intervals first

With an actual I/O clock of 8 MHz, a clock period is 125 ns. At 3 MHz and approximately 50% duty cycle, the input stays high and low for about 167 ns each. At 20% duty cycle, the high time is only about 67 ns, shorter than one I/O clock period. A counter can show 3 MHz for both signals while the receiving timer has different chances of detecting their edges. Check whether a system prescaler divides the chip’s main clock, and use the actual I/O clock for the timing calculation.

Apply a defined number of pulses on the bench. Establish a baseline at low frequency and a 50% duty cycle, then increase frequency or vary duty cycle one at a time. Use an independent instrument at the pin to verify amplitude, minimum pulse width, and pulse count. Hold the input steady when enabling and disabling counting to avoid extra events at the boundaries. Record the number of pulses actually received in each case, along with input rate.

To count narrower pulses, evaluate an external counter with specified input bandwidth, a suitable prescaler, or another input architecture. Recheck phase and pulse-width margins at the maximum rate. Record reference-clock error and minimum pulse width separately when specifying the timebase. This can explain why a more accurate 8 MHz crystal did not fix missed counts.Microchip ATmega328P datasheet

Send us a part number or your requirements

Brand, frequency, quantity and delivery target — a useful place to start.

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.