Skip to content

Detect displayless ESP32-P4 boards in the board detector, Tab5X by chip revision, rename PoE-P4 display output to Display Out - #343

Merged
lovyan03 merged 4 commits into
m5stack:developfrom
ainyan03:p4_detect
Oct 9, 2026
Merged

lovyan03 merged 4 commits into
m5stack:developfrom
ainyan03:p4_detect

Conversation

@ainyan03

@ainyan03 ainyan03 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Identify the ESP32-P4 boards without a built-in display in the board detector, select Tab5X by chip revision, and rename the PoE-P4 display output to Display Out.

Until now M5Unified told these boards apart by GPIO levels (G32 high: Tab5, G0 high: Unit PoE-P4, otherwise Stamp-P4), and the P4 detector list ran only when NVS held no board or a P4 display board. M5Unified will drop those checks in a follow-up PR once this is merged.

Changes

  • Unit PoE-P4: confirmed by reading the IP101 Ethernet PHY ID (PHY address 1, registers 2 / 3 = 0x0243 / 0x0C54) over MDIO (MDC = G31, MDIO = G52), with both lines driven open-drain. G51 (PHY reset) is not touched. Before driving, G31 / G52 must read pulled up and G32 floating; this keeps Tab5 out, where G31 / G32 are the internal I2C bus. The result does not depend on whether the Display Out board is attached.
  • Stamp-P4 / Stamp-P4X: nothing on the module can be confirmed, so it is reported only as a candidate (getBoardCandidate(); chip revision v3.0 or later: Stamp-P4X). It is never saved to NVS.
  • Tab5: still confirmed by the two IO expanders. When the internal I2C bus is present and G22 (backlight enable, pulled down by a resistor) reads low, a Tab5 candidate is kept even if the expanders do not answer or the display setup fails.
  • Tab5X (behavior change): selected from the chip revision (v3.0 or later), as Tab5X is Tab5 with a newer ESP32-P4. Before, Tab5X was detected as Tab5 unless a hint said otherwise, and Tab5 was saved to NVS.
  • The P4 detector list now always runs and reports candidates, as on the other chips. Order: CoreP4X, Tab5, Unit PoE-P4, Stamp-P4.
  • Board catalog: adds Unit PoE-P4 and Stamp-P4 / Stamp-P4X. detect_class may no longer be set on connector or button pins (external wiring or a button held at power-on changes their level); the validator rejects both. StampS3Mini's legacy_board_id is corrected to 155.
  • Rename (separate commit): board_M5UnitPoEP4HDMI → board_M5UnitPoEP4DisplayOut (value 201 unchanged), M5UnitPoEP4HDMI → M5UnitPoEP4DisplayOut, M5UnitPoEP4HDMI.h → M5UnitPoEP4DisplayOut.h. The old names remain as deprecated aliases and the old header includes the new one, so existing sketches build with deprecation warnings.

Tested

  • Stamp-P4 (chip v1.3), Tab5 (v1.0), Unit PoE-P4 (v1.3) with and without Display Out: detected as 150 / 22 / 148, also on the second boot with the saved hint.
  • Tab5 with the display setup forced to fail: the board resolves to Tab5 through the candidate, nothing saved to NVS.
  • Unit PoE-P4 + Display Out: attaches as a 1280x720 display with the new names, and with the old names (deprecation warnings only).
  • Boot time with log level 3: Stamp-P4 unchanged (38 ms), Unit PoE-P4 +3 ms (40 → 43 ms) for the MDIO read.
  • Builds for the versions in the upstream CI (Arduino 2.0.17 / 3.x, ESP-IDF 4.4 – 6.1). Board catalog: npm test, spec.js check.
  • Not tested: CoreP4X, Tab5X, Stamp-P4X (no hardware).

Add UnitPoEP4 and StampP4 / StampP4X to the board catalog.

detect_class may no longer be placed on connector pins or button pins:
external wiring or a button held at power-on changes their level, so they
cannot tell boards apart. The validator rejects both.

StampS3Mini's legacy_board_id is corrected from 150 to 155 to match
boards.hpp; 150 is StampP4 and the duplicate failed the catalog check.
ESP32-P4 boards other than Tab5 and CoreP4X were left to GPIO checks in
M5Unified (G32 high: Tab5, G0 high: UnitPoEP4, otherwise StampP4), and the
P4 detector list ran only while NVS held no board or a P4 display board.

- The P4 detector list now always runs and reports candidates to the
  caller, as on the other chips.
- UnitPoEP4: when G31 and G52 are pulled up and G32 is floating, read the
  IP101 PHY ID (address 1, registers 2 / 3 = 0x0243 / 0x0C54) over MDIO with
  both lines driven open-drain. G51 (PHY reset) is not touched. The pull
  check keeps Tab5 out, where G31 / G32 are the internal I2C bus.
- StampP4 / StampP4X has nothing on board to confirm, so it is reported
  only as a candidate (chip revision v3.0 or later: StampP4X) and is never
  saved to NVS.
- Tab5: with the internal I2C bus present and G22 (backlight enable,
  pulled down by a resistor) low, a Tab5 candidate is kept even when the
  IO expanders do not answer or the display setup fails. This replaces the
  G32 check in M5Unified.
Tab5X is Tab5 with an ESP32-P4 of chip revision v3.0 or later. Without a
saved hint the detector returned Tab5 on Tab5X and saved it to NVS, so
M5Unified did not enable Tab5X's controllable EXT port power.

Select Tab5X from the chip revision. A saved Tab5 / Tab5X hint that
disagrees is logged and overridden.
The add-on board for Unit PoE-P4 is named Display Out. Rename
board_M5UnitPoEP4HDMI to board_M5UnitPoEP4DisplayOut (value 201 is
unchanged), the class M5UnitPoEP4HDMI to M5UnitPoEP4DisplayOut and the
header M5UnitPoEP4HDMI.h to M5UnitPoEP4DisplayOut.h.

The old enum value and class remain as deprecated aliases, the old header
includes the new one, and the old feature macros stay defined, so
existing sketches build with deprecation warnings.
@lovyan03
lovyan03 merged commit 36f962a into m5stack:develop Oct 9, 2026
26 checks passed
@ainyan03
ainyan03 deleted the p4_detect branch October 9, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants