summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/stm32/i2c.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ports/stm32/i2c.c b/ports/stm32/i2c.c
index 7421ae1bd..63bd09ae5 100644
--- a/ports/stm32/i2c.c
+++ b/ports/stm32/i2c.c
@@ -113,7 +113,8 @@ int i2c_start_addr(i2c_t *i2c, int rd_wrn, uint16_t addr, size_t len, bool stop)
// Check if the slave responded or not
if (i2c->ISR & I2C_ISR_NACKF) {
- // If we get a NACK then I2C periph releases the bus, so don't send STOP
+ // If we get a NACK then I2C periph unconditionally sends a STOP
+ i2c_wait_isr_set(i2c, I2C_ISR_STOPF); // Don't leak errors from this call
i2c->CR1 &= ~I2C_CR1_PE;
return -MP_ENODEV;
}