Skip to main content
LLavr.1
Associate II
October 12, 2021
Solved

SPI doesn't START (STM32H723)

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.

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
October 12, 2021

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

7 replies

waclawek.jan
Super User
October 12, 2021

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

LLavr.1
LLavr.1Author
Associate II
October 12, 2021

This is my set up:

0693W00000FCDB6QAP.png 

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);

0693W00000FCDHiQAP.png 

This is right after:

0693W00000FCDIvQAP.png 

LLavr.1
LLavr.1Author
Associate II
October 12, 2021

Also I checked the I2S peripheral and it worked fine. Same pin configuration though.

waclawek.jan
waclawek.janBest answer
Super User
October 12, 2021

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

LLavr.1
LLavr.1Author
Associate II
October 12, 2021

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.

waclawek.jan
Super User
October 12, 2021

> 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

LLavr.1
LLavr.1Author
Associate II
October 12, 2021

Thank you.

Best Regards,

Luigi