Skip to main content

NM-EPD-420 Factory Test Quick Start

This guide walks you through running the factory test firmware on the NM-EPD-420 board.

What This Firmware Does​

The factory test firmware exercises every on-board peripheral in a fixed sequence (T0–T11), shows a result page on the EPD for every step, and lets the operator confirm or reject each step with the USER and BOOT buttons. At the end a one-page summary screen lists every test as PASS / FAIL / SKIP.

  • Boots the board and initialises every peripheral driver
  • Runs 10 hardware tests one after another
  • Renders a dedicated screen for every test on the 3-color e-paper panel
  • Plays audio tones and Beethoven's Ode to Joy through the ES8311 codec
  • Records a short voice clip from the LMD4737 DMIC and computes RMS
  • Probes I2C, scans Wi-Fi, mounts an SD card, talks to the LoRa modem
  • Prints a structured summary on the EPD and a machine-parseable line on the serial port

A complete run typically takes ~3 minutes, dominated by EPD full-refresh time (~10 s per page on a 3-color panel).

Test Sequence​

TestItemDescriptionScreen
T0System startupSerial / EPD init, welcome screen, wait USERT0
T1EPD displayWhite / Black / Red fill + text demo (four-color SKU adds yellow fill / text)—
T2WS2812 RGB LEDRED → GREEN → BLUE → WHITE cycleT2
T3ButtonsUSER key and BOOT key press detection—
T4ES8311 codecSweep 500/1k/2k/3k Hz + Ode to Joy melodyT4
T5DMIC micVoice record + speaker loopback + RMS checkT5
T6AHT20 sensorTemperature & humidity over I2CT6
T7Battery ADCBattery divider voltage (SKIP if not fitted)—
T8Wi-Fi scan2.4 GHz AP scan, expect ≥ 1 networkT8
T9SD card R/WFSPI mount + write / read-back verifyT9
T10LoRa SPI busReset modem, check BUSY low—
T11SummaryPer-item PASS/FAIL/SKIP table + verdictT11

On the four-color SKU NM-EPD-420-4C, T1 checks white, black, red, and yellow full-screen fills followed by black / red / yellow text. Each full refresh takes about 25–30 seconds on this panel and partial refresh is not supported, so T1 takes noticeably longer than on the tri-color or black/white versions.

Operator Workflow​

power on
│
▼
┌─────────────┐
│ T0 Welcome │ ──► press USER
└─────────────┘
│
▼
┌─────────────┐
│ T1 – T10 │
│ for each: │
│ show screen
│ run hardware
│ USER = PASS
│ BOOT = FAIL
└─────────────┘
│
▼
┌─────────────┐
│ T11 Summary │ ──► halt; power-cycle to retest
└─────────────┘

Buttons are debounced (5 – 10 ms samples) and gated against EPD BUSY so a press during a refresh cannot be consumed as a verdict for the next test.

Build & Flash​

Prerequisites: PlatformIO Core (or VS Code + PlatformIO extension).

# Clone the repository, then in repo root:
$env:IDF_GITHUB_ASSETS = "dl.espressif.cn/github_assets" # optional, China mirror
pio run # build
pio run --target upload --upload-port COM38 # flash
pio device monitor --baud 115200 # serial console

The commands above use the default nm-epd-420 environment (tri-color panel). For the four-color SKU NM-EPD-420-4C, select the nm-epd-420-4c build environment instead:

  • pio run -e nm-epd-420-4c — build
  • pio run -e nm-epd-420-4c --target upload --upload-port COM38 — flash

Or one-shot via VS Code tasks:

  • Build (nm-epd-420)
  • Upload (nm-epd-420)

The first build downloads the ESP-IDF toolchain (~hundreds of MB) into %USERPROFILE%\.platformio. Subsequent builds take ~25 s.

Serial Output Example​

[FACTORY TEST] Board: NM-EPD-420
[FACTORY TEST] FW: v1.3.10
[FACTORY TEST] T0 - System startup OK
...
[FACTORY TEST] T1 START - EPD Display
[T1] Round 1/4 - Filling screen WHITE ...
[T1] BUSY self-check: sawHigh=1 highMs=2873
...
[FACTORY TEST] ===== SUMMARY =====
[FACTORY TEST] T1 EPD Display [PASS]
[FACTORY TEST] T2 WS2812 RGB LED [PASS]
...
[FACTORY TEST] Overall: FACTORY_TEST=OK

Troubleshooting​

IssueSolution
sawHigh=0 on T1Check BUSY-pin wiring (open net, cold solder joint, wrong GPIO)
EPD misbehaves after portingLook at Display::resync() in src/ui/display_helper.h
No audio on T4Verify PIN_PA_CTRL is HIGH and external PA is enabled
SD card fails on T9Ensure HSPI pins (7–11) are not occupied by other functions
Wi-Fi scan empty on T8Move closer to an AP or check antenna connection

Reference​