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
+1
View File
@@ -37,6 +37,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
- [[gear-box-can-revealings]] — **gear fully decoded & VERIFIED** (2026-07-16/17): `0x1D2` byte0 = lever, **byte1 = engaged gear 1–6**, byte4 = Drive/Sport/Manual mode; `0x0BA` = the box's own target gear incl. **reverse**; raw at `raw/gear_box_can_revealings.csv` + `raw/gearbox_engaged_gear.csv`
- [[can-capture-2026-07-17-drive]] — **first capture with the vehicle moving** (2026-07-17): verifies `0x0BA` gears 2nd–6th directly (making it a complete gear source), catches the lockup clutch live, and produces the ×0.125 output-shaft scaling evidence; raw at `raw/log_20260717_145930.txt`
- [[e65-reverse-engineering-repo]] — **E65 per-ID DBC-style docs (ingested 2026-07-17)** — the highest-value source yet: settled the gearbox-temp offset (raw−40) and battery layout (12-bit ×0.015), proved the engine was running in our capture, and revealed turbine speed, output shaft, pedal position and cruise state
- [[perf-dots-and-ota-2026-09-27]] — **dots are not dropped frames** (panel 24/s, 41.5 ms gap while dots visible → sub-frame DMA glitches, bounce buffers are the fix) and **OTA drops the panel to 4–8 frames/s** (flash writes blank it ~75 % of the download → XIP step needed before any progress bar)
- [[perf-baseline-2026-09-27]] — **first display-performance baseline** (`perf` monitor, 2026-09-27): per-screen fps / ms per frame / PSRAM copy load / idle; Driveline's needless 10 Hz redraw, 140–330 ms screen-change frames, Simulation tab as the heaviest load, flash writes invisible to LVGL counters (vsync counter needed), monitor blind during OTA
- [[esp32-s3-touch-lcd-5-schematic]] — **the board schematic** (re-downloaded 2026-09-26): VOUT = `I2C_VCC` chosen by solder jumper `H8` (3V3 default / 5V), level-shifted I2C, SY8293 2 A 5 V rail, SD pins, CAN/RS485 GPIOs confirmed
- [[esp32-s3-touch-lcd-5-intro-photo]] — Waveshare annotated board photo (moved into `raw/` 2026-09-21): terminal-block signal order (VIN/GND/VOUT · SDA/SCL · CAN · RS485 A/B · DO0/DO1 · DI), shared CAN/RS485 120 Ω switch, IO0/IO3/IO4/IO46 strapping pads
+3
View File
@@ -166,3 +166,6 @@ Step 1 of the display plan. New `src/modules/perf_monitor.cpp`: LVGL `monitor_cb
From the baseline findings. (1) `driveline_screen.cpp`: `setText()` / `setChip()` write a label or colour only when it differs — idle Driveline went from 9.7 fps, 30 ms/frame, 52 ms/s PSRAM copies, LVGL idle 68 %, core 1 idle 66 % to **0 fps, 0 ms/s, 96 %, 96 %** `(verified bench)`. (2) `perf` now counts the RGB panel's refresh-finished interrupt (attached in the port when tearing-avoidance is off): **≈24 vsync/s, longest gap 41.5 ms** = one frame at the 16 MHz pixel clock; a DMA restart will read as ≥ 83 ms — the first direct instrument for flicker and dots. (3) Periodic PERF moved from `loop()` to an esp_timer so it keeps reporting through the OTA download. Recorded on [[open-questions]] #13 and [[esp32-s3-touch-lcd-5b]]; root CLAUDE.md gained the "write only on change" rule for screen ticks. Next: provoke session with markers, then bounce buffers.
## [2026-09-27] ingest | Perf session with dots on screen + OTA: dots are sub-frame glitches, OTA kills 75 % of frames
`raw/perf-20260927-165903.log` → [[perf-dots-and-ota-2026-09-27]]. User started logging while dots/dashes were visible on the idle Driveline: LVGL 0 fps, cores 95 % idle, **panel 24–25 vsync/s with a 41.5 ms gap** — the frames were all on time, so the dots are FIFO underruns of a few pixels that the driver's restart-in-vsync never sees; only eyes can judge them, and bounce buffers (DMA from internal SRAM) are the designed cure. During `ota install` the panel fell to **4–8 vsync/s, gaps 290–747 ms** (332 ms = 8 frames recurring): each sector write disables the cache and starves the DMA — quantifies why the screen is unusable during updates and sets the step-3 target (24/s, 41.5 ms during install). Trim edits + deferred NVS save and `ota check` lost no frames. Still no markers typed — asked the user what was seen. Updated [[open-questions]] #13, [[esp32-s3-touch-lcd-5b]], index.
+1
View File
@@ -63,6 +63,7 @@ Note: the screen occupies most GPIOs; auxiliary functions (backlight, reset, SD_
- **The dots came back on v0.1.4, gone on v0.1.5** `(verified 2026-09-27, user)`: v0.1.4 limited scans to "Settings open and not connected", but it forgot the network on every restart, so after the OTA restart it sat disconnected and rescanned every 10 s whenever Settings was open. v0.1.5 remembers the network and scans only when the Wi-Fi page opens or Scan is tapped. The underlying weakness remains: the RGB panel streams from PSRAM with no bounce buffer, so heavy Wi-Fi or flash traffic can still disturb the picture ([[open-questions]] #13).
- **Panel refresh rate ≈ 24 Hz** `(verified 2026-09-27, perf vsync counter)`: 16 MHz pixel clock over 1024×600 plus blanking; one frame = 41.5 ms. A steady 41.5 ms longest-gap in `perf` means no DMA restart happened in that window; anything ≥ 83 ms is a dropped frame.
- **Idle screens must render nothing** `(verified 2026-09-27)`: the Driveline tick used to re-set every label at 10 Hz, costing a third of core 1 and 52 ms/s of PSRAM writes with constant data; writing only on change took it to 0 fps / 96 % idle → [[perf-baseline-2026-09-27]].
- **Dots are not dropped frames** `(verified 2026-09-27)`: with dots visible on an idle Driveline the panel completed 24 frames/s with a 41.5 ms gap — they are sub-frame FIFO underruns (a few wrong pixels, frame still on time), which the driver cannot detect; bounce buffers are the fix. **OTA collapses the panel to 4–8 frames/s** (gaps to 0.75 s) for the whole download → [[perf-dots-and-ota-2026-09-27]].
- **The dots are NOT fully gone** `(user, 2026-09-27)`: they still appear occasionally on v0.1.6 with scans limited — so scan policy only reduced the trigger; the PSRAM-streaming weakness itself is what shows. Structural fix (bounce buffers, then XIP-from-PSRAM) is now a committed job, not a nice-to-have → [[open-questions]] #13.
- **SquareLine's screen lifecycle was the freeze risk, not LVGL**: its generated screens are deleted on leave and rebuilt on entry, so any pointer kept elsewhere dangles. Since 2026-09-27 every screen is hand-coded, built once and kept `(repo)`.
- **Uploading over USB from a script on Windows**: esptool crashed printing its progress bar into a cp1252 pipe *in the middle of writing* and left the board frozen until a power cycle; the bootloader then fell back to the other OTA slot, so nothing was lost `(verified 2026-09-27)`. Set `PYTHONIOENCODING=utf-8` when piping upload output.
+1 -1
View File
@@ -75,7 +75,7 @@ The research frontier. Answering any of these should trigger updates across the
**Decision 2026-09-27 (user): this is a must-fix, all steps through XIP, bench time is no constraint.** Two corrections to the record: (a) the flickering dots **still appear occasionally** on v0.1.6 — the scan policy reduced the trigger, it did not remove the weakness; (b) the dark screen during OTA is a **safety/UX defect**, not a mitigation: with no feedback a driver may switch the ignition off mid-update. Requirement: the screen stays on during an update with a visible progress bar and a "do not switch off" message — which needs Step B (flash writes must stop blanking the panel), plus an OTA progress callback on the Updates page. (The OTA design already survives a power cut — the new image is only confirmed after 30 s, else it rolls back — so the risk is a wasted update and a confused user, not a bricked board.)
**Plan agreed 2026-09-27 (next display session, bench + USB, `dev` builds only until verified):**
1. **Baseline first**: Settings → System → Performance overlay (LVGL's perf monitor = real render FPS + CPU; never measured before). Provoke each symptom on purpose: a Wi-Fi scan (dots), a Tuning edit that gets saved (flash write), an update (flash writes). Without numbers there is no telling whether a change helped. **Tooling landed 2026-09-27 `(repo)`**: the `perf` console command (`perf on 1` streams a `PERF,` CSV line per second: fps, ms/frame, flush ms/s, LVGL idle, core idle, heap). **Idle baseline, Driveline screen, bench/USB, v0.1.6+perf**: 9.7 fps rendered (= the screen's own update rate), 30 ms per frame avg (122 ms worst in the first window), ~40 kpx/frame, 52 ms/s copying into the PSRAM framebuffer, LVGL idle 68 %, core 0 idle 94 %, core 1 idle 66 %, internal 66.9 KB free / 31.7 KB largest, PSRAM 6.6 MB free. **Provoke session logged 2026-09-27 → [[perf-baseline-2026-09-27]]**: Driveline redraws ~10×/s with nothing changing (39 kpx, 30 ms, a third of core 1 — an unconditional `lv_label_set_text` every 100 ms `(repo)`); screen changes are single 140–330 ms frames (= the swipe lag; not a bounce-buffer matter); the Simulation tab is the heaviest normal load (2 Mpx/s, 26 % of the time writing PSRAM, LVGL idle 9 %); a flash write is invisible to the LVGL counters, so the monitor needs a **panel vsync/refresh counter** to see flicker and dots directly; the monitor is blind during OTA (ticks from the blocked `loop()`). Heap flat throughout (66–67 KB internal, 31.7 KB largest, 6.6 MB PSRAM). **Plan amended**: 1b = stop the Driveline redraw + add vsync counter + timer-driven PERF, re-baseline; step 2 judged on the Simulation tab and during a scan, by the refresh counter. **Step 1b done 2026-09-27 `(verified, bench)`**: Driveline `tick()` now writes labels/chips only on change → idle Driveline 0 fps, 0 ms/s PSRAM copies, LVGL idle 96 %, core 1 idle 96 % (was 9.7 fps / 52 ms/s / 68 % / 66 %). `perf` gained the panel counters: **~24 vsync/s, longest gap 41.5 ms when healthy** — a DMA restart must show as a gap ≥ 2 frames (≈ 83 ms). Reporting runs from an esp_timer, so OTA is no longer a blind spot. **Next: re-run the provoke session with `#` markers** (scan, tuning save, OTA) to see the vsync gap during each symptom; then step 2 (bounce buffers).
1. **Baseline first**: Settings → System → Performance overlay (LVGL's perf monitor = real render FPS + CPU; never measured before). Provoke each symptom on purpose: a Wi-Fi scan (dots), a Tuning edit that gets saved (flash write), an update (flash writes). Without numbers there is no telling whether a change helped. **Tooling landed 2026-09-27 `(repo)`**: the `perf` console command (`perf on 1` streams a `PERF,` CSV line per second: fps, ms/frame, flush ms/s, LVGL idle, core idle, heap). **Idle baseline, Driveline screen, bench/USB, v0.1.6+perf**: 9.7 fps rendered (= the screen's own update rate), 30 ms per frame avg (122 ms worst in the first window), ~40 kpx/frame, 52 ms/s copying into the PSRAM framebuffer, LVGL idle 68 %, core 0 idle 94 %, core 1 idle 66 %, internal 66.9 KB free / 31.7 KB largest, PSRAM 6.6 MB free. **Provoke session logged 2026-09-27 → [[perf-baseline-2026-09-27]]**: Driveline redraws ~10×/s with nothing changing (39 kpx, 30 ms, a third of core 1 — an unconditional `lv_label_set_text` every 100 ms `(repo)`); screen changes are single 140–330 ms frames (= the swipe lag; not a bounce-buffer matter); the Simulation tab is the heaviest normal load (2 Mpx/s, 26 % of the time writing PSRAM, LVGL idle 9 %); a flash write is invisible to the LVGL counters, so the monitor needs a **panel vsync/refresh counter** to see flicker and dots directly; the monitor is blind during OTA (ticks from the blocked `loop()`). Heap flat throughout (66–67 KB internal, 31.7 KB largest, 6.6 MB PSRAM). **Plan amended**: 1b = stop the Driveline redraw + add vsync counter + timer-driven PERF, re-baseline; step 2 judged on the Simulation tab and during a scan, by the refresh counter. **Step 1b done 2026-09-27 `(verified, bench)`**: Driveline `tick()` now writes labels/chips only on change → idle Driveline 0 fps, 0 ms/s PSRAM copies, LVGL idle 96 %, core 1 idle 96 % (was 9.7 fps / 52 ms/s / 68 % / 66 %). `perf` gained the panel counters: **~24 vsync/s, longest gap 41.5 ms when healthy** — a DMA restart must show as a gap ≥ 2 frames (≈ 83 ms). Reporting runs from an esp_timer, so OTA is no longer a blind spot. **Second session 2026-09-27 → [[perf-dots-and-ota-2026-09-27]]**: (a) with dots on screen and everything idle the panel refreshed perfectly (24/s, 41.5 ms) — **dots are sub-frame DMA data glitches, invisible to the vsync counter, judged by eye only; bounce buffers are the designed fix**; (b) during `ota install` the panel drops to **4–8 refreshes/s with 290–747 ms gaps** — flash writes blank it ~75 % of the time; **no progress bar is possible before step 3**; target 24/s + 41.5 ms during an install. Tuning save and `ota check` lost no frame. Next: step 2 (bounce buffers, 8–10 lines, judged by eye on an idle screen with Wi-Fi up and by `perf` headroom on the Simulation tab).
2. **Step A - bounce buffers only** (`ESP_PANEL_LCD_RGB_BOUNCE_BUF_SIZE`, today 0; start at 10 lines = 1024x10 px, ~20 KB each, two buffers, internal DMA-capable RAM). The panel then reads from internal RAM that the CPU refills from PSRAM, so it tolerates short PSRAM stalls. **Expected to cure the Wi-Fi-traffic dots; will NOT cure flash-write flicker**: while flash is written the cache is disabled, so the refill has nothing to read from either. RAM: 67 KB internal free but the largest block is ~32 KB, so two 20 KB buffers may not fit - if not, shrink the LVGL draw buffer 60 -> 40 lines (frees ~40 KB) and check render speed. The refill costs CPU (measure).
3. **Step B - `CONFIG_SPIRAM_XIP_FROM_PSRAM` (+ `CONFIG_SPIRAM_RODATA`)** via pioarduino `custom_sdkconfig`: code and constants run from PSRAM, so flash writes no longer block PSRAM. **Cures flash-write flicker** (screen could stay on during OTA with a progress bar instead of going dark). Cost/risk: `custom_sdkconfig` rebuilds the Arduino core from source (much slower builds, locally and in CI), and may not work cleanly with this platform version - do it on a branch, release only once it works.
4. **Measure again after each step** (FPS, CPU, which symptoms still reproduce) and record the numbers here and on [[esp32-s3-touch-lcd-5b]].
+2
View File
@@ -270,3 +270,5 @@
16:48:48.914 [158935][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #213 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=815 fail=0]
16:48:49.326 [ota] verified and installed v0.1.6. Rebooting in 3 s; it confirms itself after 30 s of uptime.
16:48:52.331 [162361][W][STA.cpp:137] _onStaArduinoEvent(): Reason: 8 - ASSOC_LEAVE
16:58:59.826 >>> python tools\perf_session.py COM14
16:58:59.826 >>> perf off
+146
View File
@@ -0,0 +1,146 @@
16:59:03.876 >>> perf on 1
16:59:03.880 [ 30257][I][main.cpp:152] loop(): [LOOP] Heartbeat - system runn[188177][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #107 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=914 fail=0]
16:59:03.962 [perf] periodic every 1 s (columns: ts,fps,avg_ms,max_ms,kpx,flush_ms/s,lv_idle,idle0,idle1,int_free,int_largest,psram,vsync/s,vsync_gap_max_us)
16:59:04.496 [188793][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v239 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:04.948
16:59:05.956 PERF,190262,1.0,8.0,8,19,2,91,96,94,66820,31732,6601780,25,41612
16:59:06.948 41501
16:59:07.195 [191501][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:07.955 PERF,192262,0.0,0.0,0,0,0,93,96,94,66820,31732,6601780,24,41498
16:59:08.534 [ota] working - console and screen values pause until done
16:59:08.956 PERF,193262,11.0,7.8,16,25,35,80,94,65,63800,31732,6542036,24,41594
16:59:09.170 [193457][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #132 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=940 fail=0]
16:59:09.514 [193807][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v239 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:09.952 PERF,194262,0.0,0.0,0,0,0,92,89,25,61380,31732,6556892,24,41837
16:59:10.230 [ota] running dev | latest release v0.1.6 (1709280 bytes, signature OK) - `ota install` to update
16:59:10.234 [ota] loop stack headroom after job: 3556 B
16:59:10.956 PERF,195262,6.0,12.3,34,34,24,79,95,61,66320,31732,6601580,24,41591
16:59:11.955 PERF,196262,0.0,0.0,0,0,0,91,96,94,66320,31732,6601580,24,41500
16:59:12.237 [196543][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:12.955 PERF,197262,0.0,0.0,0,0,0,91,96,94,66320,31732,6601580,24,41511
16:59:13.956 PERF,198262,1.0,116.0,116,614,64,0,96,83,66320,31732,6601580,24,41584
16:59:14.069 [198374][I][tuning_screen.cpp:558] build(): [Tuning] Gauge tuning screen built
16:59:14.455 [198742][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #157 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=966 fail=0]
16:59:14.521 [198819][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v239 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:14.956 PERF,199262,2.0,154.0,302,310,64,92,92,54,66320,31732,6601580,24,41625
16:59:15.955 PERF,200262,0.0,0.0,0,0,0,91,96,95,66320,31732,6601580,25,41497
16:59:16.399 [200694][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v240 (changed): ppr=2 trim=-12 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:16.595 [200888][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v241 (changed): ppr=2 trim=-11 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:16.819 [201112][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v242 (changed): ppr=2 trim=-10 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:16.955 PERF,201262,26.0,4.8,14,7,26,74,91,79,66320,31732,6601580,24,41721
16:59:17.301 [201607][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:17.733 [202027][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v243 (changed): ppr=2 trim=-11 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:17.955 PERF,202262,8.0,5.0,10,7,7,82,94,89,66320,31732,6601580,24,41645
16:59:17.988 [202281][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v244 (changed): ppr=2 trim=-12 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:18.209 [202504][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v245 (changed): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:18.955 PERF,203262,14.0,4.8,12,7,13,91,93,86,66320,31732,6601580,24,41563
16:59:19.790 [204079][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #182 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=998 fail=0]
16:59:19.955 PERF,204262,0.0,0.0,0,0,0,92,94,95,66320,31732,6601580,24,41505
16:59:20.956 PERF,205262,7.0,24.2,134,83,66,90,95,78,66320,31732,6601580,24,41504
16:59:21.956 PERF,206262,11.0,13.2,96,58,65,64,95,78,66320,31732,6601580,24,41508
16:59:22.316 [206622][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:22.955 PERF,207262,6.0,6.3,8,16,14,91,96,90,66320,31732,6601580,24,41729
16:59:23.227 [207519][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v245 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:23.889 [cfg] override mode=1 rpm=0 duty=0 (not saved)
16:59:23.931 [208224][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v246 (changed): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=1
16:59:23.953 PERF,208262,5.0,33.2,136,114,66,63,92,77,66320,31732,6601580,24,41751
16:59:24.955 PERF,209262,3.0,14.0,32,38,13,89,96,90,66320,31732,6601580,24,41498
16:59:25.084 [209379][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #207 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1025 fail=0]
16:59:25.330 [cfg] override mode=1 rpm=3952 duty=0 (not saved)
16:59:25.365 [209665][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v247 (changed): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=1
16:59:25.956 PERF,210262,14.0,23.7,34,86,135,28,92,59,66320,31732,6601580,25,41597
16:59:26.728 [cfg] override mode=0 rpm=3952 duty=0 (not saved)
16:59:26.759 [211059][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v248 (changed): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:26.951 PERF,211262,5.0,6.4,8,8,5,92,95,91,66320,31732,6601580,24,41537
16:59:27.389 [211694][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:27.955 PERF,212262,10.0,29.6,36,98,121,0,95,60,66320,31732,6601580,24,41556
16:59:27.992 [cfg] override mode=0 rpm=0 duty=0 (not saved)
16:59:28.033 [212333][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (changed): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:28.952 PERF,213262,5.0,17.2,32,71,31,83,94,88,66320,31732,6601580,24,41501
16:59:29.949 ,41617
16:59:30.399 [214688][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #232 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1053 fail=0]
16:59:30.956 PERF,215262,1.0,138.0,138,614,62,64,94,80,66320,31732,6601580,24,41599
16:59:31.956 PERF,216262,1.0,8.0,8,27,3,0,96,92,66320,31732,6601580,24,41498
16:59:32.476 [216782][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running
16:59:32.956 PERF,217262,3.0,46.0,120,163,68,0,96,77,66320,31732,6601580,24,41506
16:59:33.051 [217345][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:33.957 PERF,218262,7.0,22.0,116,82,92,0,94,61,66320,31732,6601580,24,41602
16:59:34.955 PERF,219262,2.0,147.0,278,318,26,91,96,86,66320,31732,6601580,24,41660
16:59:35.681 [219970][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #1 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1079 fail=0]
16:59:35.729 [ota] working - console and screen values pause until done
16:59:35.956 PERF,220262,4.0,46.5,140,176,77,86,94,73,63800,31732,6558824,25,41725
16:59:36.955 PERF,221262,0.0,0.0,0,0,0,91,92,22,61428,31732,6550072,24,41637
16:59:37.503 [ota] installing v0.1.6 -> app1 (1709280 bytes)
16:59:37.958 PERF,222262,1.0,160.0,160,614,70,64,94,39,66320,31732,6601580,24,42322
16:59:38.063 [222356][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:38.955 PERF,223262,0.0,0.0,0,0,0,93,94,94,66320,31732,6601580,24,41525
16:59:39.956 PERF,224262,0.0,0.0,0,0,0,92,96,95,66320,31732,6601580,24,41510
16:59:40.963 [225251][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #26 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1105 fail=0]
16:59:41.250 [ota] 0%
16:59:41.969 PERF,226271,0.0,0.0,0,0,0,95,43,26,59376,31732,6544660,5,331969
16:59:42.972 PERF,227278,0.0,0.0,0,0,0,96,37,28,59376,31732,6542356,4,747276
16:59:43.098 [227385][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:43.994 PERF,228297,0.0,0.0,0,0,0,91,37,29,59376,31732,6544768,6,373448
16:59:44.956 PERF,229262,0.0,0.0,0,0,0,96,39,31,59376,31732,6556888,6,291250
16:59:45.138 [ota] 10%
16:59:45.956 PERF,230262,0.0,0.0,0,0,0,82,32,23,59376,31732,6556876,5,331968
16:59:46.683 [230982][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #51 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1131 fail=0]
16:59:46.990 PERF,231295,0.0,0.0,0,0,0,93,33,27,59376,31732,6542384,4,331968
16:59:47.973 PERF,232283,0.0,0.0,0,0,0,85,37,29,59376,31732,6544788,6,331969
16:59:48.110 [232411][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:48.743 [ota] 20%
16:59:48.954 PERF,233264,0.0,0.0,0,0,0,94,35,27,59376,31732,6544804,4,331969
16:59:49.952 PERF,234262,0.0,0.0,0,0,0,95,39,31,59376,31732,6547224,6,331969
16:59:50.965 PERF,235274,0.0,0.0,0,0,0,93,36,28,59376,31732,6547216,4,331967
16:59:51.952 PERF,236262,0.0,0.0,0,0,0,95,33,25,59376,31732,6552048,4,331969
16:59:52.227 [236529][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #76 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1157 fail=0]
16:59:52.392 [ota] 30%
16:59:52.952 PERF,237262,0.0,0.0,0,0,0,91,33,25,59156,31732,6551976,4,331968
16:59:53.123 [237416][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:53.990 PERF,238295,0.0,0.0,0,0,0,96,33,26,59376,31732,6544788,6,331968
16:59:54.960 PERF,239269,0.0,0.0,0,0,0,94,44,36,59376,31732,6547188,8,331969
16:59:55.957 PERF,240262,0.0,0.0,0,0,0,94,36,30,59376,31732,6556876,7,331968
16:59:56.222 [ota] 40%
16:59:56.979 PERF,241286,0.0,0.0,0,0,0,95,33,25,59376,31732,6542304,5,331968
16:59:57.960 PERF,242264,0.0,0.0,0,0,0,95,44,34,59376,31732,6547100,7,332029
16:59:58.020 [242287][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #101 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1183 fail=0]
16:59:58.156 [242459][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
16:59:58.986 PERF,243293,0.0,0.0,0,0,0,94,32,24,59376,31732,6544660,4,331968
17:00:00.068 PERF,244262,0.0,0.0,0,0,0,0,34,26,59376,31732,6549452,5,331802
17:00:00.069 [ota] 50%
17:00:00.988 PERF,245297,0.0,0.0,0,0,0,94,35,27,59376,31732,6542348,6,331968
17:00:01.958 PERF,246268,0.0,0.0,0,0,0,97,34,26,59376,31732,6542388,6,290838
17:00:02.984 PERF,247289,0.0,0.0,0,0,0,95,37,29,59376,31732,6547224,4,331969
17:00:03.186 [247487][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
17:00:03.585 [247886][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #126 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1210 fail=0]
17:00:03.876 [ota] 60%
17:00:03.953 PERF,248262,0.0,0.0,0,0,0,94,35,29,59376,31732,6556876,7,331968
17:00:04.948
17:00:05.956 PERF,250262,0.0,0.0,0,0,0,94,37,28,59376,31732,6556888,7,290482
17:00:06.958 PERF,251262,0.0,0.0,0,0,0,95,39,30,59376,31732,6556892,6,290844
17:00:07.248 [ota] 70%
17:00:07.956 PERF,252262,0.0,0.0,0,0,0,90,39,29,59376,31732,6556876,6,290471
17:00:08.233 [252497][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
17:00:08.953 PERF,253262,0.0,0.0,0,0,0,93,35,26,59376,31732,6556876,4,331971
17:00:09.128 [253396][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #151 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1236 fail=0]
17:00:10.835 PERF,254262,0.0,0.0,0,0,0,0,38,30,59376,31732,6556876,6,291034
17:00:10.836 [ota] 80%
17:00:10.956 PERF,255262,0.0,0.0,0,0,0,95,38,28,59376,31732,6556876,7,291116
17:00:11.951 PERF,256262,0.0,0.0,0,0,0,86,37,29,59376,31732,6556876,6,290473
17:00:12.948
17:00:13.226 [257521][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
17:00:13.949
17:00:14.257 [ota] 90%
17:00:14.616 [258876][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #176 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1262 fail=0]
17:00:14.952 PERF,259262,0.0,0.0,0,0,0,95,39,33,59376,31732,6547200,6,290474
17:00:15.955 PERF,260262,0.0,0.0,0,0,0,94,38,29,59376,31732,6544784,5,290836
17:00:16.955 PERF,261262,0.0,0.0,0,0,0,95,39,30,59376,31732,6556888,7,290894
17:00:17.623 [ota] 100%
17:00:17.956 PERF,262262,0.0,0.0,0,0,0,95,53,17,66068,31732,6601536,10,373467
17:00:18.049 [ota] verified and installed v0.1.6. Rebooting in 3 s; it confirms itself after 30 s of uptime.
17:00:18.234 [262527][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v249 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
17:00:18.958 PERF,263262,1.0,148.0,148,614,65,65,91,72,66320,31732,6601580,22,124588
17:00:20.072 PERF,264262,0.0,0.0,0,0,0,0,96,94,66320,31732,6601580,24,41564
17:00:20.095 [264372][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #201 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1288 fail=0]
17:00:20.949
17:00:21.051 [265359][W][STA.cpp:137] _onStaArduinoEvent(): Reason: 8 - ASSOC_LEAVE
@@ -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]]