PGA2040 - I2C (noob question)

I’m building a little glowing cube (6 4x4 addressable LED maxricies) and I’m planning on using a PGA2040. I’ve got a 3 axis accelerometer I’m thinking of attaching, the easiest way is I2C (SPI is also an option)

What’s the best way to connect these up? It looks like there are many pairs of pins I can use for either I2C0 or I2C1. It is just a matter of connecting the approptiate pins on the PGA2040 to the device and then coding it

i2c = machine.I2C(1, scl=machine.Pin(11), sda=machine.Pin(10))

or any related pair based on:

I2C Controller GPOI Pin
I2C0 – SDA GP00 GP04 GP08 GP12 GP16 GP20 GP28
I2C0 – SCL GP01 GP05 GP09 GP13 GP17 GP21 GP29
I2C1 – SDA GP02 GP06 GP10 GP14 GP18 GP26
I2C1 – SCL GP03 GP07 GP11 GP15 GP19 GP27

Do I need a pull up resistor? Some examples have referenced it, or said it’s not needed with the pico, but I wasn’t clear if that was a pico specific thing, or if it was an RP2040 chip thing.

Thanks

It shouldn’t really matter which pair of SDA/SCL pins you use, as long as they’re both I2C0 or I2C1. I assumed you had to use pins which were next to each other, but the datasheet implies that it actually doesn’t matter, as long as they’re both part of the same I2C bus, bus 0 or bus 1.

The RP2040’s pins have pull-up resistors which should be enabled when they’re put into I2C mode. However, the datasheet says this:

There should also be external pull-ups on the board as the internal pad pull-ups may not be strong enough to pull up external circuits.

So it might work without additional pull-ups. Actually, the schematic for your accelerometer shows on-board pull-up resistors, so you probably won’t need them. There seems to be a bit of a philosophical argument about where pull-ups should go, some people put them on the board, some people put them on the breakout. It shouldn’t matter if you have both.

1 Like

Ah, thank you. I should have looked at that. Much appreciated