SPI clock / transfer-time calculator

The slider covers 1 to 100 in the chosen unit; type any clock from 1 Hz to 1 GHz.

Enter decimal or scientific notation, such as 8 or 8e6. Gap and chip-select times are in microseconds. Changing a unit reinterprets the number.

No valid result to draw.

Show the steps

Interactive calculation is unavailable until JavaScript loads. The formulas, worked examples and references below remain available.

Calculate SPI transfer time and throughput from clock rate, frame size, frame count and gaps, or the clock needed for a time budget.

How to use

Choose Transfer time or Clock for a time budget.

Enter the SCK frequency, or the time budget, with its unit. The slider sets the SCK frequency in steps.

Enter bits per frame (8 for bytes) and the number of frames.

Choose standard, dual or quad data lanes.

Optionally enter the gap between frames and the chip-select setup plus hold time, in microseconds.

Read the result, throughput and time breakdown. Copy result copies labeled values; Reset restores the starting example.

Science

SPI is a synchronous bus: the controller drives SCK and each SCK cycle moves one bit on each data line. A frame of b bits on one line therefore takes b clock periods, whatever the clock polarity and phase mode.

Real transfers add idle time. Many controllers insert a programmable delay between frames, and chip select must be asserted before the first edge and held after the last. Those times do not scale with SCK, so above some clock frequency they dominate the total.

Dual and quad SPI move 2 or 4 bits per clock on separate lines. Memory devices often send the command and address on one line and only the data on all lanes, so a quad transfer is slower than this ideal.

Limitations: the tool assumes a constant SCK, no clock stretching, and the same lane count for every bit. It does not model DMA set-up, interrupt latency, software gaps you have not measured, or the maximum SCK of your device and wiring. The minimum clock is a lower bound; choose an available clock at or above it.

Formulas

Data time: t_data = F × b / (w × f). F frames of b bits on w lanes at SCK frequency f.

Transfer time: T = t_data + (F - 1) × t_gap + t_cs.

Throughput: R = F × b / T bits per second; divide by 8 for bytes per second.

Minimum clock: f_min = F × b / (w × (T_max - (F - 1) × t_gap - t_cs)). No solution when the bracket is 0 or less.

SCK period: t_sck = 1 / f.

Examples

10 MHz, 8-bit frames, 256 frames, standard SPI: 204.8 μs, 1.25 MB/s. 256 × 8 / 10e6 s.

8 MHz, 16-bit frames, 100 frames, 1 μs gaps, 0.5 μs chip-select: 299.5 μs, 5.342237062 Mbit/s. 200 μs of data, 99 μs of gaps and 0.5 μs of chip-select time.

50 MHz quad SPI, 4096 bytes: 163.84 μs. 32768 bits on 4 lanes take 8192 clocks.

1024 bytes in 1 ms, standard SPI: 8.192 MHz minimum SCK. 8192 bits / 1 ms.

100 16-bit frames in 50 μs with 1 μs gaps: No clock meets the budget. Common mistake: 99 μs of gaps already exceed the 50 μs budget.

References

Texas Instruments: KeyStone SPI user guide (SPRUGP2A)

BIPM: SI prefixes