Driveline screen: boot into it, add engine torque, revise shaft scaling

Boot screen: land on the Driveline data screen instead of the SquareLine
gauges Home screen. Done in display_init after ui_init while the backlight is
still off (no flash of the wrong screen); Home stays reachable by swiping off
Driveline.

Engine torque added to the screen, decoded from 0x0A8 TORQ_AVL (available/
delivered torque), bits 12-23, signed x0.5 Nm. The user identified the ID and
supplied the spreadsheet formula (D2*256+D1)/32, which is algebraically
bits12-23 x0.5; confirmed against the repo's 0x0A8 worked example (24 Nm).
Firmware masks D1's low nibble (that's the alive counter, not torque - the
repo example shows ALIV=8 there) and sign-extends so overrun reads negative.
0x0AA TORQ_DVCH is the same layout but driver demand - identical at idle,
diverges under load - so the delivered value is the right one to show.

Output-shaft scaling revised: a direct Launch reference (output speed 128 rpm
at our raw 1192) implies ~0.107, contradicting the earlier x0.125 (which would
predict 149). One eyeballed cross-tool point, so nothing is adopted - the
field stays raw counts - but 0.125 is downgraded in firmware and wiki, and the
Launch now gives a direct rpm reference so calibration is just a multi-point
sweep and a linear fit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 17:45:00 +02:00
parent 0b31c6f5f7
commit e10e03eb90
11 changed files with 99 additions and 427485 deletions
+4
View File
@@ -26,6 +26,10 @@ User confirmed: donor chassis is **E60/E65 (2003+)**, transmission is a **BMW au
User captured steady byte values per lever detent (`raw/gear_box_can_revealings.csv`) → [[gear-box-can-revealings]]. **0x1D2 verified as the gear source**: byte0 = P `0xE1` / R `0xD2` / N `0xB4` / D `0x78` (all match documented codes exactly); byte0 can't split D from S/M (shared `0x78`) so byte4 does it (`0xF0` auto / `0xF1` Sport-Manual / `0xF2` downshift −); byte1 is a drive-gate flag (`0x0F`→`0x5F`); byte3 = rolling counter (confirms prediction). 0x0BA also tracks the lever but is messier (D/S-M collide) — don't use. Promoted 0x1D2 gear row to VERIFIED and rewrote the encoding-dispute section in [[can-id-candidates]]; updated index. Still open: actual engaged gear number (needs a drive capture) and the manual up-shift (+) value. Next: rewrite firmware gear map to 0x1D2 byte0 (+byte4).
## [2026-07-17] update | Driveline screen live; torque decoded; output-shaft scaling revised
Firmware flashed and running on the car. Built a hand-coded Driveline screen (src/, boot screen, swipe to reach Home) showing gear + coolant + gearbox temp + RPM + torque + turbine + output-shaft + status chips. Three findings from the user testing it: (1) **Torque decoded & verified** — on **0x0A8 TORQ_AVL** (available engine torque; user-identified the ID). User's Excel `(D2*256+D1)/32` is algebraically bits12-23 ×0.5; confirmed against the repo's 0x0A8 worked example (24 Nm, ALIV=8 in D1 low nibble), ~27-28 Nm at idle. Firmware masks D1's low nibble (alive counter, not torque) and sign-extends. Note 0x0AA TORQ_DVCH is the same layout but driver *demand* — identical at idle, diverges under load. → [[can-id-candidates]], [[driveline-speed-signals]]. (2) **Output-shaft scaling revised**: a direct Launch reference (output speed 128 rpm at our raw 1192) **contradicts the earlier ×0.125** (would predict 149) and points to ~0.107. One eyeballed cross-tool point, so not adopted — but 0.125 is downgraded, and the Launch now gives a direct rpm reference so calibration is just a multi-point sweep + linear fit. Firmware keeps raw counts. (3) Fixed a latent display bug: main.cpp showed DEFAULT_* placeholder temps/voltage as if measured; now gated on valid_flags. Ignition decoded from 0x3B4 byte2 (user: 0x00=on/0x09=off, tracks ignition not engine — both published sources wrong here).
## [2026-07-17] ingest | First drive capture — 0x0BA gear ladder verified, output-shaft scaling narrowed
`raw/log_20260717_145930.txt` (CANNY 5.3 Pico, 1,857 frames / ~34 s, filtered to 0x0BA + 0x1D2) → [[can-capture-2026-07-17-drive]]. **First capture with the vehicle actually moving.** Closes the inference left open yesterday: **`ST_GR_GRB` values 6/7/8/9/A observed directly** (238/77/93/127/94 frames) = 2nd–6th, so **`0x0BA` D0's low nibble is a complete gear source on its own** — P/R/N + 1st–6th, reverse included; `0x1D2` is now needed only for lever + mode. Also caught `ST_CCLT` (converter lockup) live — 422 frames "controlling" in the higher gears, which matters because a locked clutch makes turbine = engine exactly, so the engagement-ratio test needs to read it before trusting a ratio ≈ 1.0 at road speed. **Output shaft identification VERIFIED** (rises monotonically 1139→16702 across gears 1→6, zero whenever the output is held). **Scaling narrowed to ×0.125** `(unverified)`: implies a coherent 901→1872 rpm upshift schedule across five independent ratios, vs 7,200–15,000 rpm for raw-as-rpm against a ~4,500 redline. User confirmed the box is a **ZF 6HP26X** — same gearset as 6HP26 so the ratio table holds, and the xDrive output variant **dates the donor to E60/E61, not E65** (partly answers open Q#2). New question #11: was the transfer case retained? The X box measures output **upstream** of it, so a Patrol transfer case in the path would make road speed high/low-range dependent. Remaining assumption on the scaling: max-output-per-gear = upshift point — **one capture including `0x1A2` closes it** (turbine ÷ output = ratio directly). Updated [[driveline-speed-signals]], [[gear-box-can-revealings]], [[can-id-candidates]], [[nissan-patrol-swap]], [[open-questions]], index.
+2 -1
View File
@@ -39,8 +39,9 @@ Findings from the 2026-07-15 deep-research run (95 claims extracted from ~15 sou
| Battery voltage | **0x3B4** (`U_BT`) | bits 0–11 | **`((D1 & 0x0F) << 8 \| D0) × 0.015` V** | Power module | 5 s | **✅ RESOLVED 2026-07-17** — 12-bit LE × 0.015 confirmed by [[e65-reverse-engineering-repo]] worked example (`0x3D9`→14.775 V). The E90 24-bit BE × 0.001 reading is **wrong for us**. Bonus: `ENG_ST` bits 16–19 |
| Engine RPM | **0x0AA** (`RPM_ENG`) | bits 32–47 | **`(D4 + D5×256) × 0.25`** 1/min | DME/DDE | 10 ms | **✅ VERIFIED 2026-07-17** — 679–684 rpm at idle on our capture, matching `RPM_IDLE_TARGET`=700 from `0x1D0` |
| **Turbine speed** | **0x1A2** (`RPM_GRB_TURB`) | bits 0–15 | **`(D0 + D1×256) × 0.125 + 6`** 1/min | EGS | 20 ms | **✅ VERIFIED 2026-07-17** — physical proof of gear engagement; collapses ~630→~0 when the box engages. → [[driveline-speed-signals]] |
| **Output shaft speed** | **0x0BA** | bits 20–39 (D3/D4) | 🔬 raw × **0.125** = rpm (hypothesis) | EGS | 20 ms | **ID ✅ verified 2026-07-17** — rises monotonically 1st→6th in the drive capture, zero in every stationary frame incl. engaged-in-D. **Scaling still 🔬**: ×0.125 implies a coherent 901→1872 rpm upshift schedule (raw-as-rpm would imply 7,200–15,000 rpm — ruled out), but rests on "max-per-gear = upshift point". **Our only road-speed signal** (no DSC on this bus) → [[driveline-speed-signals]] |
| **Output shaft speed** | **0x0BA** | bits 20–39 (D3/D4) | 🔬 raw × ~**0.107** rpm (was 0.125) | EGS | 20 ms | **ID ✅ verified 2026-07-17** — rises monotonically 1st→6th, zero whenever the output is held. **Scaling 🔬 and revised**: a direct Launch reference (128 rpm @ raw 1192) **contradicts ×0.125** (would predict 149) and points to ~0.107. Needs a multi-point Launch sweep to fix. **Our only road-speed signal** (no DSC on this bus) → [[driveline-speed-signals]] |
| Engine run state | **0x1D0** (`ST_ENGINE_RUN`) | bits 20–21 | `0`=off `1`=starting `2`=running `3`=invalid | DME/DDE | 100 ms | **✅ VERIFIED 2026-07-17** — read 2 ("running") in 397/397 frames of the 2026-07-15 capture |
| Engine torque (available) | **0x0A8** (`TORQ_AVL`) | bits 12–23 | signed × **0.5 Nm** (`(D2<<8\|D1)/32` after masking D1's alive-counter nibble) | DME/DDE | 10 ms | **✅ VERIFIED 2026-07-17** — user-identified ID; formula matches the repo's 0x0A8 worked example (24 Nm, ALIV=8 in D1 low nibble); ~27–28 Nm at warm idle. On the driveline screen → [[driveline-speed-signals]]. NB **0x0AA `TORQ_DVCH`** is the same layout but is driver *demand* — diverges under load |
| Pedal position / cruise state | **0x0AA** | `ANG_ACPD` bits 24–31 (×0.39063 %); `ST_CLCTR_V` bits 52–55 | see [[driveline-speed-signals]] | DME/DDE | 10 ms | (source: [[e65-reverse-engineering-repo]]) — relevant to a cruise-control PoC |
| Gearbox cooling demand | **0x0B5** (`ST_OTMP_GRB`) | bits 38–39 | `0`=none `1`=stage 1 `2`=stage 2 `3`=invalid | EGS | 10 ms | (source: [[e65-reverse-engineering-repo]]) — the box's own overheat opinion; better display warning than a raw threshold |
| Ignition/terminal status | **0x130** | byte 0 bitmasks | 0xD5/0xC5/0xC1 | CAS | 100 ms | **Absent from our bus** (verified 2026-07-15) — CAS not retained in the swap |
+22 -3
View File
@@ -114,9 +114,24 @@ A smooth, gently-rising upshift schedule — textbook M57N at light throttle. Fi
The gearbox is a confirmed **6HP26X** (user, 2026-07-17), so the ratio table is right. The one assumption left standing is **max-output-per-gear = upshift point**.
### Finishing it (one capture)
### ⚠ Direct reference reading contradicts ×0.125
Log **`0x1A2` alongside `0x0BA`** at steady speed through the gears. **Turbine ÷ output gives each gear ratio directly** — no assumption about shift points — and simultaneously cross-checks the box identity against the 6HP26 table. `0x0AA` for engine rpm makes it airtight. The 2026-07-17 capture was filtered to `0x0BA`/`0x1D2` only, which is the sole reason this is still open.
The Launch diagnostic tool reads the EGS output speed directly in rpm (it polls the box, so this is the EGS's own value in engineering units). First simultaneous-ish reading (user, 2026-07-17):
| Launch output speed | our raw `0x0BA` D3/D4 | implied factor |
|---|---|---|
| **128 rpm** | **1192** | **0.107** |
`0x125` would predict 1192 × 0.125 = **149 rpm**; the Launch showed **128**. That's 16 % off — too far to be rounding. **So ×0.125 is probably wrong**, and the true factor is nearer **0.107**. This is exactly the failure mode flagged above: the upshift-schedule test couldn't distinguish 0.107 from 0.125 (both produce a plausible-looking curve), so it never really pinned the factor — it only ruled out raw-as-rpm.
> [!warning] One eyeballed point, not a calibration
> Reading 128 on one tool and 1192 on another at the same instant, on a spinning driveline, is hard to do precisely — the two may be a second apart at slightly different speed. So this **downgrades ×0.125** but doesn't yet promote 0.107. It also can't see an offset (both go through zero, which we know, so a pure factor should hold).
### Finishing it (now easier — the Launch IS the reference)
The Launch gives road/output speed directly in rpm, so we no longer need the turbine-ratio inference at all — just **several simultaneous `(raw, Launch-rpm)` pairs across a speed sweep**, then a linear fit. Slope = the factor, intercept should be ~0. Three or four points settle it far better than one.
Still worth logging **`0x1A2` alongside `0x0BA`** in the same capture: turbine ÷ output cross-checks the box identity against the 6HP26 table independently, and `0x0AA` gives engine rpm. The 2026-07-17 drive capture was filtered to `0x0BA`/`0x1D2` only, which is why the ratio method couldn't run.
`docs/6HP26.pdf` in the source repo would confirm the ratios from a document rather than recollection. → [[open-questions]] wishlist.
@@ -149,7 +164,11 @@ The DME publishes its own cruise/ACC regulation state. `0x0AA` `ST_CLCTR_V` (bit
(source: [[e65-reverse-engineering-repo]]. Our capture reads `0x0` on all 3835 frames — pedal untouched, consistent with a stationary idling test. (verified, 2026-07-17))
Also available: **`ANG_ACPD`** (`0x0AA` bits 24–31, ×0.39063 %) — accelerator pedal position, `0x00` unpressed → `0xFF` floored. And **`TORQ_DVCH`** (bits 12–23, signed ×0.5 Nm) — driver-demand torque.
Also available: **`ANG_ACPD`** (`0x0AA` bits 24–31, ×0.39063 %) — accelerator pedal position, `0x00` unpressed → `0xFF` floored.
> [!note] Torque decode — user's spreadsheet formula confirmed
> **Engine torque is on `0x0A8` (`TORQ_AVL`, available/delivered torque)**, bits 12–23, signed ×0.5 Nm — user-identified. `0x0AA` carries `TORQ_DVCH` (driver *demand*) in the same bit layout, so both read ~27 Nm at idle and are indistinguishable there, but they diverge under load; the delivered value (`0x0A8`) is the one to display.
> The user's Excel formula `(D2*256 + D1)/32` is algebraically identical to `bits12-23 × 0.5` — `(D2<<8|D1)/32 == ((D2<<4)|(D1>>4))×0.5`. Verified against the repo's `0x0A8` worked example (`C7 08 03 …` → 24 Nm). **One caveat**: the low nibble of D1 is `ALIV_TORQ_1_DME` (the alive counter) — the repo example literally shows `ALIV`=8 there — not torque, so the full-16-bit read sweeps in ~±0.5 Nm of jitter. The firmware masks it and sign-extends the 12-bit field (so overrun/braking reads negative). ~27–28 Nm at warm idle on our capture. (verified, 2026-07-17)
### Why a PoC is architecturally plausible
+1 -1
View File
@@ -14,7 +14,7 @@ The research frontier. Answering any of these should trigger updates across the
## Active
8. **What is the scaling of `0x0BA` D3/D4 (output shaft speed)?** *Narrowed 2026-07-17.* The **identification is now verified** (rises monotonically 1st→6th under drive, zero whenever the output is held) and **×0.125 is a strong hypothesis** — it implies a coherent 901→1872 rpm upshift schedule across five independent 6HP26 ratios, where raw-as-rpm would imply 7,200–15,000 rpm against a ~4,500 redline. **Remaining assumption:** that each gear's max output is its upshift point. **One capture closes this** — log `0x1A2` alongside `0x0BA` at steady speed through the gears; turbine ÷ output gives each ratio directly with no shift-point assumption. The 2026-07-17 capture was filtered to `0x0BA`/`0x1D2` only, which is the sole reason it's still open. Still the project's only road-speed signal (no DSC on this bus). → [[driveline-speed-signals]]
8. **What is the scaling of `0x0BA` D3/D4 (output shaft speed)?** *Identification verified; factor still open and revised 2026-07-17.* The field is confirmed output shaft speed (rises monotonically 1st→6th, zero whenever the output is held). The factor is **not** settled: the upshift-schedule test suggested ×0.125, but a **direct Launch reference (128 rpm @ raw 1192) contradicts it** — that implies **~0.107** (0.125 would predict 149 rpm). One eyeballed cross-tool point isn't a calibration, so nothing is adopted yet. **Closing it is now easy**: the Launch reads output speed directly in rpm, so log several simultaneous `(raw, Launch-rpm)` pairs across a speed sweep and fit a line (slope = factor, intercept ≈ 0). Log `0x1A2` too for an independent box-identity cross-check. Still the project's only road-speed signal (no DSC on this bus). → [[driveline-speed-signals]]
11. **Was the BMW transfer case retained, and what's downstream?** The 6HP26**X** measures its output shaft *upstream* of the transfer case, so raw counts → km/h depends on the path: BMW case retained (rear output ~1:1, math unaffected) / deleted and coupled straight to the Patrol driveline (also fine) / a Patrol transfer case in the path (its ratio enters the calculation **and changes with high/low range**, making road speed range-dependent). → [[nissan-patrol-swap]]
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
3B4 CAN 8 A5 F3 89 FC FF FF FF FF ........ 15473596 RX0
3B4 CAN 8 FF FF 09 FC FF FF FF FF ........ 15473820 RX0
3B4 CAN 8 FF FF 09 FC FF FF FF FF ........ 15474335 RX0
3B4 CAN 8 FF FF 00 FC FF FF FF FF ........ 15474696 RX0
3B4 CAN 8 FF FF 00 FC FF FF FF FF ........ 15479337 RX0
3B4 CAN 8 FF FF 00 FC FF FF FF FF ........ 15484332 RX0
3B4 CAN 8 FF FF 09 FC FF FF FF FF ........ 15487289 RX0
3B4 CAN 8 FF FF 09 FC FF FF FF FF ........ 15489333 RX0
3B4 CAN 8 FF FF 09 FC FF FF FF FF ........ 15494327 RX0