SME
Embedded Systems · Problem type
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?”
This is an example. Type your own values to start a new problem.
r (MB/s)
=
fSCK (MHz)
÷
8
t (μs)
=
n
÷
fSCK (MHz)
Formulas
r
=
fSCK
8
1
=
8
8
t
=
n
fSCK
2
=
16
8
Assumptions
•
Each SCK cycle shifts one bit out on MOSI and one bit in on MISO, so SPI is full duplex.
•
SCK runs without gaps between bytes; the chip-select setup time is left out.
•
A byte is 8 bits, so the bytes a second are the clock rate over 8.
Step-by-step
WE KNOW
fSCK = 8 MHz, n = 16
FIND
bytes a second (r), transfer time (t)
Step 1 · Find bytes a second (r)
Use r = fSCK ÷ 8
One bit moves each clock cycle, and 8 bits make a byte.
r
=
8
8
r
=
1
MB/s
Step 2 · Find transfer time (t)
Use t = n ÷ fSCK
Each
bit
takes
one
clock
period,
1
fSCK
.
t
=
16
8
t
=
2
μs
Check
Put the numbers back in. Both sides should match.
1
=
8
8
✓
2
=
16
8
✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.
Related lessons
Serial protocols
Main lesson
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?”
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?”