7 years, 1 month ago.

How can I change SPI clock frequency?

Hi,

I am using NUCLEO-F767ZI as SPI master. The default SPI clock of this model is set to 1 MHz. I want to use 1 kHz clock for the SPI, but spi.frequency(1000) function is not work. How can I change SPI clock?

best regards,

2 Answers

7 years, 1 month ago.

Hi,

The minimum SPI frequency is the SPI clock divided by 256.

For this device, the SPI clock is configured to 54 MHz for SPI2/SPI3 and 108 MHz for SPI1/SPI4/SPI5/SPI6.

So, the minimum frequency you can achieve is around 211 kHz (54 MHz/256) or 422 kHz (108 MHz/256).

This can be modified, but you need to use mbed-dev and change the clock prescalers in the system_clock.c file.

Accepted Answer
7 years, 1 month ago.

That is quite a low a frequency. I'm not sure this board would support such a low frequency. Without digging into their HAL, I would suggest trying to decrement from 1 MHz until you reach the limit.