From ae49405bc6be80f85c182e48a03279f02544443a Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Thu, 2 May 2019 17:47:14 +0200 Subject: stm32_i2c: correct timeout detection on transfer stop event Fix timeout detection in i2c_wait_stop(). Signed-off-by: Etienne Carriere Reviewed-by: Joakim Bech --- core/drivers/stm32_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') diff --git a/core/drivers/stm32_i2c.c b/core/drivers/stm32_i2c.c index 6bae2e6c..c15e4dd7 100644 --- a/core/drivers/stm32_i2c.c +++ b/core/drivers/stm32_i2c.c @@ -902,7 +902,7 @@ static int i2c_wait_txis(struct i2c_handle_s *hi2c, uint64_t timeout_ref) /* Wait STOPF bit is 1 in I2C_ISR register */ static int i2c_wait_stop(struct i2c_handle_s *hi2c, uint64_t timeout_ref) { - while (timeout_elapsed(timeout_ref)) { + while (!timeout_elapsed(timeout_ref)) { if (io_read32(get_base(hi2c) + I2C_ISR) & I2C_ISR_STOPF) break; -- cgit v1.2.3