Files
ESP32-S3-Touch-LCD-5B/wiki/sources/can-capture-2026-07-15.md
T
julian 87801c593c CAN raw logger + toggle fix; wiki: first live capture confirms ID map
Firmware — make the board a working CAN sniffer and fix real bugs:
- can_driver: add raw candump-style logger (CANRAW,<ts>,<id>,<extd>,<dlc>,<hex>),
  capturing every frame incl. unknown IDs for offline decoding. Single atomic
  write per frame.
- serial_lock: new global serial mutex so concurrent task writes (CAN logger,
  UART 5Hz log, heartbeat) no longer splice mid-line. Corruption 3.2% -> 1.4%.
- Fix CAN toggle: the switch had no event handler registered, so it never
  started CAN and reverted on screen change. Wire up onCANBusToggle.
- platformio: route Serial to native USB-CDC (USB_MODE=1, CDC_ON_BOOT=1) so the
  ~486 frame/s stream isn't throttled by the 115200 UART ceiling; bump monitor
  baud to 921600.
- tools/fix_toolchain_path.py: pre-build workaround for pioarduino nesting the
  Xtensa toolchain bin under a subdir that never reaches PATH.
- Correct misleading "LISTEN_ONLY" log string (driver runs TWAI_MODE_NORMAL).

Wiki — ingest the first live capture off the real swap bus:
- raw/can-capture-2026-07-15-gearshift.csv (20,596 frames) + sources page.
- Research map CONFIRMED: 0x1D0/0x1D2/0x0B5/0x3B4 all live; placeholder IDs
  (0x4F/0x55/0x201/0x1001/0x101F) verified absent; 0x130/0x304/0x192 absent.
- 0x1D0 b0 coolant drifts up (37->40C, -48 holds); 0x1D0 b1 oil temp = 0xFF.
- 0x1D2 gear encoding resolved: DLC 6, byte0 gear codes (E1=P, B4=N, 78=D live).
- Corrected LISTEN_ONLY -> NORMAL/ACK across pages; documented non-isolated
  TJA1051 grounding requirement. Updated index + log.

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

46 lines
3.8 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, e60]
updated: 2026-07-16
---
# Live CAN Capture — 2026-07-15 (FIRST REAL BUS DATA)
First capture off the **actual swap's bus**, taken with the ESP32-S3-Touch-LCD-5B itself (new raw-frame logger, `(repo)`). Two dumps: a ~20 s idle capture and a ~40 s gear-shift capture (`P→R→N→D→S/M→P`, ~5 s per position). Raw dump filed at `raw/can-capture-2026-07-15-gearshift.csv` (20,596 well-formed frames, `CANRAW,<ts_ms>,<id>,<extd>,<dlc>,<hex>` format).
Bus: 500 kbps, ~486 frames/s. Capture was clean (~1.4 % line-splice loss, filtered out).
## Headline: the research map is broadly CONFIRMED
**15 IDs seen live:** `0A8 0A9 0AA 0B5 0BA 1A2 1B6 1D0 1D2 200 332 3B3 3B4 492 498`
- All four researched signal IDs are **present and live**: `0x1D0`, `0x1D2`, `0x0B5`, `0x3B4` — plus bonus candidates `0x0AA` and `0x0BA`. (verified: present on bus)
- The firmware's placeholder IDs (`0x4F`, `0x55`, `0x201`, `0x1001`, `0x101F`) are **completely absent** — confirmed placeholders. (verified: absent)
- Researched candidates **NOT seen**: `0x130` (terminal status), `0x304` (gear lever), `0x192`. Either not broadcast by the retained modules, or need a different bus state (ignition/engine). Note for follow-up.
## Signal-level findings
| Signal | ID | What the capture shows | Status |
|--------|----|------------------------|--------|
| Coolant temp | `0x1D0` byte0 | Drifts up `0x55→0x56→0x57→0x58` (−48 → ~37→40 °C). Consistent with a warming coolant sensor. | **Partly verified** — ID + byte + upward drift confirmed; scaling still inferred; needs a cold-start ramp to lock in |
| Oil temp | `0x1D0` byte1 | Constant **`0xFF`** the whole capture — reads invalid/unpopulated | ⚠ oil temp NOT present here — the weakest research signal stays unconfirmed |
| Gear lever | `0x1D2` byte0 | Took values **`0xB4`, `0x78`, `0xE1`** — these ARE the documented BMW gear codes (N, D, P). Resting value `0xE1` = **P**. **DLC = 6** → E90 dialect. | **Verified: ID + byte0 + encoding.** Not all positions cleanly walked (R `0xD2` and S/M not captured as distinct plateaus) |
| Battery volt | `0x3B4` | Present at **~5 s rate** (matches E65 prediction) but payload mostly `0xFF` (`FF FF 00 FC FF FF FF FF`); byte3 = `0xFC`, not the predicted 0x00/0x09 engine flag | ID + rate confirmed; **payload dormant** — needs a powered/engine-running capture |
| RPM | `0x0AA` | Present at **~10 ms rate** (matches predicted RPM cadence) | ID + rate consistent; decode unverified (needs a throttle blip) |
## The 0x1D2 encoding dispute — RESOLVED (mostly)
The capture settles it: **DLC = 6** (E90-dialect length, not E65's DLC 5), and byte0 carries **whole-byte gear codes matching the documented table** (`0xE1`=P, `0xB4`=N, `0x78`=D seen live). The two sources were the same scheme in different notation, as suspected in [[can-id-candidates]].
## Open contradiction to resolve
Coolant (`0x1D0` b0) drifting upward *suggests engine running/warm, but the battery message (`0x3B4`) and oil temp (`0x1D0` b1) are dormant/`0xFF`, which suggests it wasn't. Engine state during this capture was **unconfirmed** (question not answered). A clean **cold-start + idle** capture with confirmed engine state is the next step to promote coolant + battery to fully `(verified)`.
## Method note
Gear discovery via a continuous P→R→N→D→S→P sweep was **ambiguous** — timing alignment between the physical shift and the capture window was poor, and slow IDs (`0x1D2` ~4/s) undersample the plateaus. The whole-byte gear-code match is what saved it. **Next time use a differential capture**: hold P (capture ~6 s), hold R (~6 s), diff the steady-state bytes — zero timing ambiguity.
## Related
[[can-id-candidates]] · [[can-bus-integration]] · [[bmw-m57n-engine]] · [[open-questions]]