cancel
Showing results for 
Search instead for 
Did you mean: 

SPI doesn't START (STM32H723)

LLavr.1
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7

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
Associate II

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
Associate II

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

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
Associate II

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.

> 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
Associate II

Thank you.

Best Regards,

Luigi