I am trying to communicate with an ADC via SPI. In the datasheet, It is mentioned, that:

The performance of the ADC161S626 is ensured over temperature at clock rates of 1 MHz to 5 MHz – DNL +0.8 / −0.5 LSB and reference voltages of 2.5 V to 5.5 V

I went to STM32CubeMX to configure SPI. I found that the one I am using is connected to APB1 which works at 80 MHz. There is a prescaler for SPI that divide this value but I noticed the result is a baud rate not a frequency (MBits/s). So, my question is: to correctly set the clock frequency for the SPI, should I consider that MBits/s is equivalent to MHz and set this latter to a value between 1 MBits/sec and 5 MBits/s ?

  • 1
    If you look at the datasheet 1) 40ns is 25Mhz. SCLK can be up to 25MHz. And 2) yes as it shows there is one SCLK period per data bit in the SPI transaction so bits per second and MHz are the same. Dont confuse baud though I suspect your peripheral is a universal uart/spi/i2c/whatever and the terms get mangled as a result. – old_timer Aug 10 at 8:38
  • 1
    A scope is your friend here, see what SCLK looks like for the various divisor settings in your MCU. Then change one of those and see how it affects the SCLK, repeat until you are within your desired range. – old_timer Aug 10 at 8:40
up vote 3 down vote accepted

(Updated after P__J__'s comment)

Yes, if you count within one byte (see explanation below). No, if you count over multiple bytes, because of the gap between the bytes.

[enter image description here]

(Note that instead of ASCII, any data can be sent).

As you can see the clock speed has an up/down pulse, and this corresponds to 1 bit. So 1 mbits/s equals the 1 MHz clock speed (or in other words, in 1 million clock pulses, 1 million bits can be sent/received).

This is not mandatory for all protocols, but for SPI it is.

  • @old_timer I changed it for the complete SPI picture, thanks for the notification. – Michel Keijzers Aug 10 at 8:38
  • MHz clock != Mbits as there are gaps between the data. – P__J__ Aug 11 at 1:52
  • @P__J__ I meant actually the data bits themselves, but if one counts for one second the number of 'real data bits' than it is not the same... I will adjust my answer, thank you. – Michel Keijzers Aug 11 at 9:18

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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