🔁 SPI Baud Prescaler

Closest achievable SPI clock from a peripheral clock and prescaler, for STM32 and AVR.

SPI/APB clock feeding the prescaler.
Desired SCK frequency (check slave max!).
Some slaves have a hard maximum SCK.

How it works

Most SPI peripherals (STM32 BR[2:0], AVR SPR1:0 + SPI2X) only offer power-of-two clock dividers:

fSCK = fPCLK ÷ prescaler    (prescaler ∈ {2, 4, 8, 16, 32, 64, 128, 256})

The tool evaluates every available prescaler and ranks them either by closeness to your target or by the highest clock that still stays at or below it — useful when a slave device specifies a hard maximum SCK frequency.