Files
ESP32-S3-Touch-LCD-5B/wiki/sources/gear-box-can-revealings.md
T
julian 0a58afca9a Gear decode VERIFIED: real 0x1D2 map in firmware + wiki
The gear lever is fully decoded and confirmed on the actual swap bus
(raw/gear_box_can_revealings.csv): 0x1D2 byte0 = P 0xE1 / R 0xD2 / N 0xB4 /
D 0x78, matching the documented BMW codes exactly. Byte4 splits D vs S/M
(0xF0 auto) and carries manual +/- shifts.

Firmware:
- automotive_data.h: replace placeholder gear map (0x1001) with CAN_ID_GEAR_LEVER
  0x1D2, verified byte-0 codes, byte-4 mode define, and can_to_gear_lever().
- can_driver.cpp: decode 0x1D2 byte0 into gear_position via the enum; reject
  unrecognized codes instead of copying the raw byte.
- Scope: P/R/N/D only (verified). S/M shows as D for now (no enum slot; engaged
  gear number needs a drive capture) — TODO'd, not faked. Coolant/oil/battery
  left as flagged placeholders pending a cold-start capture.

Wiki:
- New source page gear-box-can-revealings + raw CSV filed.
- can-id-candidates: 0x1D2 gear row -> VERIFIED; encoding "dispute" section
  rewritten with the full lever+mode decode table.
- Updated index + log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 14:54:06 +02:00

47 lines
2.4 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, capture, verified, gear, egs, e60]
updated: 2026-07-16
---
# Gearbox Lever Decode — 2026-07-16 (VERIFIED)
Second, cleaner capture focused on the gear lever: the user moved the Steptronic selector through every detent and recorded the steady byte values per position. Raw table at `raw/gear_box_can_revealings.csv`. This **verifies `0x1D2` as the gear source on the actual swap bus** and fully decodes the lever, including the D-vs-S/M gate and the manual +/− shift signal.
Two IDs react to the lever: **`0x1D2`** (clean, use this) and **`0x0BA`** (secondary, messier).
## `0x1D2` (DLC 6) — the gear lever ✅ VERIFIED
| Lever | D0 | D1 | D4 |
|-------|------|------|------|
| P | `0xE1` | `0x0F` | `0xF0` |
| R | `0xD2` | `0x0F` | `0xF0` |
| N | `0xB4` | `0x0F` | `0xF0` |
| D | `0x78` | `0x5F` | `0xF0` |
| S/M | `0x78` | `0x5F` | `0xF1` |
- **D0 = lever position**, whole-byte code: `0xE1`=P, `0xD2`=R, `0xB4`=N, `0x78`=D. **Matches the documented E65/E90 codes exactly** — every value. (verified, 2026-07-16)
- **D0 can't split D from S/M** (both `0x78`) — Steptronic's S/M is a side-gate off D, so fore/aft is identical. Two bytes disambiguate:
- **D1** = drive-gate flag: `0x0F` in P/R/N, `0x5F` in D **and** S/M.
- **D4** = mode / manual shift: `0xF0` = Drive (auto), `0xF1` = Sport/Manual engaged, **`0xF2` = downshift (−)** (user confirmed by pushing the lever forward). Up-nudge (+) likely `0xF3`/`0xF4` — **unconfirmed, one more capture**.
- **D3 = rolling counter** (fluctuates, no meaning) — matches the research prediction of a byte-3 rolling counter. Ignore. D2/D5 = `0xFF` (unused).
### Recommended decode
```
gear = D0: 0xE1→P 0xD2→R 0xB4→N 0x78→D (if D0==0x78 && D4!=0xF0 → S/M)
manual: D4 0xF0 auto · 0xF1 manual · 0xF2 downshift(−)
```
## `0x0BA` (DLC 8) — secondary, do NOT use
D0 low bits also track the lever (P=3, R=2, N=1, D=5, S/M=5) but it's messier: D and S/M collide at 5, and D7 collides R=D=`0xCF` (P=`0xEF`, N=`0xDF`). D5/D6 fluctuate (counter/checksum). Prefer `0x1D2`.
## Still open
- **Actual engaged gear (1st…6th)** is a different signal — the lever position ≠ the gear the box is in. Needs a drive capture (watch `0x1D2` byte1 upper nibble / `0x0BA` while it shifts under load).
- **Manual up-shift (+) value** on `0x1D2` D4 not captured.
## Related
[[can-id-candidates]] · [[can-capture-2026-07-15]] · [[can-bus-integration]] · [[bmw-m57n-engine]]