diff --git a/artiq/firmware/libboard_artiq/i2c.rs b/artiq/firmware/libboard_artiq/i2c.rs index 819c21c1b..e46b3d0fd 100644 --- a/artiq/firmware/libboard_artiq/i2c.rs +++ b/artiq/firmware/libboard_artiq/i2c.rs @@ -59,7 +59,19 @@ mod imp { half_period(); half_period(); if !sda_i(busno) { - error!("SDA is stuck low on bus #{}", busno) + warn!("SDA is stuck low on bus #{}, trying to unstuck", busno); + + // Try toggling SCL a few times + for bit in 0..8 { + scl_o(busno, false); + half_period(); + scl_o(busno, true); + half_period(); + } + } + + if !sda_i(busno) { + error!("SDA is stuck low on bus #{} and doesn't get unstuck", busno); } } }