Add diag console probe (OBD-II mode 01/09 on 0x7DF); wiki: diagnostic polling, two sources

Firmware:
- CANDriver::transmit(): the single sanctioned transmit path (single-shot,
  echoed as CANTX lines, TX_FAILED alert counted); CAN-task warnings now take
  the serial lock
- DiagProbe module: `diag pids` supported-PID bitmap scan, `diag pid <hex>`,
  `diag vin`, `diag ecu`, `diag status`; ISO-TP reassembly with flow control;
  one request in flight, refused for 3 s after any foreign tester frame
- Console dispatch chained via Tunables::setExtraCommandHandler()
- CLAUDE.md and docs/UART_PROTOCOL.md updated

Wiki:
- New page obd-diagnostic-polling (broadcast vs polled, 0x6F1->0x612 addressing,
  Route A generic OBD PID table, Route B, test-day procedure, firmware probe)
- New sources: google-ai-dde7m57-pids (clipping, unverified, 0x612 direction
  contradicted), dwr-335d-torque-pids (thread + raw/BMW 335d.csv decoded)
- Clippings/ folder added to the schema (Obsidian Web Clipper, treated as raw/)
- bmw-m57n-engine, can-bus-integration, open-questions, index, log updated
This commit is contained in:
2026-09-21 19:51:49 +02:00
parent f60bdac268
commit 974082cb3e
21 changed files with 1357 additions and 24 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
---
type: entity
tags: [engine, bmw, can-bus]
updated: 2026-07-15
updated: 2026-09-21
---
# BMW M57N Engine
@@ -10,8 +10,8 @@ The engine at the heart of the project: the display reads its CAN bus and shows
## This specific engine (verified — user, 2026-07-15)
- Donor chassis: **E60/E65 (2003+)** — so a DDE5/DDE6-generation ECU, exact variant TBD.
- Transmission: **BMW automatic with its EGS ECU wired into the CAN bus** — gearbox temp and gear position have a real data source. Likely a ZF 6HP-family box with GS19-era EGS `(unverified)`.
- Donor chassis: **E60/E61 (2003+)** — narrowed from E60/E65 by the 6HP26X gearbox (xDrive output; the 7-series never had M57N + xDrive) — so a DDE6-generation ECU (Bosch EDC16C31/C35) is the expectation `(unverified)`; the DDE7.3 / EDC17CP09 that Google searches for "dde7 m57" describe is the later M57N2 in the E90/E70. Exact variant still TBD — the Launch's ECU-identification page names it (`D60M57D0`/`D62M57B0` vs `D73N57C0`). → [[obd-diagnostic-polling]]
- Transmission: **ZF 6HP26X** (user-confirmed 2026-07-17) with its EGS ECU wired into the CAN bus — gearbox temp and gear position have a real data source ([[gear-box-can-revealings]]).
## Overview (unverified)
@@ -27,11 +27,11 @@ Per the project goals: coolant temperature, oil temperature, gearbox oil tempera
- Exact DDE version and donor model year — narrows the CAN matrix further. → [[open-questions]]
- Whether the swap harness alters what's broadcast vs. a stock E60.
- Values the DDE keeps to itself (boost, MAF, rail pressure, injection quantity, DTCs) are only reachable by polling → [[obd-diagnostic-polling]].
## CAN IDs
> [!warning]
> The candidate IDs originally seeded here (`0x316`, `0x329`, `0x545`) are from **E46/E39-generation** documentation and probably do NOT apply — the donor is E60/E65, a newer bus generation with a different matrix. E60-specific research is tracked in [[can-bus-integration]]. The firmware's current IDs (`0x4F`, `0x55`, `0x201`, `0x1001`, `0x101F` `(repo)`) remain placeholder-quality either way.
The verified E60 map (coolant, gearbox temp, gear, rpm, torque, battery, turbine and output-shaft speed) lives in [[can-id-candidates]]; the firmware decodes exactly that map `(repo, 2026-09-21)`. The E46/E39-era IDs once seeded here (`0x316`, `0x329`, `0x545`) and the firmware's original placeholders (`0x4F`, `0x55`, `0x201`, `0x1001`, `0x101F`) were all confirmed absent from the live bus.
## Related
+4
View File
@@ -43,6 +43,10 @@ The core technical challenge of the project: reading real data from the [[bmw-m5
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]]
## Transmit path `(repo, 2026-09-21)`
The firmware is no longer strictly read-only: `CANDriver::transmit()` exists, used only by the on-demand `diag` console probe (single-shot OBD-II requests on `0x7DF`, refused while a scan tool is polling). Nothing is sent without a typed command. Details and the test-day procedure → [[obd-diagnostic-polling]].
## Related
[[bmw-m57n-engine]] · [[esp32-s3-touch-lcd-5b]] · [[open-questions]]
+114
View File
@@ -0,0 +1,114 @@
---
type: concept
tags: [can-bus, dde, egs, diagnostics, kwp2000, uds, obd, design-decision]
updated: 2026-09-21
---
# OBD / Diagnostic Polling
Why some values never appear on the sniffer, how a scan tool gets them, and what it would take for Controller A 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`.
> [!warning]
> The [[google-ai-dde7m57-pids]] clipping states the opposite (`0x612` = request, `0x6F2` = response). Two sources (dieslg8's working code on a real M57, and the `0x6xx` = ECU-address convention) against one uncited AI summary: **we go with tester `0x6F1` → DDE `0x612`** until our own capture shows the pair. Nothing is verified until then.
- **Generic EOBD** (`0x7DF` functional / `0x7E0` physical → reply `0x7E8`, mode `01`) is a second, standard route `(unverified)` — early E60s served EOBD over K-line, later ones over CAN. See the next section: it is the cheaper experiment and needs no BMW knowledge.
## Route A — generic OBD-II mode 01 (try this first)
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 Controller A (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 / UDS on `0x6F1` → `0x612`)
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)`
Controller A 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 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)
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.
## Beyond the probe `(repo)`
- 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, and diagnostic sessions can change what an ECU broadcasts.
- 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.
## Related
[[can-id-candidates]] · [[can-bus-integration]] · [[bmw-m57n-engine]] · [[google-ai-dde7m57-pids]] · [[listen-and-send-pid-arduino]] · [[open-questions]]
+7 -4
View File
@@ -1,7 +1,7 @@
---
type: synthesis
tags: [meta, todo]
updated: 2026-07-17
updated: 2026-09-21
---
# Open Questions
@@ -24,7 +24,7 @@ The research frontier. Answering any of these should trigger updates across the
## Project context
2. **Exact donor model year / DDE version and EGS variant?** *Partly answered 2026-07-17.* The gearbox is a **ZF 6HP26X** (user-confirmed) — the X is the xDrive output variant, which means the donor is an **E60/E61, not an E65**: the 7-series never took M57N + xDrive. Remaining: model year and DDE version. → [[bmw-m57n-engine]]
2. **Exact donor model year / DDE version and EGS variant?** *Partly answered 2026-07-17.* The gearbox is a **ZF 6HP26X** (user-confirmed) — the X is the xDrive output variant, which means the donor is an **E60/E61, not an E65**: the 7-series never took M57N + xDrive. Remaining: model year and DDE version. **Cheap to close (2026-09-21):** the Launch scanner's ECU-identification page (or any INPA "control unit found" string) names the variant — `D60M57D0`/`D62M57B0` = DDE6 (EDC16), `D73N57C0` = DDE7.3 (EDC17). → [[bmw-m57n-engine]], [[obd-diagnostic-polling]]
3. **Standalone harness or full donor loom? Which BMW modules were retained?** Affects which modules broadcast on the swap's bus. → [[nissan-patrol-swap]]
4. **Which Patrol generation, and how is the display being mounted/powered?** → [[nissan-patrol-swap]]
@@ -32,7 +32,7 @@ The research frontier. Answering any of these should trigger updates across the
5. **Operating temperature 0–65 °C** (source: waveshare-wiki) — outside automotive norms at both ends (sub-zero winter cabins, sun-baked dashboards). Is the mounting location temperature-controlled enough? Any mitigation (mounting away from vents/sun, accepting reduced lifespan)?
6. **Transient protection on the 7–36 V input**: the board takes vehicle 12 V directly, but ISO 7637 load-dump spikes can exceed 36 V `(unverified)`. Consider an upstream TVS diode / automotive-rated buck. Also: ignition-switched vs constant power (the isolated digital input could sense ignition).
7. **Fault codes**: the UART packet reserves a field for fault codes — DDE fault codes are read via diagnostic protocols (KWP2000/UDS over K-line or CAN), not passively broadcast. Is passive reading even possible? `(unverified)` — **update 2026-07-17**: the same barrier explains why the Launch scanner shows boost/gearbox data our dump lacks (it polls; nothing broadcasts them). A capture *while the Launch is connected* would record both request and reply frames, handing us the exact bytes to replay. → [[obd-diagnostic-polling]]
7. **Fault codes**: the UART packet reserves a field for fault codes — DDE fault codes are read via diagnostic protocols (KWP2000/UDS over K-line or CAN), not passively broadcast. Is passive reading even possible? `(unverified)` — **update 2026-07-17**: the same barrier explains why the Launch scanner shows boost/gearbox data our dump lacks (it polls; nothing broadcasts them). A capture *while the Launch is connected* would record both request and reply frames, handing us the exact bytes to replay. **Update 2026-09-21**: the user has seen `0x612` appear on the tapped bus while the Launch is connected — that is the DDE *replying* (`0x600` + DDE address `0x12`); the requests go out on `0x6F1`. Diagnostic traffic therefore reaches our tap, so the capture will contain both halves. Page written with the capture procedure and the firmware implications (polling = transmitting on the bus). **Cheapest first experiment** (from [[dwr-335d-torque-pids]]): one generic `01 00` supported-PID query on `0x7DF` — tells whether this DDE answers EOBD on the PT-CAN and which mode-01 PIDs it has, with zero BMW-specific knowledge. → [[obd-diagnostic-polling]]
## Answered
@@ -61,4 +61,7 @@ The research frontier. Answering any of these should trigger updates across the
- ~~A real candump log from the engine running~~ ✅ → [[can-capture-2026-07-15]] (engine confirmed running, 2026-07-17)
- **`6HP26.pdf`** — sitting in the E65 repo's `docs/`. The ZF 6HP26 manual, very likely our exact gearbox: gear ratios would let us convert output-shaft rpm → road speed and self-check the D3/D4 scaling. → [[driveline-speed-signals]]
- **`can_message_list.txt`** (same repo) — full ID → name → sending-module map, 0x00–0xFFF. Not yet mined; useful if the project ever wants non-powertrain data
- A capture taken **while the Launch scanner is polling** — would reveal the request/response byte sequences for boost, gearbox temp and DTCs → [[obd-diagnostic-polling]]
- A capture taken **while the Launch scanner is polling** — would reveal the request/response byte sequences for boost, gearbox temp and DTCs. Step-by-step procedure now on [[obd-diagnostic-polling]]; also read the Launch's ECU-identification page during the same session (closes #2)
- ~~Web search on DDE7 M57 PIDs~~ ✅ clipped → [[google-ai-dde7m57-pids]] — uncited AI summary; identifiers `(unverified)`, addressing claim contradicted
- ~~A worked generic-PID set for an M57 diesel~~ ✅ ingested → [[dwr-335d-torque-pids]] (2009 335d, DDE7.3; J1979 mode-01 scalings gauge-checked by the author)
- DWR's **Testo parameter list** (e90post "Testo" thread, post 175, German→English names of the DDE's non-standard values) — the pointer for Route B identifiers if our own Launch capture is not enough