STM32CubeG0 icon indicating copy to clipboard operation
STM32CubeG0 copied to clipboard

I2C addr flag not reset inside I2C_ITAddrCplt

Open kjsdf7wr3 opened this issue 3 years ago • 0 comments

Inside I2C_ITAddrCplt the address flag is reset for

  • 10bit mode (if event count == 2)
  • listen is disabled

it is not reset for

  • 7bit mode
  • 10bit mode (if event count == 1)

See https://github.com/STMicroelectronics/STM32CubeG0/blob/03cb8e9ec0cbefad623caebe47359df0bab1d05e/Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_hal_i2c.c#L5486

I think this is an error, it should be reset in all cases before calling HAL_I2C_AddrCallback(hi2c, transferdirection, slaveaddrcode);. This means HAL_I2C_CLEAR_FLAG(hi2c, I2C_FLAG_ADDR); should be added in the two cases mentioned above. If the flag is not reset, the chip will pull the clock line low forever after receiving its slave address.

kjsdf7wr3 avatar Feb 11 '22 17:02 kjsdf7wr3