Skip to content

Commit

Permalink
Clear i2c abort reason less often.
Browse files Browse the repository at this point in the history
It seems to be possible to get stuck in the loop which is checking for
abort. It can take 100s of iterations before an abort happens and on
each iteration we're clearing the abort interrupt even when it's not
required. If we only clear the abort when needed the lockup doesn't seem
to be reproducible.

Fixes raspberrypi#2025
  • Loading branch information
peterharperuk committed Nov 7, 2024
1 parent 6587f5c commit e5159e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/rp2_common/hardware_i2c/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ static int i2c_read_blocking_internal(i2c_inst_t *i2c, uint8_t addr, uint8_t *ds

do {
abort_reason = i2c->hw->tx_abrt_source;
abort = (bool) i2c->hw->clr_tx_abrt;
if (i2c->hw->raw_intr_stat & I2C_IC_INTR_MASK_M_TX_ABRT_BITS) {
abort = true;
i2c->hw->clr_tx_abrt;
}
if (timeout_check) {
timeout = timeout_check(ts, false);
abort |= timeout;
Expand Down

0 comments on commit e5159e1

Please sign in to comment.