Selaa lähdekoodia

docs: add bench setup guide (VS Code ESP-IDF extension)

docs/bench-setup.md walks through flashing the Waveshare ESP32-P4-ETH via
the Espressif ESP-IDF VS Code extension: install/configure IDF v5.5+, set
the esp32p4 target, optionally enable the Dante features (menuconfig),
build/flash/monitor, the expected boot log, a gated bench-test checklist,
and troubleshooting.

Explains why the Arduino IDE isn't usable here (needs ESP_NETIF_L2_TAP +
PTP sdkconfig, the components/ layout, sdkconfig.defaults). README links
the guide from the Build section.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Benjamin Harris 3 kuukautta sitten
vanhempi
sitoutus
6d3a59d182
2 muutettua tiedostoa jossa 186 lisäystä ja 0 poistoa
  1. 8 0
      README.md
  2. 178 0
      docs/bench-setup.md

+ 8 - 0
README.md

@@ -102,6 +102,14 @@ idf.py flash monitor
 Waveshare ESP32-P4-ETH). Not yet build-verified — needs an ESP-IDF v5.5+
 toolchain.
 
+For bench bring-up (build/flash/monitor via the VS Code ESP-IDF extension,
+enabling the Dante features, and a test checklist), see
+[`docs/bench-setup.md`](docs/bench-setup.md).
+
+> **Not Arduino IDE:** this project relies on ESP-IDF sdkconfig options
+> (`ESP_NETIF_L2_TAP`, PTP daemon) and the `components/` + `sdkconfig.defaults`
+> layout that the Arduino build can't provide — see the bench guide.
+
 ## Roadmap
 
 - [x] Fork `aes67-esp32p4`'s `components/aes67` in as the starting point

+ 178 - 0
docs/bench-setup.md

