2019-11-19 01:01 AM
STM32Cube_FW_F0_V1.10.1
Line 2434 in function HAL_I2C_Mem_Read_DMA()
/* Process Unlocked */
__HAL_UNLOCK(hi2c);
/* Enable DMA Request */
hi2c->Instance->CR1 |= I2C_CR1_RXDMAEN;
/* Enable ERR and NACK interrupts */
I2C_Enable_IRQ(hi2c, I2C_XFER_ERROR_IT);
I2C_Enable_IRQ is called after set I2C_CR1_RXDMAEN.This is not safe.
The hi2c->XferISR is cleared in DMA Interrupt function that may occur before I2C_Enable_IRQ is called.
2021-07-30 10:12 AM
I had the same problem on an L081.
My cheap and dirty but effective workaround was to call MX_I2C_Init() immediately before each call to HAL_I2C_Mem_Read_DMA()