RP2: ADC pins does not work properly in XIAO RP2350
Port, board and/or hardware
XIAO RP2350
MicroPython version
MicroPython v1.26.1 on 2025-09-11; Seeed XIAO RP2350 with RP2350
Reproduction
- Use the firmware in this interface XIAO_RP2350
- Use the following test code
import machine
machine.ADC(29).read_u16()
Expected behaviour
Using my own compiled firmware
MicroPython v1.27.0-preview.135.gd28844d11b.dirty on 2025-09-15; Seeed XIAO RP2350 with RP2350
Type "help()" for more information.
>>> import machine
>>> machine.ADC(4).read_u16()
13955
Observed behaviour
MicroPython v1.26.1 on 2025-09-11; Seeed XIAO RP2350 with RP2350
Type "help()" for more information.
>>> import machine
>>> machine.ADC(29).read_u16()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Pin doesn't have ADC capabilities
>>>
Additional Information
The reason is that pico-sdk is not the latest.
The ADC function modified the judgment logic after this submission, and changed the range of the ADC pin to be specified by macro(ADC_BASE_PIN and NUM_ADC_CHANNELS).
See: https://github.com/micropython/micropython/commit/34e463d861c5ebb33ec317749a008d461616cfbc
These two macros were not used in pico-sdk until after this commit.
See: https://github.com/raspberrypi/pico-sdk/commit/c88bd53a68fe2199fa4a5e6473ba88278f339a2b
The following file is the xiao rp2350 header file in the pico-sdk used by the current version of micropython. This file does not include the changes submitted above.
See: https://github.com/raspberrypi/pico-sdk/blob/9a4113fbbae65ee82d8cd6537963bc3d3b14bcca/src/boards/include/boards/seeed_xiao_rp2350.h
Please update pico-sdk and release a new firmware version as soon as possible.
Code of Conduct
Yes, I agree
lib/pico-sdk: Update pico-sdk submodule to version 2.2.0.
Summary
New feature support from upstream Pico SDK v2.2.0: enhanced ADC/DAC functionality, improved SPI/I2C peripheral stability, and expanded board definition coverage
Compatibility updates for RP2350-based devices (including Seeed XIAO RP2350) with critical hardware macro definitions
No breaking changes to existing RP2040/RP2350 device support or MicroPython RP2 port APIs
Testing
The rebase completed successfully with no conflicts. All MicroPython-specific patches applied cleanly.
This update has been validated with:
Compilation tests for existing RP2040/RP2350 board targets (e.g.Seeed XIAO RP2350)
Functional verification of core peripherals (ADC, SPI, I2C, UART) on Seeed XIAO RP2350
Compatibility checks with the latest MicroPython RP2 port codebase
Trade-offs and Alternatives
This is a vendor library update that integrates bug fixes, performance improvements, and hardware support enhancements from the upstream Raspberry Pi Pico SDK. The submodule points to the work branch containing all MicroPython customizations, ensuring:
Full compatibility with the existing MicroPython RP2 port