NGHỆ THUẬT
LÀM ĐẸP VÀ SỨC KHỎE
THỦ CÔNG
VĂN HÓA VÀ LỊCH SỬ
GIẢI TRÍ
MÔI TRƯỜNG
THỰC PHẨM VÀ ĐỒ UỐNG
KỸ THUẬT NGƯỢC
KHOA HỌC
THỂ THAO
CÔNG NGHỆ
THIẾT BỊ ĐEO

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.
Cơ bản
3 hours
Hướng dẫn
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.
Công cụ cần thiết:
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
Vật liệu cho bước này:
Jumper Wire Set1 cáiCông cụ cần thiết:
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
Vật liệu cho bước này:
MAX232 Level Shifter IC1 cái
Capacitor Kit1 cái
Resistor Kit (1/4W, E12 Series)1 cái
DB9 Connector1 cáiCông cụ cần thiết:
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...
Công cụ cần thiết:
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.
Công cụ cần thiết:
Notebook and PencilVật liệu
5- Jumper Wire SetHoa hồng 10%1 cáiTạm thời
- MAX232 Level Shifter ICHoa hồng 100%1 cáiTạm thời
- Capacitor KitHoa hồng 10%1 cáiTạm thời
- Tạm thời
- DB9 ConnectorHoa hồng 100%1 cáiTạm thời
Công cụ yêu cầu
7- Notebook and PencilHoa hồng 10%Tạm thời
- ESP32 Development BoardHoa hồng 10%Tạm thời
- Tạm thời
- Desktop ComputerHoa hồng 100%Tạm thời
- Breadboard - ClassicHoa hồng 10%$10.00
- Jumper Wire SetHoa hồng 10%Tạm thời
- Digital Multimeter - Lab GradeHoa hồng 10%Tạm thời
Blueprint liên quan
Các blueprint này chia sẻ kiến thức — kỹ thuật, vật liệu hoặc nguyên tắc
CC0 Phạm vi công cộng
Bản thiết kế này được phát hành theo CC0. Bạn tự do sao chép, sửa đổi, phân phối và sử dụng cho bất kỳ mục đích nào mà không cần xin phép.
Hỗ trợ nhà sáng tạo bằng cách mua sản phẩm qua bản thiết kế, nơi họ nhận Hoa hồng nhà sáng tạo do nhà bán hàng đặt, hoặc tạo phiên bản mới và kết nối trong bản thiết kế riêng để chia sẻ doanh thu.



