With the new device tree on my Raspberry Pi 3B+, the i2c baudrate gets set in the /boot/config.txt. Is it possible to set this on the fly instead? I have a device (DAC8574) that needs some initial setup communication at 400 K baudrate first before it can switch to the 3.4 M baudrate.

This is what I have in /boot/config.txt


As a test, I tried to rmmod the i2c_bcm2835 and then reload with the following.

sudo rmmod i2c_bcm2835
sudo modprobe i2c_bcm2835 i2c_arm_baudrate=100000

But no luck, the speed remains at 400 K. I'm using the i2c-dev (SMBUS) tools with a C executable. Ideally, I'd like to be able to change the speed within the C program/executable. I could not find anything in the smbus docs about changing speeds. But maybe there is another way.

  • 1
    I believe you are more likely to get an accurate answer if you ask on raspberrypi.org/forums. I think there is a device tree section (or used to be). The device tree experts are more likely to see the question there.
    – joan
    Commented Jun 15, 2018 at 8:50

1 Answer 1


Yes. I use RPIO, which has an API to set the I2C baud rate. I have long sensor wires for gardening, and lower baudrates allow me to run longer cables. I set my I2C to 10000 (10kHz for 10meter cables).

RPIO is a Javascript GPIO package. It should be possible to do the same in other languages--consult the documentation of the chosen library for your language.

Caveat: I have not taken my oscilloscope and actually verified that the baud rate changes when so configured. I am simply trusting the provided library API. I would defer to an answer where such research has been conducted. As Joan points out, such information may be available elsewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.