flash-tool · v0.12.x
Docs · Recipes

Identify an unknown board

You have an unlabeled ESP32 board and the chip alone cannot tell which model it is. phpflash discover --all flashes a small probe firmware, built per candidate preset, brings the peripherals up on each, and prints a boxed verdict with the exact [esp32] preset to set.

Two presets for the same chip share the same silicon, so probing the chip cannot tell a P4-ETH from a P4-Pico: the difference is board-level wiring — whether there is an Ethernet PHY, whether there is a microSD slot. phpflash discover --all settles it by actively probing those peripherals: it flashes a small discovery firmware, built once per candidate preset so it uses each preset's real GPIO wiring, brings up the peripherals, and names the match.

What you need

  • The unknown board, plugged in over a USB cable that carries data, not just power.
  • php-esp32 installed (phpflash system-setup) — discover --all builds the probe firmware from it.
  • If the board might have Ethernet, a network cable connected: the probe identifies the board by bringing the link up, so it needs a live link and DHCP.

--all overwrites the app on the board

discover --all flashes a probe firmware over whatever is currently on the board. It warns, asks first (-y/--yes skips the prompt), and reminds you to re-flash your project afterward with phpflash flash.

Look at the chip first

Plug the board in and run plain discover. It lists the serial ports and their USB bridge, probes the chip with esptool, and maps it to the supported boards in that family — enough to know the family and get a paste-ready [esp32] target line, but not which model within the family:

bash terminal — discover
phpflash discover

The chip and its built-in radio come straight from the silicon; the network and microSD columns are what each preset wires, since the chip cannot be probed for them. When the chip has more than one preset, that is the ambiguity --all resolves.

Probe the peripherals

Run discover --all. It orders network-capable candidates first (a link coming up is the clearest discriminator), builds and flashes the discovery firmware for each candidate wiring in turn, and reads back what actually came up — Ethernet, microSD, PSRAM:

bash terminal — discover --all
phpflash discover --all      # add -y to skip the confirmation prompt

Each candidate prints a short probe report. When a board's own wiring brings its network up, that is the board, and the run stops there and prints the verdict:

text discover --all output (verdict)
== Probing with the waveshare-esp32-p4-eth wiring ==
  Ethernet:     up (10.42.0.224)
  microSD:      card present (14895MB)
  PSRAM:        32MB

====================================================
  THIS BOARD IS:  Waveshare ESP32-P4-ETH
  set in php-baremetal.config.toml:
    [esp32]
    preset = "waveshare-esp32-p4-eth"
====================================================

The discovery firmware is on the board now -- re-flash your project:
  phpflash flash        (or: phpflash build && phpflash flash)

Read the verdict

The boxed block is the answer. THIS BOARD IS names the model, and the verdict prints the [esp32] preset to set. Put that preset into a project:

toml php-baremetal.config.toml
[esp32]
preset = "waveshare-esp32-p4-eth"      # the preset from the verdict box

When it cannot decide

The probe is honest about ambiguity. If nothing came up — no Ethernet link, no card — it cannot separate a slotless preset from a board with an empty slot, and it says so rather than guessing:

text discover --all output (undecided)
Couldn't uniquely identify the board -- the probe results are above.
If it has Ethernet, connect the cable (the probe needs the link up) and retry.
If it has a microSD slot, insert a card and retry; if it has neither
network nor a card slot, it's the slotless variant.

Insert a card (a mounted card rules out the slotless variant) or connect the network cable and run it again. A single non-network preset for the chip is decided even without a card, since there is nothing else it could be.

After identifying

The discovery firmware is still on the board, so re-flash your project — phpflash flash, or phpflash build && phpflash flash if you have not built it yet. From here, continue to the design reference for how phpflash reads php-esp32.