@@ -561,7 +561,8 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag
561561 // Wait transmission complete
562562
563563 // If certain errors occur, the MB bit may never be set (RFTM: SAMD21 sec:28.10.6; SAMD51 sec:36.10.7).
564- // There are additional errors that can occur (including BUSERR) that are rolled up in INTFLAG.ERROR
564+ // The data transfer errors that can occur (including BUSERR) are all
565+ // rolled up into INTFLAG.bit.ERROR from STATUS.reg
565566 if (sercom->I2CM .INTFLAG .bit .ERROR ) {
566567 return false ;
567568 }
@@ -605,9 +606,10 @@ bool SERCOM::sendDataMasterWIRE(uint8_t data)
605606 // Wait transmission successful
606607 while (!sercom->I2CM .INTFLAG .bit .MB ) {
607608
608- // If a bus error occurs, the MB bit may never be set.
609- // Check the bus error bit and bail if it's set.
610- // There are additional errors that can occur (including BUSERR) that are rolled up in INTFLAG.ERROR
609+ // If a data transfer error occurs, the MB bit may never be set.
610+ // Check the error bit and bail if it's set.
611+ // The data transfer errors that can occur (including BUSERR) are all
612+ // rolled up into INTFLAG.bit.ERROR from STATUS.reg
611613 if (sercom->I2CM .INTFLAG .bit .ERROR ) {
612614 return false ;
613615 }
@@ -715,7 +717,7 @@ uint8_t SERCOM::readDataWIRE( void )
715717 // A variety of errors in the STATUS register can set the ERROR bit in the INTFLAG register
716718 // In that case, send a stop condition and return false.
717719 // readDataWIRE should really be able to indicate an error (which would never be used
718- // because the readDataWIRE caller should have checked availableWIRE() first and timed it
720+ // because the readDataWIRE callers (in Wire.cpp) should have checked availableWIRE() first and timed it
719721 // out if the data never showed up
720722 if (sercom->I2CM .INTFLAG .bit .ERROR || sercom->I2CM .INTFLAG .bit .MB ) {
721723 sercom->I2CM .CTRLB .bit .CMD = 3 ; // Stop condition
0 commit comments