Electronic – Bad clock pulse on I2C EEPROM read

errori2c

I am seeing a strange behaviour on an I2C waveform, and it is causing an incorrect bit to be read by the master. The master device is an ET1200 EtherCAT ASIC, and my slave is a CY8C3666LTI PSoC which is emulating a 16-bit address EEPROM.

I2C Circuit

The master is attempting to read a few bytes from the 'EEPROM'. On the logic analyser and oscilloscope, the waveform looks like this:

I2C Waveform with bas clock pulse

The logic analyser is interpreting the waveform correctly. The bytes 0x24, 0x04, 0x30, 0x05, etc. can be seen written along the top. However, the ET1200 is seeing every other byte have the top bit set. So it's seeing 0x24, 0x84, 0x30, 0x85, etc.

Looking closely at those bits on the oscilloscope, we can see a malformed clock pulse there. And it's also so close to the preceding data bit, that it's not surprising that a 1 is being seen.

My question is: What could be causing this malformed clock pulse? Has anyone seen this before?

Best Answer

"What could be causing this malformed clock pulse? Has anyone seen this before?"

When I've seen this problem it's been because I didn't code my I2C driver correctly. It's usually something along the lines of incorrectly setting the I/O pin to an input for a few clock cycles while nothing else on the I2C bus is driving it. This causes the pullup resistor to start to drive the line high before the somebody reasserts the data line.