Files
ESP32-S3-Touch-LCD-5B/wiki/pages/dual-controller-architecture.md
T
2026-09-27 07:55:09 +02:00

3.0 KiB
Raw Permalink Blame History

type, tags, updated
type tags updated
concept
architecture
uart
2026-09-27

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).

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).

ESP-NOW and Wi-Fi share the radio (verified 2026-09-26). When A joins a Wi-Fi network (for OTA), its channel follows the AP (seen: 6, 9, 11) and B hops to find it; ESP-NOW kept running (6,410 frames, 0 failed). Until 2026-09-26 the Wi-Fi code powered the radio off on connect/disconnect (WiFi.disconnect(true)), which silently killed ESP-NOW and left B on the wire only — fixed, and EspNowLink::send() now re-initialises ESP-NOW if the driver drops it. Planned: Controller B's firmware updates will travel from A over ESP-NOW (bidirectional, unlike the one-way wire) → ota-updates.

A keeps the ESP-NOW channel stable (v0.1.5, 2026-09-27) (repo): Wi-Fi auto-reconnect is off. A tries the remembered network once at boot and once after a drop, then parks the radio back on channel 1 — an endless reconnect (e.g. driving away from home Wi-Fi) would keep hopping channels under the link to B. Scans happen only when someone opens the Wi-Fi page or taps Scan.

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).

esp32-s3-touch-lcd-5b · can-bus-integration