You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wire.cpp does not generate a "Wire.onReceive()" interrupt for an i2c Slave following transmission of a 'restart' rather than a 'stop' by an i2c Master. This situation can occur frequently when a Master sends a register address followed by a read request for the contents of that register.
This is particularly important in a Multi Master i2c system, where the Master should not allow another Master to obtain control of the bus between its write of the required register and the read of the register content [and therefore explicitly uses a 'restart' rather than a 'stop' follow by a 'start' between it's write and read over the bus].
I have written a short Arduino C++ program to illustrate the issue
The error is that wire.cpp in arduino-pico/libraries/Wire/src only checks the IC_INTR_STAT register bit 10 (R_START_DET - a 'start' condition) to generate it's interrupt . . . it should also check and act on bit 12 (R_RESTART_DET - i.e. a 'restart' condition)
The attached image shows the required changes to wire.cpp to correct this