Pico RGB Keypad i2c pullup error

Hi all,
I was using the Emergency cat GIF macro example by @sandyjmacdonald using CircuitPython

But I’m getting an error on the I2C setup.

 File "<stdin>", line 43, in <module>
RuntimeError: SDA or SCL needs a pull up

This is the line that triggers the error

# Set up I2C for IO expander (addr: 0x20)
i2c = busio.I2C(board.GP5, board.GP4)

I have no idea if it’s an issue with CircuitPython or with the RGB Keypad or something I did wrong with soldering the pins to the pico.

The MicroPython example for the RGB Keypad runs without any issues so I would think it has nothing to do with the Pico or the Keypad.

Anyone that can give me some advise?

It’s possible to manually pull the pins up using resistors (4.7-10K) connecting the pin and 3v3, but at a glance Sandy doesn’t seem to have used those.

The board itself (the keypad) has I2C pullups, so it’s weird that that error is coming up. Not sure what could be going on. Is it definitely connected properly and is the soldering good?

1 Like

Thanks for the feedback!

Weird things are going on here :/

I had no problem running the MicroPython demo code for the RGB Keypad so I re-flashed the Pico with the Pimoroni MicroPython firmware to see if that code was still running as should but now I can’t get the lights to light up anymore.

While running MP, when I print the button number on press I get the correct number, so I guess the I2C connection is still working. I don’t know anything about the difference between MP en CP but I would think that they connect in the same way to the keypad?

And now that my RGB lights aren’t working anymore I really hope I didn’t destroy them while trying different things.

After some test with continuity test of my tester I found 2 problems: in my case the 4.7k ohm resistor soldered in the board has some soldering problem, so after re-soldered on the board the continuity test works pretty well. The second problem is that the RUN pin makes shor-circuit to the ground. Playing around with pins I’ve found a solution to make a middle socket between the Raspberry PICO and the keyboard socket itself. It seems to work for now, but probably we are bad lucky and we met some production problem? We remain in waiting for some news

Just trying out the same code and had the same issue. Not sure to understand how @Davide_Di_Do sorted it out to experiment.

@thibault Is the soldering on your Pico good?

Well I believe so. the micro python example runs perfectly. I have the issue only with the CircuitPython one.
I soldered it today and all looks fine but if you know a way to check them to be 100% sure I’ll do it.

EDIT: I tried with another pico and have the same error :(

Yeah, I’m getting the same now too. You can disable that warning but it requires rebuilding CircuitPython, which I’m currently trying to do… I’ll get back to you when I’ve got it sorted, hopefully…

I’m running into the same issue. Tried with 2 different Picos. The soldering is good and the Pimoroni Micropython example works. Any idea?

Hi, I’m one of the CircuitPython core developers.

We had a discussion about using the internal pullups for I2C in CircuitPython in this proposed CircuitPython PR: RP2040: Add support for using internal i2c pullups. The internal pullups are 50k-80k, which are really too high to be adequate I2C pullups. MicroPython does enable the internal pullups for I2C as a backstop, and CircuitPython does not. All Adafruit I2C breakouts include pullups.

The original motivation to use the internal pullups was the Keybow board. But that reason is now moot, I believe, due to a board redesign mentioned in this comment in the PR: RP2040: Add support for using internal i2c pullups by Gadgetoid · Pull Request #4488 · adafruit/circuitpython · GitHub. So the PR mentioned above was closed and not merged.

@otherguy is seeing the issue on their RGB Keypad.

I just wanted to chime in and say I’m also facing this issue with the RGB Keypad. I’ve tried it on two different Picos, one with presoldered headers and one that I soldered myself. Both throw this error.

@danhalbert is this something that could be fixed by forking the repo, merging the changes in PR #4488 and rebuilding the UF2 file from that?

Hi, I’ve had some success.

TL;DR: I added my own pullups and it all works, but it’s messy.

I’m getting the same error about the pullup, and searching around on Github for the error message, I found the PR where the wording was changed.

The code that checks the pullups looks like it compares the value of the SDA and SCL pullups and fails if they aren’t the same, so I guess that means with the keypad they aren’t the same.

Now, I’m only just about good enough at electronics to be dangerous, but I could only find one obvious resistor on the board, so my uneducated guess is that the board might only be pulling up the SDA line and there must be some sort of weak pullup in the Pico already for SCL but for some reason it’s not enough for CircuitPython to register that both lines are pulled up.

I stuck the Pico on a breadboard and jumpered across to the keypad on GP4/GP5 (I2C for the buttons) and GP17/GP18/GP19 (SPI for the pixels), plus a few power (VBUS along to VREF) and a couple of ground pins. I then put a pair of 3k (no maths involved - that’s all I had laying around) pullup resistors of my own on the breadboard, attached to GP4/GP5 and +3V3.

The wildestpixel demo code works just fine now for me.

So I guess the next question is what we do about it because breaking the Pico out on to a breadboard to put extra pullups in kinda defeats the neatness of the RGB Keypad. If I’m right, is this a hardware problem, or do we need the Pico’s internal pullups handled in circuitpython?

I just added 2 resistors on the RGB keypad itself, since there are free pads. I added the resistors between normal digital pins and SCL/SDA and enabled the pins in code. This works fine and takes about 3 seconds to solder.

I also emailed Pimoroni about this but got no real answer yet, apart from the fact that the RGB keypad should have pullup resistors!

On my RGB keypad, the resistance is infinite if I measure it without a Pico plugged in.

1 Like

A bit more testing later, and it seems that it fails whichever pullup I remove - the keypad needs both pullups in place to work correctly.

@otherguy I’ll follow your lead and add the pullups to the extra row of pads.

Also consider that plenty of people DON’T have this issue. I think there must be a hardware issue on our RGB Keypads.

Hi all,

This is something we’re looking into, please could anyone who hasn’t already send a ticket to support@ with their order number so we can arrange a replacement and if you’re in the UK a return of the faulty one as well?

Cheers :)

4 Likes

The replacement works perfectly, thanks @Matt.

Some 3D printed key covers and a bit of tweaking and it’s doing exactly what I wanted it for:

1 Like