Question
Running SPI at 2MHz
Posted on May 15, 2013 at 23:21
I've got an STM32F407 with main clock set to 168MHz and am communicating with a slave device over SPI2. The SPI on the slave can work up to 2MHz and I would like to get as close to this as I can.
As far as I can tell, the SPI2 clock has to be a power-of-two divisor of the APB1 which in turn is a power-of-two divisor of the main clock. The closest I can get is therefore approx 1.3MHz. Counter intuitively I'm coming to the conclusion that to communicate at 2MHz I need to slow the system clock down to 128MHz. Firstly, is this right, or am I missing something? Secondly, does changing the system clock speed open up a can of worms that I need to be aware of? (I'm also using USB FS so presumably that would be affected). #stm32f4xx-spi-clock