RP2350: "stuck at 2V" input pin behavior
Port, board and/or hardware
Pimoroni Tiny2350
MicroPython version
Using build from https://github.com/pimoroni/pimoroni-pico-rp2350
https://github.com/pimoroni/pimoroni-pico-rp2350/releases/download/v0.0.5/tiny2350-v0.0.5-pimoroni-micropython.uf2
Reproduction
I have been debugging what seems to be a problem in CircuitPython which seems related to the discussion here: https://github.com/orgs/micropython/discussions/15621#discussioncomment-10423602
It appears related to RP2350-E9 in the RP2350 datasheet, but am seeing even stranger behavior that seems more pervasive than RP2350-E9. The "stuck high" behavior described in the erratum seems to be reproducible even without enabling the internal pulldown:
Testing on a Pimoroni Tiny 2350:
>>> from machine import Pin
>>> gp0 = Pin(0, mode=Pin.IN, pull=None)
>>> gp0.value() # initial value of unconnected pin
0
>>> gp0.value() # attach 1M resistor from pin to 3.3V
1
>>> gp0.value() # remove resistor
1
>>> gp0.value() # jumper pin to ground with 1M resistor
1
A voltmeter on the pin shows a stable 2.3V even after many seconds. The pin appears to be latched to 2.3V, as the erratum describes. Jumpering the pin hard (0 ohms) to ground and then removing the jumper restores the quiescent pin voltage to 0v and gp0.value() again shows 0.
I first saw this behavior in CircuitPython and reproduced it in MicroPython as well.
I don't see similar "stuck" behavior on RP2040.
One consideration: the hard-reset state of the pin has the pull-down set. But I have been modifying the CircuitPython code to clear the pull-downs before the pin is set up for input, and that did not help.
I opened an issue with raspberrypi: https://github.com/raspberrypi/pico-feedback/issues/401
Expected behaviour
see above
Observed behaviour
see above
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
rp2: on RP2350 configure jmp pins as input if they are in isolation mode
Summary
On RP2350, enable PIO jmp pins as input if they haven't already been configured. This allows them to work as input pins to the PIO. Otherwise the pin remains in isolation mode from reset and doesn't work as expected, in particular code that works on RP2040 does not work on RP2350.
Resolves issue #17047.
Testing
Tested with the code in #17047. Without the fix here the test fails (as described there). With the fix, it passes.
Trade-offs and Alternatives
The alternative would be to just document this. But I think a little bit of code to help things work "out of the box" makes it easier for users.