2024-10-15 09:42 AM
Even after setting up a DMA stream to a SPI_RX DMA request, the HAL_SPI_Receive_DMA() function return error code 1 when called. I've solved this problem by also setting up a DMA stream to the SPI_TX request, even though I won't use it.
Problem occurred when using SPI1 on Full-Duplex Master mode in the STM32F412 uC, STM32CubeIDE Version: 1.16.1
Solved! Go to Solution.
2024-10-15 10:43 AM
Hello @EngScn ,
In Full-Duplex mode, both the TX and RX DMA streams need to be configured.
Ensure that the SPI is disabled before calling the HAL_SPI_Receive_DMA () function to avoid overrun errors.
2024-10-15 09:54 AM
2024-10-15 10:24 AM
Surely, in a Full-Duplex master, you would have to have a TX running - so the behaviour is as expected?
I would like to have only my RX using DMA. My TX would be transmitting data in polling mode. I believe this should justify using a DMA stream only to the RX channel?
What does that code indicate?
HAL_SPI_Receive_DMA() returns a HAL_StatusTypeDef, for code 1 that would be HAL_ERROR.
2024-10-15 10:43 AM
Hello @EngScn ,
In Full-Duplex mode, both the TX and RX DMA streams need to be configured.
Ensure that the SPI is disabled before calling the HAL_SPI_Receive_DMA () function to avoid overrun errors.