Skip to content

Commit 78d1667

Browse files
committed
stm32/i2cslave: Account for slow addr_match callback.
Signed-off-by: Damien George <[email protected]>
1 parent 2443878 commit 78d1667

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/stm32/i2cslave.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ void i2c_slave_irq_handler(i2c_slave_t *i2c) {
9494
i2c->ISR = I2C_ISR_TXE;
9595
i2c->ICR = I2C_ICR_ADDRCF;
9696
i2c_slave_process_addr_match(i2c, (i2c->ISR >> I2C_ISR_DIR_Pos) & 1);
97+
// Re-read ISR in case i2c_slave_process_addr_match() took some time
98+
// to process and TXIS/RXNE was set in the meantime.
99+
isr = i2c->ISR;
97100
}
98101
if (isr & I2C_ISR_TXIS) {
99102
// This callback must call i2c_slave_write_byte.

0 commit comments

Comments
 (0)