Upon running i2cdetect the device stops printing timestamps in the loop. i2cdetect is sluggish, and shows no available addresses, not even other devices on the bus:
Thing Plus' Wire lib was written for a SAMD21, which has a single Sercom interrupt for I2C slave operations. Whereas, the SAMD51 uses 4 Sercom Interrupts when being used as an I2C slave.
Workaround
Near the top of the repro sketch sketch declare each of the 4 SERCOM3 interrupt handlers:
Issue
Using the Thing Plus as an I2C slave:
onRequest
oronReceive
callbacks.This issue also affects Adafruit SAMD51 boards, an issue tracking a fix for their Wire lib and variants is in the ArduinoCore-samd repo.
Reproduction
Sample Program:
Upon running
i2cdetect
the device stops printing timestamps in the loop.i2cdetect
is sluggish, and shows no available addresses, not even other devices on the bus:i2cget
is unable to read values from the board:Explanation
Thing Plus' Wire lib was written for a SAMD21, which has a single Sercom interrupt for I2C slave operations. Whereas, the SAMD51 uses 4 Sercom Interrupts when being used as an I2C slave.
Workaround
Near the top of the repro sketch sketch declare each of the 4 SERCOM3 interrupt handlers:
Now both
i2cdetect
andi2cget
are nominal:Fix
Update
Wire.h
to support 4 sercom interrupt handlers for a wire interface in addition to declaring the handlers in the Thing Plusvariant.h
.I'm submitting a PR to Adafruit and can also submit one here.