Files
ESP32-S3-Touch-LCD-5B/wiki/pages/can-bus-integration.md
T

45 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
type: concept
tags: [can-bus, reverse-engineering]
updated: 2026-07-15
---
# CAN Bus Integration
The core technical challenge of the project: reading real data from the [[bmw-m57n-engine]]'s CAN bus and mapping it into the display's data structure.
## Current firmware state (repo)
- ESP32-S3 TWAI peripheral, 500 kbps, **LISTEN_ONLY** mode (cannot disturb the bus — good).
- Falls back to dummy simulated data when CAN is off or failing.
- Configured message map:
| ID | Byte(s) | Mapped to |
|--------|---------|-----------|
| 0x4F | 0 | Coolant temp |
| 0x55 | 7 | Oil temp |
| 0x201 | 3 | Gearbox oil temp |
| 0x1001 | 0, 1 | Gear position / gear number |
| 0x101F | 0–1 | Battery voltage (16-bit BE) |
> [!warning] These IDs are almost certainly placeholders, not real BMW IDs.
> Two red flags: (1) `0x1001` and `0x101F` exceed `0x7FF`, the maximum for standard 11-bit CAN identifiers — BMW E-series PT-CAN of the M57N era uses 11-bit frames `(unverified)`, so these would never match. (2) None of the five IDs appear in community BMW reverse-engineering documentation. The map needs to be rebuilt from real bus captures or a trustworthy source before any of the displayed data can be believed.
> [!info] Research done 2026-07-15
> Web research produced a replacement candidate map — **0x1D0** (coolant + oil temp), **0x1D2** (gear), **0x0B5** (gearbox temp), **0x3B4** (battery voltage) — with confidence ratings and two layout disputes to settle on the bench. Full table and sources: [[can-id-candidates]]. Fault codes are NOT passively broadcast (diagnostic requests required) — the `fault_codes` field needs a design decision.
## Verification plan
1. Get a raw capture of the actual bus (candump / Savvy CAN / cheap USB-CAN dongle) with the engine running. File the log into `raw/`.
2. Identify candidate IDs by watching which bytes track known physical behavior (rev the engine, warm it up, shift gears).
3. Cross-check against community DBC files / reverse-engineering wikis for the donor vehicle.
4. Update `automotive_data.h` `(repo)` and mark each mapping `(verified)` here only after it matches reality on the live bus.
## Signal-source caveat
Coolant/oil temp come from the DDE, but **gearbox temp and gear position come from the EGS module** — they only exist on the bus if the swap retained the automatic transmission and its ECU. `(unverified)` → [[open-questions]]
## Related
[[bmw-m57n-engine]] · [[esp32-s3-touch-lcd-5b]] · [[open-questions]]