Wiki: dots are sub-frame DMA glitches (panel 24/s while visible); OTA drops panel to 4-8 fps
Firmware / build (push) Successful in 6s

This commit is contained in:
2026-09-27 17:03:36 +02:00
parent 6593abe9f5
commit 5a874ff943
7 changed files with 209 additions and 1 deletions
@@ -0,0 +1,55 @@
---
type: source
tags: [display, performance, psram, dma, flicker, ota, verified]
updated: 2026-09-27
---
# Perf session with dots on screen, then an OTA (2026-09-27, 16:59–17:00)
Raw: `raw/perf-20260927-165903.log` — second `tools/perf_session.py COM14` run, firmware `dev` = v0.1.6 + perf monitor with the **panel vsync counter** (step 1b). Bench, USB, Wi-Fi joined. The user started the session **while the screen was showing horizontally aligned small dots and dashes** on the idle Driveline screen, then ran `ota check`, edited trim on Gauge Tuning (deferred NVS save), toggled the Simulation override, and installed v0.1.6 over the air. No `#` markers were typed; the timeline comes from the board's own lines.
## The two results
### 1. Dots are NOT dropped panel frames `(verified)`
| 16:59:05–07, Driveline idle, dots visible (user) | value |
|---|---|
| frames LVGL rendered | 0–1 per second |
| PSRAM copy time | 0–2 ms/s |
| LVGL idle / core 0 idle / core 1 idle | 91–93 % / 96 % / 94 % |
| **panel refreshes** | **24–25 per second** |
| **longest gap between refreshes** | **41.5–41.6 ms = exactly one frame** |
The RGB panel completed every frame on time while the dots were on screen, with the CPUs idle and nothing being drawn. So the dots are **not** the DMA restart the driver knows about (`RESTART_IN_VSYNC`) — they are **sub-frame data glitches**: the LCD DMA's FIFO runs dry for a handful of pixels while the PSRAM bus is busy elsewhere, the peripheral keeps clocking, wrong pixels go out, the frame still ends on time. That is why they look like short horizontal dashes and why the vsync counter cannot see them. Who was using the PSRAM/flash bus with LVGL idle: Wi-Fi (associated), ESP-NOW every 200 ms, the UART/console tasks, and every **flash cache miss** — on this module the flash and the OPI PSRAM share the SPI0 bus, so instruction fetches from flash steal cycles from the framebuffer DMA `(unverified: bus-sharing detail)`. This is precisely the failure mode Espressif's **bounce buffers** exist for (the DMA reads internal SRAM; the CPU refills it from PSRAM with slack), and why `XIP_FROM_PSRAM` also helps (fewer flash↔PSRAM bus switches).
Consequence for measurement: **dots can only be judged by eye** (or a camera); the vsync gap is the instrument for *flicker* and *frame loss*, not for dots.
### 2. During an OTA the panel loses ~75 % of its frames `(verified)`
| 16:59:41 → 17:00:17, `ota install` v0.1.6 (1.71 MB, ~42 KB/s) | value |
|---|---|
| panel refreshes | **4–8 per second** (healthy: 24) |
| longest gap | **290–747 ms** (healthy: 41.5) — repeatedly 332 ms ≈ 8 frames |
| core 0 / core 1 idle | 33–44 % / 23–31 % |
| LVGL rendered frames | 0 (the job owns the loop; nothing is drawn) |
| internal free | 59.4 KB (TLS buffers); back to 66 KB after |
Every flash write disables the cache, the PSRAM framebuffer becomes unreadable, the DMA underruns, the driver restarts at the next vsync — and the next sector write hits again. With ~42 KB/s of writes the panel is dead about three quarters of the time. This is the mechanism behind "the screen goes dark during updates", independent of the backlight: **no on-screen progress bar is possible until flash writes stop blanking the panel** → step 3 (`CONFIG_SPIRAM_XIP_FROM_PSRAM`). Target after step 3: 24 refreshes/s and a 41.5 ms gap throughout `ota install`.
Reboot after install: gap 373 ms at 17:00:17 (slot switch), 125 ms at 17:00:18 (first full redraw, 614 kpx, 148 ms), back to 41.5 ms at 17:00:20.
## Other observations
- `ota check` (16:59:08–10): core 1 idle fell to 25 % (TLS in the loop task), internal free dipped to 61 KB, **no frame lost** (gap 41.8 ms).
- Trim edits (16:59:16–18) and the deferred NVS save ~3 s later: **no frame lost** (gap 41.5 ms). A single small NVS write is short enough to hide inside a frame; the old per-tap saves were many of them in a row.
- Screen changes are single 116–160 ms frames of 614 kpx, as in the first session — the swipe lag, unaffected by 1b (only idle redraws were removed).
- Step 1b confirmed in the wild: idle Driveline windows show 0 fps and 0 ms/s of PSRAM copying.
## Consequences for [[open-questions]] #13
- **Step 2 (bounce buffers)** is aimed at the dots. Success criterion: the user no longer sees dots on an idle screen with Wi-Fi associated, and the Simulation tab / a Wi-Fi scan still leave core 1 with headroom (`perf` idle columns). The vsync gap must stay at 41.5 ms (a badly sized bounce buffer would *add* restarts).
- **Step 3 (XIP from PSRAM)** is aimed at the OTA collapse and any flash-write flicker. Success criterion: 24 vsync/s, 41.5 ms gap during `ota install`. Only then does step 4 (progress bar on screen) make sense.
## Related
[[perf-baseline-2026-09-27]] · [[open-questions]] · [[esp32-s3-touch-lcd-5b]] · [[ota-updates]]