Files
ESP32-S3-Touch-LCD-5B/wiki/sources/e65-reverse-engineering-repo.md
T
julian bb87b3d6da Decode the real CAN map: gear, temps, battery, driveline speeds
Ingest HeinrichG-V12/E65_ReverseEngineering (per-ID DBC-style docs with
worked examples) and re-analyse our own 2026-07-15 capture against it.
Resolves both outstanding scaling disputes, closes the engine-state
question, and adds the driveline speeds.

Resolved:
- Gearbox oil temp = raw - 40 (not offset 0, not +40). Source's worked
  example plus our own cross-check: the box read 31 C while coolant was
  at 37 C and climbing; offset 0 would have the transmission warming
  faster than the engine.
- Battery = 12-bit LE * 0.015 (0x3B4 U_BT); the E90 24-bit BE reading is
  wrong for us. The high nibble of byte 1 is ST_BTSW, not voltage.
- Engine was running during the 2026-07-15 capture (ST_ENGINE_RUN = 2 in
  397/397 frames), so its coolant trace is genuine warm-up data and the
  planned cold-start capture is unnecessary.
- Engaged gear = 0x1D2 byte 1, gear = (D1>>4)-4. No drive capture needed.

New signals (0x1A2 turbine, 0x0BA output shaft, 0x0AA RPM/pedal). Turbine
speed physically proves engagement: it free-spins at ~engine speed in P/N
and collapses to ~0 when the box loads up. Output shaft is the only
road-speed source on this bus - there is no DSC module - so it is the
feedback variable any future cruise-control work would need. Scaling is
uncalibrated; it is carried as raw counts with no physical unit.

Corrects three of my own earlier claims:
- 0x1D2 D1 is the engaged gear, not a "drive-gate flag" (it only ever
  showed two values because the car was stationary in 1st).
- 0x1D2 D4 0xF2 is a persistent Manual mode, not a "downshift event" - it
  holds across gears 2-6.
- 0x0BA was dismissed on the strength of D7, which is an alive counter.
  The gear is in D0's low nibble, and it is the only source of engaged
  reverse: 0x1D2 D1 stays 0x0F in R.

Firmware: real IDs replace the placeholder map (all 11-bit standard now,
so the extended-ID assumption is gone), full gear decode incl. Sport vs
Manual, and a debounced lever-vs-gearbox mismatch fault - the "lever says
R but the box never took it" case. Engine oil temp reads 0xFF here (sensor
not populated), so its valid flag is left clear rather than publishing
-207 C. Driveline speeds are kept out of automotive_data_t deliberately:
that struct is the UART wire format and widening it would break
Controller B.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 12:33:31 +02:00

