Files
julian 1cba9f30bc
Firmware / build (push) Successful in 10m49s
Reverse lights on DO0, Sport + Vehicle screens, per-DDE live data, ECU identification
- ReverseLight: isolated output DO0 (CH422G OC0 -> PC817 -> NPN sink) drives the
  reverse-lamp relay while the lever is in R on a live bus with ignition on; 10 Hz
  decision confirmed over 200 ms, written through the panel library's expander
  object so the backlight cannot undo it; `reverse status|on|off|force` console,
  default ON (NVS `revlight_en`). Wiki page reverse-lights-output with the wiring.
- Sport screen: BMW-style power + torque gauges (lv_meter on a dial-face image,
  image needle); PNG sources in assets/, tools/png2lvgl.py converter.
- Vehicle: final drive ratio + tyre circumference -> road speed, hp from torque;
  Settings > Vehicle page; `vehicle` console.
- Bench simulation (`sim` console) overlays torque / rpm / shaft on the snapshot.
- EcuIdent: KWP 1A 86 / 1A 80 read once, stored in NVS, shown on Settings >
  Vehicle, passive ECU CHANGED? check; `ecu` console.
- Ignition fallback from the 0x1D2 lever byte on buses without 0x3B4 (Patrol 2).
- Engine data: per-DDE `2C 10` identifier profiles (Patrol 1 vs Patrol 2
  rail 00C2 / boost 003A / battery 002F); DiagProbe liveConfigure().
- Wiki: Patrol 2 captures, vehicles page, obd identifier table per DDE, logs.
2026-10-28 16:46:42 +01:00

19 KiB
Raw Permalink Blame History

type, tags, updated
type tags updated
concept
can-bus
dde
egs
diagnostics
kwp2000
uds
obd
design-decision
rail-pressure
2026-10-18

OBD / Diagnostic Polling

