drivers: i2c: stm32f4: Add check for BTF flag before reading N-2 byte

According to STM32F4 reference manual, software should wait for BTF=1
before reading N-2 data byte.

Reference:

"For N >2 -byte reception, from N-2 data reception" section, page
853 of STM32F4 Reference manual.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
This commit is contained in:
Manivannan Sadhasivam 2018-01-04 21:14:19 -08:00 committed by Kumar Gala
commit 1bd48edd26

View file

@ -461,6 +461,9 @@ s32_t stm32_i2c_msg_read(struct device *dev, struct i2c_msg *msg,
break;
case 3:
while (!LL_I2C_IsActiveFlag_BTF(i2c)) {
;
}
/* Set NACK before reading N-2 byte*/
LL_I2C_AcknowledgeNextData(i2c, LL_I2C_NACK);
/* Fall through */