Number of SPI clock cycles changes when below 1Mhz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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?
- Labels:
-
STM32F4 Series
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-10-08 4:37 PM - edited 2023-10-08 4: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.
