SME
Embedded Systems
Serial protocols
Use this for “How many bytes per second can a 115 200-baud 8N1 UART send?”
Diagram
The line idles high; a start bit pulls it low, then the byte 0x4B goes out LSB first and 1 stop bit high. frame = 1 + 8 + 0 + 1 = 10 bits.
This is an example. Type your own values to start a new problem.
nframe
=
1
+
ndata
+
nₚₐᵣᵢₜᵧ
+
nₛₜₒₚ
r (B/s)
=
baud (b/s)
÷
nframe
tbyte
Time a byte
calculated
Formulas
nframe = 1 + ndata + nₚₐᵣᵢₜᵧ + nₛₜₒₚ
10 = 1 + 8 + 0 + 1
r
=
baud
nframe
11,520
=
115,200
10
tbyte
=
nframe
baud
8.6806 ×
10
-5
=
10
115,200
Formulas are worked in s. The step-by-step shows the conversions.
Assumptions
•
The line idles high; the start bit pulls it low, then the data bits go out LSB first.
•
8N1 means 8 data bits, no parity bit and 1 stop bit; 7E1 is 7 data bits, even parity, 1 stop bit.
•
Each bit lasts 1 ÷ baud, and frames follow each other with no idle time between them.
Step-by-step
WE KNOW
baud = 115,200 b/s, ndata = 8, nₚₐᵣᵢₜᵧ = 0, nₛₜₒₚ = 1
FIND
bits a frame (nframe), bytes a second (r), time a byte (tbyte)
Step 1 · Find bits a frame (nframe)
Use nframe = 1 + ndata + nₚₐᵣᵢₜᵧ + nₛₜₒₚ
One start bit, then the data bits, the parity bit if there is one, and the stop bits.
nframe = 1 + 8 + 0 + 1
nframe = 9 + 1
nframe = 10
Step 2 · Find bytes a second (r)
Use r = baud ÷ nframe
Every byte costs a whole frame of bits, so divide the bits a second by the frame.
r
=
115,200
10
r
=
11,520
B/s
Step 3 · Find time a byte (tbyte)
Use tbyte = nframe ÷ baud
Each
bit
lasts
1
baud
seconds,
and
one
byte
takes
the
whole
frame.
tbyte
=
10
115,200
tbyte
=
8.6806 ×
10
-5
s
Step 4 · Convert the answers
Change each answer back to the unit you chose.
tbyte = 8.6806 × 10⁻⁵ s = 86.8056 μs (1 s = 10⁶ μs)
Check
Put the numbers back in. Both sides should match.
10 = 1 + 8 + 0 + 1 ✓
11,520
=
115,200
10
✓
8.6806 ×
10
-5
=
10
115,200
✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.
More problem types
Baud-rate register and error
Use this for “A 16 MHz microcontroller sets its UART to 115 200 baud. What goes in UBRR, and how far off is the baud rate?”
SPI throughput
Use this for “An SPI bus clocks at 8 MHz. How many bytes a second can it move, and how long does a 16-bit transfer take?”
I²C transaction time
Use this for “How long does a 400 kHz I²C write of 2 data bytes take, address byte included?”
UART, SPI or I²C?
Use this for “A bus has two shared wires, pull-up resistors and a 7-bit address for each device. Is it UART, SPI or I²C?”