Using i2c at 100 kHz?

I’m trying to get a DS1307 RTC working. I’m using the seeed grove board ( on a sensors mezzanine ( so its a plug and go setup.

Other i2c devices I’ve plugged in work fine (i2cdetect -y -r 0 or -y -r 2). However, this one is only detected occasionally. The difference that I can see in the spec is that the DS1307 is limited to 100 kHz, whereas everything else I’ve tried is 400 kHz.

I have changed to 100000 here; or here;

Before I hook it up to a probe, is there anything else that should be needed to get the i2c running at 100 kHz? Or is there any known issue with that rate? Has anybody actually used a 100 kHz device on this board?

Did you check the I2C bus with your logic analyzer ? I know we have issues with fast-mode (1Mbps) and high-speed (3Mbps), but this does not apply for standard mode.

Not until just now.
I am reading 100 kHz clock on i2c-0, but i2c-7 (/dev/i2c-2) is reading 160 kHz.

hmmm, i2c7 has a wrong value which could explain issue with your device (limited to 100khz), note that i2c7 has a different oscillator frequency, 100Mhz vs 32Mhz for i2c0. @guodong, any known I2C frequency issue on hikey 960 ?

SO I suggest to use i2c0 for now, but if I understand correctly you reproduce the issue on both i2c0/i2c7 anyway ?

Correct. This particular device is not working on either i2c port.

Looks like half the problem is in the specs that seeed advertises for the rtc board. They say 3.3 or 5.0 volt. ds1307 spec is 4.5-5.5.

I tried it connected to a raspberry pi. Had exactly the same behavior until I hooked the Vcc to 5.0, then it started working.

The strange thing though, is that i2c-0 is 5.0 volt on the seeed board, and I have it running at 100 kHz. I would expect that to work.

Without adjusting the frequency in the DT, I’m reading i2c-0 at 545 kHz and i2c-7 at 375.

Ha, crazy thing.
I have it hooked up to i2c-7, but with the Vcc line disconnected from the 3.3V grove and hooked into a 5V. Now its working. Well, at least its detecting consistently, so first step :slight_smile: – and that is running at 375 kHz despite the part spec listing max 100 kHz.

Nothing on i2c-0, even though that one should work better (at least it should when I have it clocked at 100 kHz).

Looks like it is probably a bad idea to keep it hooked up that way since there are 10k pullup resistors to 3.3V at the level shifters (BSS138) and 4.7k pullup to 5V at the ds1307 and no diodes in sight. So this actually connects the 3.3 and 5v together. Probably ok to just remove the 4.7’s from the ds1307 since it spec’s logic high as anything over 2.2. Edit: Yep, still works with the 4.7’s removed from the ds1307.

Edit again;
Now I have it working on i2c-0 at 5V. Guess it didn’t have enough drive to pull the data line low with the 4.7k’s in place.

I’ve got the RTC working now.
Only problem is that it triggers bug #662