changing raspberry pi zero i2c baud rate: what actually works
The syntax is fragile; an extra space breaks it, so just copy and paste into /boot/config.txt.
#100kbps, slow, default
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=100000
#400kbs, "fast"
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=400000
#100kbps, slow, default
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=100000
#400kbs, "fast"
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=400000
#1.2mbs, "high speed"
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=1200000
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=1200000
You may see elsewhere that you can check the baudrate with these commands, but they don't work for me:
cat /sys/module/i2c_bcm2708/parameters/baudrate
cat /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency
While you cannot verify the baudrate setting directly, you can time how quickly data can be read from /dev/i2c-1. I can read 100 bytes in 7ms at 1.2mbs "high speed" talking to an ADS1115 adc (note: it's sample rate is lower than that, but the currently digitized value can be read that fast).
Comments