Skip to content

Commit a38aba7

Browse files
authored
Merge pull request #591 from agprimatic/master
Fix I2C Master hang when communicating with bad I2C slaves.
2 parents 1a7d8d0 + 11dbf85 commit a38aba7

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)