Posts: 22
Joined: Wed Jan 30, 2019 10:47 pm

BCM2835 library slower I2C

Fri May 17, 2019 6:15 pm

Is there a way to get slower I2C that 100KHz. I'd like to try at 50KHz or so instead. I've got an I2C slave which I think tries to clock stretch when at 100KHz, but the Pi is well known for having a bug in it's ability to cope with clock stretches by slaves. I'd like to try slower I2C and see if it runs any better, if I can get a bit slower then I don't think clock stretching will have to happen and I will not come against the Pi's clock stretching bug.

The bcm2835 library lets you set a clock divider to control the I2C frequency, but only for 100KHz, 400KHz and a few >1MHz options.

I've already tried using the example scripts from ... stretching they had no effect, I'm guessing that BCM2835 doesn't use the same I2C driver as it's backend.

I've also tried adding dtparam=i2c_baudrate=50000 to /boot/config.txt and tried some lower values of core_freq also mentioned on this page ... bian-linux. Again no success.

Surely these must be a way to get the BCM2835 library to use the I2C hardware at a slower clock speed?

User avatar
Posts: 14262
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: BCM2835 library slower I2C

Fri May 17, 2019 6:19 pm

You could just use the standard Linux I2C driver instead.

Return to “Interfacing (DSI, CSI, I2C, etc.)”