STMicroelectronics / STM32CubeG0

STM32Cube MCU Full Package for the STM32G0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
163 stars 75 forks source link

I2C addr flag not reset inside I2C_ITAddrCplt #31

Closed kjsdf7wr3 closed 9 months ago

kjsdf7wr3 commented 2 years ago

Inside I2C_ITAddrCpltthe address flag is reset for

it is not reset for

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.

ASELSTM commented 1 year ago

ST Internal Reference: 149407

ASELSTM commented 12 months ago

Hi @kjsdf7wr3,

The addr flag is not cleared intentionally in the case of listen. Actually, this allows to force a stretch of the line until the application calls the slave sequential interfaces.

The stretch makes possible to block the master, as long as the slave app has not prepared its use case via the sequential interfaces.

Since this is not an issue, please allow me thus to close this thread.

With regards,