@@ -561,7 +561,8 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag
561
561
// Wait transmission complete
562
562
563
563
// 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
565
566
if (sercom->I2CM .INTFLAG .bit .ERROR ) {
566
567
return false ;
567
568
}
@@ -605,9 +606,10 @@ bool SERCOM::sendDataMasterWIRE(uint8_t data)
605
606
// Wait transmission successful
606
607
while (!sercom->I2CM .INTFLAG .bit .MB ) {
607
608
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
611
613
if (sercom->I2CM .INTFLAG .bit .ERROR ) {
612
614
return false ;
613
615
}
@@ -715,7 +717,7 @@ uint8_t SERCOM::readDataWIRE( void )
715
717
// A variety of errors in the STATUS register can set the ERROR bit in the INTFLAG register
716
718
// In that case, send a stop condition and return false.
717
719
// 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
719
721
// out if the data never showed up
720
722
if (sercom->I2CM .INTFLAG .bit .ERROR || sercom->I2CM .INTFLAG .bit .MB ) {
721
723
sercom->I2CM .CTRLB .bit .CMD = 3 ; // Stop condition
0 commit comments