Why some values never appear on the sniffer, how a scan tool gets them, and what it would take for Main CTRL to do the same. Several pages have linked here since July (can-id-candidates, open-questions #7); the page was created on the google-ai-dde7m57-pids ingest, 2026-09-21.

Broadcast vs polled

  • The DDE and EGS broadcast only what other modules need to run the car: rpm, coolant, gear, gearbox temp, torque, pedal, battery… — the verified list is in can-id-candidates.
  • Not broadcast (verified by absence on our own bus): manifold boost (AIP_ENG on 0x1D0 is barometric), MAF, rail pressure, injection quantity, fault codes. The Launch scanner shows them because it polls the ECU and displays the answers.
  • Consequence: a listen-only display can never show these. Getting them means transmitting requests on the PT-CAN.

How a tester talks to the DDE on this bus

E60-generation BMWs use one shared diagnostic ID pair with an ECU address in the first payload byte (BMW's extended-addressing variant of ISO 15765):

Direction CAN ID First payload byte Then Evidence
Tester → any ECU 0x6F1 target address (DDE = 0x12, EGS = 0x18 (unverified)) len, service, data (source: dieslg8 via can-id-candidates)
ECU → tester 0x600 + address → DDE 0x612, EGS 0x618 0xF1 len, service + 0x40, data same
  • What the user saw (2026-09-21): 0x612 appears on the tapped bus only while the Launch is connected. That is the DDE answering — consistent with the table. The requests should be present in the same capture as 0x6F1; the user's recollection of "0x6F2" is almost certainly 0x6F1.

Note

Resolved 2026-09-23: our own probe sent 0x6F1 [12] 1A 86 and the DDE answered on 0x612 (verified) — dieslg8's scheme was right, the google-ai-dde7m57-pids clipping's reversed claim is dead. See diag-route-b-2026-09-23.

  • Generic EOBD (0x7DF functional → reply 0x7E8, mode 01) is a second, standard route — (verified 2026-09-23): the DDE answers it on the PT-CAN. See Route A results below.

Route A — generic OBD-II mode 01 — VERIFIED WORKING (2026-09-23)

First live run done, engine idling, probe on the tapped bus: the DDE replies on 0x7E8 (and only the DDE — the EGS stays silent on generic OBD). Full readings, raw logs and the two scaling warnings: diag-route-a-2026-09-23.

  • Supported PIDs (bitmap scan): 01, 04, 05, 0B, 0C, 0D, 0F, 10, 1C, 20, 21 — a minimal EOBD set, consistent with EDC16/DDE6 (unverified). No boost 70, no EGT 78, no baro 33, no fuel rate 5E.
  • Cross-checked live: rpm 681 (CAN said 678–682) and coolant 64 °C (CAN said 63–64) — request path and decode both (verified).
  • MAP 0B = 104 kPa at idle; the 255 kPa clip question needs a drive with boost.
  • MAF 10 and IAT 0F reply with implausible values (258 g/s, 155 °C at idle) — explained the same afternoon: those are sensor faults (P0101, P0113), not scalings (diag-route-b-2026-09-23).
  • Mode 09 (VIN, ECU name) is ACKed but never answered — the donor could not be identified via generic OBD; Route B's 1A 86 did it instead.
  • PID 01 reports MIL off with 5 stored DTCs — read the same day via the new diag dtc (mode 03): P0101, P0113, P0500, P0545, P0030, all swap leftovers (diag-route-b-2026-09-23).

The original pre-test notes and PID reference table follow.

The dwr-335d-torque-pids source is a worked, gauge-checked set of J1979 mode-01 PIDs from an M57 diesel (a 2009 335d, DDE7.3). They are ECU-agnostic by design, so whichever subset our DDE supports can be read with standard frames and no reverse-engineering:

Request on 0x7DF Reply on 0x7E8 Value
02 01 00 06 41 00 A B C D bitmap of supported PIDs 01–20 (then 01 20, 01 40, 01 60 for the next blocks)
02 01 05 03 41 05 A coolant A − 40 °C
02 01 0B 03 41 0B A manifold absolute pressure, A kPa — clips at 255 kPa, below full boost
02 01 0C 04 41 0C A B rpm (A·256+B)/4
02 01 0F / 01 46 03 41 xx A intake / ambient air temp A − 40 °C
02 01 10 04 41 10 A B MAF (A·256+B)/100 g/s
02 01 33 03 41 33 A barometric A kPa
02 01 5E 04 41 5E A B fuel rate (A·256+B)×0.05 L/h
02 01 70 0A 41 70 A B C D E … boost actual (D·256+E)×0.03125 kPa — 2007+ J1979 diesel PID, likely absent on an EDC16 (unverified)
02 01 73 / 78 / 7A / 83 — exhaust pressure / EGT / DPF ΔP / NOx — same caveat; DPF/SCR rows are meaningless on an M57N anyway
  • First test = the 01 00 bitmap query. One frame on 0x7DF with the engine running (no scan tool attached) answers both open points at once: does this DDE speak EOBD on the PT-CAN at all, and which PIDs does it offer. No reply → the DDE serves EOBD on K-line (or not on this bus) and only Route B remains.
  • Implemented on Main CTRL (2026-09-21) (repo) as the diag console command — see Firmware: the diag probe below. The whole test is diag pids typed on the USB console.
  • Route A cannot give fault codes beyond generic mode 03 DTCs (P0xxx) — BMW-specific codes need Route B.

Route B — BMW proprietary (KWP2000 on 0x6F1 → 0x612) — VERIFIED WORKING (2026-09-23)

First live exchange without any scan tool: diag bmw 12 1A 86 → 65-byte multi-frame ident from 0x612, containing DDE part numbers (7 799 764 / 7 799 765 / 7 793 887), a 2006-03 date, and the VIN prefix WBANC92090 → E60 530d (verified bytes / unverified decode) — full breakdown in diag-route-b-2026-09-23. 22 F1 90 (UDS) is rejected: the DDE speaks KWP2000, not UDS — pointing at DDE6/EDC16. 1A 90 (full VIN) answers busyRepeatRequest to a single-shot probe. Same day, identifier scans: the clipping's 22 D1xx identifiers are confirmed wrong (whole block NRCs), and a 21 xx sweep shows the measurement blocks are gated behind a diagnostic session / security access (NRC 0x22/0x33) — outside the probe's read-only whitelist by design.

Capture-with-Launch done, and it worked — launch-capture-2026-09-23. The Launch reads live values via service 2C (dynamicallyDefineLocalIdentifier), not 21/22: poll 2C 10 00 DF → reply 6C 10 HHLL. Rail pressure actual is fully decoded and verified: bar = HHLL × 0.03 (two points against the Launch display: idle 305, 2500 rpm 430). The method generalises to any value the Launch will display. Crucially, the capture shows the DDE served this in its default state — no 10 session, no 27 security, no 3E tester-present (launch-capture-2026-09-23); self-polling needs only the 2C 10 15 E0 define + 2C 10 00 DF poll, no secret. What gates it is our own policy, not the ECU (see Beyond the probe).

This depends on the DDE variant, which is still open (open-questions #2, bmw-m57n-engine):

DDE ECU Typical fitment Ediabas group Diagnostic layer
DDE6.x Bosch EDC16C31/C35 E60/E61 M57N 2003–07 (our likely donor) D60M57D0 / D62M57B0 KWP2000 on CAN (unverified)
DDE7.3 Bosch EDC17CP09 E90 335d / E70 35d (M57N2, NA market) D73N57C0 KWP2000 on CAN, UDS variant exists (unverified)
  • The clipping's identifiers (22 D1 0C boost, 22 D1 1E rail, 22 D1 14 MAF, 22 D1 06 injection) are (unverified) and uncited — do not implement from them. The Ediabas result names (STAT_LADEDRUCK_IST_WERT, STAT_RAILDRUCK_IST_WERT, STAT_LUFTMASSE_WERT, STAT_EINSPRITZMENGE_AKTUELL_WERT, STAT_KUEHLMITTELTEMPERATUR_WERT, STAT_MOTORDREHZAHL_WERT) are real and are the right search terms.
  • The reliable route needs no guessing: capture while the Launch is on its live-data page (procedure below). The exact request bytes and the reply layout come for free, for whatever variant is in the car.

Procedure: capture with the Launch polling

  1. Start the board's raw logger (CANRAW stream, see can-bus-integration) with the Launch connected; open the Launch's live-data page for boost or rail pressure; blip the throttle twice.
  2. Filter the log to 0x6F1 and 0x612 (also keep 0x7E0/0x7E8 and 0x618 if they show up).
  3. Pair each 0x6F1 request with the 0x612 reply that follows. In the reply, the byte after the length is the service + 0x40 (0x62 for a 0x22 request, 0x61 for 0x21); the identifier is echoed next; the data bytes follow. Match the bytes that move with the throttle to the values the Launch displayed.
  4. Open the Launch's ECU identification page and note the variant string — closes open-questions #2.
  5. File the log in raw/, write a source page, promote whatever pairs were seen to (verified).

Firmware: the diag probe (repo, 2026-09-21)

Main CTRL now has one transmit path onto the PT-CAN: CANDriver::transmit(), called only by src/modules/diag_probe.cpp. It sends nothing on its own; every frame is typed by a human on the USB console.

Command What it sends What it prints
diag pids 02 01 00 on 0x7DF, then 01 20, 01 40… as long as the engine ECU advertises the next block each block's supported PIDs, then a per-responder summary with names (coolant, rpm, MAP, MAF, boost 70, EGT 78…)
diag pid <hex> one mode-01 request raw reply bytes + a decoded value for the PIDs in the Route A table
diag vin mode 09 PID 02 the VIN as text — identifies the donor (open-questions #2)
diag ecu mode 09 PID 0A the ECU name string
diag dtc mode 03 on 0x7DF the stored generic DTCs, decoded (added 2026-09-23)
diag ident [addr] BMW KWP 1A 80 on 0x6F1 (default addr 12 = DDE) ECU identification, full hex+ASCII dump (added 2026-09-23)
diag bmw <addr> <hex...> one raw BMW-addressed request reply dump; whitelisted read-only services only (1A ident, 18 DTCs, 21/22 read data — never session control or writes)
diag status nothing request/reply/timeout counters, responders seen, tester-guard timer

Safety rules baked in: one request in flight at a time; frames are single-shot (no retransmit storm if nobody ACKs, the failure is just counted); refused for 3 s after any foreign tester frame (0x7DF, 0x7E0–7, 0x6F1), so it cannot collide with the Launch; only services 01 and 09, never session control or writes; multi-frame replies are reassembled with a standard flow-control frame (30 00 00) to the responder's physical ID. Every transmitted frame is echoed as CANTX,<ts>,<id>,0,<dlc>,<hex> next to the CANRAW lines, so a saved console log holds both halves of every exchange.

Test-day procedure (Route A probe) — executed 2026-09-23, outcome: Route A works

Run via tools/diag_session.py (one serial session, logs straight into wiki/raw/); results in diag-route-a-2026-09-23. Procedure kept for re-runs (e.g. the boost-clip drive test):

  1. Engine running, Launch unplugged (the probe refuses to send for 3 s after any tester frame, and the Launch keeps polling while attached).
  2. Laptop on the 5B's USB, console at 115200 with the output saved to a file, e.g. from the repo root:
    pio device monitor -p COM11 --quiet > diag-<date>.log
    
    (or any terminal with logging on). The CANRAW stream keeps running; the diag lines and CANTX echoes land in the same file.
  3. Type diag pids. Read the summary line — four possible outcomes:
    • "NOT ACKED - no other node saw it" → wiring or bus problem, not an ECU answer. Check the CAN terminal block, the 120 Ω switch (off), and that CANRAW lines are still flowing.
    • "ACKED but NO REPLY on 0x7E8-0x7EF" → the DDE does not answer generic OBD-II on this bus (EOBD on K-line, or not at all). Route B only.
    • Reply from 0x7E8 listing PIDs → Route A works. Continue with step 4.
    • Replies from 0x7E8 and 0x7E9 → the EGS also answers generic OBD; note which PIDs it claims.
  4. If Route A works: diag pid 0C (rpm — proves a live read), diag pid 05 (coolant — cross-check against the 0x1D0 value on the Driveline screen), diag pid 70 (does the boost PID exist on this ECU?), diag pid 0B (does 1-byte MAP clip?), then diag vin and diag ecu.
  5. diag status once at the end (counters, tester guard), then stop the monitor.
  6. Copy the log into raw/, write a sources/ page with the supported-PID list and the VIN, update this page (Route A verified / refuted) and open-questions #2 and #7.

Known live-data identifiers (2C 10 <id> → 6C 10 HH LL) — PER DDE

[!warning] The identifiers belong to one DDE software, not to the M57N (verified 2026-10-18) With the board on Patrol 2 (DDE 7794904) and Patrol 1's set in the firmware, the Engine data screen showed no rail pressure, a flat "2800 mbar" boost and a charge-air temperature above 300 °C (user). The Launch, which re-reads 1A 80 on every cycle precisely to pick its data set, polled 00C2 for rail pressure on that car instead of 00DF. So 2C 10 <id> is an address inside each unit's software (the "define" 15 E0 was not seen on Patrol 2 either). The firmware now keeps one identifier set per DDE part number ((repo) engine_screen.cpp PROFILES[], keyed by EcuIdent) and asks nothing for a slot it has no identifier for. Every value on a new DDE must be captured with the Launch again (recipe below).

Value DDE 7796678 / 7799764 (Patrol 1) DDE 7794904 / 7796156 (Patrol 2) Scaling Status
One-time define sent by the Launch 15E0 none seen — —
Rail pressure, actual 00DF 00C2 bar = raw × 0.03 Patrol 1 (verified 2026-09-23), two points; Patrol 2 (unverified) — raw 11 016–11 304 at idle = 330–339 bar at the same scale, the Launch showed "rail pressure" while polling it (label/value not noted)
Charge-air pressure, actual (boost, absolute) 0091 003A mbar = raw ÷ 8 Patrol 1 (unverified) one point, engine off; Patrol 2 (unverified scale) — 1 018 mbar idle → 1 186 on a rev blip, physically right, Launch value not noted (launch-captures-2026-10-18-patrol-2)
Charge-air temperature 16A8 not captured °C = raw × 0.01 − 15 (unverified) one point, engine off
Battery voltage 0093 002F V = raw × 0.002455 Patrol 1 (unverified) one point; Patrol 2 (unverified scale) — 14.0 V running, 12.7 V after the engine stop, Launch value not noted (launch-captures-2026-10-18-patrol-2)

Evidence: launch-capture-2026-09-23, launch-captures-2026-10-07, can-capture-2026-10-18-patrol-2, launch-captures-2026-10-18-patrol-2. Each provisional scaling needs one more capture at a different operating point; the remaining empty Patrol 2 cell (charge-air temperature) needs one Launch session. Note how every identifier moved between the two DDEs while the scalings stayed the same — expect the same on setup 3.

ECU identification (1A 80 / 1A 86) (verified 2026-09-23 / 2026-10-18)

The Launch re-reads 1A 80 on every cycle and both Patrols' DDEs answer it in their default state (31 / 37-byte replies); our own probe's 1A 80 was silent on Patrol 1 on 2026-09-23 while 1A 86 answered with 65 bytes. Observed layouts (field names (unverified)): 1A 80 → BCD part number at payload bytes 4–7, BCD date YY MM DD at 15–17; 1A 86 → ASCII "@B892524 ", date at 11–13, three 6-byte BCD part-number fields from byte 16, VIN prefix at 53–62. The firmware stores both blocks once per setup (vehicles, (repo) EcuIdent) and compares the Launch's 1A 80 passively.

Engine data screen (repo, 2026-10-07)

Decision (user, 2026-10-07): the four values above get their own screen on Controller A, opened by an "Engine data" button on the Driveline screen, no password. This replaces the 2026-09-23 plan of a password-protected Diagnostics screen for these reads. Guard rails kept: polling runs only while the screen is shown (stops ~1.5 s after it is left), one request in flight, ~100 ms apart (each value ~2.5 Hz), pauses while another tester is on the bus (3 s guard), only these fixed frames - 2C stays forbidden from the diag console. Sends the profile's define once per start (Patrol 1: 2C 10 15 E0), then its reads in turn. Since 2026-10-18 the identifier set is chosen per identified DDE (table above): an unidentified ECU or one without a profile polls nothing and the status line says so; a slot without an identifier reads "identifier not known for this ECU yet". Provisional scalings are tagged on screen and every value shows its raw number and identifier for calibration against the Launch. A password can still come with a future Diagnostics screen for anything beyond these reads.

Beyond the probe (repo)

  • The decode recipe (proven 2026-09-23): log CANRAW while the Launch shows a live value → find the 2C 10 <id> / 6C 10 <data> pair whose data tracks the reading → calibrate scale against the display at two operating points (idle + a blip). One session per parameter. Boost, MAF, injection quantity, EGTs all reachable this way. Worked example: launch-capture-2026-09-23 (rail pressure).
  • A continuous poller (Route A or B) would reuse the same transmit path with a fixed request list: one request per ≥100 ms, one identifier at a time, only while no scan tool is connected, never a session-control or write service. Still a design decision: a request storm or a malformed frame can disturb the DDE/EGS.
  • What Route B self-polling actually requires (settled 2026-09-23): just the 2C 10 15 E0 define then the 2C 10 <id> poll — no diagnostic session (10), no security access (27), no tester-present (3E), proven from the full Launch capture (launch-capture-2026-09-23). The 21-block NRCs (0x22/0x33) that earlier looked like a session/security wall are a different mechanism and do not gate the 2C path. 2C is not strictly read-only (it writes a dynamic-identifier definition — harmless), so it stays out of the probe whitelist by policy.
  • Design decision — the "Diagnostics" screen (2026-09-23): if active polling is ever built, it lives behind a password-protected Diagnostics screen on Main CTRL (authorized-technician gate), triggered manually, only while no scan tool is connected, read-oriented services only. This is the deliberate on/off switch for transmit-on-the-bus — not a background poller. Not built yet; captured here so the capability and its guard rails are not re-researched later.
  • Protocol v2 dropped the fault_codes field in favour of the alert bitmap (dual-controller-architecture); polled values would need new DATA fields.
  • The same request path would also be the only way to read DTCs (service 0x18/0x19, variant-dependent) → open-questions #7.

can-id-candidates · can-bus-integration · bmw-m57n-engine · google-ai-dde7m57-pids · listen-and-send-pid-arduino · open-questions