Update of the day: I was able to get SPI2 to work and still no success with getting SPI5 to work. I will continue forward with SPI2.
Solution for getting SPI2 to work:
I created a new project from the stm32cubemx, and my first setup was to only setup spi2.
I set the Data Size to 8 bits (can keep at default of 4 bits just update the logic analyzer setup) and the prescaler to 32 (which sets the baudrate to 7.8125 MBits/s)
Notes:
- the system clock is set to max by default 250MHz
- The peripheral clock is set to the max by default as well of 250MHz
- Setting the prescaler to 32 -256 works great no issue, however when setting to a smaller value nothing transmits.
- would like to note that C is detected in the image below which is not expected (I will need to check if this is due to also using SPI5).
- In the same project I tried to setup spi5, however regardless of the prescaler value nothing would transmit over the lines.
- An image of the output for both spi2 and spi5:
Other steps I took to try and to get spi5 and spi2 working:
Original situation: I have the logic analyzer connected to the devkit and I am using the stmod+ extension. Image added at the bottom.
- I had initialized spi5 first with an interrupt enable and tested it alone, but with no progress getting it to transmit. I then setup SPi2 on the same project. Result: no success getting it to transmit either.
- I then proceeded to change the SPI5 setup from having interrupt enable to disable, to test only polling. Result: no success getting it to transmit.
- I then proceeded to change the SPI gpio pins for Maximum output speed to very high (originally at low). Result: no success getting it to transmit.
- then I proceeded to disable spi5 and continue testing with just spi2, I setup RCC and changed the HSE and LSE to use the Crystal/ceramic resonator. Result: no success, in transmitting.
- then I proceeded to cross examine my project with the example from stm32H7 for SPI. No main difference, everything looked to be setup correctly, nothing was missing on my end.
- I also posted this issue on the stm32 forum and got two responses: link to post: STM32H573 SPI clock not working - STMicroelectronics Community
- 1: check if the pins are being used by other components
- The pins weren't being used by another component and were free to use. Will note that the SPI5 pins had an extension/fan-out board to easily connect.
- 2: check the SPI clock pins max output for PB13 and PB14.
- I checked the SPI2 and SPI5 pins but I wasn't using those pins listed. I did change the prescaler for both SPIs but no noticeable difference was made.
- i tried clearing out all the pin configuration and board, and then setup just spi 2. Result: no success in transmitting.
- I was renaming my project example and lost access to the project, so I created a new project and setup only spi2 and changed the prescaler to 64, and it worked =)
- Image of setup for spi5
