Files
ESP32-S3-Touch-LCD-5B/wiki/pages/can-id-candidates.md
T
julian 0a58afca9a Gear decode VERIFIED: real 0x1D2 map in firmware + wiki
The gear lever is fully decoded and confirmed on the actual swap bus
(raw/gear_box_can_revealings.csv): 0x1D2 byte0 = P 0xE1 / R 0xD2 / N 0xB4 /
D 0x78, matching the documented BMW codes exactly. Byte4 splits D vs S/M
(0xF0 auto) and carries manual +/- shifts.

Firmware:
- automotive_data.h: replace placeholder gear map (0x1001) with CAN_ID_GEAR_LEVER
  0x1D2, verified byte-0 codes, byte-4 mode define, and can_to_gear_lever().
- can_driver.cpp: decode 0x1D2 byte0 into gear_position via the enum; reject
  unrecognized codes instead of copying the raw byte.
- Scope: P/R/N/D only (verified). S/M shows as D for now (no enum slot; engaged
  gear number needs a drive capture) — TODO'd, not faked. Coolant/oil/battery
  left as flagged placeholders pending a cold-start capture.

Wiki:
- New source page gear-box-can-revealings + raw CSV filed.
- can-id-candidates: 0x1D2 gear row -> VERIFIED; encoding "dispute" section
  rewritten with the full lever+mode decode table.
- Updated index + log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 14:54:06 +02:00

10 KiB
Raw Blame History

type, tags, updated
type tags updated
synthesis
can-bus
reverse-engineering
e60
research
2026-07-16

E60/E65 CAN ID Candidates (Research Results)

Findings from the 2026-07-15 deep-research run (95 claims extracted from ~15 sources, 30 adversarially verified against primary repos before the run was interrupted; synthesis done manually from the journal). These are the IDs to program into the firmware for bench testing against a live capture — none are (verified) until seen on the actual swap's bus.

[!success] Live capture 2026-07-15 — the map is CONFIRMED on the real bus First dump off the actual swap's bus (can-capture-2026-07-15) validates the research:

  • All four signal IDs are live: 0x1D0, 0x1D2, 0x0B5, 0x3B4 (+ bonus 0x0AA, 0x0BA). (verified: present)
  • The firmware's placeholder IDs are absent — confirmed junk. (verified: absent)
  • 0x1D0 byte0 drifts up 0x55→0x58 = coolant warming (−48 scaling holds). Oil temp 0x1D0 byte1 = 0xFF (not populated here).
  • 0x1D2 gear fully VERIFIED (2026-07-16, gear-box-can-revealings): byte0 0xE1=P/0xD2=R/0xB4=N/0x78=D — all codes match; byte4 splits D vs S/M and carries manual +/− shifts.
  • Absent despite being researched: 0x130, 0x304, 0x192.
  • Still needs a cold-start + confirmed-engine-running capture to lock scaling on coolant/battery. See the source page for the full table.

