I am one of the CircuitPython core developers. A user asked about running CircuitPython on the PicoCalc, which I didn’t know about. I heard that there was an issue getting the CircuitPython I2C implementation to talk to the STM32-based I2C keyboard. It worked with MicroPython but not CIrcuitPython. Someone made a custom build of CIrcuitPython which provided a different I2C implementation to get around this problem, but no one opened an issue with us about it.
The CircuitPython I2C implementation is very close to the MicroPython implementation, except that it includes a check for pull-ups on the I2C lines. So it’s unclear to me why it wouldn’t work. It was also reported that our bitbangio implementation of I2C didn’t work also, which is even stranger, because it shares no code with the hardware-based busio implementation.
I am interested in fixing the I2C issue in CircuitPython, if it is still present. If someone has further technical details, I’d be interested in hearing them.
(I also understand there was non-technical conflict related to the CircuitPython implementation. My interest here is only technical.)
Easy test: load CircuitPython on the Pico. Try this in the REPL import busio i2c = busio.I2C(scl=board.<proper SCL pin>, sda=board.<proper SDA pin>) # I don’t know the pins needed i2c.try_lock() i2c.scan()
The keyboard should respond as an I2C device at a particular address.
@jblanked Thanks! So are you using just the latest vanilla CircuitPython build for the particular Pi Pico version that’s plugged in, or do you have a specially-built UF2?
Nice! So it looks like you are using the raw pico-sdk I2C calls instead of busio.I2C in your custom CircuitPython build.
I don’t have a PicoCalc, and it looks like getting one will take months or I’ll need to pay a premium. My main interest is in making sure vanilla CircuitPython is able to talk to the STM32 on the keyboard properly.
Ahh I see, my apologies. Unfortunately, no one has been able to get it to work. There has been three or four (public) attempts from other developers on this forum.
@ernst Thanks very much. I have another user who verified that as well, using the PicoCalc 1.6 BIOS.
The test program below to test the keyboard also worked for that user. Load it and press keyboard buttons. I used Claude to cook up a quick test after pointing it to some info about the keyboard I2C device.
This means that much more can now be written in CircuitPython itself instead of resorting to custom C code in a custom CircuitPython build. I don’t intend to do that myself, but I’m glad the original issue seems to be resolved.