UART: two wires, no clock, and a frame you have to design yourself
UART is the interface everyone implements once, from a datasheet, and then stops thinking about. Two wires, a baud rate, a few bits of framing, and it works. The trouble is that what works on a bench at 25 degrees does not always work in a cabinet at 60, and the failure does not look like a broken wire. It looks like a plausible number arriving in the wrong field.
The reason is that UART only guarantees one thing: it will deliver bytes, or tell you it could not. Everything above that level, from knowing where a message begins to knowing whether the message survived the trip, is a decision the designer makes and usually does not document. This piece walks through the character level, quantifies the clock budget, and then argues that the message level is where the real engineering happens.
What the hardware actually guarantees
A UART link is asynchronous, which means there is no shared clock line. The transmitter generates bit timing from its own oscillator and the receiver samples using its own, and the two agree only because both were configured for the same baud rate.
At the character level the format is fixed and familiar. The line idles high. A start bit pulls it low for one bit time, and that falling edge is the synchronisation event. Five to nine data bits follow, least significant bit first. An optional parity bit, then one or two stop bits at logic high, and the line returns to idle.
Eight data bits, no parity and one stop bit is the default configuration almost everywhere, and it is called 8N1. Ten bits on the wire per byte, so a 115200 baud link carries at most 11520 bytes per second, and in practice rather fewer.
The receiver does not sample once per bit. It oversamples, typically at 16 times the baud rate, and decides each bit from samples near the middle of the bit period, usually by majority vote over three consecutive ticks. That oversampling is what gives the link any tolerance at all to a clock mismatch, and it is also the reason the tolerance is smaller than most people assume.
The clock budget is five percent, not ten
A figure that gets repeated in tutorials is that the two ends may differ by up to 10 percent. That is roughly twice the real limit, and it is worth deriving rather than trusting.
Sampling the middle of bit k happens at k plus a half bit periods after the start edge. The receiver counts those bit periods with its own clock, so if its baud rate is fractionally fast by e, the sample lands at a fractionally earlier time. The requirement is that the last sample still falls inside its own bit. For a ten-bit character that is the stop bit, at 9.5 bit periods, and the constraint is met while the mismatch stays under half a bit period over that distance, which is a little over 5 percent.
With 16 times oversampling and a three-sample majority, the usable budget drops to about 4 percent, and the published figures cluster around 4.6 percent for a single-sample receiver and 3.95 percent for a majority receiver on 8N1.

We simulated the link at bit level, sampling the middle of each of the ten bits with the receiver's own clock and deciding by majority over three oversampling ticks. Characters decoded perfectly until the mismatch reached 4.5 percent on the slow side and 5.8 percent on the fast side, and then the error rate rose steeply rather than gradually.
The asymmetry has a mechanical explanation, and it tells you what the failure looks like. When the receiver is fast its samples drift earlier, so the data bits start landing in the previous bit and the byte comes out wrong. When the receiver is slow its samples drift later, and the first casualty is the stop bit; since the line idles high, a late stop-bit sample still reads as one, so the error hides until the drift is large enough to corrupt data. That is why a marginal link often produces no errors at all and then a burst of garbage, rather than a consistent degradation.
Two practical consequences follow. The first is that the design budget is 2 percent of total mismatch, not 5, because that budget has to cover both oscillators, the rounding error of the baud divisor, and temperature. A crystal is essentially free of this problem; an internal RC oscillator trimmed to 1 percent at room temperature can drift past 2 percent over the industrial range, which is why the same board can work at 9600 baud and fail at 115200.
The second is that the error does not accumulate across the message. Every start bit re-synchronises the receiver, so a 3 percent mismatch breaks individual characters at random rather than making a long message progressively worse. A link that fails only on long messages is not a clock problem.
Parity catches less than people think
The parity bit is the first error check most people meet, and it is weaker than its reputation. It is computed over the data bits of one character, and the receiver recomputes it: any odd number of flipped bits changes the parity and is caught, and any even number leaves it unchanged and is not.
That single sentence covers the whole situation. A one-bit error in a character is always caught. A two-bit error in the same character never is. A burst that flips an even number of bits is invisible.
The numbers from a simulated 10-byte message make it concrete. Flipping random bits in the payload and checking each byte's parity gave the following detection failures, alongside a CRC-8 and a CRC-16-CCITT computed over the whole message.
| Corrupted bits | Per-character parity | CRC-8 | CRC-16-CCITT |
|---|---|---|---|
| 1 | 0 percent missed | 0 percent | 0 percent |
| 2 | 8.5 percent missed | 0 percent | 0 percent |
| 3 | 0 percent missed | 0 percent | 0 percent |
| 4 | 2.4 percent missed | 0.85 percent | 0.005 percent |
The 8.5 percent on the two-bit row is not a property of parity in the abstract but of the geometry: with ten bytes in the message, two flipped bits land in the same byte often enough to be missed roughly one time in twelve, and if they do land in the same byte they are always missed.
Which is the argument for a message-level checksum. Parity protects characters, and characters are not what your protocol cares about. A CRC computed over the whole frame covers the parts parity never sees: the address, the command, the length field, and any corruption that spans a byte boundary.
CRC-8 is adequate for short frames and cheap on an 8-bit micro. CRC-16-CCITT over a 10-byte payload missed 1 in 20,000 four-bit corruptions in our run, and nothing at all below that. If the frame carries configuration or commands that could move a machine, use the wider one.
Three ways to find the start of a message
Above the character level, a UART hands you a stream with no boundaries. Deciding where a message starts is the framing problem, and there are three common answers, each with a different cost.

