diff options
| author | Damien George | 2018-05-09 15:53:09 +1000 |
|---|---|---|
| committer | Damien George | 2018-05-09 15:53:09 +1000 |
| commit | e638defff453102d5d0811f7b9a596682a21e9af (patch) | |
| tree | b3328e1e075d4dd7f24de623a29c0fbda0d82270 /ports/stm32/i2c.c | |
| parent | 2ada1124d42a85e056637fc10c0c2764ba96bdd6 (diff) | |
stm32/i2c: Make sure stop condition is sent after receiving addr nack.
Diffstat (limited to 'ports/stm32/i2c.c')
| -rw-r--r-- | ports/stm32/i2c.c | 3 |
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; } |
