2022-03-07 02:10 AM
Hi, I am using stm32f769Ni evk for a project. Here I am interfacing stm32 with a wifi module using spi dma . The communication fails during reception with HAL_SPI_ERROR_DMA after /* Enable the Tx DMA Stream/Channel */
if (HAL_OK != HAL_DMA_Start_IT(hspi->hdmatx, (uint32_t)hspi->pTxBuffPtr, (uint32_t)&hspi->Instance->DR,
hspi->TxXferCount))
{
/* Update SPI error code */
SET_BIT(hspi->ErrorCode, HAL_SPI_ERROR_DMA);
errorcode = HAL_ERROR;
hspi->State = HAL_SPI_STATE_READY;
goto error;
}
The error is inconsistent and even on successful read the rxbuffer contains on 0x00 or 0xFF. Kindly help me with this
2022-03-07 03:19 AM
Hi
Can you please refer to STM32CubeF7 package and check this example configuration (SPI, DMA). Available via this path: STM32Cube_FW_F7_V1.16.1\Projects\STM32F722ZE-Nucleo\Examples\SPI\SPI_FullDuplex_ComDMA
Bouraoui
2022-03-07 06:01 AM
Step through HAL_DMA_Start_IT to see where it's failing. Not much going on in there. Either the stream is locked because the previous call isn't finished, or your size parameter is invalid.
2022-03-07 08:30 PM
Hi Bouraoui,
Yes, I have referred this example. The issue is very random and it rarely happen when I put breakpoints. It happens after __HAL_DMA_ENABLE(hdma); call
2022-03-07 08:30 PM
The issue is very random and it rarely happen when I put breakpoints. It happens after __HAL_DMA_ENABLE(hdma); call
2022-11-09 11:58 PM
Faced with similar situations on F767, F427. I will describe the situation with F427: The master controller periodically exchanges with the chip via SPI. The exchange is initiated each time by the HAL_SPI_TransmitReceive_DMA() function, after processing the HAL_SPI_TxRxCpltCallback() of the previous exchange. When a breakpoint is set before HAL_SPI_TransmitReceive_DMA(), receiving and transmitting returns HAL_OK, but if you run the same code without a breakpoint, HAL_SPI_TransmitReceive_DMA() returns HAL_ERROR and data exchange becomes impossible. When delving into the code, it turned out that when HAL_DMA_Start_IT() is executed, the HAL_SPI_ERROR_DMA bit is set in hspi->ErrorCode.
I will also check if the exchange is less frequent if this error occurs
2023-02-10 10:25 AM
Hi,
I got the same problem on the STM32L432KC.
Some time, the HAL_DMA_Start_IT return the HAL_ERROR, and random happened at power up.
Now, I try to add the HAL_SPI_DeInit and HAL_SPI_Abort before the SPI Init.
Testing...