Header-delimited framing is the cheapest and the most common in small devices. Two distinctive bytes, then a length, a command, the payload and a checksum. The Hiwonder arm protocol documented on this site is exactly that shape: 0xFF 0xFF, device ID, length, command, arguments, checksum. The cost is a small probability that the header pattern appears inside a payload, so the receiver has to sanity-check the length before allocating a buffer and verify the checksum before acting.
Silence-delimited framing is what Modbus RTU does. There is no header at all; a gap of 3.5 character times ends one frame and the next byte after the gap starts the next. This removes the escape problem entirely, because any byte value can appear in the payload without ambiguity. The cost is timing: every node has to agree on what 3.5 character times means, and a USB-to-serial converter with a 16 millisecond latency timer routinely destroys that assumption, which is why Modbus RTU over USB adapters is a recurring source of confusion.
Escaped framing, as used by HDLC and by COBS variants, wraps the payload between flags and escapes any occurrence of the flag bytes inside it. This is unambiguous by construction and survives any payload content. The cost is a little expansion and an escape loop in both directions, which is more code than a header comparison but much easier to prove correct.
Designing the frame you will live with
If you are writing the protocol rather than adopting one, the decisions that matter later are these.
Make the header unique to your device pair rather than a common value. The point of a header is not to look like a protocol; it is to make a false start unlikely and to let you distinguish your device from the one next to it on a shared bus.
Put the length before the payload, and validate it against a maximum before you use it. A length field that is trusted is a buffer overflow with extra steps, and a length field that is not checked is how a resync turns into a crash.
Compute the checksum over everything after the header, including the length and command bytes. A CRC that covers only the payload will happily pass a frame whose command byte was corrupted into something that starts a motor.
Decide the validation order and implement it in that order: header, then length, then checksum, then command. Anything that fails before the checksum is discarded silently; anything that fails after it is a real message with a bad body, and probably deserves a counter rather than a reply.
Decide what happens on a bad frame, and make it cheap. On a point-to-point link the usual answer is to drop the frame, increment a counter and let the application retry. On a shared bus, a negative acknowledgement costs bus time and invites a retry storm, so silent drop plus a timeout is often better.
Finally, expose the error counters. A checksum failure rate that climbs over a week is the earliest evidence of a connector corroding or a cable running next to a drive, and it costs one register to publish.
The short version
Three things are worth keeping from all of this. UART gives you characters and nothing else, so the frame is yours to define and yours to get wrong. The clock budget is about 5 percent in theory and 2 percent in practice, which makes an external crystal the cheap option above 115200 baud. And a parity bit only knows whether the number of ones changed, which means it is blind to exactly the error patterns that matter when something is emitting interference nearby.
Everything above was measured on a bit-level simulation of an 8N1 link and against 20,000 corrupted messages, not on hardware. The numbers should be read as the shape of the problem rather than as guarantees about your particular cable.