cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and DMA on STM32H7

Gpeti
Senior II

Hello,

I'm trying to use STM32CubeH7 SPI_FullDuplex_ComDMA example code inside a CubeMX generated project.

I have been using the original SPI_FullDuplex_ComDMA (as it is) successfully.

Now I copied it to my CubeMX project.

First I have read the following post regarding a bug in STM32CubeMX:

https://community.st.com/s/question/0D50X00009XkX4ZSAV/solved-stm32h7-spi-does-not-seem-to-work-with-dma?t=1560413821975

This bug seems to be fixed in my version of STM32CubeIDE.

The clocks, SPI and DMA settings are identical as I copied/pasted the code from example code.

However I'm still not able to make the communication work.

The IRQs and callback seems to be configured correctly as I see my code go in the DMA2 stream IRQ handler for a "xfer complete" event and then in the SPI handler for a EOT event.

The global wTransferState is set to TRANSFER_COMPLETE.

However the received buffer contains crap on master side.

On slave side it's weird: all received bytes are correct except the first four ones. The Master send 0x0,0x1,0x2,0x3,0x4,0x5 etc... and I receive 0x0,0x0,0x0,0x0,0x4,0x5 etc...

I was thinking to an alignement issue but the reception buffer is 4 bytes aligned and FIFO and burst are disabled.

Any idea ?

0 REPLIES 0