i have a question.when i work with spi at stm32f4.when config Baudrates.it shows 76KBits/s. Is that the Bit rate.And with my clock is 10MHZ .how can i calculate my Baudrates.(Frame fomat: Motorola. Data size: 8 bits.).Thanksyou!

  • 1
    \$\begingroup\$ Please, use punctuation. \$\endgroup\$ – Bence Kaulics Sep 26 '16 at 8:53
  • \$\begingroup\$ I'm pretty sure the manual has all the necessary information. \$\endgroup\$ – pipe Sep 26 '16 at 9:01
  • \$\begingroup\$ Baud-rate is usually misused these days. It was much more relevant when line signalling was used at rather slower rates. Baud rate is the rate of change of polarity on your baseband, in telex days it was equal to the bit rate. With FM modems it was much larger, with PSK/FSK it was usually double and with modern modulation techniques it may be a fraction like 1/16 in 16PQAM modulation. You are talking about framing standards and bit rate dividers and this has pretty much nothing directly to do with modulation. \$\endgroup\$ – KalleMP Sep 26 '16 at 11:16

SPI doesn't use start or stop bits, so there is no 'wasted' signal time.

There are only two symbols (high and low), so Baud rate = bit rate, measured in bit/s, kbit/s, Mbit/s, etc (not KBits/s).

If the SPI clock is 10MHz, then the bit rate will be 10Mbit/s divided by 2, 4, 8, 16, 32, 64, 128, 256, set by the 'Baud rate control' bits in e.g. 'SPI control register 1'

The nearest divider of 10MHz clock, to approach 76kbit/s is 128.

Some STM32F4xxx SPI are programmable for 8 or 16 bit units of transfer, so you can choose 8 bits/transfer if that's what you want.

The SPI slave does not need to be configured for the transfer speed because the master provides a clock signal (SCLK) which keeps the slave synchronised explicitly. The master's SPI clock is active when data is being transferred, and that clock signal drives the slave's sensing data in signal (MOSI), or setting the data output signal (MISO).

So, as long as the SPI slave can keep up with the transfer speed, the actual transfer speed can vary significantly, and the clock signal keeps the SPI slave synchronised.

This is unlike asynchronous transfers, where both sides of the transfer need to know the transfer speed because they need to use that to recognise and extract the data.

| improve this answer | |
  • \$\begingroup\$ your answer make me more cleary.But i have a confuse why don'tt config baudrate for slave.Because in synchronous how slave can know exactly data send from master. \$\endgroup\$ – Tran Toan Sep 28 '16 at 9:42
  • \$\begingroup\$ @TranToan - I've updated my answer to explain why the slave doesn't need to be configured for the transfer rate. \$\endgroup\$ – gbulmer Sep 29 '16 at 9:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.