cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 SPI6 problem

JLima
Associate II

Hello everyone,

I am having a very strange problem with respect to SPI6 and I am hoping someone can give me some direction.

I have configured the SPI6 to be in SPI master mode and I am continuously reading data from a sensor. Everything looks to be fine until I generated and started to use the SDMMC interface to connect to a SD card. (I am using a nucleo board).

When the SD card is in and doing something I get sporadic SPI6 errors and the only way I found to get the problem workaround is to before sending a next byte I ensure that I have already the previous byte on the RX fifo (by changing the CubeMX generated code in the function HAL_SPI_TransmitReceive and make this if before sending a new byte if (hspi->TxXferCount == hspi->RxXferCount)).

Somehow the TX and RX fifo of the spi get out of sync, which is very odd, since the SPI is synchronous and for every byte transferred we should latch a byte received.

If however, I use the SPI1 in the same pins, no problem is observed. Looks to me that there is a general problem inside the chip. The only difference I find between the SPI1 and SPI6 are the clock sources.

Would be very helpful to have some reply as this is blocking my current project

Thanks,

Joao

3 REPLIES 3
Amel NASRI
ST Employee

Hello @JLima​ ,

Another difference between SPI1 and SPI6 is that SPI1 is mapped on APB2 and SPI6 on APB4.

Are they configured to use same frequency?

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @Amel NASRI​ ,

Thanks for the reply. Seems like they are. I am attaching a picture from the clocks. Any other idea? Is there any bug related with the Bus bridges that we have to workaround that is not included in the code generated by CubeMX? The SPI bugs seem to be already addressed by the generated code from CubeMX.

thanks

Best regards,

Joao0690X0000087vBqQAI.png

SLei.2
Associate

Hi JLima, I've found this problems on my device also.

What I found is, the SDMMC will use an internal dma named IDMA and is dependent on the interrupt. When I use SPI6 in polling mode and make its interrupt disable, the problem seems to be well.