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>
This commit is contained in:
2026-07-17 12:33:31 +02:00
parent 0a58afca9a
commit bb87b3d6da
13 changed files with 428331 additions and 132 deletions
+137
View File
@@ -0,0 +1,137 @@
---
type: concept
tags: [can-bus, egs, dde, speed, gear, cruise-control, verified]
updated: 2026-07-17
---
# Driveline Speed Signals
The three rotating speeds our bus exposes — **engine**, **turbine (gearbox input)**, and **output shaft** — and why they matter well beyond the gear display. Together they give (a) a physical proof of gear engagement that no status byte can provide, and (b) the feedback variable a **cruise-control proof of concept** would be built on.
> [!important] Why this page exists
> The swap bus carries **no DSC module** — the 2026-07-15 capture found 15 IDs and *none* of the chassis/stability IDs (`0x0CE`, `0x19E`, `0x1A0`) the [[e65-reverse-engineering-repo]] documents. **There is no wheel-speed message on this bus.** So the gearbox's own shaft speeds are not a nice-to-have — they are the *only* road-speed information available to us. Anything speed-dependent this project ever does, including cruise control, has to come from here.
## The three speeds
| What | ID | Bytes | Decode | Status |
|---|---|---|---|---|
| **Engine RPM** | `0x0AA` `RPM_ENG` | bits 32–47 | `(D4 + D5×256) × 0.25` 1/min | ✅ **verified** — 679–684 at idle |
| **Turbine (input)** | `0x1A2` `RPM_GRB_TURB` | bits 0–15 | `(D0 + D1×256) × 0.125 + 6` 1/min | ✅ **verified** — see below |
| **Output shaft** | `0x0BA` bits 20–39 | D3/D4 | ⚠ **uncalibrated** | 🔬 **hypothesis** — see below |
`0x1A2` is DLC 4 @ 20 ms; `0x0AA` is DLC 8 @ 10 ms; `0x0BA` is DLC 8 @ 20 ms. All three are fast — good for a control loop.
> [!note] Do not use `GRDT_REIN` (`0x0BA` bits 8–19)
> The repo documents it as a gearbox speed (×0.125 1/min), but on **our** bus it reads `0xFFE`/`0xFFF` — the invalid marker — across every frame of both captures. Not populated here. `0x1A2` is the turbine source that works. (verified, 2026-07-17)
## Turbine speed = physical proof of engagement ✅
The single most useful thing this ingest produced. Correlating `0x1A2` against lever position across the 2026-07-15 capture (engine idling ~680 rpm, vehicle stationary on its brakes):
| Lever | Frames | Turbine min | **avg** | max |
|---|---|---|---|---|
| P | 1370 | 6 | **634** | 652 |
| N | 95 | 6 | **628** | 649 |
| **D** | 458 | 6 | **70** | 652 |
| **R** | 2 | 6 | **~0** | 6 |
(verified, 2026-07-17 — derived from `raw/can-capture-2026-07-15-gearshift.csv`)
This is textbook torque-converter behaviour and it is unambiguous:
- **P/N** — nothing is engaged, so the turbine free-spins at roughly engine speed (~630 vs ~680; the gap is normal converter slip).
- **D/R** — the box engages, the output shaft is held by the brakes, and the turbine **stalls to near zero**.
The D column's `max` of 652 and the wide min/max spread are just the transition frames as the lever passed through — the *average* tells the story.
### Why this beats every status byte
`ST_GR_GRB` (`0x0BA`) tells you what the gearbox **intends**. `0x1D2` D0 tells you what the driver **selected**. Neither is proof that anything mechanically happened. **Turbine speed is a physical measurement of load** — the box can't fake it.
**The engagement test** is the *ratio* of turbine to engine speed, not the absolute value:
```
ratio = RPM_GRB_TURB (0x1A2) / RPM_ENG (0x0AA)
ratio ≈ 1.0 → turbine free-spinning → NOT engaged (normal in P/N)
ratio ≈ 0 → turbine stalled/loaded → engaged, output held
0 < ratio < 1 → engaged and moving (converter slip under load)
```
This directly answers the UX problem that motivated the search — *"lever says R but the car isn't moving."* With the vehicle on the ground and the brake released:
- lever = R, **ratio ≈ 0 or climbing from 0** → box engaged, it's working
- lever = R, **ratio ≈ 1.0** → **the box never took the request** ⚠ this is the fault to surface
> [!warning] The ratio is only meaningful under known output conditions
> On a **lift with the wheels free**, an engaged box spins the wheels up until the turbine approaches engine speed again — so `ratio ≈ 1.0` is normal there and does **not** indicate a fault. The test is only valid when the output is loaded (on the ground). Any firmware use of this must gate on output-shaft speed ≈ 0, or the display will cry wolf every time the car is jacked up.
## Output shaft speed — the cruise-control variable 🔬
`0x0BA` bits **20–39** (D2 high nibble, D3, D4) are a **gap in the published source** — the [[e65-reverse-engineering-repo]] table jumps from `GRDT_REIN` at bit 19 straight to the checksum at bit 40. Its own E65 example leaves those bytes zero. **Our bus populates them.**
Evidence that they are an output-shaft/road-speed field (verified, 2026-07-17):
| Condition | D3 | D4 | Turbine | Interpretation |
|---|---|---|---|---|
| P — stationary | `00` | `00` | ~634 | output stopped |
| N — stationary | `00` | `00` | ~628 | output stopped |
| **D — stationary, brakes on** | `00` | `00` | **~70** | engaged but **output held** → zero |
| **R — wheels lifted & turning** | `A8` | `01` | — | **output turning → non-zero** |
The field is zero in *every* stationary frame **including engaged-in-D**, and non-zero the moment the wheels actually rotate. That decouples it from engine, turbine, and gear state — it tracks the **output shaft** and nothing else. Which is exactly the definition of road speed, minus a diff ratio and a tyre circumference.
Read as 16-bit Intel at bit 24: `0x01A8` = 424. At the ×0.125 factor its neighbours use, ~53 rpm — plausible for lifted wheels idling in R, but **the scaling is a guess off a single snapshot and must not be trusted yet.**
### Calibrating it (the next capture)
1. Wheels lifted, hold a steady speed in **D**, log `0x0BA` + `0x1A2` + `0x0AA` together.
2. Step through 1st→6th if the box will shift, recording D3/D4 at each. Turbine ÷ output at each gear should reproduce the **6HP26 gear ratios** — which is a self-check: if the ratios come out right, the scaling is right.
3. `6HP26.pdf` lives in the source repo's `docs/` and gives those ratios. → [[open-questions]] wishlist.
4. Cross-check against the Launch's road-speed readout if it exposes one. → [[obd-diagnostic-polling]]
Getting from output-shaft rpm to km/h needs the **final drive ratio and tyre size of the Patrol**, not the donor — a swap-specific number nobody has written down yet. → [[nissan-patrol-swap]]
## Cruise control: what the bus already gives us
The DME publishes its own cruise/ACC regulation state. `0x0AA` `ST_CLCTR_V` (bits 52–55):
| Value | Meaning |
|---|---|
| `0x0` | ACC regulation, pedal not pressed |
| `0x1` | ACC regulation, pedal pressed |
| `0x4` | **CC regulation, retard** |
| `0x5` | **CC regulation, constant speed** |
| `0x6` | **CC regulation, recall** |
| `0x7` | **CC regulation, speed up** |
| `0x8` | Pedal not pressed |
| `0x9` | Pedal pressed |
| `0xA` | Pedal transgress |
| `0xB` | Pedal kickdown |
(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.
### Why a PoC is architecturally plausible
The E65 powertrain is built around **external modules requesting torque from the DME** — that is precisely what `0x0B5` ("Torque Request EGS") is, and what `0x0BA`'s repo title ("Torque Request ACC") points at. The DME arbitrates requests from the EGS, from ACC, and from itself; `ST_CLCTR_V` is it *reporting which regulator currently has the ball*. So the plumbing for "another module asks the engine for torque" is native to this bus, not something we'd have to invent.
A PoC would then need:
- **Feedback**: output shaft speed (`0x0BA` D3/D4) — *the only road-speed source we have* ⬅ the reason this page exists
- **Actual/limits**: `RPM_ENG`, `ANG_ACPD` (driver override — pedal press must instantly disengage)
- **Engagement sanity**: turbine ratio, so it can't regulate against a box in N
- **Actuation**: a torque-request frame the DME accepts
> [!danger] Actuation is a different category of risk from everything so far
> Every capability in this project to date is **read-only**. A cruise-control PoC **transmits frames that command engine torque**. Getting the ID, scaling, checksum, or alive counter wrong doesn't produce a bad reading — it produces **unintended acceleration**. Additional hazards specific to our situation:
> - The board already runs `TWAI_MODE_NORMAL` and ACKs the bus, so transmit is one function call away — there is **no accidental-write safety margin** left. → [[can-bus-integration]]
> - `0x0B5`/`0x0BA` carry **checksums and alive counters**; the DME rejects (and may fault on) malformed requests. Both algorithms are unknown to us.
> - The swap has **no DSC and no brake-pedal switch on the bus** we've found — so the usual "brake cancels cruise" interlock has no source. A PoC would have no independent way to know the driver is braking.
>
> Treat this as a **bench/lifted-wheels-only** exercise until every one of those is resolved. Nothing here should be enabled on a moving vehicle on the strength of a wiki page.
## Related
[[e65-reverse-engineering-repo]] · [[can-id-candidates]] · [[gear-box-can-revealings]] · [[can-bus-integration]] · [[nissan-patrol-swap]] · [[open-questions]]