AnsweredAssumed Answered

STM32L051 SPI Slave DMA - last byte duplicated & doesn't terminate

Question asked by Danny /\ on Sep 26, 2014
Latest reply on Sep 29, 2014 by Montassar BEN ROMDHANE
I have a problem with a SPI data transfer with DMA. I use a STM32L051 as SPI slave and created the code with STM32CubeMX.
I used the sample code as a reference and do something like this:

if (HAL_SPI_TransmitReceive_DMA(&hspi1, &txb, &rxb, 5) != HAL_OK)
                    /* Transfer error in transmission process */
               while (HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY)

The transfer never completes (HAL_SPI_GetState always returns busy). The bytes are transmitted to the SPI master but the last byte is wrong (duplicated from the byte before).

Before that I transfer a single byte (with the blocking function not with DMA) and that works. I also tried to use the blocking HAL function instead of the DMA version for transmitting the 5 bytes above but it also will not terminate.

I've spent hours on that, any ideas anyone?