STM32F429 SPI Transmit Problems
- July 5, 2019
- 6 replies
- 2693 views
I have been following a course Mastering microcontroller with STM32, and the emphasis of this course is to walk the student through the architecture of STM32 MCU's, and develop the driver's for GPIO, SPI. I2C, and USART from scratch.
I have an STM32F429 dev board with LCD screen. At this stage of the course, it is the first time trying to use the SPI protocol so I am only transmitting information to a slave (arduino - code written by the professor). My issue is that even when I don't have a slave connected, and just my logic analyser, nothing is toggling (chip select, clock, or MOSI) even though (from what I can tell) all my bit positions within each appropriate register is correctly toggled. I have attached an image that shows within OneNote all the registers correctly toggled after I enable my SPI2 peripheral.
What I do notice is, that after I use my send data function (for sending the length of message information) my status register is fine with no errors (each time I use my send data function my RXNE bit is setting for some reason), but after I use my send data function for my actual message (I'm sending a text string) it presents and error. The OVR flag which is an information receiving error, the input data register is not being read before it receives new information. The thing is I should have zero information received. I only have the SCLK, MOSI, and NSS (CS) pins connected. So this is another peace of the puzzle that I'm not sure how to go about.
to summarise:
- My GPIO clocks and SPI2 clock are enabled
- SPI control registers hvae SSI,SSM, and Master enabled, with CPOL and CPHA LOW.
- 8 bit communication
I have attached my project in hopes that someone can test this out to see if this code works for them, as I'm not sure what to do anymore or how to proceed debugging. Does anything sound really wrong?
If I am missing information, or if I can provide further clarification please let me know.
Thanks everyone!