espressif: correct ESP32-P4 ADC2 channel mapping - #11492
Merged
dhalbert merged 1 commit intoOct 5, 2026
Merged
Conversation
GPIO49 through GPIO54 are ADC2 channels 0 through 5. The previous offset selected neighboring inputs and invalid channels for GPIO53 and GPIO54. Match ESP-IDF adc_channel.h. Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
This was referenced Oct 3, 2026
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused mapping correction is consistent, complete, and supported by hardware and compile testing.
Review effort: Balanced
Findings: None
What changed in this PR
Corrects ESP32-P4 ADC2 pin metadata to match the GPIO49–54 hardware channel mapping.
Changes:
- Remaps GPIO49–54 from ADC2 channels 2–7 to channels 0–5.
- Restores analog input access for affected ESP32-P4 boards.
| File | Description |
|---|---|
ports/espressif/peripherals/esp32p4/pins.c |
Corrects six ADC2 channel assignments. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Reviewed, looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-assisted with Codex during Metro ESP32-P4 bring-up; the results below come from local builds and serial captures.
GPIO49–54 map to ADC2 channels 0–5, but the P4 pin table used channels 2–7. Correct the six entries. Before this change, A4 and A5 failed with
IDFError('Invalid argument')andIDFError('Requested resource not found').Tested on Adafruit Metro ESP32-P4 Rev A, silicon v0.1, running the 10.3.0-alpha.4 development tree:
All six inputs constructed and read successfully. Recorded values were 49210, 59656, 60629, 61305, 61205, and 61046. These were floating inputs, so this verifies channel access, not voltage accuracy.
The combined bring-up tree built for Metro, P4 GPIO, both Espressif P4 function EV variants, M5Stack Tab5, and Solder Party P4 Stamp XL using
make -C ports/espressif BOARD=<board> -j6. Hardware testing used the combined tree; this PR isolates the mapping correction on currentmain. Changed-file pre-commit andgit diff --checkpass. Other boards were compile-tested only.