2023-10-06 12:31 PM
Hi, I find that the number of SPI clock cycles change when I set the SPI clock speed below 1Mhz.
When SPI Clock > 1 Mhz, the SPI clocks out 8 cycles 4 times, as expected. ( I am sending 4 bytes of data)When the SPI Clock < 1Mhz, the SPI clocks out 32 cycles despite transmitting only 4 bytes of data in the HAL function call.
What is the reason for the number of clock cycles to change despite only changing the SPI clock speed in the cubemx tool?
2023-10-08 04:37 PM - edited 2023-10-08 04:39 PM
Increase the sampling rate on your logic analyzer to accommodate the higher data rate. If your logic analyzer isn't fast enough, you'll need to decrease the SPI clock speed to an appropriate level.
As for why it's sending 32 clock instead of 8: most likely due to a bug in the code or a misinterpretation of what it should be doing. Show your code or follow SPI examples given in CubeMX repository.