I have rolled my own circuit, >> 1, that connect to two devices via the I2C/TWI/Wire. Everything works perfectly at the default Arduino frequency, i.e. 100 kHz. However, setting the clock to 400 kHz, using setClock, creates issues about 80% of the time.
On an oscilloscope I can see a spike, at both I2C frequencies. The spike is less than 1 us wide but with a ~2/3 of the full I2C amplitude and always in the same places on the pulse train. At 100 kHz this width is probably seen as noise but at 400 kHz it becomes close to 1/10 of the signal width.
I have reduced the capacitive load of the I2C bus but little does it help. The pull up resistors are right in the sweet spot and lower values have been tried but also without any luck.
I have never had issues on Arduino '328 platforms. Is there an issue with the Zero? Some setup bits that needs to be set but aren't?
A 1us pulse at 2/3rds amplitude is a pretty big "spike" on your I2C bus, as at 400kHz the SCL clock period is only 2.5us long.
For the signal to change by 2/3rds amplitude, I'd imagine it has something to do with the I2C bus itself rather than interference.
Here are just some suggestions:
Have you inspected your board for possible solder bridges or solder debris?
Are the I2C devices on- or off-board? Is it possible to remove them from the system? This tests if a defective I2C device is causing the problem. If the devices are off-board you could try placing a small value series resistors around say 150R on both the SCL and SDA lines to reduce the switching speed of the bus.
Are two I2C devices using the same address?
Does noise appear on both the SCL and SDA lines or only on one of them?
If the noise signal is periodic as you describe, are there any neighbouring signals of a similar period?
Do you have a second board against which you can compare? This checks if there's something fundamentally wrong, or if it's just a device misbehaving or perhaps a dry solder joint.
You mention about changing the line capacitance, how are you achieving that? The maximum load capacitance for the I2C bus is 400pF.
Thanks for taking your time to respond to me. I did some spec reading and if I am not mistaken the short pulse is the slave responding initially to the preamble of the protocol.
I have the same problem across three boards. So it is not an assembly issue. Of cause this does not exclude a design issue.
The total track length of the I2C bus is around 6 cm each. Which in an I2C context is short. The two devices are on-board but one of them, EEPROM, is in a socket. Thus it can easily be removed decreasing the capacitive load on the bus. A conservative load estimate is 100 pF with both devices mounted but the real load is probably below half that.
Besides the "slave response pulse" both SCL and SDA look perfect on a scope and no crosstalk seems to be present either.