SPI clock speed

Been trying to figure out the SPI clock speed, but haven’t gotten through all the layers of setup and HAL.

Is there any official statement on what the current baud rate prescaler setting in per_spi.cpp is equivalent to?

hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;

I’ll be trying to get to about 10 MHz. Is that supported by the current clock tree?

I’m fairly sure that SPI runs on 42 Mbit on Daisy, which means that you’re getting 5.25 Mbit on that prescaler settings. So you should use SPI_BAUDRATEPRESCALER_4 for getting 10.5 Mbit.

Btw, they’ve put CubeMX project in github. It’s quite useful for determining clocks, but I think it could be a bit out of date and I had to update some settings based on actual values in libDaisy sources.

Ok, thanks. 10.5 MHz is a bit beyond what my external device supports, so I guess I’ll stick with 5.25 MHz for now.

From those that are familiar with the reasoning for 42 MHz, does it seem possible to update to something compatible with getting closer to 10 MHz? I’m not used to being so restricted to powers of 2 baud rates in a device.

Changing PLL2 setttings is possible, but it’s shared with other peripherals (FMC, USART). So you’d have to make sure that it won’t break anything else.

It’s probably safer to change SPI settings to use different clock source. According to clock configurator in CubeMX, SPI bus supports 4 different clock sources. With current Daisy settings they are set to 160/42/12.29/16 MHz. So you should be able to find something that works for you if you use different clock rather than just prescaler.

Looks like 160 is the magic clock. Will investigate how to do that. Thanks!