cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate the Baudrate in SPI?

Muzahir Hussain
Associate III
Posted on February 10, 2018 at 19:56

How do I calculate the SPI baudrate in nucleo STM32F103RB?

In reference manual it says, 

Bits 5:3 BR[2:0]: Baud rate control

000: fPCLK/2

001: fPCLK/4

010: fPCLK/8

011: fPCLK/16

100: fPCLK/32

101: fPCLK/64

110: fPCLK/128

111: fPCLK/256

What does it mean??

#stm32f103rb #stm32-f3 #spi-communication
1 REPLY 1
Posted on February 10, 2018 at 20:19

Take the APB clock that the SPI peripheral is attached too and divide it down.

ie

rate = HAL_RCC_GetPCLK2Freq() / 8;

For a 72 MHz bus this would be a 9 MHz SPI1

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..