1

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.

  • Ah, let me refresh my memory on the Rpi3B+ I2C speed bug: (1) "Raspberry Pi3 I2C baud rate setting": raspberrypi.org/forums/viewtopic.php?f=29&t=219675. And as the wise old guy Warren Buffett says: "There's never just one cockroach in the kitchen.". I think I better use my US$300 Rigol DS1054 four-channel 50MHz digital storage oscilloscope to make sure. Stay tuned. :) – tlfong01 Mar 2 at 1:40
  • 1
    Just now I have confirmed that the Rpi4B buster I2C can set to 50kHz, 100kHz, 400kHz, and 1MHz. So I have made a quick and dirty answer. Cheers. – tlfong01 Mar 4 at 13:02
2

Answer

I have confirmed that Rpi4B 4GB v1.2 buster 2020feb13 I2C #1 can set speed other than 100kHz.

Figures

i2c 1


i2c 2


i2c 3


io2c 4


i2c 5


i2c 6


i2c 7


Appendices

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

Python program listing to test I2C Speed Setting


| improve this answer | |
2

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 /boot/config.txt

dtparam=i2c_baudrate=400000

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.

enter image description here

| improve this answer | |
  • so does the error in the old model fixed in the new one? will it actually run the 400 Kb/s? – Jack Mar 1 at 16:48
  • I did not know there was an error. Could you add a link to your question? – joan Mar 1 at 16:57
  • i do not have the exact source since it was a year(s) ago that i got a wind of it. but a quick google search led me to this thread. It would seem that @tlfong01 investigated this, hope he sees this to clarify if he was able to successfully probe a 400khz signal on the Rpi3 – Jack Mar 1 at 17:09
  • That thread was about setting a low baud rate of 40 kbps. – joan Mar 1 at 17:35
  • yes, but he mentioned that Just now I also tried setting 400kHz, but no effect. To summarize, whether I set 40kHz, 50kHz, 100kHz, or 400kHz, Rpi always runs at 100kHz (checked with a scope). So its kinda fixed at 100khz according to his test. Another guy posted that the clock can go upto 1.6Mhz, does that mean 400kHz is not the actual highest? – Jack Mar 1 at 18:00
2

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...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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