Files
ESP32-S3-Touch-LCD-5B/wiki/sources/gear-box-can-revealings.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

6.4 KiB
Raw Blame History

type, tags, updated
type tags updated
source
can-bus
capture
verified
gear
egs
e60
2026-07-17

Gearbox Lever & Gear Decode — 2026-07-16/17 (VERIFIED)

User-recorded per-detent captures of the Steptronic selector: raw/gear_box_can_revealings.csv (lever positions, 2026-07-16) and raw/gearbox_engaged_gear.csv (engaged gear 1–6 in both D and M/S, 2026-07-17). Together these verify 0x1D2 as the gear source and decode the lever, the engaged gear number, and the D/S/M mode.

Two IDs react to the gearbox: 0x1D2 (lever + engaged gear) and 0x0BA (the gearbox's own target gear). Both are needed — see the correction notice below.

0x1D2 (DLC 6) — lever + engaged gear ✅ VERIFIED

Byte Meaning Values
0 Lever position 0xE1=P · 0xD2=R · 0xB4=N · 0x78=D and S/M
1 Engaged gear high nibble − 4 = gear; 0x0F = no numbered gear
2 unused 0xFF
3 rolling counter fluctuates — ignore
4 Mode 0xF0=Drive(auto) · 0xF1=Sport · 0xF2=Manual
5 unused 0xFF

Byte 0 — lever position

Whole-byte codes, matching the documented E65/E90 values exactly, every one. (verified, 2026-07-16)

Byte 0 cannot split D from S/M (both 0x78) — Steptronic's S/M is a side-gate off D, so the fore/aft position is physically identical. Byte 4 does that job.

Byte 1 — engaged gear ✅ (2026-07-17)

The raw/gearbox_engaged_gear.csv capture resolves this. D1 is a clean arithmetic ladder, +16 per gear — the high nibble counts, the low nibble is a constant 0xF:

D1 hex Engaged gear
15 0x0F none (P / R / N)
95 0x5F 1
111 0x6F 2
127 0x7F 3
143 0x8F 4
159 0x9F 5
175 0xAF 6

gear = (D1 >> 4) − 4

The D and M/S halves of the capture show identical D1 values for the same gear — which is the proof that this is engaged gear and not a lever field: the box is in 3rd whether it chose 3rd or the driver asked for it.

Corroborated by the earlier dump: E10F (P), D20F (R), B40F (N), 785F (D) — D at standstill = gear 1. And 0x0BA ST_GR_GRB uses the same ladder (5 = 1st), independently. (verified, 2026-07-17)

[!warning] Corrects the 2026-07-16 claim "D1 = drive-gate flag" This page previously called D1 a boolean gate (0x0F in P/R/N → 0x5F in D+S/M). Wrong — it was the gear number all along, reading 1 because the vehicle was stationary. Only two values were ever observed, so a flag looked like a reasonable fit. This also closes the "actual engaged gear needs a drive capture" item that this page previously listed as open — it didn't need a drive capture, it needed the lever held per-gear.

[!note] Reverse is not numbered D1 stays 0x0F with the lever in R and the box engaged (verified 2026-07-17: 1D2 = D2 0F FF DC F0 FF). 0x1D2 D1 is blind to reverse. The engaged-R signal is 0x0BA ST_GR_GRB = 2.

Byte 4 — mode ✅ (2026-07-17)

D4 Mode
0xF0 Drive — automatic
0xF1 Sport — side gate, no manual input yet
0xF2 Manual — driver has taken control via +/−

From gearbox_engaged_gear.csv: M/S 1st = 0xF1, M/S 2nd–6th = 0xF2. Read with the user's note — "when I switch the lever to M/S the D4 has 241; I have not yet pulled the lever +; when I do it becomes 242" — this maps onto Steptronic behaviour: the side gate puts you in S, and the first +/− tap promotes you to M, where it stays.

[!warning] Corrects the 2026-07-16 claim "0xF2 = downshift (−)" This page previously called 0xF2 a transient downshift event. Wrong — it persists across M/S gears 2 through 6, and events don't hold steady. It's a mode flag, not a shift pulse. The original observation (pushing the lever forward → 0xF2) is still true but was misread: the downshift didn't signal 0xF2, it promoted the box into Manual, which is what 0xF2 reports. This also dissolves the old "manual up-shift (+) value unconfirmed" question — + and − don't have distinct D4 codes; both simply mean Manual.

lever  = D0:  0xE1→P  0xD2→R  0xB4→N  0x78→D/S/M
mode   = D4:  0xF0→auto Drive   0xF1→Sport   0xF2→Manual
gear   = D1:  0x0F→none, else (D1>>4)−4   (1..6; never set for R)
engaged R  →  0x0BA D0 low nibble == 2

0x0BA (DLC 8) — the gearbox's own target gear ⚠ previously dismissed in error

[!warning] Corrects the 2026-07-16 claim "0x0BA — secondary, do NOT use" The 2026-07-16 dismissal rested on D7 colliding R=D=0xCF. D7 is not a gear field — per e65-reverse-engineering-repo it's ST_HYPP_ACV/alive-counter territory. The gear is in D0's low nibble (ST_GR_GRB), which does not collide and which carries a distinct R code that 0x1D2 has nowhere. 0x0BA is not redundant — it is the only source of engaged reverse and the only source of output-shaft motion. Do use it.

Similarly "D5/D6 fluctuate so there are no values" — D5 = CHKSM_GRB (checksum), D6 = ALIV_GRB (alive counter). The observation was correct; the fluctuation is by design, not noise.

ST_GR_GRB = D0 low nibble: 1=N, 2=R, 3=P, 5–A=gears 1–6, 0xF=invalid. Values 1/2/3/5 verified against our capture; 6–A inferred from the matching 0x1D2 ladder (unverified).

0x0BA D3/D4 carry what is almost certainly output shaft speed — undocumented in the source repo, zero in every stationary frame, non-zero the moment the wheels turn. This is the project's only road-speed signal. → driveline-speed-signals

Lever vs box: the UX cross-check

0x1D2 D0 = what the driver selected; 0x0BA ST_GR_GRB = what the box intends. Disagreement means the box refused the request — a real fault worth surfacing on the display. Neither, however, is proof of mechanical engagement; for that, use turbine speed (0x1A2), which physically collapses when the box loads up. Full treatment: driveline-speed-signals.

Still open

  • 0x0BA ST_GR_GRB values 6–A (2nd–6th) not directly observed — inferred.
  • Value 4 in the ST_GR_GRB ladder unaccounted for.
  • 0x0BA D3/D4 scaling uncalibrated → driveline-speed-signals.

can-id-candidates · driveline-speed-signals · e65-reverse-engineering-repo · can-capture-2026-07-15 · can-bus-integration