Skip to main content
Associate II
April 16, 2024
Question

STM32H755 I2c BDMA BUSY ON SECOND CALL

  • April 16, 2024
  • 0 replies
  • 459 views

I am having issues with BDMA on consecutive transfers, the DMA handle is always in the busy state on the second call. 

I call this from my application and first transfer works as expected, goes into ISR 

void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c);

 

HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress,
 uint16_t MemAddSize, uint8_t *pData, uint16_t Size)

 

 This call returns error on second transfer because hi2c->hdmatx->State is 

HAL_DMA_STATE_BUSY

 

 dmaxferstatus = HAL_DMA_Start_IT(hi2c->hdmatx, (uint32_t)pData, (uint32_t)&hi2c->Instance->TXDR,
 hi2c->XferSize);

 

 

I call HAL_I2C_Mem_Write_DMA on every transfer and wait for the previous transfer to finish before calling again but still remains busy. Wondering if this is incorrect implementation.

Thanks