Skip to content

i2c default clock speed for Pi Pico (RP2040) is 90.9kHz (and 400kHz is around 265kHz) #4466

Closed
@kevinjwalters

Description

@kevinjwalters

I've not had any particular i2c issues but looking at #4082 the clock speed looked wrong on both boards including the Pi Pico running 6.2.0-beta.1. Here's a view from Ikalogic SQ25 of a (Maker) Pi Pico talking to a generic SSD1306-driven screen and using the change contrast command to get something to capture (at 25MHz).

ScanaStudio-pi-pico-slow-i2c-clock-1

This has the 10k pullups on SSD1306 and whatever the RP2040 might be doing. The Maker Pi Pico adds 3M3 to GND on each GPIO and a mosfet gate to drive LED but I don't see that making any difference here.

I took those 3 measurements and 3 others to get mean of 90.8827kHz. That's suspiciously close to 1000/11 = 90.9090.

Would be useful if someone could confirm i2c speed on Pi Pico and perhaps another established processor. These examples are from 6.2.0-beta.4, not 6.2.0-beta.1.

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Raspberry Pi Pico with rp2040
>>> import board
>>> import busio
>>> i2c = busio.I2C(scl=board.GP1, sda=board.GP0)
>>> i2c.try_lock()
True
>>> buffer = bytearray(2)
>>> buffer[0] = 0x81  ### set contrast command
>>> buffer[1] = 0x80
>>> i2c.writeto(60, buffer)

Same result with frequency=100_000. Oddly, frequency=110_000 gives actual 111.193kHz.

And frequency=400_000 gives actual 250.000 kHz, shown below:

ScanaStudio_pi-pico-6 2 0 beta 4-wanted400-got250withfatpulses-1

That also shows up some fat clock pulses. The first one is 6.88us, the second one 3.16us then it settles into the circa 2.9us rhythm.

For comparison I had a look back at an old trace from a Gemma M0 talking to a bear running CircuitPython 2.2.0 (this is only at 1MHz capture) and everything is much more regular.

ScanaStudio-gemma-m0-pimoroni-bearable-201807vintage-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrp2040Raspberry Pi RP2040

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions