Skip to content

Commit 11dbf85

Browse files
authored
Update SERCOM.cpp
Added check for ARBLOST in sendDataMasterWIRE so misbehaving I2C slaves don't cause the Zero to get stuck in an endless loop.
1 parent 0b60a79 commit 11dbf85

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/SERCOM.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ bool SERCOM::sendDataMasterWIRE(uint8_t data)
568568
while(!sercom->I2CM.INTFLAG.bit.MB) {
569569

570570
// If a bus error occurs, the MB bit may never be set.
571-
// Check the bus error bit and bail if it's set.
572-
if (sercom->I2CM.STATUS.bit.BUSERR) {
571+
// Check the bus error bit and ARBLOST bit and bail if either is set.
572+
if (sercom->I2CM.STATUS.bit.BUSERR || sercom->I2CM.STATUS.bit.ARBLOST) {
573573
return false;
574574
}
575575
}

0 commit comments

Comments
 (0)