Arduino Due I2C not working, code works on Uno/Mega

All,

I have been working on this problem for almost 2 wks. I have built a LED matrix, and have a USB keyboard that plugs into a USB Host device that does I2C to Arduino. This works fine on Uno/Mega,
it does not work on Due. I have confirmed that IDE is getting the right libraries for wire.h.
I’ve read that their where problems with wire.h I2C on the Due. I’m running the latest version of IDE
these should all be fixed. Also I have I2C connected to pins 20 and 21. Again the exact code will work
on Mega. Also, I have a new Due R3.

long_signboard_broken.ino (17.7 KB)

EMI could hang the I2C bus. Consider 10 or 20 ohm series resistors ( you can try up to 120 ohm) between the Due and the bus (one for SDA, another for SCL). This will attenuate the glitches leaving your Due.

It's also a good practice to detect timeouts to reset the I2C bus if necessary. You will find an I2C bus reset function in the DUE sub forum.