The raspberry pi 3 B has a fixed i2c speed of 100kHz because of productions errors. I assumed that they have fixed it in the new version Raspberry pi 4, but of course there have been newer standards since then too of speed reaching up to the MHz range. Given the previous errors, it would make me doubt what the software is saying that it is running on
Does anyone know what is the maximum speed the pi 4 can handle, it would be better if you have actually scoped the lines yourself. I unfortunately dont have easy access to a scope and am pretty much blind.
The maximum supported speed is 400 Kb/s.
I am not aware of any difference in the I2C implementation between Pi models.
The Broadcom Serial Controller (BSC) controller is a master, fast-mode (400Kb/s) BSC controller. The Broadcom Serial Control bus is a proprietary bus compliant with the Philips® I2C bus/interface version 2.1 January 2000.
See page 28 of BCM2835 ARM Peripherals.
As to whether any particular speed is achievable will depend on the wiring, termination, capacitance etc.
To change the I2C baud rate to 400 kb/s add the following entry to
I just set 3MHz and the appropriate clock was sent. I don’t have any devices which work at that speed so have no idea if it actually would work in practice.
I have confirmed that Rpi4B 4GB v1.2 buster 2020feb13 I2C #1 can set speed other than 100kHz.
Appendix A – /boot/config.txt tlfong01 2020mar04
# /boot/config.txt 2020feb0801 tlfong01 2020feb08hkt1701 # last update 2020feb13hkt2238 # last update 2020mar02hkt1521 # last update 2020mar04hkt1830 # *** Display *** disable_overscan=1 dtoverlay=vc4-fkms-v3d max_framebuffers=2 # *** Audio *** dtparam=audio=on # *** UART *** enable_uart=1 # *** I2C *** # dtparam=i2c_arm=on,i2c_arm_baudrate=50000 #dtparam=i2c_arm=on,i2c_arm_baudrate=100000 #dtparam=i2c_arm=on,i2c_arm_baudrate=400000 dtparam=i2c_arm=on,i2c_arm_baudrate=1000000 dtoverlay=i2c1,pins_2_3 (board pins 3, 5) dtoverlay=i2c3,pins_4_5 (board pins 7, 29) # dtoverlay=i2c4,pins_6_7 (board pins 31, 26) # dtoverlay=i2c5,pins_12_13 (board pins 32, 33) # dtoverlay=i2c6,pins_22_23 (board pins 15, 16) # *** SPI *** dtparam=spi=on dtoverlay=spi1-3cs # *** End of config.txt ***
Appendix B – Python program listing to test I2C Speed Setting
WIth an RPi 4: Using i2cdetect program to make the lines wiggle.
Using an oscilloscope, if I just enable i2c in the config.txt with no other lines in the file, I see 10usec SCL periods (100kHz).
Adding the i2c_baudrate=400000 to the config.txt file I see 2.5usec SCL periods (400kHz).
Have not done the same experiment with the RPi 3 yet but obviously runs at full speed on the 4. I can post pics if necessary…