During bring-up of an ARM or RISC-V MCU, clock and UART are among the first subsystems to check. Load-capacitance and baud-error calculations guide diagnosis, alongside measurements and device checks. A design error is one possibility, together with configuration, supply, layout and faults.
The crystal that won’t start: it’s about load capacitance
Failure to start, an unlocked PLL or out-of-spec frequency can indicate clock-chain problems. Before attributing them to the crystal, check supply, configuration, load capacitance, ESR, gain margin and layout. An excessively capacitive probe can disturb the measurement.
Load capacitance is one item to check. A crystal oscillates at its nominal frequency only when it sees a specific capacitance across its terminals, the load capacitance CL stated on the datasheet (typically 8, 12, 18, 20 pF). That value is the capacitance the external circuit must present to the crystal. If it’s wrong, the crystal oscillates at a slightly different frequency (pulling), or the oscillation loop doesn’t have enough gain and won’t start at all.
The two capacitors C1 and C2 at the crystal pins are computed as follows. Two equal capacitors set to CL won’t do: the crystal sees the series of C1 and C2, plus the parasitic capacitances of the PCB and the package pins. The correct formula is:
where Cstray collects the parasitics of traces, pads and the on-chip oscillator inputs — typically 3-5 pF, not negligible. With C1 = C2, the series term is C/2: to obtain CL = 18 pF with Cstray = 4 pF you need C1 = C2 ≈ 28 pF, not 18 pF and not 36 pF either. A wrong calculation gives capacitances too high (the crystal struggles to start) or too low (frequency out of spec). To avoid redoing the math by hand every time we put a load-capacitance calculator online; the full reasoning, with the edge cases, is in the dedicated wiki.
The unreadable UART: baud-rate error
Unreadable serial data can result from baud, frame format, electrical levels, noise, pin configuration or software handling. Occasional correct bytes do not by themselves identify the cause: compare measured bit timing with both endpoints’ configuration.
An asynchronous UART generates its own transmit clock by dividing a peripheral clock by an integer (or fractional, on newer MCUs) divisor. The actual baud rate is therefore almost always slightly different from the nominal one, because the nearest integer divisor rarely hits it exactly. The percentage difference between actual and nominal baud rate is the baud error.
A mismatch between transmit and receive bit periods produces drift within a frame. There is no universal ±2–3% limit, however: margin and error detection depend on receiver, oversampling, divisor and line. Distinguish nominal generator error from the tolerances of both clocks; the wiki gives an STM32F4 example with its reference manual.
Start with the configured peripheral clock, divisor and frame format; calculate baud rates, then include clock tolerances and receiver limits. Check signals and the line as well. The UART calculator and wiki distinguish actual error, quantization and receiver margin.
Calculation and measurement
Calculations identify inconsistent configurations before testing. Measurements then check startup, frequency, waveform and margin in the actual circuit: the two steps are complementary. For STM32 oscillators, ST AN2867 documents load, ESR, gain and drive level.
We can help diagnose clock and UART issues during bring-up: describe your board and the problem.