forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
CircuitPython version
Adafruit CircuitPython 9.2.0-alpha.2350-19-gc53a0cb864 on 2024-08-19; Raspberry Pi Pico 2 with rp2350a
Code/REPL
import time, board, touchio
touchin = touchio.TouchIn( board.GP2 )
while True:
print( touchin.value )
time.sleep(0.1)
Behavior
Pin GP2 has a 1M resistor going to GND.
code.py output:
Traceback (most recent call last):
File "code.py", line 2, in <module>
ValueError: No pulldown on pin; 1Mohm recommended
Description
The standard touchio technique doesn't seem to work.
Happens for at least these pins: board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7 ,board.GP8, board.GP9, board.GP10, board.GP11, board.GP12, board.GP13, board.GP14, board.GP15
on a known-good board that works with Pico RP2040.
Additional information
The three functions touchio
uses:
common_hal_digitalio_digitalinout_switch_to_output(self->digitalinout, true, DRIVE_MODE_PUSH_PULL)
common_hal_digitalio_digitalinout_switch_to_input(self->digitalinout, PULL_NONE)
common_hal_digitalio_digitalinout_get_value(self->digitalinout)
Haven't had any changes for RP2350 except for one-line to select pin drive strength. Since other normal digitalio
uses seem to work, I'm at a loss .
But for that drive-strength setting in DigitalInOut.c, why is it this:
hw_write_masked(&pads_bank0_hw->io[pin],
PADS_BANK0_GPIO0_DRIVE_VALUE_12MA << PADS_BANK0_GPIO0_DRIVE_LSB,
PADS_BANK0_GPIO0_DRIVE_BITS);
and not:
gpio_set_drive_strength(pin, GPIO_DRIVE_STRENGTH_12MA);
as described in the Pico-SDK docs?