I have experienced an I2CREAD problem that might be related to this one. Coincidentally, I was using the DS3231 RTC device also, and it works fine with the PBP I2CREAD and I2CWRITE commands. My design also includes the Everset ES100 time code receiver (Canaduino), which responded correctly to I2CWRITE commands, but not to the I2CREAD command. I was able to enable the ES100 by writing to it, but when I tried to read its interrupt status, the ES100 clamped the I2C clock line after the I2CREAD's 3rd (read) byte.

Referring to the lower scope screen in post #16 in this thread, it can be seen the PBP's I2CREAD command does not execute a full stop and start sequence between bytes 3 and 4 of the I2CREAD command. The ES100 requires (at the end of its 2nd byte) that the clock line be released high followed by the data line being released high (this is the stop sequence). Then, the 3rd byte starts with the data line being pulled low followed by the clock line being pulled low (the start sequence).

In the traces below, it can be seen that start sequence at the beginning of the 4th byte is correct with the data going low followed by the clock going low, but it was not preceded by stop sequence. The data is released high followed by the clock released high rather than the reverse order.

To solve the incompatibility of the PBP I2CREAD command with the ES100, I wrote a bit-banger routine that manipulates the clock and data lines in the proper sequences for start, stop, ack and nak, and combined these with the SHIFTOUT and SHIFTIN commands to send and receive data bytes.

My interpretation of the I2C standard is that either a full start/stop or a restart sequence is permitted, with the restart having a slight speed advantage in time critical applications.

The 24Cxx data sheet I checked seems to spec that only a restart sequence (that is, not a complete stop/start sequence) is required which the scope trace fulfills, but if you're really stumped on this, you might try implementing a full start/stop to see if this makes it act correctly.

An alternate I2CREAD command addition to PBP that provides this full start/stop sequence would be nice to have.

http://www.picbasic.co.uk/forum/atta...8&d=1633766449