@@ -0,0 +1,178 @@
+# Bench setup — build & flash (VS Code ESP-IDF extension)
+
+How to get this firmware onto a **Waveshare ESP32-P4-ETH** for bench testing,
+using the official **Espressif ESP-IDF** extension for VS Code.
+
+> **Why not Arduino IDE?** This is a native ESP-IDF project. It depends on
+> sdkconfig options the Arduino build can't provide — `ESP_NETIF_L2_TAP` and
+> the PTP daemon config (for hardware-timestamped PTP), plus the `components/`
+> layout, managed components (`mdns`, `esp-dsp`, `es8311`) and the tuned
+> `sdkconfig.defaults`. Arduino would drop exactly the timing features that
+> make AES67 work on the P4. Use one of the ESP-IDF workflows instead.
+
+---
+
+## 0. What you need
+
+- Waveshare **ESP32-P4-ETH** board.
+- **USB-C cable** (data-capable — not charge-only) between the PC and the
+  board's USB port used for flashing/console.
+- An **Ethernet cable** to a switch/router that hands out DHCP (the firmware
+  waits for an IP before starting audio). For real interop testing, the same
+  switch as your Dante/AES67 gear.
+- Windows 11 with VS Code.
+
+> **Board USB port:** the ESP32-P4 flashes over its built-in USB-Serial-JTAG.
+> Use the USB-C port wired for that on the board — confirm the silkscreen /
+> the [board wiki](https://www.waveshare.com/wiki/ESP32-P4-ETH) if there is
+> more than one connector. If the PC never enumerates a serial port, see
+> *Troubleshooting → download mode* below.
+
+---
+
+## 1. Install the ESP-IDF extension (one time)
+
+1. In VS Code: **Extensions** (Ctrl+Shift+X) → search **"ESP-IDF"** (publisher
+   *Espressif Systems*) → **Install**.
+2. Open the command palette (Ctrl+Shift+P) → **ESP-IDF: Configure ESP-IDF
+   Extension**.
+3. Choose **Express** install.
+4. Select ESP-IDF **v5.5** (or newer) — this project requires ≥ 5.5. Let it
+   download the toolchain and tools (several minutes). ESP32-P4 is a RISC-V
+   target; the installer pulls the right compiler automatically.
+5. When it finishes you'll have an **ESP-IDF Terminal** and a row of icons in
+   the VS Code status bar (target, port, build, flash, monitor…).
+
+---
+
+## 2. Open the project & set the target
+
+1. **File → Open Folder** → `d:\GIT_REPO\ESP32-P4_DANTE` (the repo root — the
+   folder containing the top-level `CMakeLists.txt`).
+2. Set the chip target: command palette → **ESP-IDF: Set Espressif Device
+   Target** → **esp32p4** → choose the **built-in USB-JTAG** flash method when
+   prompted.
+   - Status-bar equivalent: the chip icon.
+3. First configure will apply `sdkconfig.defaults` (L2 TAP, PTP daemon, PSRAM,
+   32 MB flash, IRAM tuning) into a generated `sdkconfig`. That file is
+   gitignored — it's your local build config.
+
+---
+
+## 3. (Optional) enable the Dante prototype features
+
+By default the build comes up as an **AES67** endpoint plus **read-only Dante
+discovery** (logs what Dante gear it sees). The Dante *advertisement* and
+*CMC responder* are gated OFF until validated. To turn them on:
+
+1. Command palette → **ESP-IDF: SDK Configuration Editor (menuconfig)**.
+2. Search **"Dante"** and enable as needed:
+   - `Browse for Dante devices on boot` (**DANTE_DISCOVERY_ON_BOOT**) — on by
+     default; leave it on, it's read-only and useful.
+   - `Advertise this device over mDNS (Dante)` (**DANTE_ADVERTISE_ON_BOOT**).
+   - `Run the Dante CMC (device-announce) responder` (**DANTE_CMC_ON_BOOT**).
+3. **Save**.
+
+> These two are **prototype / untested against hardware**. Enable them when
+> you're ready to watch what Dante Controller does with a device that answers
+> CMC but not yet ARC — expect it to appear but not be fully routable.
+
+---
+
+## 4. Build
+
+- Command palette → **ESP-IDF: Build your project** (or the build/wrench icon).
+- First build compiles ESP-IDF + both components; it takes a while. Subsequent
+  builds are incremental.
+- On success you'll see the app/partition sizes. If it fails, check
+  *Troubleshooting* below — the most likely first-run issues are toolchain/IDF
+  version and the managed-component download needing internet.
+
+---
+
+## 5. Flash & monitor
+
+1. Plug the board in. Set the port: command palette → **ESP-IDF: Select Port
+   to Use** → pick the board's COM port (status-bar plug icon).
+2. **ESP-IDF: Flash your project** → choose **UART**/**JTAG** as offered for
+   the built-in USB-JTAG.
+3. **ESP-IDF: Monitor your project** (or the "Flash + Monitor" combined
+   action). Monitor runs at **115200** baud.
+   - Exit the monitor with **Ctrl+]**.
+
+### What a healthy boot looks like
+
+Log tags to watch for, roughly in order:
+
+```
+I (…) main: LDO4 set to 3.3V
+I (…) main: ethernet started
+I (…) main: ethernet link up
+I (…) main: waiting for IP address...
+I (…) main: got IP: 10.x.x.x
+I (…) main: PA enabled (GPIO53 high)
+I (…) main: Ethernet RTP hook installed
+I (…) main: ES8311 codec initialized (MCLK running)
+I (…) main: node ready
+I (…) dante_disc: discovery task started (interval=15000ms)
+I (…) dante_disc: scan complete: N Dante service instance(s)
+```
+
+If you enabled the Dante servers you'll also see `dante_cmc: CMC responder
+listening on udp/8800` and `dante_adv: advertising as "ESP32P4-Dante-XXXXXX"`.
+
+---
+
+## 6. Bench test checklist
+
+Work down this list; each step gates the next.
+
+1. **Boots & links** — you reach `node ready`, Ethernet shows `link up`, and
+   an IP is obtained. No boot loop.
+2. **Codec init OK** — `ES8311 codec initialized` with no error. (If it fails,
+   suspect I2S/I2C pins or the PA — cross-check `main/board_config.h`.)
+3. **PTP** — with a PTP master / AES67 gear on the network, watch for the PTP
+   lock log from the AES67 stack. Sync is required for clean audio.
+4. **AES67 receive** — point a known AES67 source (or Dante gear in AES67
+   mode) at the network; the SAP auto-subscribe in `main.c` should pick up the
+   first source (`Auto-subscribing to "…"`), and audio should come out the
+   speaker.
+5. **Dante discovery** — with Dante devices present, `dante_disc` should log
+   their `_netaudio-*` services and channel formats.
+6. **Dante CMC / advertisement** (if enabled) — open **Dante Controller** on a
+   PC on the same network; the device should appear. It won't be fully
+   routable until the ARC responder exists — that's expected.
+
+Capture a packet trace (Wireshark, mirror port) during 5–6 — it's the ground
+truth for validating the clean-room Dante notes and fixing the "unknown"
+protocol fields.
+
+---
+
+## 7. Troubleshooting
+
+- **No serial port appears / can't connect → download mode.** Hold **BOOT**,
+  tap **RESET** (EN), release BOOT, then flash. Some boards need this only if
+  the app crashes early or USB re-enumeration fails.
+- **Build can't find managed components** (`mdns`, `esp-dsp`, `es8311`) — the
+  IDF component manager needs internet on first build to fetch them into
+  `managed_components/`.
+- **`Wrong flash size` / boot loops** — confirm the SDK config has 32 MB flash
+  (from `sdkconfig.defaults`) and PSRAM enabled. Try **ESP-IDF: Erase Flash**,
+  then flash again.
+- **No IP** — check the Ethernet link LED and that the switch does DHCP. The
+  firmware blocks at `waiting for IP address...` until it gets one.
+- **No audio but everything else is fine** — check PTP lock first, then the
+  amp: PA enable is GPIO53 (active high). Verify subscription actually
+  happened in the log.
+- **IDF version errors** — this project needs **v5.5+**. Re-run *Configure
+  ESP-IDF Extension* and select a 5.5 (or newer) release.
+
+---
+
+## Alternatives (same project, other tools)
+
+- **CLI:** open the **ESP-IDF Terminal**, then
+  `idf.py set-target esp32p4 && idf.py build && idf.py -p <PORT> flash monitor`.
+- **PlatformIO:** `framework = espidf`, `board` for the P4; add the components
+  and point at `sdkconfig.defaults`.