Files
parking_solution/wiki/concepts/esp32-flashability-test.md
T
julian 6eb65361a8 docs(wiki): park-2 event-loop stall incident + bounded-request-cost decision; Dingtian firmware retired, dev-board pinout, edge-controller memo
- concepts/park-2-event-loop-stall: /api/sessions/active ~2 s synchronous (quote() per open
  unpaid transient x664, unindexed ledger scans) froze the loop; Node runs expired timers before
  queued UDP replies, so healthy Dingtian pulses reported "timeout" and signed entries lost
  their snapshot/session row. Standing decision: bounded request cost whatever the operator data.
- Dingtian: custom firmware retired (2026-10-23), runbook shelved, vendor pinout in raw/,
  relay-proxy PoC marked retired; edge-controller hardware memo (open).
2026-10-24 11:17:30 +02:00

121 lines
5.5 KiB
Markdown

---
type: concept
tags: [parking, hardware, runbook, esp32, dingtian]
sources: []
updated: 2026-10-23
---
# Runbook — Is this ESP32 board flashable? (Dingtian DT-R0xx lock test)
> **Shelved 2026-10-23** — custom Dingtian firmware is retired (user decision, mini PCs instead).
> Kept as reference; never run on the bench unit.
A bench test that answers one question in a few minutes: **is the ESP32 on this [[dingtian-relay]]
locked (standard SKU) or open (Development Board Version)?** Run it before ordering more units or
planning any custom-firmware work (see [[dingtian-relay]] "Can we flash our own firmware?").
The test is read-only. Nothing is written to the chip, no eFuse is burned, and the stock firmware
boots normally afterwards.
## What "locked" means on an ESP32
The vendor burns one-time eFuse bits at the factory; they can never be cleared. Any one of these
blocks custom firmware:
| eFuse | Effect | How the test shows it |
| --- | --- | --- |
| `DISABLE_DL_ENCRYPT` / `DISABLE_DL_DECRYPT` / UART download disabled | ROM bootloader refuses serial flashing | `esptool chip_id` never connects |
| `FLASH_CRYPT_CNT` (flash encryption) | flash contents unreadable/unwritable from outside | `espefuse summary` shows it odd/enabled |
| `ABS_DONE_0` / `ABS_DONE_1` (secure boot) | ROM only runs a vendor-signed bootloader | `espefuse summary` shows it set |
On the 2- and 4-channel boards relays and inputs are **direct GPIOs** (DT-R004: relays IO16/IO2/IO32/IO12,
inputs IO36/IO39/IO33/IO35, UART IO1/IO3, PHY JL1101 on RMII with IO23 MDC / IO18 MDIO / IO17 clock /
IO0 PHY power); only the 8/16/32-channel boards use 74HC595/74HC165 shift registers. Neither is a
blocker; community firmware drives both.
## Equipment
- USB-to-UART adapter, **3.3 V logic** (CP2102 / CH343 / FT232; a CH340 clone needs the old
WCH 3.4 driver on Windows — see [[relay-proxy-firmware]]). Set its jumper to 3.3 V.
- Dupont leads. Do **not** connect the board's 12 V supply; the adapter's 3.3 V powers the ESP32.
- A PC with Python: `pip install esptool` (gives both `esptool.py` and `espefuse.py`).
## The debug header (DT-R004) — from the vendor's dev-board repo
Source: `raw/dingtian_dev_pinout/` (photos + GPIO table from
[dtlzp/relay_dev_demo](https://github.com/dtlzp/relay_dev_demo/tree/master/gpio_pinout)).
It is the **unlabelled pin header right next to the ESP32-WROOM-32D module**, left edge of the
board under the relays. **There is no BOOT switch on the board** — the only button is `FACTORY`
(IO34, the firmware's factory-reset button) and it plays no part in flashing. Download mode is
entered the bare-ESP32 way: **IO0 held to GND while NRST is pulsed to GND** (or while power comes
up).
| Pin (from the GND end) | ESP32 | Role |
| --- | --- | --- |
| 1 | GND | ground |
| 2 | IO3 | U0RXD — adapter **TX** goes here |
| 3 | IO1 | U0TXD — adapter **RX** goes here |
| 4 | NRST | reset, active LOW (adapter DTR/RTS or a jumper to GND) |
| 5 | IO0 | boot strap — **to GND for download mode** (also RMII_RST/PWR on this board) |
| 6 | 3.3V | power in from the adapter |
| 7, 8 (V2 boards only) | IO4, IO5 | CAN_RX / CAN_TX — not used for flashing |
V1 (hw V3.6.8 photo) has the 6-pin row; V2 adds IO4/IO5 for 8 pins. The order is identical.
Confirm GND with a multimeter against the terminal-block GND before powering anything.
## Procedure
1. Wire as above, adapter unplugged: GND↔GND, 3V3↔3.3V, adapter TX↔IO3, adapter RX↔IO1.
2. Jumper **IO0 to GND**. Then either hold **NRST to GND** for a second and release, or simply plug
the adapter in (power-on with IO0 low = download mode). If the adapter has DTR/RTS wired to
NRST and IO0, esptool can do this itself.
3. Identify the port: `COMx` on Windows, `/dev/ttyUSB0` on Linux. On WSL, pass the device through
or run from Windows.
4. Run:
```
esptool.py --port COM5 --baud 115200 chip-id
```
5. If it connects, read the eFuses:
```
espefuse.py --port COM5 summary
```
6. Remove the IO0 jumper before a normal boot.
## Reading the result
**Open (Development SKU):**
```
Chip is ESP32-D0WD-V3 (revision v3.x)
Features: WiFi, BT, Dual Core, 240MHz, ...
Chip ID: 0x...
```
and in the summary `FLASH_CRYPT_CNT = 0`, `ABS_DONE_0 = False`, `ABS_DONE_1 = False`,
`DISABLE_DL_* = False`. Custom firmware (ESPHome `dtr0xx_io`, Tasmota, ESP-IDF) is possible.
**Locked (Standard SKU), either of:**
- `A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header`
after the boot-switch step was done correctly → UART download is disabled.
- It connects but the summary shows flash encryption and/or secure boot enabled → you can reach the
ROM but cannot run your own image. Treat as locked.
**Inconclusive:** garbled output or "Connecting....." forever on the *first* try is usually a wiring
or boot-mode slip (TX/RX swapped, 5 V jumper, switch released too early). Retry twice before calling
it locked. One forum report of exactly this symptom was never resolved.
## Record the outcome
Add a line to the "Status" list on [[dingtian-relay]] with the unit's serial, SKU, firmware version
and the verdict, and a `## [date] query` entry in `log.md`. A locked verdict closes the custom-firmware
question for that unit; the only route is ordering the Development Board Version
([[esp32-custom-controller]] remains deferred, [[open-questions]] #6).
## Related
- [[dingtian-relay]] — hardening gaps that custom firmware would close.
- [[esp32-custom-controller]] — the prevention-grade device this would approximate.
- [[site-device-installation]] — field runbook; this test is a bench task, not a site task.