DMA stay in busy state when using HAL_I2C_Slave_Receive_DMA
Hello,
I'm working on 2 NUCLEO-F767ZI Demo Board.
I'm using STM32CubeMX with last firmware package to generate the code and STM32CubeIDE to modify it and debug it.
One of the board is used as an I2C Master, the other as I2C Slave. Every thing work fine when using IT, but I have a problem using DMA on the slave.
In the main, I call HAL_I2C_Slave_Receive_DMA, trying to receive one byte
It work fine. The HAL_I2C_SlaveRxCpltCallback is called. The correct data is received. Then in the call back, I call again HAL_I2C_Slave_Receive_DMA, but this time, the call back is never triggered.
With the debugger, I have seen that, in the HAL_I2C_Slave_Receive_DMA
- When trying to start the DMA, HAL_DMA_Start_IT, the function always return error code 0x02, ie DMA_BUSY
- The function return it because the hdma->State is not in Ready State. It is in HAL_DMA_STATE_BUSY
What causes the DMA to be in an busy state? How to avoid it? Is there something special to know to be able to make several Receive_DMA ones after other?
Thank you for your help
Antoine