I know that we can modify a Arduino's clock frequency for I2C communication via Wire.setClock(). I am wondering if we can use the fast mode, Wire.setClock(400000), on all Arduino boards? More specifically, can I use the fast mode on Arduino MKR ZERO and Adafruit Feather M4 Express?
Fastmode 400 works on basic Arduinos (Uno, Nano, etc.).
I would be surprised if it didn't work on higher-end boards.
Try it, and post the results.
Leo..
The I2C interface is implemented in hardware in most controllers. The maximum frequency depends only on the available controller clock frequency, which is divided down by a prescaler for slower operation. But as used for communication, a counterpart station must support the same frequency, so that two of the same Arduinos should be used for the first speed tests, one as master and one as slave.
With higher frequency also the bus cable becomes important. It should be e.g. a ribbon cable, eventually with dedicated pairs of signal and Gnd for the signal wires (SCL, SDA), and possibly with reduced pullup resistance at the ends of the cable only. Some bus systems have any other wire connected to Gnd, separating adjacent signal wires. Other cables have twisted pairs of wires, with short flat sections interleaved for connector attachment. On our pdp 11/34 we had such 40 (80?) pole cables for attaching external disk stations, about 2m long.
A scope will be helpful in monitoring the signal shape on the bus cable. Slower devices are allowed to stretch the clock pulses on the bus, so that they can work also with higher speed masters, at a speed reduced to their own capabilities. This feature will work almost only with I2C hardware, not with a software emulation.