AnsweredAssumed Answered

HAL_I2C_Master_Transmit() may overrun 1byte.

Question asked by tomiyama.tadao on Oct 19, 2016
Latest reply on Oct 31, 2016 by TobiB

Hi!

Attached stm32f4xx_hal_i2c.c is from stm32cube_fw_f4_v1131.zip.
line 657,
      if((__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BTF) == SET) && (Size != 0U))
It looks better to be hi2c->XferCount or hi2c->XferSize, than Size.

regards,
---------------------------
      /* Write data to DR */
      hi2c->Instance->DR = (*hi2c->pBuffPtr++);
      hi2c->XferCount--;
      hi2c->XferSize--;

      if((__HAL_I2C_GET_FLAG(hi2c, I2C_FLAG_BTF) == SET) && (Size != 0U))
      {
        /* Write data to DR */
        hi2c->Instance->DR = (*hi2c->pBuffPtr++);
        hi2c->XferCount--;
        hi2c->XferSize--;
      }
---------------------------

Attachments

Outcomes