--- type: concept tags: [architecture, uart] updated: 2026-09-21 --- # Dual-Controller Architecture The system is two ESP32-S3 boards linked by UART **and ESP-NOW** (repo, protocol v2 since 2026-09-21): ``` BMW M57N CAN bus ──▶ Controller A ──UART1 + ESP-NOW, 5 Hz──▶ Controller B ──▶ Patrol tach + temp gauge (this repo: (ESP32-S3-LCD-1.3, 5" 1024×600 display) 1.3" round display, gauge outputs) ``` - **Controller A** — [[esp32-s3-touch-lcd-5b]]: listens to the CAN bus, renders the main UI, and re-broadcasts a compact sensor packet over UART1 (GPIO 43/44, 115200 baud) at 5 Hz. - **Controller B** — ESP32-S3-Touch-LCD-1.3: a secondary display fed purely by that UART stream. Lives in a sibling repo (`bmw-patrol/` parent directory). ## Link protocol v2 (repo, 2026-09-21) `0xAA | 0x02 | type | length | payload | XOR | 0x55`, identical on UART1 (GPIO 44 → SP3485 → `485_A`/`485_B`) and ESP-NOW broadcast (channel 1). DATA frames (lever, target/engaged gear nibbles, rpm, temps, battery, alert bitmap, valid flags) every 200 ms; CONFIG frames (`link_config_t`: Patrol gauge calibration + alert thresholds, edited on A via the `cfg` serial console and stored in NVS) on change and every 5 s. Alerts are decided here; B only renders them. Spec: `docs/UART_PROTOCOL.md`. Bench-verified with both transports live and B deduplicating every frame `(verified 2026-09-21)`. Controller B's side of this (receiver, ESP-NOW channel hopping, gauge outputs, bench wiring) is documented in the sibling wiki: `../../ESP32-S3-LCD-1.3/wiki/pages/controller-link.md` and `patrol-gauge-outputs.md`. ## Why it matters for the wiki Any change to what data we extract from the [[can-bus-integration]] ripples into this packet **and** into Controller B's parser — both ends must move together: edit `include/protocol/automotive_data.h` here, bump `PACKET_VERSION`, copy the header byte-identical to B (B rejects other versions). ## Related [[esp32-s3-touch-lcd-5b]] · [[can-bus-integration]]