The map (replaces the firmware's placeholder IDs)

Signal CAN ID Bytes Scaling Sender Rate Confidence
Coolant temp 0x1D0 byte 0 °C = raw − 48 DME/DDE 100 ms Very high — verified verbatim in E65 docs, present in E90-gen DBC, confirmed live on a real E60 545i, E60 tool32 table lists 0x1D0 "Motordaten" from DDE1 (diesel!), and the e60-vfl-can-codes-xlsx sheet shows 0x7A→74 °C on a real E60 VFL (raw−48 checks out)
Engine oil temp 0x1D0 byte 1 °C = raw − 48 DME/DDE 100 ms High — same sources as coolant
Gearbox oil temp 0x0B5 ("Torque_request_EGS") byte 7 ⚠ disputed: raw + 0 vs raw + 40 EGS ? Medium — in the E9x community DBC; absent from the E65 repo's decoded EGS messages. Offset must be settled on the bench (a ~40 °C error is dangerous — resolve before trusting)
Gear lever position 0x1D2 ("TransmissionDataDisplay") byte 0 0xE1=P 0xD2=R 0xB4=N 0x78=D/(S/M); split D vs S/M with byte 4 (0xF0 auto / 0xF1 S-M) EGS 200 ms ✅ VERIFIED on the swap bus 2026-07-16 — every code matches. Full decode: gear-box-can-revealings
Current gear number 0x1D2 byte 1 upper nibble (GearAct, −4 offset) or 0x0BA bits 0–3 (E65: values P/R/N…6th) EGS 20–200 ms Medium — two candidate messages; also 0x304 "Gear lever" — the E60 VFL sheet shows a 2-byte lever message: P=0xE3, R=0xC2, N=0xD1, M=0xC9 (its D=0xC2 duplicates R — likely a sheet typo)
Battery voltage 0x3B4 ("Powermanagement Batteriespannung") ⚠ disputed layout 12-bit LE × 0.015 V (E65, verified: 0x3D9→14.775 V) vs 24-bit BE × 0.001 V (E90 DBC) Power module / DDE 5 s (E65) High on ID (E60 tool32 table + E60 VFL sheet: 64 F3→12.76 V, consistent with the 12-bit LE layout though implying factor ≈0.0147 vs 0.015). Bonus from the sheet: byte 3 = engine running flag (0x09 on / 0x00 off)
Engine RPM (bonus) 0x0AA bytes 4–5 RPM = raw / 4 DME/DDE 10 ms High — cross-generation (E65 + E90 comment)
Ignition/terminal status (bonus) 0x130 byte 0 bitmasks 0xD5/0xC5/0xC1 CAS 100 ms Medium — used by an M57 project as its only passive decode

The 0x1D2 encoding dispute — ✅ RESOLVED on the swap bus (2026-07-16)

The live lever capture (gear-box-can-revealings) settles it — DLC 6, whole-byte codes in byte 0, matching the documented table exactly:

Byte Meaning Values
0 Lever position 0xE1=P, 0xD2=R, 0xB4=N, 0x78=D and S/M
1 Drive-gate flag 0x0F in P/R/N, 0x5F in D + S/M
3 Rolling counter fluctuates — ignore (matches the predicted byte-3 counter)
4 Mode / manual shift 0xF0=Drive(auto), 0xF1=Sport/Manual, 0xF2=downshift (−); up-shift (+) unconfirmed

Byte 0 alone gives P/R/N/D; byte 4 splits D vs S/M (Steptronic side-gate) and carries the manual +/− nudges. The old "dispute" was just notation — the E65 whole-byte values and the E90 low-nibble scheme agree (0xE1 low nibble = 1 = P, etc.), and this bus speaks the whole-byte/DLC-6 dialect.

The firmware's automotive_data.h gear map should be rewritten to 0x1D2 byte 0 (+ byte 4 for S/M). → can-bus-integration

Field checklist for the live capture session

Setup: 500 kbps, board's 120 Ω termination switch OFF, common ground with the vehicle, tap CAN-H/CAN-L on the PT-CAN. (Note: the firmware runs TWAI_MODE_NORMAL and ACKs the bus — not listen-only — see can-bus-integration.) Log everything raw for the whole session and save the dump into wiki/raw/ — even IDs we don't care about yet.

Test Watch Confirms
Ignition on, engine off 0x130 byte 0 changes per key position; 0x3B4 appears (~every 5 s) Terminal status; battery message alive
Compare 0x3B4 to a multimeter at the battery Try 12-bit LE ×0.015 and ×0.0147 vs meter (engine off ≈12.4 V, running ≈14+ V); check byte 3 flips 0x00→0x09 on start Battery layout + factor; engine-running flag
Cold start, note ambient temp 0x1D0 byte 0 ≈ ambient+48 raw, then climbs steadily to ~90 °C (raw ~0x8A) Coolant ID + −48 scaling
Same, byte 1 Should ALSO start near ambient but climb slower than byte 0 and lag behind Oil temp really is byte 1 (weakest engine signal)
Cold start 0x0B5 byte 7: if raw ≈ ambient → offset 0; if raw ≈ ambient+40… i.e. reads 40 under ambient with offset 0 assumed → offset +40 Gearbox temp offset dispute (cold start makes the two hypotheses ~40 apart — unmistakable)
Hold brake, shift P→R→N→D→(S/M) slowly 0x1D2 byte 0 (note DLC: 5 vs 6!); 0x304 bytes; 0x0BA bits 0–3 Gear lever encoding + which message to use; settles the D=R typo in the E60 sheet
Drive: let the box shift 1→2→3… 0x1D2 byte 1 upper nibble, 0x0BA low nibble increments per shift Current gear number source
Blip throttle 0x0AA bytes 4–5 = RPM×4 RPM sanity check (fast cross-check that you're on the right bus)

If an expected ID is absent entirely, note it — it means the swap harness dropped that module's traffic, which is itself an answer (open-questions #3).

Fault codes: passive reading is NOT possible ⚠

Consistent across sources: no DTC/fault-code broadcast exists. The dieslg8 project (M57 diesel, later EDC17 DDE) gets coolant temp and DTCs only via active diagnostic requests (send on 0x6F1, parse responses on 0x612; e.g. coolant = raw×0.01 − 100). At most, a MIL/check-engine lamp status bit may be passively derivable (a commercial Patrol-swap CAN module offers a check-engine output). Consequences for the firmware (repo):

  • The fault_codes field in automotive_data_t cannot be filled in LISTEN_ONLY mode.
  • Options: (a) drop the field, (b) show MIL lamp status only, (c) leave LISTEN_ONLY and accept it empty, or (d) later add a diagnostic-request mode (means transmitting on the bus — design decision).

Swap-context validation

A commercial module exists specifically for BMW M57/N57 swaps into Nissan Patrols/Landcruisers that derives tach, check-engine lamp, reverse trigger (from the ZF EGS via CAN — the box has no reverse wire), and fan trigger from the engine CAN. Proof that passive listening on exactly this drivetrain-in-a-Patrol works. → nissan-patrol-swap

Also useful: an E60 forum claim (unverified) that arbitration IDs are identical across E60 K-CAN and PT-CAN (PT-CAN just broadcasts faster, ~10 ms vs ~100 ms) — meaning E90 K-CAN DBC findings likely transfer to our 500 kbps PT-CAN tap.

Sources

  • e60-vfl-can-codes-xlsx — E60 VFL community spreadsheet (ingested): E60-specific confirmation of 0x1D0 (−48 scaling), 0x3B4, 0x1D2 DLC 6; adds 0x304 gear lever; contains NO oil-temp or gearbox-temp rows
  • listen-and-send-pid-arduino — technique reference (ingested): ELM327 PID-request pattern for the fault-code fallback; E46 cluster frames, not E60 evidence
  • HeinrichG-V12/E65_ReverseEngineering (GitHub) — E65 760Li PT-CAN, docs verified verbatim by the adversarial pass (0x1D0, 0x3B4, 0x192, 0x1D2, 0x0BA, 0x1A2)
  • damienmaguire/BMW-E65-CANBUS (GitHub) — live E65 735i captures + working EGS emulator code (0x1D2 encoding, 0x192, 0x0AA)
  • TimesNewRomanZ/e60-canbus (GitHub, community bmw_e9x_e8x.dbc) — author runs a real E60 545i; 0x1D0 confirmed live on E60
  • kmalinich/dieslg8 (GitHub) — M57 diesel (E90 335d, EDC17): diagnostic-request-only coolant/DTC evidence
  • loopybunny E90 K-CAN DBC — 0x1D0/0x1D2/0x3B4 E90 layouts
  • E60 forum thread with tool32/EDIABAS-derived ID table — confirms 0x1D0/0x1D2/0x304/0x3B4 exist on E60 with DDE1 as sender
  • Commercial M57/N57 Patrol-swap CAN module product page — swap-context feasibility

Caveats

  • No source used an actual E60 M57N diesel end-to-end; the closest anchors are the E60 tool32 table (lists DDE1 as sender for 0x1D0/0x3B4), the E60 VFL spreadsheet (real pre-facelift E60, engine variant unknown), and the M57 dieslg8 project (different chassis generation). Engine-side layouts are inferred from petrol DME captures of the same bus generation.
  • Oil temp and gearbox oil temp remain the weakest signals — absent from both E60-specific sources; only the E9x DBC and E65 docs place oil temp at 0x1D0 byte 1, and only the E9x DBC has gearbox temp (0x0B5 byte 7, offset disputed).
  • Firmware's current IDs (0x4F, 0x55, 0x201, 0x1001, 0x101F) are contradicted by every source AND confirmed absent from the live bus (verified, 2026-07-15) — definitively placeholders. → can-bus-integration
  • Promotion to (verified) requires a live capture from the swap's bus: warm the engine and watch 0x1D0 byte 0 climb, shift through P/R/N/D and watch 0x1D2. Partially done 2026-07-15 (can-capture-2026-07-15): IDs + 0x1D2 gear codes verified; coolant/battery scaling still needs a cold-start capture with confirmed engine state.

can-bus-integration · bmw-m57n-engine · nissan-patrol-swap · open-questions