艺术
美容与健康
工艺
文化与历史
娱乐
环境
食品与饮料
逆向工程
科学
体育
技术
可穿戴设备

The UART and Start-Stop Framing
Two machines, one wire, and no shared clock. That is the whole problem, and everything else in this batch is built on the answer to it.
A human telegraphist needed no convention: Morse has rhythm, and a listener locks onto it without being told. A machine has an oscillator that is a percent or two off, drifting with temperature, and it cannot hear rhythm. It needs to be told exactly when a character starts.
The answer came from teleprinters and it is almost embarrassingly simple. Hold the line at MARK when idle. Drop it to SPACE for exactly one bit time — that is the start bit, and its falling edge is the only timing reference in the entire system. Send the data bits, least significant first. Then return to MARK for at least one bit time, the stop bit, so the line is guaranteed back at idle and the next falling edge is unambiguous.
It costs two bits in every ten, a flat twenty percent, and it buys a clock tolerance of about five percent split between the two ends — which a cheap RC oscillator can hold. That trade is the whole design. Resynchronise often and you may use a bad clock; resynchronise rarely and you need a crystal, which is the road that leads to Ethernet's preamble seven blueprints later.
FULLY BUILDABLE. Bit-bang a frame, look at it on a scope, then walk the receiver's baud rate off by a percent at a time and find where it breaks. The stop bit fails before the data does, every time, and that is not a coincidence — it is the last bit sampled and it carries the most accumulated error.
初学者
3 hours
说明
1
1
Where the framing came from
Where the framing came from
Work the Baudot blueprint first. It gives you the fixed-length character code — five bits, always five, unlike Morse's variable lengths — that makes machine reception possible at all.
What Baudot does NOT settle is when a character begins. A teleprinter's mechanism solved it with a start pulse that released a rotating distributor and a longer stop pulse that let it come to rest, which is where the odd 1.5-bit stop length comes from.
The UART is that mechanism in silicon: same start bit, same idle-at-mark, same least-significant-bit-first order. Nothing was invented. It was electrified.
所需工具:
Notebook and Pencil2
2
Bit-bang a frame and break it deliberately
Bit-bang a frame and break it deliberately
Join GPIO17 to GPIO16 with one jumper and flash the sketch. Put the scope on GPIO17 first and send 0x55: alternating bits give the clearest possible picture of the frame, and you can measure one bit time directly with the cursors.
Then let the sweep run. It walks the receiver's baud rate from ten percent slow to ten percent fast and counts, at each step, how many bytes arrived correctly, how many raised a FRAMING error, and how many arrived as the wrong value.
Framing errors appear BEFORE wrong data. That is the whole lesson: the stop bit is the last thing sampled, so it carries the most accumulated error and fails first — which is exactly why a UART reports framing errors rather than silently handing you rubbish.
bitbang_uart.inocpp
此步骤所需材料:
Jumper Wire Set1 个所需工具:
ESP32 Development Board
Digital Oscilloscope
Desktop Computer
Breadboard - Classic3
3
The line driver and the null modem
The line driver and the null modem
Build the MAX232 stage if you want to talk to anything with a nine-pin D connector. It does two jobs: it INVERTS, because RS-232's mark is negative, and it swings to about plus and minus ten volts, which is what let the standard drive fifteen metres of unshielded cable in 1960.
The charge-pump capacitors make those rails from a single five-volt supply. Reversing one is the commonest fault on this circuit and the symptom is a chip that gets hot.
Then read the crossover at the bottom of the schematic. RS-232 assumed a terminal talking to a modem, so transmit and receive are named from opposite ends and a straight cable works. Two computers are both terminals, both transmit on pin 3, and neither hears anything — which is why the null-modem cable had to be invented and had to have a name.
Loading KiCanvas viewer...
Professional PCB Design Viewer
此步骤所需材料:
MAX232 Level Shifter IC1 个
Capacitor Kit1 个
Resistor Kit (1/4W, E12 Series)1 个
DB9 Connector1 个所需工具:
Breadboard - Classic
Jumper Wire Set
Digital Multimeter (Lab Grade)
Digital Oscilloscope4
4
Clock tolerance and the awkward crystal
Clock tolerance and the awkward crystal
Loading Jupyter Notebook...
所需工具:
Desktop Computer5
5
Compendium: the cost of having no clock
Compendium: the cost of having no clock
THE TRADE, IN ONE LINE. Two framing bits per eight data bits is twenty percent of the wire spent on saying nothing, and it buys a five percent clock tolerance. Every synchronous protocol after this one spends less on framing and demands a better clock: Ethernet's preamble is 64 bits ONCE per frame rather than two bits per byte, which is far cheaper for a 1500-byte frame and impossible without a crystal.
BREAK, AND WHY IDLE IS MARK. Holding the line at SPACE for longer than a whole frame is a BREAK condition — impossible in normal traffic, because a stop bit must always arrive. It is a signal outside the alphabet, and it exists precisely because idle is mark: a cut wire with a pull-up reads as idle, while a shorted one reads as a permanent break. The choice of which state is idle is what makes those two faults distinguishable.
AGAINST THE DISC. Blueprint 90-3's MFM code solves the same problem — a receiver with no clock — and solves it oppositely, by constraining the DATA so transitions can never be far apart. That works on a disc because the medium is yours to encode. On a wire shared with other equipment you cannot constrain what the other end sends, so you add framing around arbitrary data instead. Same problem, and the answer depends entirely on whether you own the alphabet.
所需工具:
Notebook and Pencil材料
5- Jumper Wire Set10% 佣金1 个占位符
- MAX232 Level Shifter IC100% 佣金1 个占位符
- Capacitor Kit10% 佣金1 个占位符
- DB9 Connector100% 佣金1 个占位符
相关蓝图
这些蓝图共享知识——技术、材料或原理
CC0 公共领域
此蓝图以 CC0 协议发布。你可以自由复制、修改、分发和使用此作品,无需征得许可。
通过购买蓝图中的产品支持创客,他们将获得 创客佣金 (由供应商设定),或创建此蓝图的新版本并将其作为连接包含在你自己的蓝图中以分享收入。



