From 26e61190f931b39a0efae2a776452186669ac33a Mon Sep 17 00:00:00 2001 From: Julian Cuni Date: Sun, 27 Sep 2026 17:48:40 +0200 Subject: [PATCH] Wiki: step 3 verified - OTA download keeps 24 panel frames/s under XIP from PSRAM --- wiki/index.md | 1 + wiki/log.md | 4 ++ wiki/pages/esp32-s3-touch-lcd-5b.md | 1 + wiki/pages/open-questions.md | 2 +- wiki/raw/perf-xip-ota-20260927-174617.log | 87 +++++++++++++++++++++++ wiki/sources/perf-xip-ota-2026-09-27.md | 39 ++++++++++ 6 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 wiki/raw/perf-xip-ota-20260927-174617.log create mode 100644 wiki/sources/perf-xip-ota-2026-09-27.md diff --git a/wiki/index.md b/wiki/index.md index 0e177b9..7faf3ae 100644 --- a/wiki/index.md +++ b/wiki/index.md @@ -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-xip-ota-2026-09-27]] — **step 3 result**: core rebuilt with XIP-from-PSRAM + IRAM-safe RGB ISR; a full OTA download no longer drops a single panel frame (24/s, 41.5 ms vs 4–8/s, 0.75 s gaps); PSRAM −1.7 MB; dots still to be judged by eye - [[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 diff --git a/wiki/log.md b/wiki/log.md index 4e2b708..2439d78 100644 --- a/wiki/log.md +++ b/wiki/log.md @@ -173,3 +173,7 @@ From the baseline findings. (1) `driveline_screen.cpp`: `setText()` / `setChip() ## [2026-09-27] lint | Correction: bounce buffers were on all along (10 lines, 21 MHz); the dots are late refills While preparing step 2 I found the panel library reads `ESP_PANEL_BOARD_LCD_RGB_*` from its own `BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5_B.h` — bounce buffer = width × 10, pixel clock 21 MHz (→ 24.1 Hz, matching the vsync counter exactly). The three `-DESP_PANEL_LCD_RGB_*` flags in `platformio.ini` were dead names; removed and replaced by a comment. Corrected [[esp32-s3-touch-lcd-5b]] (no more "no bounce buffer" / "16 MHz"), [[perf-dots-and-ota-2026-09-27]] (warning callout with the refined mechanism: a late 20 KB refill makes the DMA re-send the previous 10-line chunk → text-coloured dashes below each line, as in the user's photo `raw/dots-20260927_170136.jpg`), [[open-questions]] #13 (step A void; step 3 now covers dots and OTA). Contributing PSRAM traffic noted from the qio_opi sdkconfig: `CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y` (Wi-Fi buffers in PSRAM), 32 KB data cache / 32 B lines, `LCD_RGB_ISR_IRAM_SAFE` off, XIP off. pioarduino 55.03.33 supports `custom_sdkconfig` (rebuilds the core) — branch `display-xip` next. + +## [2026-09-27] verify | Step 3 (XIP from PSRAM + IRAM-safe RGB ISR): OTA no longer blanks the panel + +Branch `display-xip`: pioarduino `custom_sdkconfig` with `CONFIG_SPIRAM_XIP_FROM_PSRAM`/`FETCH_INSTRUCTIONS`/`RODATA` and `CONFIG_LCD_RGB_ISR_IRAM_SAFE`. First core rebuild (20 min) failed at the end on RainMaker/Insights embedding `https_server.crt`; dropping the unused components with `custom_component_remove` fixed it (rebuild ~3 min after). Flashed COM14, then a scripted `ota install force` with `perf on 1` → [[perf-xip-ota-2026-09-27]]: **24–25 vsync/s, 41.5 ms gap for the entire 33 s download** (stock core an hour earlier: 4–8/s, 290–747 ms). Flash-write blanking is fixed `(verified)`; step 4 (progress bar with the screen on) is unblocked. PSRAM free 6.6 → 4.9 MB, internal 66 → 63 KB, first full redraw 142 ms (no slow-down seen). Generated IDF files git-ignored. Open: dots by eye on the XIP build, swipe-lag comparison, CI must rebuild the core. Updated [[open-questions]] #13, [[esp32-s3-touch-lcd-5b]], index. diff --git a/wiki/pages/esp32-s3-touch-lcd-5b.md b/wiki/pages/esp32-s3-touch-lcd-5b.md index 221176c..3de5e07 100644 --- a/wiki/pages/esp32-s3-touch-lcd-5b.md +++ b/wiki/pages/esp32-s3-touch-lcd-5b.md @@ -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)`: **21 MHz** pixel clock (board header, not the 16 MHz once written here) over 1368 × 637 clocks incl. porches → 24.1 Hz; one frame = 41.5 ms. **Bounce buffers are on**: 2 × 10 lines (20 KB each, internal DMA RAM) set by the library's `BOARD_WAVESHARE_ESP32_S3_TOUCH_LCD_5_B.h`; the `platformio.ini` flag that said 0 was a dead name (removed 2026-09-27). 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]]. +- **XIP from PSRAM cures the flash-write blanking** `(verified 2026-09-27, branch display-xip)`: with `CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE` the panel kept 24 frames/s and a 41.5 ms gap through a whole OTA download (stock core: 4–8 frames/s). Costs ~1.7 MB of PSRAM for resident code and a core rebuild (`custom_sdkconfig`) → [[perf-xip-ota-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)`. diff --git a/wiki/pages/open-questions.md b/wiki/pages/open-questions.md index a969ba7..5b97c3e 100644 --- a/wiki/pages/open-questions.md +++ b/wiki/pages/open-questions.md @@ -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. **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. **Correction the same evening**: the panel library already runs **10-line bounce buffers** and a **21 MHz** clock (the `platformio.ini` flags saying otherwise were dead names) — so the dots are *late bounce refills* re-sending the previous 10-line chunk (the photo shows text pixels echoed below each line), and step 2 as written is moot. **Step 3 (`CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE`, pioarduino `custom_sdkconfig`, branch `display-xip`) now targets both the dots and the OTA blanking.** Fallbacks if dots remain: lower pixel clock (18 MHz), larger bounce buffers, Wi-Fi/LWIP buffers back to internal RAM (`CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n`, costs internal RAM). + 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. **Correction the same evening**: the panel library already runs **10-line bounce buffers** and a **21 MHz** clock (the `platformio.ini` flags saying otherwise were dead names) — so the dots are *late bounce refills* re-sending the previous 10-line chunk (the photo shows text pixels echoed below each line), and step 2 as written is moot. **Step 3 (`CONFIG_SPIRAM_XIP_FROM_PSRAM` + `CONFIG_LCD_RGB_ISR_IRAM_SAFE`, pioarduino `custom_sdkconfig`, branch `display-xip`) now targets both the dots and the OTA blanking.** Fallbacks if dots remain: lower pixel clock (18 MHz), larger bounce buffers, Wi-Fi/LWIP buffers back to internal RAM (`CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=n`, costs internal RAM). **Step 3 built and measured 2026-09-27 17:46 → [[perf-xip-ota-2026-09-27]]: during a full `ota install` the panel held 24–25 refreshes/s with a 41.5 ms gap (stock core: 4–8/s, 290–747 ms). The flash-write blanking is fixed `(verified)`; a progress bar during updates is now possible (step 4). PSRAM free 6.6 → 4.9 MB (code resident there); no render slow-down seen in the one full-redraw sample. Dots on the XIP build still to be judged by eye (Wi-Fi up, idle screen).** 2. ~~**Step A - bounce buffers only**~~ **(void — already on, 10 lines, via the board header; 2026-09-27)** (`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]]. diff --git a/wiki/raw/perf-xip-ota-20260927-174617.log b/wiki/raw/perf-xip-ota-20260927-174617.log new file mode 100644 index 0000000..f519199 --- /dev/null +++ b/wiki/raw/perf-xip-ota-20260927-174617.log @@ -0,0 +1,87 @@ +17:46:18.747 >>> perf on 1 +17:46:18.831 [ 23256][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] [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) +17:46:19.228 [ 60516][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running +17:46:19.828 PERF,61113,0.0,0.0,0,0,0,100,96,95,63268,31732,4891400,24,41576 +17:46:19.941 [ 61220][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #19 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=289 fail=0] +17:46:21.826 PERF,62113,0.0,0.0,0,0,0,99,95,96,63268,31732,4891400,24,41496 +17:46:21.830 PERF,63113,0.0,0.0,0,0,0,100,96,96,63268,31732,4891400,24,41498 +17:46:22.054 [ 63336][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 +17:46:22.827 PERF,64113,0.0,0.0,0,0,0,100,95,96,63268,31732,4891400,24,41497 +17:46:22.827 >>> wifi status +17:46:22.850 [wifi] connected to 'ArtServis', IP 10.0.10.104, RSSI -53 dBm, channel 1 +17:46:22.851 [wifi] saved network: ArtServis +17:46:22.853 [wifi] ESP-NOW ready, sent 303, failed 0 +17:46:23.826 PERF,65113,0.0,0.0,0,0,0,100,96,96,63268,31732,4891400,24,41510 +17:46:24.256 [ 65543][I][main.cpp:152] loop(): [LOOP] Heartbeat - system running +17:46:24.826 PERF,66113,0.0,0.0,0,0,0,100,96,95,63268,31732,4891400,24,41500 +17:46:25.033 >>> ota install force +17:46:25.067 [ota] working - console and screen values pause until done +17:46:25.226 [ 66500][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #44 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=315 fail=0] +17:46:26.585 PERF,67113,0.0,0.0,0,0,0,99,92,50,57880,31732,4839564,24,41604 +17:46:26.588 [ota] installing v0.1.6 -> app1 (1709280 bytes) +17:46:26.831 PERF,68113,1.0,142.0,142,614,67,100,95,18,62772,31732,4888752,24,41569 +17:46:27.067 [ 68349][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 +17:46:28.831 PERF,70113,0.0,0.0,0,0,0,100,96,96,62772,31732,4891200,24,41497 +17:46:29.827 PERF,71113,0.0,0.0,0,0,0,100,96,83,60124,31732,4831640,25,41598 +17:46:30.304 [ota] 0% +17:46:30.507 [ 71784][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #69 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=341 fail=0] +17:46:30.826 PERF,72113,0.0,0.0,0,0,0,100,91,25,55828,31732,4836836,24,41504 +17:46:31.826 PERF,73113,0.0,0.0,0,0,0,100,92,30,55828,31732,4836836,24,41496 +17:46:32.083 [ 73365][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 +17:46:33.728 PERF,74113,0.0,0.0,0,0,0,99,91,30,55828,31732,4834420,24,41515 +17:46:33.728 [ota] 10% +17:46:33.826 PERF,75113,0.0,0.0,0,0,0,99,93,30,55828,31732,4834420,24,41496 +17:46:34.824 +17:46:35.801 [ 77080][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #94 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=367 fail=0] +17:46:36.825 PERF,77113,0.0,0.0,0,0,0,99,91,33,55828,31732,4846500,24,41499 +17:46:36.827 +17:46:37.016 [ota] 20% +17:46:37.113 [ 78386][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 +17:46:37.828 PERF,79113,0.0,0.0,0,0,0,100,91,29,55828,31732,4834420,24,41497 +17:46:38.831 PERF,80113,0.0,0.0,0,0,0,100,92,29,55828,31732,4834420,24,41500 +17:46:40.443 PERF,81113,0.0,0.0,0,0,0,99,92,37,55828,31732,4836836,25,41503 +17:46:40.444 [ota] 30% +17:46:40.827 PERF,82113,0.0,0.0,0,0,0,100,92,28,55828,31732,4832004,24,41525 +17:46:41.090 [ 82368][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #119 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=393 fail=0] +17:46:41.826 PERF,83113,0.0,0.0,0,0,0,100,91,29,55828,31732,4846500,24,41539 +17:46:42.122 [ 83404][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 +17:46:42.826 PERF,84113,0.0,0.0,0,0,0,100,91,30,55828,31732,4846500,24,41497 +17:46:43.786 [ota] 40% +17:46:44.827 PERF,85113,0.0,0.0,0,0,0,99,92,29,55828,31732,4846500,24,41611 +17:46:44.829 PERF,86113,0.0,0.0,0,0,0,100,92,30,55828,31732,4846500,24,41565 +17:46:46.379 PERF,87113,0.0,0.0,0,0,0,99,92,32,55620,31732,4841636,24,41560 +17:46:46.396 [ 87657][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #144 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=419 fail=0] +17:46:47.143 [ 88424][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 +17:46:47.181 [ota] 50% +17:46:47.826 PERF,89113,0.0,0.0,0,0,0,100,91,27,55828,31732,4834420,24,41697 +17:46:48.829 PERF,90113,0.0,0.0,0,0,0,99,92,30,55828,31732,4836836,24,41498 +17:46:49.827 PERF,91113,0.0,0.0,0,0,0,100,92,27,55828,31732,4834420,25,41507 +17:46:50.527 [ota] 60% +17:46:50.830 PERF,92113,0.0,0.0,0,0,0,100,92,30,55828,31732,4834420,24,41497 +17:46:51.669 [ 92948][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #169 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=445 fail=0] +17:46:52.164 PERF,93113,0.0,0.0,0,0,0,99,91,32,55828,31732,4846500,24,41579 +17:46:52.171 [ 93445][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 +17:46:52.825 55828,31732,4841668,24,41499 +17:46:53.782 [ota] 70% +17:46:54.827 PERF,95113,0.0,0.0,0,0,0,99,92,30,55828,31732,4832004,24,41634 +17:46:55.830 PERF,97113,0.0,0.0,0,0,0,0,92,37,55828,31732,4844084,24,41496 +17:46:56.801 [ota] 80% +17:46:56.831 PERF,98113,0.0,0.0,0,0,0,99,92,29,55828,31732,4829588,24,41505 +17:46:56.967 [ 98241][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #194 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=471 fail=0] +17:46:57.186 [ 98467][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 +17:46:57.826 PERF,99113,0.0,0.0,0,0,0,0,90,32,55828,31732,4846500,24,41528 +17:46:58.828 PERF,100113,0.0,0.0,0,0,0,100,91,34,55828,31732,4829492,24,41522 +17:46:59.825 P +17:46:59.903 [ota] 90% +17:47:01.025 P +17:47:01.826 ERF,102113,0.0,0.0,0,0,0,99,93,32,55828,31732,4846500,24,41548 +17:47:01.828 PERF,103113,0.0,0.0,0,0,0,100,92,38,55828,31732,4846500,24,41715 +17:47:02.196 [103478][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 +17:47:02.273 [103552][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #219 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=498 fail=0] +17:47:02.830 PERF,104113,0.0,0.0,0,0,0,99,89,30,55828,31732,4834412,24,41610 +17:47:03.055 [ota] 100% +17:47:03.458 [ota] verified and installed v0.1.6. Rebooting in 3 s; it confirms itself after 30 s of uptime. +17:47:03.827 PERF,105113,1.0,128.0,128,614,62,73,95,28,62772,31732,4891200,24,41616 +17:47:04.828 PERF,106113,0.0,0.0,0,0,0,99,96,96,62772,31732,4891200,24,41496 +17:47:05.831 PERF,107113,0.0,0.0,0,0,0,100,96,96,62552,31732,4891200,24,41496 +17:47:06.457 [107742][W][STA.cpp:137] _onStaArduinoEvent(): Reason: 8 - ASSOC_LEAVE diff --git a/wiki/sources/perf-xip-ota-2026-09-27.md b/wiki/sources/perf-xip-ota-2026-09-27.md new file mode 100644 index 0000000..c7e599e --- /dev/null +++ b/wiki/sources/perf-xip-ota-2026-09-27.md @@ -0,0 +1,39 @@ +--- +type: source +tags: [display, performance, psram, xip, ota, flicker, verified] +updated: 2026-09-27 +--- + +# OTA under XIP-from-PSRAM: the panel keeps every frame (2026-09-27, 17:46) + +Raw: `raw/perf-xip-ota-20260927-174617.log` — scripted session on COM14 (attach without reset, `perf on 1`, `wifi status`, `ota install force`, log until the reboot). Firmware: branch `display-xip` `dev` build = v0.1.6 + perf monitor + **core rebuilt with `CONFIG_SPIRAM_XIP_FROM_PSRAM=y` (`FETCH_INSTRUCTIONS`, `RODATA`) and `CONFIG_LCD_RGB_ISR_IRAM_SAFE=y`** via pioarduino `custom_sdkconfig`. Bench, USB, Wi-Fi joined (RSSI −53 dBm, channel 1). Same test as in [[perf-dots-and-ota-2026-09-27]] an hour earlier on the stock core. + +## Result `(verified)` + +| `ota install force`, v0.1.6, 1.71 MB | stock core (16:59) | XIP core (17:46) | +|---|---|---| +| panel refreshes per second during the download | **4–8** | **24–25** | +| longest gap between refreshes | **290–747 ms** | **41.5–41.7 ms** (one frame) | +| download time | ~36 s | ~33 s | +| core 1 idle during download | 23–31 % | 25–38 % | +| core 0 idle during download | 33–44 % | 89–93 % | +| internal free during download | 59.4 KB | 55.8 KB | +| PSRAM free (idle, before) | 6.60 MB | **4.89 MB** (code + rodata now resident in PSRAM, ~1.7 MB) | + +Not one dropped frame in 33 s of continuous flash writes. The mechanism in the earlier page — cache disabled for every sector write → framebuffer refill starves → restart at vsync — no longer applies: with the code executing from PSRAM the flash operation does not take the PSRAM away, and with the refill interrupt in IRAM it keeps running while flash is busy. **The screen can stay on during an update; a progress bar is now possible** (step 4). + +Also seen: +- Boot / first full redraw under XIP: 614 kpx in 142 ms (stock: ~148 ms) — no measurable render slow-down from executing code out of PSRAM in this one sample; screen-change frames should be compared over a real session. +- Idle Driveline under XIP: 0 fps, LVGL idle 99–100 %, cores 95–96 % idle, 24 vsync/s, gap 41.5 ms — same as the stock core after step 1b. +- Internal free at idle 63.3 KB (stock 66.3 KB); largest block unchanged at 31.7 KB. +- Cost: `custom_sdkconfig` rebuilds the Arduino core: first build 20 min (and it failed on RainMaker/Insights embedding `https_server.crt` until those unused components were dropped with `custom_component_remove`), rebuilds ~3 min, normal incremental builds unchanged. Generated `sdkconfig.defaults`, `sdkconfig.`, `managed_components/`, `.dummy/` are git-ignored. CI must be able to do the same rebuild (open). + +## Still to verify (needs eyes) + +- **Dots**: idle screen with Wi-Fi associated, several minutes, on the XIP build. The vsync counter cannot see them; only the user can. If the refill ISR being IRAM-safe and the flash traffic being gone were the cause, they are gone; if PSRAM bandwidth contention alone can still delay a refill, some may remain → fallbacks on [[open-questions]] #13 (lower pixel clock, larger bounce buffers, Wi-Fi/LWIP buffers to internal RAM). +- **Swipe lag**: screen-change frame times on the XIP build vs the 140–330 ms measured on stock. +- **Gauge Tuning save flicker**: no frame was lost on stock either; expect none. + +## Related + +[[perf-dots-and-ota-2026-09-27]] · [[perf-baseline-2026-09-27]] · [[open-questions]] · [[ota-updates]] · [[esp32-s3-touch-lcd-5b]]