SPI doesn't START (STM32H723)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 2:22 AM
Hello,
I'm testing the SPI peripheral through a simple PDM mic. The problem is the SPI doesn't start at all. The CSTART bit (that is the one that start the transfer) remain cleared, even right after I SET the bit.
Now, I noticed that just after I've done the SET_BIT in the SR register happen to be set the EOT bit which indicate the (End Of Transfer). The problem is that I didn't get any data, nor in the buffer and nor in the registers.
I thought the problem could be the transfer do start, but it is stopped immediately by the rise of the EOT.
Didn't know If I am right, and more I didn't know how to solve the problem.
Thanks for all your help guys.
Solved! Go to Solution.
- Labels:
-
SPI
-
STM32H7 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 4:42 AM
The 'H7 SPI is overcomplicated and I don't use the 'H7, but from what I see above it appears that
- you've set up a simplex Rx of 10 frames per 8 bits
- as in simplex Rx mode SPI generates clocks as soon as it's enabled, it generated all 10x8 clocks and autocleared CSTART
- SR.RXWNE indicates, that there are data in FIFO; you've already read out one word as you've displayed the RXDR register in the debugger so there is no complete packet in the FIFO already
- you are complaining about "I didn't get any data" but that probably means that you are receiving all 0s, which may be due to incorrect GPIO setup, that's why I said to read out and check the relevant GPIO registers content and also observe the SPI signals using oscilloscope or LA
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 3:38 AM
How did you set up the SPI and how do you intend to operate it? Have you observed the pins? Read out and check/post content of SPI and relevant GPIO registers.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 4:05 AM
This is my set up:
The intend to test the various operation modes: polling, IT, DMA.. Already tried all of them but got the same issue. By now I'll be happy to see it functioning just in the polling mode, for this I'm using HAL_SPI_Receive(&hspi1, buffer, 32, 100).
This is the SPI1 register before the: SET_BIT(hspi->Instance->CR1, SPI_CR1_CSTART);
This is right after:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 4:06 AM
Also I checked the I2S peripheral and it worked fine. Same pin configuration though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 4:42 AM
The 'H7 SPI is overcomplicated and I don't use the 'H7, but from what I see above it appears that
- you've set up a simplex Rx of 10 frames per 8 bits
- as in simplex Rx mode SPI generates clocks as soon as it's enabled, it generated all 10x8 clocks and autocleared CSTART
- SR.RXWNE indicates, that there are data in FIFO; you've already read out one word as you've displayed the RXDR register in the debugger so there is no complete packet in the FIFO already
- you are complaining about "I didn't get any data" but that probably means that you are receiving all 0s, which may be due to incorrect GPIO setup, that's why I said to read out and check the relevant GPIO registers content and also observe the SPI signals using oscilloscope or LA
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 6:03 AM
Thanks for the answer. I know the H7 is overcomplicated!
I don't have an oscillator yet but I tested the I2S which share the same pinout configuration. The thing that concern me most is the fact that possibly the bit clock isn't generate properly.
May I ask you if you got some oscilloscope to suggest me? I was keeping an eye on the bitscope mini though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 6:57 AM
> May I ask you if you got some oscilloscope to suggest me?
Sorry, I don't make this kind of recommendations. Try some general-purpose electronics forums. If you can borrow one from a friend, even for a short time, that would provide a very good starting point, as you would learn which features are important for you are which are not.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-10-12 7:16 AM
Thank you.
Best Regards,
Luigi