163 lines
11 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: source
tags: [can-bus, e65, reverse-engineering, dbc, egs, dde, verified]
updated: 2026-07-17
---
# HeinrichG-V12/E65_ReverseEngineering (GitHub)
<https://github.com/HeinrichG-V12/E65_ReverseEngineering>
Per-ID CAN documentation for the **BMW E65/E66** PT-CAN, written DBC-style (signal name, start bit, length, byte order, factor, offset, unit) with a **worked decode example on every page**. Ingested 2026-07-17. This is the single highest-value source the project has found: it resolved two long-standing disputes, closed an open question, and handed us three signals we didn't know existed.
Structure: `docs/` holds 39 markdown files named by ID (`0x1D0.md`, `0x0B5.md`, …) plus `can_message_list.txt`/`.xlsx` (full ID → name → sending-module table), `can_error_list.txt`, and **`6HP26.pdf`** — the ZF 6HP26 transmission document, i.e. very likely *our* gearbox. Also `Log1.blf`/`Log2.blf` raw captures.
> [!warning] Generation/engine caveat
> The donor for this repo is an **E65 with a petrol MED 9.2.1 DME** (N73-era V12), not an M57N diesel. Engine-side layouts are therefore cross-engine inferences. **However**: every signal we checked against our own live capture decoded to physically sensible values on the first try (see below), so the EGS/DME message layouts evidently carry across the generation. Treat gearbox/power-management signals as strong, engine-internal ones as good-but-confirm.
## What it resolved
### ✅ Gearbox oil temp offset — the dispute is over
`0x0B5` = **Torque Request EGS**, DLC 8, 10 ms. `TEMP_GRB` at **start bit 56 (byte 7)**, length 8, factor 1, offset 40 — and the repo's own worked example decodes raw `0x43` (67) → **27 °C**. So the physical value is **raw − 40**.
> [!note] Sign-convention wrinkle
> The table literally prints `Offset | 40`, which in strict DBC convention (`phys = raw × factor + offset`) would mean raw **+** 40. The page's worked example computes raw **−** 40. The example wins — and our own data independently confirms it (below). Flagging so nobody "corrects" this back later.
**Independently confirmed on our bus** (verified, 2026-07-17): during the 2026-07-15 capture, `0x0B5` D7 read `0x47`/`0x48` (71–72) while `0x1D0` D0 showed coolant at 37–40 °C and climbing. raw−40 → gearbox at **31–32 °C**, sitting just behind a warming coolant. That's a correct cold-start picture. The offset-0 reading would put the gearbox at **71 °C while the engine was still at 37 °C** — the transmission warming faster than the engine it's bolted to, which is not a thing.
Other useful signals on `0x0B5`: `ST_OTMP_GRB` (bits 38–39) = gearbox cooling demand — `0x0`=none, `0x1`=stage 1, `0x2`=stage 2, `0x3`=invalid. **The box's own overheat opinion — a better display warning than thresholding raw temperature.** Also `TORQ_TAR_EGS` (bits 12–23, signed, ×0.5 Nm) and `TORQ_DRAW_GRB` (bits 48–55, Nm).
### ✅ Battery voltage layout — 12-bit wins
`0x3B4` = **Power Management Battery Voltage**, DLC 8, 5 s cycle.
| Signal | Start bit | Len | Factor | Meaning |
|---|---|---|---|---|
| `U_BT` | 0 | 12 | 0.015 V | Battery voltage (Intel/LE) |
| `ST_BTSW` | 12 | 2 | 1 | Battery main switch: `0`=closed, `1`=opening within 5 s, `2`=invalid |
| `ENG_ST` | 16 | 4 | 1 | Engine state |
| `ST_SWO_KL_30` | 30 | 2 | 1 | `1`=no PM shutdown, `2`=PM shutdown executed, `3`=invalid |
| `SDWN_COU_BTSW` | 32 | 8 | 1 | Shutdown counter (s) |
Worked example: `D9 03 00 53 FE 18 32 08` → `0x3D9` = 985 × 0.015 = **14.775 V**. This settles the [[can-id-candidates]] dispute in favour of **12-bit LE × 0.015**, against the 24-bit BE × 0.001 reading from the E90 DBC. Decode: `((D1 & 0x0F) << 8 | D0) × 0.015`.
### ✅ Engine-run state — open question closed
`0x1D0` carries `ST_ENGINE_RUN` at **bits 20–21** (byte 2): `0x0`=off, `0x1`=starting, `0x2`=**running**, `0x3`=invalid.
Checked across our capture: **`ST_ENGINE_RUN` = 2 in 397 of 397 frames** (verified, 2026-07-17). The engine was definitively running during the 2026-07-15 session, so its coolant trace is genuine warm-up data. This retires the "engine state unconfirmed" caveat that was blocking [[open-questions]] #1.
## `0x1D0` Engine Data (DLC 8, 100 ms) — full table
| Signal | Start bit | Len | Factor | Offset | Unit |
|---|---|---|---|---|---|
| `TEMP_ENG` | 0 | 8 | 1 | −48 | °C |
| `TEMP_EOI` | 8 | 8 | 1 | −48 | °C |
| `ALIV_COUNT_DME` | 16 | 4 | 1 | 0 | — |
| `ST_ENGINE_RUN` | 20 | 2 | 1 | 0 | — |
| `ST_SW_WAUP` | 22 | 2 | 1 | 0 | — |
| `AIP_ENG` | 24 | 8 | 2 | 598 | hPa |
| `IJV_FU` | 32 | 16 | 1 | 0 | µl |
| `CTL_SLCK` | 48 | 2 | 1 | 0 | — |
| `RPM_IDLE_TARGET` | 56 | 8 | 5 | 0 | 1/min |
`ST_SW_WAUP`: `0`=warming up, `1`=engine warm, `2`=EGS forced switching active, `3`=invalid.
`CTL_SLCK`: `0`=not allowed, `1`=no shiftlock requirement, `2`=shiftlock required, `3`=invalid.
Worked example `5D 3C 66 B7 CE 3A 8D 8C`: coolant 93−48=**45 °C**; oil 60−48=**12 °C**; air 183×2+598=**964 hPa**; fuel injection `0x3ACE`=**15054 µl**; idle target 140×5=**700 rpm**.
- **Coolant `−48` confirmed** — this is now the third independent source, plus our own live trace.
- **Oil temp = D1, also −48.** Ours reads `0xFF` → the sensor is genuinely unpopulated on this M57N, not a decode error. (verified, 2026-07-15)
- **`AIP_ENG` is NOT boost.** 8 bits × 2 + 598 caps at **1108 hPa**; a boosting M57N reaches ~2500 hPa absolute. The range 598–1108 hPa is barometric/altitude. Manifold boost is **not** broadcast — consistent with the finding that the Launch scanner must poll for it. → [[obd-diagnostic-polling]]
- `IJV_FU` (fuel injection quantity, µl) is a bonus the project never asked for but could display.
## `0x0AA` Torque 3 (DLC 8, 10 ms) — DME
| Signal | Start bit | Len | Factor | Unit | Meaning |
|---|---|---|---|---|---|
| `CHKSM_TORQ_3_DME` | 0 | 8 | 1 | — | Checksum |
| `ALIV_TORQ_3_DME` | 8 | 4 | 1 | — | Alive counter |
| `TORQ_DVCH` | 12 | 12 | 0.5 | Nm | Driver-demand torque (signed) |
| `ANG_ACPD` | 24 | 8 | 0.39063 | % | **Accelerator pedal position** (`0x00`=unpressed, `0xFF`=floored) |
| `RPM_ENG` | 32 | 16 | 0.25 | 1/min | **Engine RPM** |
| `RPM_ENG_ERR` | 48 | 2 | 1 | — | `0`=clear, `1`=speed sensor defective, `3`=invalid |
| `ST_IDLG_ENG` | 50 | 2 | 1 | — | `0`=idle, `1`=not idle, `3`=invalid |
| `ST_CLCTR_V` | 52 | 4 | 1 | — | **Cruise/pedal state** — see [[driveline-speed-signals]] |
| `RQAM_FU` | 56 | 8 | 1 | l/h | Fuel rate |
**RPM factor is 0.25, not the ÷4-on-bytes-4-5 guess in [[can-id-candidates]]** — same arithmetic, now with a named field and exact bit positions. Verified on our capture: **679–684 rpm at idle** (verified, 2026-07-17), matching `RPM_IDLE_TARGET` = 700 from `0x1D0`.
`ST_CLCTR_V` is the headline find here — a **cruise-control state field the DME already publishes**. Full encoding and why it matters: [[driveline-speed-signals]].
## `0x1A2` (DLC 4, 20 ms) — turbine speed
| Signal | Start bit | Len | Factor | Offset | Unit |
|---|---|---|---|---|---|
| `RPM_GRB_TURB` | 0 | 16 | 0.125 | 6 | 1/min |
Worked example `68 14 00 FF` → `0x1468` = 5224 × 0.125 + 6 = **659 rpm**.
**The most valuable single discovery in this ingest.** This is the gearbox *input* (turbine) speed, and it turns out to be a direct, physical **engagement** signal. Verified against our capture and written up in full: [[driveline-speed-signals]].
## `0x0BA` (DLC 8, 20 ms) — gearbox state ⚠ our earlier reading was wrong
Titled "Torque Request ACC" in the repo, but every signal is suffixed `_GRB` (*Getriebe*) — this is **gearbox-sourced**, and the title looks like a copy-paste artifact.
| Signal | Start bit | Len | Factor | Unit | Meaning |
|---|---|---|---|---|---|
| `ST_GR_GRB` | 0 | 4 | 1 | — | **Target gear** (N, R, 1st–6th; `0xF`=invalid) |
| `ST_GRLV_ACV` | 4 | 2 | 1 | — | Gear lever active |
| `ST_CCLT` | 6 | 2 | 1 | — | Torque converter lockup clutch: disengaged / controlled / closed / invalid |
| `GRDT_REIN` | 8 | 12 | 0.125 | 1/min | Gearbox speed |
| **(bits 20–39)** | — | — | — | — | **UNDOCUMENTED — populated on our bus** → [[driveline-speed-signals]] |
| `CHKSM_GRB` | 40 | 8 | 1 | — | Checksum |
| `ALIV_GRB` | 48 | 4 | 1 | — | Alive counter |
| `ST_MOD_GRB` | 52 | 3 | 1 | — | Gearbox mode |
| `ST_HYPP_ACV` | 56 | 2 | 1 | — | — |
Worked example `03 FF 0F 00 00 48 8B EF` → gear = **P**, clutch disengaged.
**`ST_GR_GRB` (D0 low nibble) verified against our capture** (verified, 2026-07-17) — frame counts from the 2026-07-15 dump:
| Value | Meaning | Frames | Status |
|---|---|---|---|
| `1` | N | 102 | verified |
| `2` | **R** | 2 | verified — see the R snapshot below |
| `3` | P | 1378 | verified |
| `5` | 1st gear | 453 | verified |
| `6`–`A` | 2nd–6th | — | `(unverified)` — inferred from the identical ladder in `0x1D2` D1 |
| `4` | ? | — | unaccounted for |
| `0xF` | invalid | — | (source) |
Note `5` = 1st gear here, **the same ladder as `0x1D2` D1's high nibble** — two independent messages sharing one encoding, which is good mutual corroboration.
> [!warning] Correcting the 2026-07-16 wiki claim
> [[gear-box-can-revealings]] recorded "`0x0BA` — secondary, do NOT use … D7 collides R=D=`0xCF`". **That dismissal was wrong**: D7 is `ST_HYPP_ACV`/alive-counter territory, not a gear field. The gear lives in **D0's low nibble**, which does not collide, and which carries a **distinct R code that `0x1D2` D1 lacks entirely**. `0x0BA` is not redundant — it is the only source for engaged reverse. Corrected in [[can-id-candidates]].
>
> Likewise, the same page's note that "`0x0BA` D5/D6 fluctuate so there are no values" is now explained rather than dismissed: **D5 = `CHKSM_GRB` (checksum), D6 = `ALIV_GRB` (alive counter)**. They fluctuate by design.
## Reverse-engaged snapshot (user-reported, 2026-07-17, verified)
Values with the lever held in **R** and the box engaged:
```
0BA DLC 8: 02 FE 0F A8 01 CF 8B CF
1D2 DLC 6: D2 0F FF DC F0 FF
```
- `0x0BA` D0 = `0x02` → `ST_GR_GRB` = **R**. ✅
- `0x1D2` D0 = `0xD2` → lever R; **D1 = `0x0F` → no gear number**. Confirms `0x1D2` D1 is blind to reverse — reverse is unnumbered there.
- `0x0BA` D3/D4 = `A8 01` — **non-zero**, where the repo's E65 example and every stationary frame of our own capture show `00 00`. → [[driveline-speed-signals]]
- `GRDT_REIN` = `0xFFE` ≈ invalid marker; this field reads `0xFFE`/`0xFFF` across both our captures and appears **not to be populated** on our bus. Use `0x1A2` for turbine speed instead.
## Cross-references worth chasing
- **`6HP26.pdf`** in `docs/` — the ZF 6HP26 manual. If our box is a 6HP26 (likely for an E60/E65 M57N), this is a primary source for gear ratios, which would let us convert output-shaft speed → road speed. Added to the [[open-questions]] sourcing wishlist.
- **`can_message_list.txt`** — full ID → name → sending-module map spanning 0x00–0xFFF, including K-CAN comfort/lighting. Not yet mined; worth a pass if the project ever wants non-powertrain data.
- `Log1.blf` / `Log2.blf` — real E65 captures for offline cross-checking.
## Related
[[can-id-candidates]] · [[driveline-speed-signals]] · [[gear-box-can-revealings]] · [[can-capture-2026-07-15]] · [[can-bus-integration]] · [[bmw-m57n-engine]]