6.6 KiB
type, tags, updated
| type | tags | updated | |||||||
|---|---|---|---|---|---|---|---|---|---|
| source |
|
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). > [!warning] Correction (same day, after reading the panel library)
Bounce buffers are already active. The board header
BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5_B.hsetsESP_PANEL_BOARD_LCD_RGB_BOUNCE_BUF_SIZE = width × 10(two 10-line, 20 KB internal buffers) andESP_PANEL_BOARD_LCD_RGB_CLK_HZ = 21 MHz; the-DESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE=0flag inplatformio.iniused a name the library never reads (removed). The wiki's earlier "no bounce buffer, 16 MHz" claims were wrong. 21 MHz over 1368 × 637 clocks per frame = 24.1 Hz — matches the measured vsync rate exactly(verified).With bounce buffers in use the dots have a sharper explanation: the DMA streams 10-line chunks from internal SRAM while an interrupt refills the other chunk from the PSRAM framebuffer (a 20 KB copy every ~690 µs, ~29 MB/s). When that refill is late — PSRAM/flash bus busy (Wi-Fi/LWIP buffers live in PSRAM:
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y; flash cache misses on either core), or the interrupt delayed — the DMA re-sends the previous chunk's pixels, i.e. content from ~10 lines above appears displaced: exactly the text-coloured dashes under each text line in the photo. Frame timing is untouched, so vsync stays perfect. The fix is therefore not "add bounce buffers" but make the refill never miss:CONFIG_LCD_RGB_ISR_IRAM_SAFE(refill ISR keeps running while flash is busy) andCONFIG_SPIRAM_XIP_FROM_PSRAM(code and constants execute from PSRAM, so flash writes no longer stop the world and there is no flash↔PSRAM switching) — both sdkconfig options, i.e. step 3 covers the dots as well as the OTA blanking.
Photo evidence raw/dots-20260927_170136.jpg (user, 17:01, Settings screen static, Wi-Fi connected): the dashes sit a few rows below each text line and carry that line's colour — green under the green SSID, white under white labels. They are the text's own pixels arriving late and being clocked out in the wrong place: a FIFO underrun of a few pixels with the frame timing intact. Exactly the sub-frame glitch the counters cannot see.
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 as written (add bounce buffers) is moot — they are already on. What remains of step 2: the refill's slack can be widened by a lower pixel clock (21 → 18 MHz ≈ 20.7 Hz refresh) or bigger bounce buffers (internal RAM cost); both are fallbacks if step 3 leaves residual dots.
- 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