4 Commits

Author SHA1 Message Date
julian 6bdf4d43a9 Launch capture: decode rail pressure (service 2C, bar = raw x 0.03)
- capture-with-Launch session: live data on this DDE comes via KWP service
  2C (2C 10 00 DF -> 6C 10 HHLL), not the 22 D1xx identifiers (absent) or
  the session-gated 21 blocks
- rail pressure actual VERIFIED two-point vs the Launch display:
  bar = HHLL x 0.03 (idle ~305, 2500 rpm ~430)
- recipe now generalises to any Launch-visible value; self-poll needs the
  session/define handshake (captured, deferred design decision)
- wiki: sources/launch-capture-2026-09-23.md, obd-diagnostic-polling,
  open-questions #7, index; raw serial capture (~13 MB)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 16:48:10 +02:00
julian 61e190b1b9 Diag scans: 22 D1xx refuted, 21 xx session-locked; add diag raw toggle + scanner
- diag probe: `diag raw on|off` console command (mutes CANRAW during scans)
- tools/diag_scan.py: identifier-space sweeper via `diag bmw`
- findings: whole 22 D1xx block NRCs (clipping identifiers wrong for this
  DDE); 21 xx sparse - 21 20 = O_269962, measurement blocks gated behind
  diagnostic session / security access -> Launch capture is the path to
  live data
- wiki: route-b source page + obd-diagnostic-polling updated, raw scan logs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 16:02:18 +02:00
julian 7a7398243b Diag day: Route A+B verified live, DTCs read, donor identified as E60 530d
- diag probe: add mode 03 (diag dtc), BMW KWP on 0x6F1 with extended
  addressing (diag ident, diag bmw), read-only service whitelist
  (1A/18/21/22), MAX_PAYLOAD 64->384, full hex+ascii dump of BMW replies
- tools/diag_session.py: one-session probe runner, logs into wiki/raw/
- wiki: Route A results (11 mode-01 PIDs, rpm/coolant cross-checked, mode
  09 silent), Route B verified (0x6F1 [12] -> 0x612), 1A 86 ident with
  VIN prefix WBANC92090 (E60 530d), DTCs P0101/P0113/P0500/P0545/P0030
  (disconnected-sensor swap leftovers), open-questions #2/#7 updated

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 12:54:24 +02:00
julian e9fc24778a Gauge drive day: CANNY comparison, cluster signal research, serial tools
Wiki: two new pages - canny-5-3-pico-gauge-drive (why the CANNY's 12V
negative output moved the needles and 3.3V push-pull could not; 2SK3069
low-side stage) and patrol-instrument-cluster (tach 2 ppr + trim -13
calibration, NTC temp sender curve, 20 kHz PWM flutter fix, and the
four-layer steppy-needle diagnosis ending at the cluster's ~150 rpm
count quantization, defeated with adaptive dither on B).

Tools: serial_logger.py (multi-port capture to wiki/raw), serial_cmd.py
(one-shot cfg commands to A), dual_serial_capture.py (bench snapshots),
tach_ramp.py / tach_ramp2.py (synthetic rpm sweeps via cfg override).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-23 11:12:20 +02:00
35 changed files with 464979 additions and 74 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
### Diagnostic probe (`diag` console)
`src/modules/diag_probe.cpp` is the only code allowed to call `CANDriver::transmit()`. It sends single OBD-II requests on `0x7DF` and reassembles ISO-TP replies from `0x7E8..0x7EF`: `diag pids` (supported-PID bitmap scan), `diag pid <hex>`, `diag vin`, `diag ecu`, `diag status`. One request in flight, single-shot frames, refused for 3 s after any foreign tester frame (`0x7DF`, `0x7E0-7`, `0x6F1`), services 01/09 only. Transmitted frames are echoed as `CANTX,` lines in the same format as `CANRAW,`. Console lines that `cfg` does not recognise are passed to it via `Tunables::setExtraCommandHandler()`. Background and test procedure: `wiki/pages/obd-diagnostic-polling.md`.
`src/modules/diag_probe.cpp` is the only code allowed to call `CANDriver::transmit()`. It sends single diagnostic requests and reassembles the ISO-TP replies, on two routes: generic OBD-II on `0x7DF` (replies `0x7E8..0x7EF`) and BMW-addressed KWP2000 on `0x6F1` with target byte (replies `0x600`+addr, extended addressing). Commands: `diag pids` (supported-PID bitmap scan), `diag pid <hex>`, `diag dtc` (mode 03), `diag vin`, `diag ecu`, `diag ident [addr]` (KWP `1A 80`), `diag bmw <addr> <hex...>` (raw, whitelisted), `diag raw on|off` (CANRAW mute for scans), `diag status`. One request in flight, single-shot frames, refused for 3 s after any foreign tester frame (`0x7DF`, `0x7E0-7`, `0x6F1`); read-only services only — generic 01/03/09, BMW `1A`/`18`/`21`/`22` (whitelist enforced in `sendBmwRequest()`), never session control or writes. Transmitted frames are echoed as `CANTX,` lines in the same format as `CANRAW,`. Console lines that `cfg` does not recognise are passed to it via `Tunables::setExtraCommandHandler()`. Background and test procedure: `wiki/pages/obd-diagnostic-polling.md`.
### ESP-NOW link
+202 -34
View File
@@ -25,13 +25,15 @@ static const uint32_t OBD_RESP_LAST = 0x7EF; // physical request = response
static const uint32_t OBD_REQ_FIRST = 0x7E0;
static const uint32_t OBD_REQ_LAST = 0x7E7;
static const uint32_t BMW_TESTER_ID = 0x6F1; // BMW KWP/UDS tester (Launch, INPA)
static const uint32_t BMW_RX_BASE = 0x600; // an ECU replies on 0x600 + its address
static const uint8_t BMW_ADDR_DDE = 0x12; // engine ECU address (reply on 0x612)
static const uint32_t REPLY_TIMEOUT_MS = 500; // P2 is 50 ms; be generous
static const uint32_t LINGER_MS = 150; // after the first reply, wait for other ECUs
static const uint32_t PENDING_EXTRA_MS = 2000; // NRC 0x78 "response pending"
static const uint32_t TESTER_GUARD_MS = 3000; // refuse to send this soon after a foreign tester
static const uint8_t PAD_BYTE = 0x00;
static const size_t MAX_PAYLOAD = 64;
static const size_t MAX_PAYLOAD = 384; // KWP ident replies can be long
static const int MAX_RESPONDERS = 4;
static const int SCAN_BLOCKS = 8; // 0x00, 0x20, ... 0xE0
@@ -50,7 +52,10 @@ struct responder_t {
static SemaphoreHandle_t g_mutex = NULL;
static state_t g_state = ST_IDLE;
static uint8_t g_req_mode = 0, g_req_pid = 0;
static uint8_t g_req_mode = 0;
static int g_req_pid = 0; // -1 = request had no PID/sub byte (e.g. mode 03)
static bool g_bmw = false; // current request is BMW-addressed on 0x6F1
static uint8_t g_bmw_target = 0; // its target ECU address (reply on 0x600+addr)
static uint32_t g_deadline_ms = 0;
static uint8_t g_replies_this_req = 0;
@@ -190,8 +195,8 @@ static responder_t* findResponder(uint32_t id, bool create) {
// Transmit
// ----------------------------------------------------------------------------
/** Build and send one single-frame request. Caller holds no lock. */
static bool sendRequest(uint8_t mode, uint8_t pid) {
/** Common preconditions for any transmit; prints the refusal reason. */
static bool clearToSend() {
if (!CANDriver::isActive()) {
print("[diag] refused: CAN is not running");
return false;
@@ -212,23 +217,41 @@ static bool sendRequest(uint8_t mode, uint8_t pid) {
(unsigned long)tester_id, (unsigned long)since_tester);
return false;
}
return true;
}
uint8_t f[8];
memset(f, PAD_BYTE, sizeof(f));
f[0] = 0x02; // ISO-TP single frame, 2 bytes
f[1] = mode;
f[2] = pid;
/** Arm the waiting state. Caller sends the frame right after. */
static void armRequest(uint8_t mode, int pid, bool bmw, uint8_t target) {
lock();
g_state = ST_WAITING;
g_bmw = bmw;
g_bmw_target = target;
g_req_mode = mode;
g_req_pid = pid;
g_deadline_ms = now + REPLY_TIMEOUT_MS;
g_deadline_ms = millis() + REPLY_TIMEOUT_MS;
g_replies_this_req = 0;
g_rx_active = false;
g_requests++;
g_tx_fail_at_send = CANDriver::getStats().tx_failures;
unlock();
}
/** Build and send one single-frame OBD request on 0x7DF. pid < 0 = mode only. */
static bool sendRequest(uint8_t mode, int pid) {
if (!clearToSend()) return false;
uint8_t f[8];
memset(f, PAD_BYTE, sizeof(f));
if (pid < 0) {
f[0] = 0x01; // ISO-TP single frame, 1 byte (e.g. mode 03)
f[1] = mode;
} else {
f[0] = 0x02; // ISO-TP single frame, 2 bytes
f[1] = mode;
f[2] = (uint8_t)pid;
}
armRequest(mode, pid, false, 0);
if (!CANDriver::transmit(OBD_FUNCTIONAL_ID, f, sizeof(f))) {
lock();
@@ -237,7 +260,52 @@ static bool sendRequest(uint8_t mode, uint8_t pid) {
print("[diag] transmit failed (TWAI queue)");
return false;
}
print("[diag] -> 0x7DF %02X %02X", mode, pid);
if (pid < 0) print("[diag] -> 0x7DF %02X", mode);
else print("[diag] -> 0x7DF %02X %02X", mode, pid);
return true;
}
/**
* One single-frame BMW-addressed request on 0x6F1 (ISO 15765 extended
* addressing: byte 0 = target ECU address, then normal ISO-TP). Read-only
* services only - enforced here, not just at the console.
*/
static bool sendBmwRequest(uint8_t target, const uint8_t* req, size_t n) {
static const uint8_t OK_SERVICES[] = {0x1A, 0x18, 0x21, 0x22};
if (n < 1 || n > 6) {
print("[diag] BMW request must be 1..6 bytes (single frame)");
return false;
}
bool allowed = false;
for (size_t i = 0; i < sizeof(OK_SERVICES); i++) {
if (req[0] == OK_SERVICES[i]) allowed = true;
}
if (!allowed) {
print("[diag] service 0x%02X refused - read-only services only (1A ident, 18 DTCs, 21/22 read data)",
req[0]);
return false;
}
if (!clearToSend()) return false;
uint8_t f[8];
memset(f, PAD_BYTE, sizeof(f));
f[0] = target;
f[1] = (uint8_t)n;
memcpy(f + 2, req, n);
armRequest(req[0], (n >= 2) ? (int)req[1] : -1, true, target);
if (!CANDriver::transmit(BMW_TESTER_ID, f, sizeof(f))) {
lock();
g_state = ST_IDLE;
unlock();
print("[diag] transmit failed (TWAI queue)");
return false;
}
char hex[3 * 6 + 1];
hexdump(hex, sizeof(hex), req, n);
print("[diag] -> 0x6F1 [%02X] %s (reply expected on 0x%03lX)", target, hex,
(unsigned long)(BMW_RX_BASE + target));
return true;
}
@@ -245,9 +313,17 @@ static bool sendRequest(uint8_t mode, uint8_t pid) {
static void sendFlowControl(uint32_t responder_id) {
uint8_t f[8];
memset(f, PAD_BYTE, sizeof(f));
f[0] = 0x30; // FC, ContinueToSend
f[1] = 0x00; // block size: all
f[2] = 0x00; // STmin: 0 ms
if (g_bmw) {
f[0] = g_bmw_target; // extended addressing: target first, then the FC
f[1] = 0x30; // FC, ContinueToSend
f[2] = 0x00; // block size: all
f[3] = 0x00; // STmin: 0 ms
CANDriver::transmit(BMW_TESTER_ID, f, sizeof(f));
return;
}
f[0] = 0x30;
f[1] = 0x00;
f[2] = 0x00;
CANDriver::transmit(responder_id - 8, f, sizeof(f));
}
@@ -259,8 +335,8 @@ static void finishScanBlockIfPrimary(uint32_t id, const uint8_t* p, size_t n);
/** A complete ISO-TP payload from `id`. Caller holds g_mutex. */
static void handleReply(uint32_t id, const uint8_t* p, size_t n) {
char hex[3 * 24 + 1];
hexdump(hex, sizeof(hex), p, n > 24 ? 24 : n);
char hex[3 * 48 + 1];
hexdump(hex, sizeof(hex), p, n > 48 ? 48 : n);
g_replies++;
if (n >= 3 && p[0] == 0x7F) {
@@ -284,10 +360,40 @@ static void handleReply(uint32_t id, const uint8_t* p, size_t n) {
g_replies_this_req++;
if (g_deadline_ms > millis() + LINGER_MS) g_deadline_ms = millis() + LINGER_MS;
print("[diag] <- 0x%03lX %s%s", (unsigned long)id, hex, n > 24 ? " ..." : "");
print("[diag] <- 0x%03lX %s%s", (unsigned long)id, hex, n > 48 ? " ..." : "");
if (n < 2 || p[0] != (uint8_t)(g_req_mode + 0x40) || p[1] != g_req_pid) {
print("[diag] (unexpected payload for request %02X %02X)", g_req_mode, g_req_pid);
if (n < 1 || p[0] != (uint8_t)(g_req_mode + 0x40) ||
(!g_bmw && g_req_pid >= 0 && (n < 2 || p[1] != (uint8_t)g_req_pid))) {
print("[diag] (unexpected payload for request %02X)", g_req_mode);
return;
}
if (g_bmw) {
// KWP ident replies are long and the header line clips at 48 bytes:
// dump the whole payload, 16 bytes per line, hex + ascii.
for (size_t i = 1; i < n; i += 16) {
size_t k = (n - i < 16) ? (n - i) : 16;
char hx[3 * 16 + 1];
hexdump(hx, sizeof(hx), p + i, k);
char as[17];
for (size_t j = 0; j < k; j++) {
as[j] = (p[i + j] >= 0x20 && p[i + j] < 0x7F) ? (char)p[i + j] : '.';
}
as[k] = 0;
print("[diag] +%03u %-48s |%s|", (unsigned)(i - 1), hx, as);
}
return;
}
if (g_req_mode == 0x03) {
// 43 <count> <2 bytes per DTC>
uint8_t cnt = (n >= 2) ? p[1] : 0;
print("[diag] %u stored DTC(s):", cnt);
for (size_t i = 2; i + 1 < n; i += 2) {
uint8_t a = p[i], b = p[i + 1];
if (a == 0 && b == 0) continue;
print("[diag] %c%u%X%02X", "PCBU"[a >> 6], (a >> 4) & 3, a & 0x0F, b);
}
return;
}
@@ -340,27 +446,40 @@ void onFrame(const twai_message_t& m) {
return;
}
if (id < OBD_RESP_FIRST || id > OBD_RESP_LAST) return;
if (m.data_length_code == 0) return;
bool maybe_obd = (id >= OBD_RESP_FIRST && id <= OBD_RESP_LAST);
bool maybe_bmw = (id >= BMW_RX_BASE && id < BMW_RX_BASE + 0x100);
if (!maybe_obd && !maybe_bmw) return;
lock();
if (g_state != ST_WAITING) { unlock(); return; }
uint8_t pci = m.data[0] >> 4;
const uint8_t* d = m.data;
uint8_t dlc = m.data_length_code;
uint8_t off = 0; // index of the ISO-TP PCI byte
if (g_bmw) {
// extended addressing: reply on 0x600+target, byte 0 = tester addr 0xF1
if (id != BMW_RX_BASE + g_bmw_target || dlc < 2 || d[0] != 0xF1) { unlock(); return; }
off = 1;
} else if (!maybe_obd) {
unlock();
return;
}
uint8_t pci = d[off] >> 4;
if (pci == 0x0) {
// single frame
size_t len = d[0] & 0x0F;
if (len > 0 && len + 1 <= dlc) handleReply(id, d + 1, len);
size_t len = d[off] & 0x0F;
if (len > 0 && off + 1 + len <= dlc) handleReply(id, d + off + 1, len);
} else if (pci == 0x1) {
// first frame: 1L LL data[6]
if (!g_rx_active && dlc >= 2) {
g_rx_expected = ((size_t)(d[0] & 0x0F) << 8) | d[1];
// first frame: 1L LL data[...]
if (!g_rx_active && dlc >= (uint8_t)(off + 2)) {
g_rx_expected = ((size_t)(d[off] & 0x0F) << 8) | d[off + 1];
if (g_rx_expected > MAX_PAYLOAD) g_rx_expected = MAX_PAYLOAD;
g_rx_len = 0;
for (uint8_t i = 2; i < dlc && g_rx_len < g_rx_expected; i++) g_rx_buf[g_rx_len++] = d[i];
for (uint8_t i = off + 2; i < dlc && g_rx_len < g_rx_expected; i++) g_rx_buf[g_rx_len++] = d[i];
g_rx_id = id;
g_rx_seq = 1;
g_rx_active = true;
@@ -370,9 +489,9 @@ void onFrame(const twai_message_t& m) {
return;
}
} else if (pci == 0x2) {
// consecutive frame: 2N data[7]
if (g_rx_active && id == g_rx_id && (d[0] & 0x0F) == (g_rx_seq & 0x0F)) {
for (uint8_t i = 1; i < dlc && g_rx_len < g_rx_expected; i++) g_rx_buf[g_rx_len++] = d[i];
// consecutive frame: 2N data[...]
if (g_rx_active && id == g_rx_id && (d[off] & 0x0F) == (g_rx_seq & 0x0F)) {
for (uint8_t i = off + 1; i < dlc && g_rx_len < g_rx_expected; i++) g_rx_buf[g_rx_len++] = d[i];
g_rx_seq++;
g_deadline_ms = millis() + REPLY_TIMEOUT_MS;
if (g_rx_len >= g_rx_expected) {
@@ -455,9 +574,14 @@ void tick() {
unlock();
if (!got_reply) {
if (g_req_pid < 0) {
print("[diag] no reply within %lu ms (request %02X)%s", (unsigned long)REPLY_TIMEOUT_MS,
g_req_mode, unacked ? " - frame was not ACKed by any node" : " - frame was ACKed, ECU stayed silent");
} else {
print("[diag] no reply within %lu ms (request %02X %02X)%s", (unsigned long)REPLY_TIMEOUT_MS,
g_req_mode, g_req_pid, unacked ? " - frame was not ACKed by any node" : " - frame was ACKed, ECU stayed silent");
}
}
if (scan) {
if (send_next) {
sendRequest(0x01, (uint8_t)(g_scan_block * 0x20));
@@ -474,10 +598,14 @@ void tick() {
static void help() {
print("diag pids scan mode-01 supported-PID bitmaps (the Route A probe)");
print("diag pid <hex> one mode-01 request, e.g. `diag pid 0C` (rpm), `diag pid 70` (boost)");
print("diag dtc mode 03 - read stored generic DTCs");
print("diag vin mode 09 PID 02 - VIN");
print("diag ecu mode 09 PID 0A - ECU name");
print("diag ident [addr] BMW KWP `1A 80` ECU identification (default addr 12 = DDE, reply 0x612)");
print("diag bmw <addr> <hex...> raw BMW request on 0x6F1, read-only services only (1A/18/21/22)");
print("diag raw on|off CANRAW frame logging (off = clean console during scans)");
print("diag status counters, responders, tester guard");
print("Sends on 0x7DF only, one request at a time; refused while a scan tool is polling.");
print("Sends on 0x7DF / 0x6F1 only, one request at a time; refused while a scan tool is polling.");
}
static void status() {
@@ -507,9 +635,9 @@ bool handleCommand(const char* line) {
strncpy(buf, line, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = 0;
char* argv[4] = {0};
char* argv[10] = {0};
int argc = 0;
for (char* tok = strtok(buf, " \t"); tok && argc < 4; tok = strtok(NULL, " \t")) {
for (char* tok = strtok(buf, " \t"); tok && argc < 10; tok = strtok(NULL, " \t")) {
argv[argc++] = tok;
}
if (argc == 0 || strcmp(argv[0], "diag") != 0) return false;
@@ -544,6 +672,46 @@ bool handleCommand(const char* line) {
if (!strcmp(argv[1], "vin")) { sendRequest(0x09, 0x02); return true; }
if (!strcmp(argv[1], "ecu")) { sendRequest(0x09, 0x0A); return true; }
if (!strcmp(argv[1], "dtc")) { sendRequest(0x03, -1); return true; }
if (!strcmp(argv[1], "raw") && argc == 3) {
bool on = !strcmp(argv[2], "on");
CANDriver::setRawLogging(on);
print("[diag] CANRAW logging %s", on ? "on" : "off");
return true;
}
if (!strcmp(argv[1], "ident")) {
uint8_t target = BMW_ADDR_DDE;
if (argc >= 3) target = (uint8_t)strtol(argv[2], NULL, 16);
uint8_t req[2] = {0x1A, 0x80};
sendBmwRequest(target, req, sizeof(req));
return true;
}
if (!strcmp(argv[1], "bmw") && argc >= 4) {
uint8_t target = (uint8_t)strtol(argv[2], NULL, 16);
char hexs[13] = {0}; // up to 6 bytes = 12 hex chars
size_t hl = 0;
for (int i = 3; i < argc; i++) {
for (const char* c = argv[i]; *c; c++) {
if (hl >= sizeof(hexs) - 1) { print("[diag] too many bytes (max 6)"); return true; }
hexs[hl++] = *c;
}
}
if (hl == 0 || (hl % 2) != 0) {
print("[diag] give whole hex bytes, e.g. `diag bmw 12 1A 80`");
return true;
}
uint8_t req[6];
size_t n = 0;
for (size_t i = 0; i < hl; i += 2) {
char b[3] = {hexs[i], hexs[i + 1], 0};
req[n++] = (uint8_t)strtol(b, NULL, 16);
}
sendBmwRequest(target, req, n);
return true;
}
help();
return true;
+8
View File
@@ -15,11 +15,19 @@
* Console (USB serial, same line reader as `cfg`):
* diag pids scan the mode-01 supported-PID bitmaps (00, 20, 40, ...)
* diag pid <hex> one mode-01 request, e.g. `diag pid 0C` (rpm)
* diag dtc mode 03 — stored generic DTCs
* diag vin mode 09 PID 02 — VIN (identifies the donor)
* diag ecu mode 09 PID 0A — ECU name string
* diag ident [addr] BMW KWP `1A 80` ECU identification on 0x6F1 (default 12 = DDE)
* diag bmw <addr> <hex...> raw BMW-addressed request; read-only services only
* diag status counters, responders seen, tester-guard timer
* diag help
*
* BMW requests use ISO 15765 extended addressing: TX on 0x6F1 with byte 0 =
* target ECU address, reply on 0x600+address with byte 0 = 0xF1. Allowed
* services are whitelisted in sendBmwRequest(): 1A (ident), 18 (DTCs),
* 21/22 (read data) — never session control, resets, or writes.
*
* Every frame we send is echoed on the console as
* CANTX,<ts_ms>,<id_hex>,0,<dlc>,<data_hex>
* — the same shape as CANRAW — so a capture holds both halves of every exchange.
+98
View File
@@ -0,0 +1,98 @@
"""Scan a BMW KWP identifier space via A's `diag bmw` console command.
Sends one read-only request per identifier value (00..FF), waits for the
probe's reply line, and prints a summary of everything that answered
positively. Full console stream goes to wiki/raw/diagscan-<timestamp>.log.
Usage:
python tools/diag_scan.py COM10 21 # scan `21 xx` (readDataByLocalIdentifier)
python tools/diag_scan.py COM10 22D1 # scan `22 D1 xx` (readDataByCommonIdentifier)
python tools/diag_scan.py COM10 22D1 40 60 # optional sub-range [0x40..0x60)
"""
import os
import re
import sys
import time
import serial
port = sys.argv[1]
space = sys.argv[2].upper() # "21" or "22D1"
lo = int(sys.argv[3], 16) if len(sys.argv) > 3 else 0x00
hi = int(sys.argv[4], 16) if len(sys.argv) > 4 else 0x100
raw_dir = os.path.join(os.path.dirname(__file__), "..", "wiki", "raw")
log_path = os.path.join(raw_dir, time.strftime("diagscan-%%s-%Y%m%d-%H%M%S.log") % space)
log = open(log_path, "wb")
s = serial.Serial(port, 115200, timeout=0.05)
print("port open, waiting for boot...")
time.sleep(4)
s.reset_input_buffer()
hits = []
def txn(cmd, wait_s=1.5):
"""Send one diag command, return the probe's reply lines."""
s.write((cmd + "\n").encode())
s.flush()
log.write(("\n>>> %s\n" % cmd).encode())
end = time.time() + wait_s
pending = b""
replies = []
done = False
while time.time() < end and not done:
chunk = s.read(4096)
if not chunk:
continue
log.write(chunk)
pending += chunk
while b"\n" in pending:
line, pending = pending.split(b"\n", 1)
text = line.decode("utf-8", "replace").rstrip()
if "[diag]" in text:
replies.append(text)
if "<- 0x" in text or "no reply within" in text or "refused" in text:
done = True
return replies
try:
txn("diag raw off", wait_s=1.0)
for v in range(lo, hi):
if space == "21":
cmd = "diag bmw 12 21 %02X" % v
label = "21 %02X" % v
else:
cmd = "diag bmw 12 22 %s %02X" % (space[2:], v)
label = "22 %s %02X" % (space[2:], v)
replies = txn(cmd)
got = [r for r in replies if "<- 0x" in r]
if not got:
replies = txn(cmd) # one retry if the line got mangled
got = [r for r in replies if "<- 0x" in r]
if not got:
print("%s (no reply)" % label)
continue
r = got[-1]
if "7F" in r and "negative" not in r.lower() and "NRC" not in r:
pass
if re.search(r"7F \d\d [0-9A-F]{2}", r) or "NRC" in r or "negative" in r:
# negative response - only note interesting NRCs (not 0x12)
if "0x12" not in r and "NRC 0x12" not in r:
print("%s NEG: %s" % (label, r))
else:
print("%s HIT: %s" % (label, r))
hits.append((label, replies))
time.sleep(0.15)
finally:
txn("diag raw on", wait_s=1.0)
log.close()
s.close()
print("\n%d positive hits" % len(hits))
for label, replies in hits:
print("== " + label)
for r in replies:
print(" " + r)
print("log saved: " + os.path.abspath(log_path))
+70
View File
@@ -0,0 +1,70 @@
"""Run the Route A OBD-II diag probe sequence on Controller A and log everything.
Opens the port once (one reboot), waits for boot, then sends each diag command
with a generous wait, echoing replies and saving the full console stream
(CANRAW + CANTX + diag output) to wiki/raw/diag-<timestamp>.log.
Usage: python tools/diag_session.py COM10 [cmd [cmd ...]]
Default sequence: pids, pid 0C, pid 05, pid 0B, pid 70, vin, ecu, status.
"""
import os
import sys
import time
import serial
port = sys.argv[1] if len(sys.argv) > 1 else "COM10"
cmds = ["diag " + c for c in sys.argv[2:]] if len(sys.argv) > 2 else [
"diag pids",
"diag pid 0C",
"diag pid 05",
"diag pid 0B",
"diag pid 70",
"diag vin",
"diag ecu",
"diag status",
]
# pids walks up to 8 blocks with 500 ms timeouts each; give it room.
WAITS = {"diag pids": 15.0, "diag vin": 6.0, "diag ecu": 6.0}
DEFAULT_WAIT = 4.0
raw_dir = os.path.join(os.path.dirname(__file__), "..", "wiki", "raw")
log_path = os.path.join(raw_dir, time.strftime("diag-%Y%m%d-%H%M%S.log"))
log = open(log_path, "wb")
s = serial.Serial(port, 115200, timeout=0.1)
print("port open, waiting for boot...")
time.sleep(4)
def pump(seconds, echo_all=False):
"""Read for `seconds`, log everything, echo non-CANRAW lines."""
end = time.time() + seconds
pending = b""
while time.time() < end:
chunk = s.read(4096)
if not chunk:
continue
log.write(chunk)
pending += chunk
while b"\n" in pending:
line, pending = pending.split(b"\n", 1)
text = line.decode("utf-8", "replace").rstrip()
if echo_all or not text.startswith("CANRAW,"):
print(text)
log.flush()
try:
pump(2) # drain boot output
for cmd in cmds:
print("\n>>> " + cmd)
log.write(("\n>>> %s\n" % cmd).encode())
s.write((cmd + "\n").encode())
s.flush()
pump(WAITS.get(cmd, DEFAULT_WAIT))
finally:
log.close()
s.close()
print("\nlog saved: " + os.path.abspath(log_path))
+40
View File
@@ -0,0 +1,40 @@
"""Capture N seconds from two serial ports in parallel and print what arrived."""
import sys
import time
import threading
import serial
PORTS = sys.argv[1].split(",") if len(sys.argv) > 1 else ["COM8", "COM9"]
SECONDS = float(sys.argv[2]) if len(sys.argv) > 2 else 6.0
MAX_LINES = 40
def cap(port, out):
try:
s = serial.Serial(port, 115200, timeout=0.5)
end = time.time() + SECONDS
buf = b""
while time.time() < end:
buf += s.read(4096)
s.close()
out[port] = buf
except Exception as e:
out[port] = ("ERR: %s" % e).encode()
out = {}
threads = [threading.Thread(target=cap, args=(p, out)) for p in PORTS]
for t in threads:
t.start()
for t in threads:
t.join()
for p in PORTS:
data = out.get(p, b"")
print("=" * 20, p, "bytes:", len(data), "=" * 20)
lines = data.decode("utf-8", "replace").splitlines()
for ln in lines[:MAX_LINES]:
print(ln)
if len(lines) > MAX_LINES:
print("... (%d more lines)" % (len(lines) - MAX_LINES))
+23
View File
@@ -0,0 +1,23 @@
"""Send a command line to a serial port and print the reply.
Usage: python tools/serial_cmd.py COM10 "cfg show" [read_seconds]
"""
import sys
import time
import serial
port = sys.argv[1]
cmd = sys.argv[2]
secs = float(sys.argv[3]) if len(sys.argv) > 3 else 3.0
s = serial.Serial(port, 115200, timeout=0.5)
s.reset_input_buffer()
s.write((cmd + "\n").encode())
s.flush()
end = time.time() + secs
buf = b""
while time.time() < end:
buf += s.read(4096)
s.close()
print(buf.decode("utf-8", "replace"))
+66
View File
@@ -0,0 +1,66 @@
"""Log one or more serial ports to timestamped files until Ctrl+C.
Usage:
python tools/serial_logger.py COM9 # one port
python tools/serial_logger.py COM8,COM9 # several ports
python tools/serial_logger.py COM9 logs/ # custom output dir (default: wiki/raw/)
Each port gets its own file, e.g. wiki/raw/serial-COM9-20260922-141503.log.
Lines are echoed to the console prefixed with the port name. Read-only:
nothing is ever written to the port, so it is safe next to a live bus.
"""
import os
import sys
import time
import threading
from datetime import datetime
import serial
ports = sys.argv[1].split(",") if len(sys.argv) > 1 else ["COM9"]
out_dir = sys.argv[2] if len(sys.argv) > 2 else os.path.join("wiki", "raw")
os.makedirs(out_dir, exist_ok=True)
stop = threading.Event()
print_lock = threading.Lock()
def log_port(port):
stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
path = os.path.join(out_dir, "serial-%s-%s.log" % (port, stamp))
with print_lock:
print("[%s] logging to %s" % (port, path))
try:
s = serial.Serial(port, 115200, timeout=0.5)
except Exception as e:
with print_lock:
print("[%s] ERROR opening port: %s" % (port, e))
return
with open(path, "wb") as f:
pending = b""
while not stop.is_set():
data = s.read(4096)
if not data:
continue
f.write(data)
f.flush()
pending += data
while b"\n" in pending:
line, pending = pending.split(b"\n", 1)
with print_lock:
print("[%s] %s" % (port, line.decode("utf-8", "replace").rstrip()))
s.close()
with print_lock:
print("[%s] closed, log saved: %s" % (port, path))
threads = [threading.Thread(target=log_port, args=(p,)) for p in ports]
for t in threads:
t.start()
try:
while any(t.is_alive() for t in threads):
time.sleep(0.2)
except KeyboardInterrupt:
stop.set()
for t in threads:
t.join()
+37
View File
@@ -0,0 +1,37 @@
"""Sweep the tach via A's override: 800 -> 3500 -> 800 rpm, then override off.
Usage: python tools/tach_ramp.py COM10 [step_rpm] [step_ms]
Sends 'cfg override rpm N' lines over A's console; A pushes each as a CONFIG
frame to B. Ctrl+C aborts and switches the override off.
"""
import sys
import time
import serial
port = sys.argv[1] if len(sys.argv) > 1 else "COM10"
step = int(sys.argv[2]) if len(sys.argv) > 2 else 50
dwell = (int(sys.argv[3]) if len(sys.argv) > 3 else 150) / 1000.0
s = serial.Serial(port, 115200, timeout=0.1)
# Native-USB boards reset when the port opens - give A time to boot.
time.sleep(4)
s.reset_input_buffer()
def send(cmd):
s.write((cmd + "\n").encode())
s.flush()
try:
points = list(range(800, 3501, step)) + list(range(3500, 799, -step))
print("ramp: %d points, %d ms each (~%.0f s total)" % (len(points), dwell * 1000, len(points) * dwell))
for rpm in points:
send("cfg override rpm %d" % rpm)
time.sleep(dwell)
finally:
send("cfg override off")
time.sleep(0.5)
s.close()
print("done, override off")
+40
View File
@@ -0,0 +1,40 @@
"""Ramp tach override 800 -> 6000 rpm, hold 5 s, ramp back down, override off.
Usage: python tools/tach_ramp2.py COM10 [step_rpm] [step_ms]
"""
import sys
import time
import serial
port = sys.argv[1] if len(sys.argv) > 1 else "COM10"
step = int(sys.argv[2]) if len(sys.argv) > 2 else 25
dwell = (int(sys.argv[3]) if len(sys.argv) > 3 else 40) / 1000.0
s = serial.Serial(port, 115200, timeout=0.1)
time.sleep(4) # native-USB reset on port open
s.reset_input_buffer()
def send(cmd):
s.write((cmd + "\n").encode())
s.flush()
try:
up = list(range(800, 6001, step))
down = list(range(6000, 799, -step))
print("up %d pts, hold 5 s at 6000, down %d pts" % (len(up), len(down)))
for rpm in up:
send("cfg override rpm %d" % rpm)
time.sleep(dwell)
send("cfg override rpm 6000")
time.sleep(5)
for rpm in down:
send("cfg override rpm %d" % rpm)
time.sleep(dwell)
finally:
send("cfg override off")
time.sleep(0.5)
s.close()
print("done, override off")
+7 -2
View File
@@ -1,6 +1,6 @@
---
type: index
updated: 2026-09-21
updated: 2026-09-23
---
# Index
@@ -9,6 +9,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
## Entities
- [[patrol-instrument-cluster]] — **what the Patrol cluster expects on its inputs**: tach = 2 pulses/rev (verified by calibration), temp = NTC sender 2.1–2.9 kΩ cold → ~250 Ω at 90 °C; the 1 kHz PWM needle-flutter problem and the mitigation ladder (fixed-duty test → 20 kHz → hardware damping)
- [[bmw-m57n-engine]] — the 3.0L BMW diesel whose CAN bus we read; E60/E65 donor (confirmed), DDE ECU, auto box with EGS on bus
- [[nissan-patrol-swap]] — the target vehicle: Patrol receiving the M57N + BMW auto; the tapped bus is a BMW island in a Nissan
- [[esp32-s3-touch-lcd-5b]] — Waveshare 5" display board (Controller A); onboard TJA1051 CAN transceiver, 7–36 V input, pinout, PSRAM/LCD gotchas
@@ -18,10 +19,11 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
- [[can-bus-integration]] — the core challenge; current firmware ID map flagged as placeholder, verification plan
- [[driveline-speed-signals]] — **engine / turbine / output-shaft speeds**: turbine speed as physical proof of gear engagement, and the output-shaft field that is our **only road-speed source** (no DSC on this bus) — the feedback variable for a future cruise-control PoC, with the safety envelope that would require
- [[dual-controller-architecture]] — Controller A → UART1 + ESP-NOW, protocol v2 → Controller B (1.3" display + Patrol gauge outputs); A owns alerts and the gauge tunables (`cfg` console)
- [[obd-diagnostic-polling]] — **why boost / MAF / rail / injection / DTCs never appear on the sniffer** and how a tester gets them: Route A generic OBD-II mode 01 on `0x7DF` (PID table, `01 00` bitmap as the first test — **implemented as the `diag pids` console probe**), Route B BMW addressing (tester `0x6F1` → DDE replies on `0x612`), DDE6 vs DDE7.3 variants, the capture-with-Launch procedure, and why polling is a transmit-on-the-bus design decision
- [[obd-diagnostic-polling]] — **why boost / MAF / rail / injection / DTCs never appear on the sniffer** and how a tester gets them: Route A generic OBD-II mode 01 on `0x7DF` and Route B BMW KWP on `0x6F1` → `0x612` — **BOTH VERIFIED WORKING 2026-09-23** (minimal PID set, no boost PID, mode 09 silent; `1A 86` ident identifies the donor; DTCs read via mode 03), the capture-with-Launch procedure (still wanted for the `22 D1xx` live-data identifiers), and why polling is a transmit-on-the-bus design decision
## Synthesis
- [[canny-5-3-pico-gauge-drive]] — **why the CANNY-based setup moves the Patrol needles and our ESP32 doesn't**: CANNY "negative output" = 12 V-domain low-side switch, ESP32 IO7/IO8 = 3.3 V push-pull; the low-side transistor fix, and why it's not firmware PWM polarity
- [[can-id-candidates]] — **the E60/E65 CAN ID map — now decoded end-to-end**: gear (lever + engaged + mode), coolant, gearbox temp (raw−40), battery (12-bit ×0.015), RPM, turbine speed, engine state all verified; placeholder IDs verified absent; fault codes and boost not passively broadcast
- [[open-questions]] — the research frontier: bench-verify the candidate IDs, operating temp, transient protection, fault-code design decision
@@ -36,4 +38,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
- [[e65-reverse-engineering-repo]] — **E65 per-ID DBC-style docs (ingested 2026-07-17)** — the highest-value source yet: settled the gearbox-temp offset (raw−40) and battery layout (12-bit ×0.015), proved the engine was running in our capture, and revealed turbine speed, output shaft, pedal position and cruise state
- [[esp32-s3-touch-lcd-5-intro-photo]] — Waveshare annotated board photo (moved into `raw/` 2026-09-21): terminal-block signal order (VIN/GND/VOUT · SDA/SCL · CAN · RS485 A/B · DO0/DO1 · DI), shared CAN/RS485 120 Ω switch, IO0/IO3/IO4/IO46 strapping pads
- [[google-ai-dde7m57-pids]] — Google AI Mode clipping on "dde7m57 pids" (ingested 2026-09-21, raw in `Clippings/`): uncited; its `0x612`-as-request claim is **contradicted**, its D1xx identifiers are `(unverified)`; kept for the Ediabas value names and the user's own observation that `0x612` appears with the Launch connected
- [[diag-route-a-2026-09-23]] — **first live Route A probe run (2026-09-23)**: DDE serves generic OBD mode 01 on `0x7E8` (verified: rpm + coolant cross-checked against the broadcast IDs); supported-PID list; MAF/IAT values implausible (explained by Route B session: sensor faults); mode 09 silent (no VIN); **5 stored DTCs, MIL off**; raw at `raw/diag-20260923-1117*.log`
- [[launch-capture-2026-09-23]] — **rail pressure decoded via Launch capture (2026-09-23)**: the DDE serves live data through service `2C` (`2C 10 00 DF` → `6C 10 HHLL`); **rail pressure bar = HHLL × 0.03**, verified two-point against the Launch (idle 305 / 2500 rpm 430); recipe generalises to any Launch-visible value; self-poll needs the session handshake (design decision); raw at `raw/serial-COM10-20260923-163511.log`
- [[diag-route-b-2026-09-23]] — **Route B verified + DTCs read (same day)**: `0x6F1 [12]` → `0x612` confirmed live; `1A 86` ident = **VIN prefix WBANC92090 (E60 530d), DDE part numbers 7799764/7799765/7793887, 2006-03, KWP2000 not UDS**; `diag dtc` = P0101/P0113/P0500/P0545/P0030 (all disconnected-sensor swap leftovers); raw at `raw/diag-20260923-124*.log`
- [[dwr-335d-torque-pids]] — **DWR's "Extended BMW 335d PIDs for Torque"** (thread page 1 + `raw/BMW 335d.csv`, ingested 2026-09-21): a gauge-checked set of **generic J1979 mode-01 PIDs** from an M57 diesel (2009 335d, DDE7.3) — boost via PID 70, exhaust pressure, EGTs, MAF, fuel rate; nothing BMW-proprietary. Basis for the "try generic OBD first" route; the diesel-specific PIDs are probably absent on our EDC16
+53 -21
View File
@@ -1,4 +1,4 @@
# Log
# Log
Append-only. `grep "^## \[" log.md | tail -5` for recent activity.
@@ -8,15 +8,15 @@ Created schema (`CLAUDE.md`), `index.md`, `log.md`, and five seed pages built fr
## [2026-07-15] ingest | Waveshare ESP32-S3-Touch-LCD-5 product wiki
Re-clipped `raw/ESP32-S3-Touch-LCD-5B.md` ingested → [[esp32-s3-touch-lcd-5b-waveshare-wiki]]. Answered two open questions: CAN transceiver is onboard (TJA1051T/3/1J, terminal block, 120 Ω termination switch off by default) and power is solved by the 7–36 V DC wide input (vehicle 12 V direct). New concern raised: operating temp spec is 0–65 °C, marginal for automotive. Updated [[esp32-s3-touch-lcd-5b]] and [[open-questions]]; added schematic PDF to sourcing wishlist.
Re-clipped `raw/ESP32-S3-Touch-LCD-5B.md` ingested → [[esp32-s3-touch-lcd-5b-waveshare-wiki]]. Answered two open questions: CAN transceiver is onboard (TJA1051T/3/1J, terminal block, 120 Ω termination switch off by default) and power is solved by the 7–36 V DC wide input (vehicle 12 V direct). New concern raised: operating temp spec is 0–65 °C, marginal for automotive. Updated [[esp32-s3-touch-lcd-5b]] and [[open-questions]]; added schematic PDF to sourcing wishlist.
## [2026-07-15] ingest | E60 VFL CAN codes spreadsheet + Listen_and_send_PID Arduino sketch
Two raw sources ingested. (1) `E60 VFL CAN-Bus Codes.xlsx` (community table, ~130 ID blocks from a real pre-facelift E60) → [[e60-vfl-can-codes-xlsx]]: independently confirms 0x1D0 coolant raw−48 (0x7A→74 °C) and 0x3B4 battery voltage (leaning 12-bit LE layout, factor ≈0.0147–0.015), adds 0x304 as a 2-byte gear-lever candidate (P=E3/R=C2/N=D1/M=C9, D value suspect), engine-running flag in 0x3B4 byte 3; contains no oil-temp or gearbox-temp rows. (2) `Listen_and_send_PID_009c` (Arduino MCP2515+ELM327, 2013) → [[listen-and-send-pid-arduino]]: transmits E46 cluster frames from OBD PID polling — filed as technique reference for a future diagnostic-request mode; no map changes. [[can-id-candidates]] updated: coolant now "very high" confidence; oil/gearbox temps flagged as weakest signals.
Two raw sources ingested. (1) `E60 VFL CAN-Bus Codes.xlsx` (community table, ~130 ID blocks from a real pre-facelift E60) → [[e60-vfl-can-codes-xlsx]]: independently confirms 0x1D0 coolant raw−48 (0x7A→74 °C) and 0x3B4 battery voltage (leaning 12-bit LE layout, factor ≈0.0147–0.015), adds 0x304 as a 2-byte gear-lever candidate (P=E3/R=C2/N=D1/M=C9, D value suspect), engine-running flag in 0x3B4 byte 3; contains no oil-temp or gearbox-temp rows. (2) `Listen_and_send_PID_009c` (Arduino MCP2515+ELM327, 2013) → [[listen-and-send-pid-arduino]]: transmits E46 cluster frames from OBD PID polling — filed as technique reference for a future diagnostic-request mode; no map changes. [[can-id-candidates]] updated: coolant now "very high" confidence; oil/gearbox temps flagged as weakest signals.
## [2026-07-15] query | Deep research: E60/E65 CAN IDs for M57N + ZF EGS
Deep-research workflow ran (interrupted twice by session task-loss on Windows; ~82 agents total, 95 claims, 30 adversarial verifications completed; synthesis done manually from the journal). Result: [[can-id-candidates]] — coolant/oil temp on **0x1D0** (raw−48, DDE, 100 ms; confirmed live on a real E60), gear on **0x1D2** (EGS, 200 ms, two generation dialects that likely reconcile), gearbox oil temp on **0x0B5** byte 7 (offset disputed 0 vs +40 — bench-critical), battery voltage on **0x3B4** (layout disputed 12-bit×0.015 vs 24-bit×0.001). Fault codes are NOT passively broadcast — require 0x6F1/0x612 diagnostic requests; firmware `fault_codes` field needs a design decision. Firmware's placeholder IDs contradicted by every source. Updated [[can-bus-integration]]; index updated. Cost note: bulk of tokens spent in the initial (pre-interruption) run; resumes replayed from cache.
Deep-research workflow ran (interrupted twice by session task-loss on Windows; ~82 agents total, 95 claims, 30 adversarial verifications completed; synthesis done manually from the journal). Result: [[can-id-candidates]] — coolant/oil temp on **0x1D0** (raw−48, DDE, 100 ms; confirmed live on a real E60), gear on **0x1D2** (EGS, 200 ms, two generation dialects that likely reconcile), gearbox oil temp on **0x0B5** byte 7 (offset disputed 0 vs +40 — bench-critical), battery voltage on **0x3B4** (layout disputed 12-bit×0.015 vs 24-bit×0.001). Fault codes are NOT passively broadcast — require 0x6F1/0x612 diagnostic requests; firmware `fault_codes` field needs a design decision. Firmware's placeholder IDs contradicted by every source. Updated [[can-bus-integration]]; index updated. Cost note: bulk of tokens spent in the initial (pre-interruption) run; resumes replayed from cache.
## [2026-07-15] update | Donor and target vehicle confirmed by user
@@ -24,35 +24,35 @@ User confirmed: donor chassis is **E60/E65 (2003+)**, transmission is a **BMW au
## [2026-07-16] ingest | Gear lever fully decoded & VERIFIED (0x1D2)
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).
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).
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
## [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.
`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.
## [2026-07-17] ingest | E65_ReverseEngineering repo — both disputes resolved, driveline speeds discovered
## [2026-07-17] ingest | E65_ReverseEngineering repo — both disputes resolved, driveline speeds discovered
User pointed at `HeinrichG-V12/E65_ReverseEngineering` (per-ID DBC-style docs, worked example on every page) → [[e65-reverse-engineering-repo]]. Highest-value source to date; combined with re-analysis of our own `raw/can-capture-2026-07-15-gearshift.csv` it closed most of the frontier. **Resolved**: gearbox oil temp = **raw − 40** (source example + our own gearbox-31 °C-vs-coolant-37 °C warm-up cross-check; my earlier "leaning offset 0" was wrong); battery = **12-bit LE × 0.015**; engine **was running** in the 2026-07-15 capture (`ST_ENGINE_RUN`=2 in 397/397) — **cold-start capture no longer needed**; RPM = `0x0AA` ×0.25 (679–684 idle). **Discovered**: `0x1A2` `RPM_GRB_TURB` turbine speed — a *physical* engagement proof (P/N ≈634/628 free-spinning vs D ≈70, R ≈0 stalled — textbook converter behaviour), plus `0x0BA` bits 20–39 output shaft (undocumented anywhere; zero in every stationary frame incl. engaged-in-D, non-zero once wheels turn), plus `ANG_ACPD` pedal % and `ST_CLCTR_V` cruise state. New page [[driveline-speed-signals]] — emphasized per user: **no DSC on this bus ⇒ output shaft is our only road-speed source**, hence the feedback variable for a future cruise-control PoC (safety envelope documented; actuation = transmitting torque requests, a different risk class from everything read-only so far). **Corrected three of my own 2026-07-16 claims**: `0x1D2` D1 is the *engaged gear* (not a "drive-gate flag" — it read 1 because the car was stationary); D4 `0xF2` is a persistent *Manual mode* (not a "downshift event" — it holds across gears 2–6); `0x0BA` is **not** to be dismissed (I'd read D7, an alive counter, instead of D0's `ST_GR_GRB` — which is the only source of engaged **reverse**, `0x1D2` D1 staying `0x0F` in R). Also: boost is **not** broadcast (`AIP_ENG` caps at 1108 hPa = barometric) — confirms the Launch must poll. Updated [[can-id-candidates]], [[gear-box-can-revealings]], [[open-questions]], index. Next: firmware pass over the whole verified map.
User pointed at `HeinrichG-V12/E65_ReverseEngineering` (per-ID DBC-style docs, worked example on every page) → [[e65-reverse-engineering-repo]]. Highest-value source to date; combined with re-analysis of our own `raw/can-capture-2026-07-15-gearshift.csv` it closed most of the frontier. **Resolved**: gearbox oil temp = **raw − 40** (source example + our own gearbox-31 °C-vs-coolant-37 °C warm-up cross-check; my earlier "leaning offset 0" was wrong); battery = **12-bit LE × 0.015**; engine **was running** in the 2026-07-15 capture (`ST_ENGINE_RUN`=2 in 397/397) — **cold-start capture no longer needed**; RPM = `0x0AA` ×0.25 (679–684 idle). **Discovered**: `0x1A2` `RPM_GRB_TURB` turbine speed — a *physical* engagement proof (P/N ≈634/628 free-spinning vs D ≈70, R ≈0 stalled — textbook converter behaviour), plus `0x0BA` bits 20–39 output shaft (undocumented anywhere; zero in every stationary frame incl. engaged-in-D, non-zero once wheels turn), plus `ANG_ACPD` pedal % and `ST_CLCTR_V` cruise state. New page [[driveline-speed-signals]] — emphasized per user: **no DSC on this bus ⇒ output shaft is our only road-speed source**, hence the feedback variable for a future cruise-control PoC (safety envelope documented; actuation = transmitting torque requests, a different risk class from everything read-only so far). **Corrected three of my own 2026-07-16 claims**: `0x1D2` D1 is the *engaged gear* (not a "drive-gate flag" — it read 1 because the car was stationary); D4 `0xF2` is a persistent *Manual mode* (not a "downshift event" — it holds across gears 2–6); `0x0BA` is **not** to be dismissed (I'd read D7, an alive counter, instead of D0's `ST_GR_GRB` — which is the only source of engaged **reverse**, `0x1D2` D1 staying `0x0F` in R). Also: boost is **not** broadcast (`AIP_ENG` caps at 1108 hPa = barometric) — confirms the Launch must poll. Updated [[can-id-candidates]], [[gear-box-can-revealings]], [[open-questions]], index. Next: firmware pass over the whole verified map.
## [2026-07-16] ingest | First live CAN capture — research map CONFIRMED
## [2026-07-16] ingest | First live CAN capture — research map CONFIRMED
First real dump off the swap's bus, taken with the board's **own new raw-frame logger** (`(repo)`; USB-CDC stream, serial mutex, ~486 frame/s, ~1.4% line loss). Raw filed at `raw/can-capture-2026-07-15-gearshift.csv` (20,596 frames) → [[can-capture-2026-07-15]]. Findings: 15 IDs live incl. **all four researched signal IDs** (0x1D0, 0x1D2, 0x0B5, 0x3B4) + bonus 0x0AA/0x0BA; firmware's placeholder IDs (0x4F/0x55/0x201/0x1001/0x101F) **verified absent**; researched-but-absent: 0x130/0x304/0x192. **0x1D0 b0** drifts 0x55→0x58 (coolant −48, ~37→40 °C); **0x1D0 b1 = 0xFF** (oil temp unpopulated). **0x1D2 gear encoding resolved**: DLC 6, byte0 whole-byte codes (0xE1=P, 0xB4=N, 0x78=D seen live). **0x3B4** at ~5 s rate but payload dormant (0xFF) — engine state unconfirmed. Updated [[can-id-candidates]], [[can-bus-integration]], [[esp32-s3-touch-lcd-5b]], [[open-questions]], index. Also corrected a firmware fact across pages: driver runs **`TWAI_MODE_NORMAL` (ACKs the bus), not LISTEN_ONLY**; TJA1051 is non-isolated → must share vehicle ground. Next: cold-start + confirmed-engine-running capture to lock coolant/battery scaling; use differential (per-position) captures for gear.
First real dump off the swap's bus, taken with the board's **own new raw-frame logger** (`(repo)`; USB-CDC stream, serial mutex, ~486 frame/s, ~1.4% line loss). Raw filed at `raw/can-capture-2026-07-15-gearshift.csv` (20,596 frames) → [[can-capture-2026-07-15]]. Findings: 15 IDs live incl. **all four researched signal IDs** (0x1D0, 0x1D2, 0x0B5, 0x3B4) + bonus 0x0AA/0x0BA; firmware's placeholder IDs (0x4F/0x55/0x201/0x1001/0x101F) **verified absent**; researched-but-absent: 0x130/0x304/0x192. **0x1D0 b0** drifts 0x55→0x58 (coolant −48, ~37→40 °C); **0x1D0 b1 = 0xFF** (oil temp unpopulated). **0x1D2 gear encoding resolved**: DLC 6, byte0 whole-byte codes (0xE1=P, 0xB4=N, 0x78=D seen live). **0x3B4** at ~5 s rate but payload dormant (0xFF) — engine state unconfirmed. Updated [[can-id-candidates]], [[can-bus-integration]], [[esp32-s3-touch-lcd-5b]], [[open-questions]], index. Also corrected a firmware fact across pages: driver runs **`TWAI_MODE_NORMAL` (ACKs the bus), not LISTEN_ONLY**; TJA1051 is non-isolated → must share vehicle ground. Next: cold-start + confirmed-engine-running capture to lock coolant/battery scaling; use differential (per-position) captures for gear.
## [2026-09-21] update | .docs folder retired; UART spec moved to docs/; board photo ingested
The repo's `.docs/` folder was deleted (user decision). `CAN_BUS_INTEGRATION.md` documented the dead placeholder IDs and an external transceiver the board does not need — superseded by [[can-id-candidates]] and [[can-bus-integration]]. `UART_PROTOCOL.md` (the packet spec, shared with Controller B) moved to `docs/UART_PROTOCOL.md` as the single copy; Controller B's duplicate was removed. The annotated board photo moved to `raw/` → [[esp32-s3-touch-lcd-5-intro-photo]]: confirms the terminal-block order, that GPIO 44 exits only as the RS485 A/B pair, and that one 120 Ω switch serves both CAN and RS485. Root `CLAUDE.md` corrected: verified CAN ID list replaces the placeholders, `TWAI_MODE_NORMAL` replaces "LISTEN_ONLY", UART TX is GPIO 44 (was written as 43), dummy-data references removed.
The repo's `.docs/` folder was deleted (user decision). `CAN_BUS_INTEGRATION.md` documented the dead placeholder IDs and an external transceiver the board does not need — superseded by [[can-id-candidates]] and [[can-bus-integration]]. `UART_PROTOCOL.md` (the packet spec, shared with Controller B) moved to `docs/UART_PROTOCOL.md` as the single copy; Controller B's duplicate was removed. The annotated board photo moved to `raw/` → [[esp32-s3-touch-lcd-5-intro-photo]]: confirms the terminal-block order, that GPIO 44 exits only as the RS485 A/B pair, and that one 120 Ω switch serves both CAN and RS485. Root `CLAUDE.md` corrected: verified CAN ID list replaces the placeholders, `TWAI_MODE_NORMAL` replaces "LISTEN_ONLY", UART TX is GPIO 44 (was written as 43), dummy-data references removed.
**Missing source**: the schematic PDF (`ESP32-S3-Touch-LCD-5-Sch.pdf`) was in `.docs/` at the start of the 2026-09-21 session and was not on disk by the time of this cleanup (never git-tracked). Its net list was read earlier that session and is reflected in [[esp32-s3-touch-lcd-5b]]; re-download it into `raw/` — still on the sourcing wishlist in [[open-questions]].
**Missing source**: the schematic PDF (`ESP32-S3-Touch-LCD-5-Sch.pdf`) was in `.docs/` at the start of the 2026-09-21 session and was not on disk by the time of this cleanup (never git-tracked). Its net list was read earlier that session and is reflected in [[esp32-s3-touch-lcd-5b]]; re-download it into `raw/` — still on the sourcing wishlist in [[open-questions]].
Sibling wiki instantiated today at `../../ESP32-S3-LCD-1.3/wiki/` for Controller B (link, redundancy, gauge outputs). Cross-references from there use the text form `(sibling: 5B wiki → page)`.
Sibling wiki instantiated today at `../../ESP32-S3-LCD-1.3/wiki/` for Controller B (link, redundancy, gauge outputs). Cross-references from there use the text form `(sibling: 5B wiki → page)`.
## [2026-09-21] update | Link protocol v2: ESP-NOW second transport, gear/rpm/alerts on the wire, tunables console
Firmware (not yet committed): shared header v2 with typed DATA/CONFIG frames; `Tunables` module (gauge calibration + alert thresholds in NVS, `cfg show|set|override|reset` on the USB console); `EspNowLink` broadcasts every frame alongside UART1 (radio now stays in STA mode — WiFiManager's off no longer calls `WIFI_OFF`); CAN driver publishes lever + target/engaged gear nibbles and rpm, and evaluates coolant/gearbox/battery/cooling-demand alerts against the tunables. Bench-verified with Controller B: both transports alive, every frame deduplicated, `cfg override rpm 2000` drove B's tach output at 133.3 Hz. `docs/UART_PROTOCOL.md` rewritten for v2. [[dual-controller-architecture]] and index updated. Build note: IDF 5.5's ESP-NOW send callback takes `wifi_tx_info_t*`; and the two repos must not be built concurrently (shared penv).
Firmware (not yet committed): shared header v2 with typed DATA/CONFIG frames; `Tunables` module (gauge calibration + alert thresholds in NVS, `cfg show|set|override|reset` on the USB console); `EspNowLink` broadcasts every frame alongside UART1 (radio now stays in STA mode — WiFiManager's off no longer calls `WIFI_OFF`); CAN driver publishes lever + target/engaged gear nibbles and rpm, and evaluates coolant/gearbox/battery/cooling-demand alerts against the tunables. Bench-verified with Controller B: both transports alive, every frame deduplicated, `cfg override rpm 2000` drove B's tach output at 133.3 Hz. `docs/UART_PROTOCOL.md` rewritten for v2. [[dual-controller-architecture]] and index updated. Build note: IDF 5.5's ESP-NOW send callback takes `wifi_tx_info_t*`; and the two repos must not be built concurrently (shared penv).
## [2026-09-21] update | Gauge Tuning screen
@@ -62,14 +62,46 @@ New hand-coded screen `src/modules/tuning_screen.cpp` (swipe right from Drivelin
User decision: the Home screen (three arc meters + battery) is not needed. Deleted `include/ui/screens/ui_Home_Screen.c/h`, its four image assets and `src/modules/meters_manager.*`; `ui_init()` now loads an empty placeholder and `display_init.cpp` shows the hand-coded Driveline screen; the generated Settings screen's right-swipe calls a new C entry point `app_show_driveline()`; Driveline swipes left to Settings and right to Gauge Tuning; Tuning swipes left back. Firmware flash shrank ~100 KB. If SquareLine re-exports a Home screen it must be deleted from the SquareLine project, not wired back in. Built and flashed.
## [2026-09-21] ingest | Google AI clipping "dde7m57 pids" — diagnostic-polling page created, 0x612 direction corrected
## [2026-09-21] ingest | Google AI clipping "dde7m57 pids" — diagnostic-polling page created, 0x612 direction corrected
User clipped a Google AI Mode conversation into `Clippings/` (Obsidian Web Clipper default folder; schema updated to treat it like `raw/`) → [[google-ai-dde7m57-pids]]. Uncited generative summary, filed `(unverified)` throughout. Two things of value: the Ediabas result names for boost/rail/MAF/injection, and the user's own observation embedded in it — **`0x612` appears on the tapped bus while the Launch is connected**, proving diagnostic traffic reaches our tap. The clipping calls `0x612` the *tester request* and `0x6F2` the reply; that contradicts dieslg8 (real M57 code) and the BMW `0x6F1` → `0x600+address` convention — flagged, and the wiki keeps **tester `0x6F1` → DDE `0x612`** until our own capture shows the pair. Its `22 D1 xx` identifiers are uncited and must not be implemented from. Created the long-dangling [[obd-diagnostic-polling]] page (broadcast vs polled, addressing table, DDE6 vs DDE7.3 variant table, capture-with-Launch procedure, firmware implications: polling = transmitting on PT-CAN, a design decision). Side finding: the search term "dde7 m57" describes DDE7.3/EDC17CP09 on the later M57N2 (E90/E70); our E60/E61 donor with a 6HP26X should carry a DDE6/EDC16 — the Launch's ECU-identification page closes [[open-questions]] #2 in one screen. Updated [[bmw-m57n-engine]] (E60/E61, 6HP26X, stale firmware-placeholder warning removed), [[open-questions]] #2/#7 + wishlist, index.
User clipped a Google AI Mode conversation into `Clippings/` (Obsidian Web Clipper default folder; schema updated to treat it like `raw/`) → [[google-ai-dde7m57-pids]]. Uncited generative summary, filed `(unverified)` throughout. Two things of value: the Ediabas result names for boost/rail/MAF/injection, and the user's own observation embedded in it — **`0x612` appears on the tapped bus while the Launch is connected**, proving diagnostic traffic reaches our tap. The clipping calls `0x612` the *tester request* and `0x6F2` the reply; that contradicts dieslg8 (real M57 code) and the BMW `0x6F1` → `0x600+address` convention — flagged, and the wiki keeps **tester `0x6F1` → DDE `0x612`** until our own capture shows the pair. Its `22 D1 xx` identifiers are uncited and must not be implemented from. Created the long-dangling [[obd-diagnostic-polling]] page (broadcast vs polled, addressing table, DDE6 vs DDE7.3 variant table, capture-with-Launch procedure, firmware implications: polling = transmitting on PT-CAN, a design decision). Side finding: the search term "dde7 m57" describes DDE7.3/EDC17CP09 on the later M57N2 (E90/E70); our E60/E61 donor with a 6HP26X should carry a DDE6/EDC16 — the Launch's ECU-identification page closes [[open-questions]] #2 in one screen. Updated [[bmw-m57n-engine]] (E60/E61, 6HP26X, stale firmware-placeholder warning removed), [[open-questions]] #2/#7 + wishlist, index.
## [2026-09-21] ingest | DWR's 335d Torque PID set — generic OBD-II route documented
## [2026-09-21] ingest | DWR's 335d Torque PID set — generic OBD-II route documented
User dropped `raw/BMW 335d.csv` and clipped page 1 of the e90post/6post thread "Extended BMW 335d PIDs for Torque" (DWR, 2009 335d = M57N2 on DDE7.3/EDC17CP09) → [[dwr-335d-torque-pids]]. **Every entry is a generic SAE J1979 mode-01 PID** (DWR says so in post 21; header `Auto` = `0x7DF`); nothing BMW-proprietary, nothing broadcast. Two revisions compared: the CSV in `raw/` is the corrected 2017 one (boost ×0.3125 = the J1979 0.03125 kPa/bit; fuel rate ×0.0938 lb/hr; post-#2's ×0.296 and ×5.64 were wrong); residual typos noted (`000031` for 0.0000305, one `+33`). Decoded his table back to SI with the J1979 byte positions. Consequence for us: the generic route is the **cheapest polling experiment** — one `01 00` supported-PID query on `0x7DF` tells whether our DDE answers EOBD on the PT-CAN and which PIDs it has — but the diesel-specific PIDs he relies on for boost (`70`), exhaust pressure (`73`), EGT (`78`), DPF (`7A`), NOx (`83`) are 2007+ J1979 additions an EDC16 almost certainly lacks `(unverified)`, and PID `0B` clips at 255 kPa. [[obd-diagnostic-polling]] restructured into Route A (generic, PID table, first test) and Route B (BMW `0x6F1`/`0x612`). Wishlist: DWR's Testo parameter list (post 175 of the Testo thread). Updated [[open-questions]] #7 + wishlist, index.
User dropped `raw/BMW 335d.csv` and clipped page 1 of the e90post/6post thread "Extended BMW 335d PIDs for Torque" (DWR, 2009 335d = M57N2 on DDE7.3/EDC17CP09) → [[dwr-335d-torque-pids]]. **Every entry is a generic SAE J1979 mode-01 PID** (DWR says so in post 21; header `Auto` = `0x7DF`); nothing BMW-proprietary, nothing broadcast. Two revisions compared: the CSV in `raw/` is the corrected 2017 one (boost ×0.3125 = the J1979 0.03125 kPa/bit; fuel rate ×0.0938 lb/hr; post-#2's ×0.296 and ×5.64 were wrong); residual typos noted (`000031` for 0.0000305, one `+33`). Decoded his table back to SI with the J1979 byte positions. Consequence for us: the generic route is the **cheapest polling experiment** — one `01 00` supported-PID query on `0x7DF` tells whether our DDE answers EOBD on the PT-CAN and which PIDs it has — but the diesel-specific PIDs he relies on for boost (`70`), exhaust pressure (`73`), EGT (`78`), DPF (`7A`), NOx (`83`) are 2007+ J1979 additions an EDC16 almost certainly lacks `(unverified)`, and PID `0B` clips at 255 kPa. [[obd-diagnostic-polling]] restructured into Route A (generic, PID table, first test) and Route B (BMW `0x6F1`/`0x612`). Wishlist: DWR's Testo parameter list (post 175 of the Testo thread). Updated [[open-questions]] #7 + wishlist, index.
## [2026-09-21] update | `diag` console probe: Controller A can now send OBD-II requests
User decision: build the Route A probe. New module `src/modules/diag_probe.cpp` and a single sanctioned transmit function `CANDriver::transmit()` (single-shot frames, `CANTX,` console echo mirroring `CANRAW,`). Console: `diag pids` (mode-01 supported-PID bitmap scan, blocks 00/20/40…, per-responder summary with PID names), `diag pid <hex>` (one request, decoded for the Route A table incl. PID 70 boost and 78 EGT), `diag vin`, `diag ecu` (mode 09), `diag status`. ISO-TP single/first/consecutive frames reassembled with a `30 00 00` flow control to the responder's physical ID. Guards: one request in flight, refused for 3 s after any foreign tester frame (`0x7DF`/`0x7E0–7`/`0x6F1`), services 01 and 09 only. Console dispatch chained through `Tunables::setExtraCommandHandler()`. Built (1.49 MB) and flashed to COM11; bench check with no bus attached: `diag pids` sent `02 01 00` on `0x7DF`, the TWAI controller reported the single-shot frame un-ACKed, and the probe reported "not ACKed - no other node saw it" rather than blaming the ECU (the summary distinguishes un-ACKed from ACKed-but-silent). CAN-task warnings now take the serial lock so they no longer splice into `CANTX` lines. The wiki's "firmware never transmits" statements are now qualified on [[can-bus-integration]] and [[obd-diagnostic-polling]] (test-day procedure and the three possible outcomes written there). Root `CLAUDE.md` and `docs/UART_PROTOCOL.md` console section updated. Procedure rewritten as numbered steps with all four outcomes (un-ACKed / ACKed-silent / one responder / two responders) and the log-capture command.
User decision: build the Route A probe. New module `src/modules/diag_probe.cpp` and a single sanctioned transmit function `CANDriver::transmit()` (single-shot frames, `CANTX,` console echo mirroring `CANRAW,`). Console: `diag pids` (mode-01 supported-PID bitmap scan, blocks 00/20/40…, per-responder summary with PID names), `diag pid <hex>` (one request, decoded for the Route A table incl. PID 70 boost and 78 EGT), `diag vin`, `diag ecu` (mode 09), `diag status`. ISO-TP single/first/consecutive frames reassembled with a `30 00 00` flow control to the responder's physical ID. Guards: one request in flight, refused for 3 s after any foreign tester frame (`0x7DF`/`0x7E0–7`/`0x6F1`), services 01 and 09 only. Console dispatch chained through `Tunables::setExtraCommandHandler()`. Built (1.49 MB) and flashed to COM11; bench check with no bus attached: `diag pids` sent `02 01 00` on `0x7DF`, the TWAI controller reported the single-shot frame un-ACKed, and the probe reported "not ACKed - no other node saw it" rather than blaming the ECU (the summary distinguishes un-ACKed from ACKed-but-silent). CAN-task warnings now take the serial lock so they no longer splice into `CANTX` lines. The wiki's "firmware never transmits" statements are now qualified on [[can-bus-integration]] and [[obd-diagnostic-polling]] (test-day procedure and the three possible outcomes written there). Root `CLAUDE.md` and `docs/UART_PROTOCOL.md` console section updated. Procedure rewritten as numbered steps with all four outcomes (un-ACKed / ACKed-silent / one responder / two responders) and the log-capture command.
## [2026-09-22] query | CANNY 5.3 pico vs ESP32 gauge drive - tach dead / temp frozen explained
First in-car test of the dual-controller rig: A reads the bus fine, B receives fine, but the Patrol tach never moves and the temp needle parks mid-scale ignoring the override slider. User disclosed the known-good reference: the same cluster works from a CANNY 5.3 pico using "Default Negative Output" (DIO mode, ch 7). Researched the CANNY docs (cannylogic.com/canny.ru): its channels are 12V-domain configurable-polarity switches - "negative output" = low-side sink to GND, letting the cluster's internal pull-up define the ~12V high level. Our ESP32 IO7/IO8 push-pull 3.3V output can't reach the tach's input threshold and biases the temp sender line to a fixed level. Not a firmware PWM polarity issue (50% square is its own inverse). Fix: logic-level N-MOSFET/NPN low-side stage per channel, temp duty law re-derived after (logic inverts). Filed [[canny-5-3-pico-gauge-drive]]; user corrected the channel to 8 (contact 4, the HR-PWM-capable one), matching the 5.3 pico docs. Index updated.
## [2026-09-22] query | Patrol cluster signal research - tach 2 ppr verified, temp sender curve, flutter plan
First day driving the real cluster from Controller B through the 2SK3069 low-side stage. Tach: needle tracked at double with ppr=4; user set ppr=2 -> tracks correctly (verified). 2 ppr matches an ECU-driven 4-cyl-style tach input (ZD30-era Y61 hint, unverified) rather than the TD42 alternator-W-terminal scheme. Temp gauge on IO8: needle flutters at temp_pwm_hz=1 kHz. Researched: stock Patrol sender is an NTC (2.1-2.9k @ 20C, 0.68-1k @ 50C, 236-260R @ 90C; patrol4x4/sensorgal), gauge is current-measuring; community PWM-gauge experience says flutter dies at ~40-50 kHz. Mitigation ladder filed: fixed-duty override test (data vs electrical), cfg set temp_hz 20000 (firmware clamp), then raise clamp / series drain resistor (~100-240R, also bounds full-on beyond-hot short) / gauge-side cap. Temp law must be re-derived after (FET inverts duty sense). Filed [[patrol-instrument-cluster]]; index updated. Earlier same day: [[canny-5-3-pico-gauge-drive]] hypothesis effectively confirmed by the needles moving through the FET; gauge-output disable bits found off during bench test (B console "disabled") - re-enabled via tuning screen.
## [2026-09-22] update | Temp gauge flutter resolved: temp_hz 1 kHz -> 20 kHz
User raised temp_pwm_hz to 20000 via the tuning screen; needle now steady at fixed override duty (verified). A confusing intermediate "gauge dead at 20 kHz" turned out to be a disconnected car-ground during rewiring - grounds first, then debug. [[patrol-instrument-cluster]] updated (flutter section marked resolved; drain series resistor kept as optional hardening). Remaining gauge work: re-derive temp_slope/temp_offset against the real needle through the FET stage (duty sense inverted vs the old direct-drive law).
## [2026-09-23] update | Tach steppy-needle saga resolved; trim -13; temp gauge stable
Full day of override-ramp experiments (ignition on, engine off; tools/tach_ramp.py + tach_ramp2.py drive A over serial). Four-layer diagnosis on B, all firmware in the 1.3 repo: (1) 5 Hz staircase -> slew limiter; (2) Arduino ledcChangeFrequency() re-inits the timer mid-period -> replaced LEDC with esp_timer toggle; (3) esp_timer task jitter from WiFi bursts -> hardware-timer ISR, phase-continuous; (4) the floor: the cluster counts pulses in ~150 rpm quanta (alternating +100/+200 needle steps on a clean ramp) -> random dither +/-45 rpm with an adaptive envelope that fades at steady rpm. Scale: cluster over-reads x1.20 low / x1.15 high (nonlinear); user settled tach_trim = -13%. Also found mid-session: user trim change via touchscreen had never registered (B stayed on cfg v99) - config state now verified over serial before every test. [[patrol-instrument-cluster]] rewritten with the saga; new tools: serial_logger.py, serial_cmd.py, tach_ramp*.py, dual_serial_capture.py. Status: RPM and temp gauges "fairly good", tach dither constants may get a future pass.
## [2026-09-23] ingest | Route A OBD probe - first live run: the DDE answers
The deferred test-day mission finally executed. `tools/diag_session.py` (new: one serial session, full console log into `wiki/raw/`) ran the `diag` sequence with the engine idling, Launch unplugged. Result: **Route A verified** - the DDE serves generic OBD-II mode 01 on `0x7E8`. Supported PIDs `01,04,05,0B,0C,0D,0F,10,1C,20,21`; rpm and coolant cross-checked live against the broadcast IDs (681 rpm / 64 C, matching). Boost PID `70` absent, mode 09 (VIN/ECU name) silent, MAF/IAT scalings implausible under J1979 (flagged unverified). PID 01: MIL off, **5 stored DTCs** - reading them needs mode 03 (probe extension or Launch). Probe counters clean: 15 req / 12 replies / 3 timeouts / 0 tx failures, no retry storms. Wrote sources/diag-route-a-2026-09-23.md; updated obd-diagnostic-polling (Route A section), open-questions #2 (OBD cannot identify the donor; EDC16 hints) and #7 (DTC path now concrete); raw logs diag-20260923-111737.log + diag-20260923-111851.log.
## [2026-09-23] ingest | Route B verified, DTCs read, donor identified (E60 530d)
Second session of the day, no Launch needed. Extended the diag probe (read-only: mode 03 `diag dtc`, BMW KWP `diag ident` / `diag bmw` on 0x6F1 with a 1A/18/21/22 service whitelist; MAX_PAYLOAD 64->384). Results, all on the tapped bus: (1) `diag dtc` read the 5 stored codes - P0101 MAF, P0113 IAT, P0500 VSS, P0545 EGT, P0030 O2 heater - all disconnected-sensor swap leftovers; the "implausible MAF/IAT scaling" flags from the morning are withdrawn (sensor faults). (2) BMW addressing verified live: 0x6F1 [12] -> reply on 0x612; the google-ai clipping's reversed claim is dead. (3) `1A 86` ident (65 B): part numbers 7799764/7799765/7793887, date 2006-03, VIN prefix WBANC92090 -> E60 530d (unverified decode); 22 F190 rejected -> KWP2000 not UDS -> DDE6/EDC16-era. 1A 90 (full VIN) always answers busyRepeatRequest to single-shots. Wrote sources/diag-route-b-2026-09-23.md; updated obd-diagnostic-polling (Route B verified, warning callout resolved), open-questions #2 (donor mostly identified - part-number lookup remains) and #7 (DTCs read), bmw-m57n-engine; raw logs diag-20260923-1241*/1242*/1243*/1245*/1246*.log. Firmware change in src/modules/diag_probe.cpp+.h (design rule kept: still the single transmit path, human-typed, single-shot).
## [2026-09-23] ingest | Identifier scans: 22 D1xx dead, 21 xx session-locked
Third session. Added `diag raw on|off` (CANRAW mute) and tools/diag_scan.py (identifier-space sweeper). Scanned `22 D100-D1FF`: every DID NRC 0x12 - the google-ai clipping identifiers are confirmed wrong for this DDE. Scanned `21 00-FF`: hits only at 21 20 (ASCII " O_269962 " - Bosch SW ref candidate), 21 06/08 (byte 0x05), 21 10 (empty); refusals 21 90 busy / 21 91 conditions-not-correct / 21 F0 security-access-denied show the measurement blocks are gated behind a diagnostic session (10 xx) and partly security access (27) - both outside the read-only whitelist by design. Conclusion: blind Route B probing is exhausted; live data needs the capture-with-Launch session. Updated sources/diag-route-b-2026-09-23.md and obd-diagnostic-polling; raw logs diagscan-22D1-*.log + diagscan-21-*.log.
## [2026-09-23] ingest | Launch capture: rail pressure decoded (service 2C)
The capture-with-Launch session, finally run (engine idling, our read-only serial_logger recording CANRAW while the Launch polled the DDE; user selected Rail Pressure actual, blipped to 2500 rpm for a second point). Result: live data on this DDE comes via KWP service 2C (dynamicallyDefineLocalIdentifier), NOT the 22 D1xx identifiers (which do not exist here) and not the session-gated 21 blocks the blind scan hit. Poll 2C 10 00 DF -> reply 6C 10 HHLL. Rail pressure VERIFIED two-point against the Launch display: bar = HHLL x 0.03 (idle raw 0x27EF=307 bar vs ~305 shown; 2500 rpm raw 0x3768=425 bar vs ~430 shown; transient spikes to 0x4E31~600 bar at tip-in). Recipe generalises to any Launch-visible value. Self-polling needs the connect-time session/define handshake (captured, but a transmit-on-the-bus design decision - deferred). Wrote sources/launch-capture-2026-09-23.md; updated obd-diagnostic-polling, open-questions #7, index; raw at serial-COM10-20260923-163511.log.
+2 -2
View File
@@ -1,7 +1,7 @@
---
type: entity
tags: [engine, bmw, can-bus]
updated: 2026-09-21
updated: 2026-09-23
---
# BMW M57N Engine
@@ -10,7 +10,7 @@ The engine at the heart of the project: the display reads its CAN bus and shows
## This specific engine (verified — user, 2026-07-15)
- Donor chassis: **E60/E61 (2003+)** — narrowed from E60/E65 by the 6HP26X gearbox (xDrive output; the 7-series never had M57N + xDrive) — so a DDE6-generation ECU (Bosch EDC16C31/C35) is the expectation `(unverified)`; the DDE7.3 / EDC17CP09 that Google searches for "dde7 m57" describe is the later M57N2 in the E90/E70. Exact variant still TBD — the Launch's ECU-identification page names it (`D60M57D0`/`D62M57B0` vs `D73N57C0`). → [[obd-diagnostic-polling]]
- Donor chassis: **E60/E61 (2003+)** — narrowed from E60/E65 by the 6HP26X gearbox (xDrive output; the 7-series never had M57N + xDrive). **2026-09-23: the DDE identified itself over KWP** ([[diag-route-b-2026-09-23]]): VIN prefix **`WBANC92090` → E60 530d** `(unverified decode)`, ident date 2006-03, part numbers 7 799 764 / 7 799 765 / 7 793 887, and it speaks **KWP2000 not UDS** — all consistent with a DDE6-generation ECU (Bosch EDC16); a 2006 build would mean the **M57N2 231 hp** revision `(unverified)`. Remaining: look up the part numbers to name the exact variant. → [[obd-diagnostic-polling]]
- Transmission: **ZF 6HP26X** (user-confirmed 2026-07-17) with its EGS ECU wired into the CAN bus — gearbox temp and gear position have a real data source ([[gear-box-can-revealings]]).
## Overview (unverified)
+60
View File
@@ -0,0 +1,60 @@
---
type: synthesis
tags: [hardware, gauges, nissan-patrol, controller-b, electronics]
updated: 2026-09-22
---
# CANNY 5.3 pico vs ESP32-S3: driving the Patrol cluster
Why the user's old CANNY-based setup moves the Patrol tach and our ESP32 (Controller B, IO7) does not. Researched 2026-09-22 after the first in-car test of the dual-controller rig: temp needle parked mid-scale, tach dead ([[dual-controller-architecture]]).
## The working reference setup `(verified)`
The user previously drove this same instrument cluster with a **CANNY 5.3 pico** (Russian visual-PLC automotive controller, cannylogic.com / canny.ru), using **"Default Negative Output" in DIO mode on IO channel 8** (contact 4 — the channel that also carries the high-resolution PWM function). The cluster's needles respond in that setup — this is our known-good electrical reference.
## What the CANNY output stage is (source: cannylogic.com/docs/c53pico, canny.ru)
- Channels are **12 V-domain**: "output operating voltage on the controller channels matches the supply voltage" (7–16 V, 18 V abs max).
- Each channel is a **configurable-polarity switch**: "positive" mode connects the line to +12 V (high-side source), **"negative" mode connects the line to GND (low-side sink)**. Two strengths: weak ~1 mA (pull) and strong 100 mA.
- Rated for inductive/resistive/capacitive loads, 100 mA per channel, 300 mA total, automatic shutoff on over-current.
- "Negative output" therefore produces the classic automotive sender signal: the line is **pulled to ground when active and floats up to the cluster's own internal pull-up (~battery) when released** — a 0 ↔ ~12 V swing without the controller ever sourcing voltage.
## What our ESP32-S3 GPIO is
- **3.3 V push-pull** logic pin, absolute max ~3.6 V, source/sink a few tens of mA, no protection `(unverified — standard ESP32-S3 datasheet values)`.
- LEDC PWM on B's IO7 (tach square wave) and IO8 (temp duty) drives the line **actively to 3.3 V and 0 V** `(repo)`.
## Why this explains the test-day symptoms `(verified 2026-09-22 for the tach — needle tracks rpm through the 2SK3069 low-side stage; see [[patrol-instrument-cluster]] for calibration)`
- The Patrol tach input expects negative-going pulses on a line it pulls up internally toward battery. With the ESP32 push-pull output attached, the "high" half of every cycle is **3.3 V instead of ~12 V** — likely below the input threshold, so the tach sees no edges at all → dead needle, exactly what the CANNY's negative output provides and we don't.
- The temp gauge input is a sender-resistance-to-ground circuit. A 3.3 V push-pull PWM can bias it to some fixed effective level — a needle that parks at one position and ignores duty changes is consistent with this (mid-scale at 89 °C may have been coincidence, not the duty law working). Re-test after the drive stage is fixed before trusting the temp calibration in [[dual-controller-architecture]].
- **It is not PWM polarity in firmware**: a 50 % square wave is its own inverse, and inverted temp duty would move the needle backwards, not freeze it.
## The fix (per channel): replicate "negative output"
Small low-side switch between the ESP32 pin and the gauge line:
```
gauge line ──────────────┬──── (cluster's internal pull-up to ~12 V)
│
D (drain/collector)
ESP32 IOx ──[R ~1k]── G/B N-MOSFET (logic-level, e.g. 2N7002/AO3400) or NPN (2N2222 + base R)
S (source/emitter)
│
GND (common with cluster!)
```
- ESP32 high → line pulled to GND; ESP32 low → line released to the cluster's pull-up. This **inverts the logic**: tach unaffected (50 % square), temp duty becomes 255 − duty at the gauge — recalibrate `temp_slope`/`temp_offset` ([[dual-controller-architecture]] tunables) or invert in B's firmware.
- If the cluster input turns out to have no internal pull-up, add an external ~4.7–10 kΩ to +12 V.
- On hand (2026-09-22): a **2SK3069** (N-ch, 60 V / 75 A, 4 V-drive class) — hugely oversized but suitable; planned for the tach channel with 220 Ω gate series + 10 kΩ gate pulldown `(source: alltransistors.com 2SK3069)`.
- **Never** connect the 12 V-pulled gauge line directly to an ESP32 pin, including in open-drain mode — the pin is not 12 V tolerant.
- Grounds must be common: cluster GND ↔ Controller B GND.
## Open items
- Scope or multimeter the tach line at rest: does it float high (~12 V) with nothing attached? Confirms the internal pull-up assumption.
- After the transistor stage: re-run the override test (Force tach rpm / Force coolant duty on A's tuning screen) and re-derive the temp duty law; promote this page's hypothesis to `(verified)`.
## Related
[[dual-controller-architecture]] · [[nissan-patrol-swap]] · [[open-questions]]
+30 -9
View File
@@ -1,7 +1,7 @@
---
type: concept
tags: [can-bus, dde, egs, diagnostics, kwp2000, uds, obd, design-decision]
updated: 2026-09-21
tags: [can-bus, dde, egs, diagnostics, kwp2000, uds, obd, design-decision, rail-pressure]
updated: 2026-09-23
---
# OBD / Diagnostic Polling
@@ -25,12 +25,23 @@ E60-generation BMWs use one shared diagnostic ID pair with an ECU address in the
- **What the user saw (2026-09-21):** `0x612` appears on the tapped bus only while the Launch is connected. That is the DDE *answering* — consistent with the table. The requests should be present in the same capture as `0x6F1`; the user's recollection of "`0x6F2`" is almost certainly `0x6F1`.
> [!warning]
> The [[google-ai-dde7m57-pids]] clipping states the opposite (`0x612` = request, `0x6F2` = response). Two sources (dieslg8's working code on a real M57, and the `0x6xx` = ECU-address convention) against one uncited AI summary: **we go with tester `0x6F1` → DDE `0x612`** until our own capture shows the pair. Nothing is verified until then.
> [!note]
> **Resolved 2026-09-23**: our own probe sent `0x6F1 [12] 1A 86` and the DDE answered on `0x612` `(verified)` — dieslg8's scheme was right, the [[google-ai-dde7m57-pids]] clipping's reversed claim is dead. See [[diag-route-b-2026-09-23]].
- **Generic EOBD** (`0x7DF` functional / `0x7E0` physical → reply `0x7E8`, mode `01`) is a second, standard route `(unverified)` — early E60s served EOBD over K-line, later ones over CAN. See the next section: it is the cheaper experiment and needs no BMW knowledge.
- **Generic EOBD** (`0x7DF` functional → reply `0x7E8`, mode `01`) is a second, standard route — **`(verified 2026-09-23)`: the DDE answers it on the PT-CAN.** See Route A results below.
## Route A — generic OBD-II mode 01 (try this first)
## Route A — generic OBD-II mode 01 — **VERIFIED WORKING (2026-09-23)**
First live run done, engine idling, probe on the tapped bus: **the DDE replies on `0x7E8`** (and only the DDE — the EGS stays silent on generic OBD). Full readings, raw logs and the two scaling warnings: [[diag-route-a-2026-09-23]].
- Supported PIDs (bitmap scan): `01, 04, 05, 0B, 0C, 0D, 0F, 10, 1C, 20, 21` — a minimal EOBD set, consistent with EDC16/DDE6 `(unverified)`. No boost `70`, no EGT `78`, no baro `33`, no fuel rate `5E`.
- Cross-checked live: rpm 681 (CAN said 678–682) and coolant 64 °C (CAN said 63–64) — request path and decode both `(verified)`.
- MAP `0B` = 104 kPa at idle; the 255 kPa clip question needs a drive with boost.
- MAF `10` and IAT `0F` reply with implausible values (258 g/s, 155 °C at idle) — **explained the same afternoon: those are sensor faults (P0101, P0113), not scalings** ([[diag-route-b-2026-09-23]]).
- **Mode 09 (VIN, ECU name) is ACKed but never answered** — the donor could not be identified via generic OBD; Route B's `1A 86` did it instead.
- **PID `01` reports MIL off with 5 stored DTCs** — read the same day via the new `diag dtc` (mode 03): P0101, P0113, P0500, P0545, P0030, all swap leftovers ([[diag-route-b-2026-09-23]]).
The original pre-test notes and PID reference table follow.
The [[dwr-335d-torque-pids]] source is a worked, gauge-checked set of J1979 mode-01 PIDs from an M57 diesel (a 2009 335d, DDE7.3). They are ECU-agnostic by design, so whichever subset our DDE supports can be read with standard frames and no reverse-engineering:
@@ -51,7 +62,11 @@ The [[dwr-335d-torque-pids]] source is a worked, gauge-checked set of J1979 mode
- **Implemented on Controller A (2026-09-21) `(repo)`** as the `diag` console command — see *Firmware: the `diag` probe* below. The whole test is `diag pids` typed on the USB console.
- Route A cannot give fault codes beyond generic mode `03` DTCs (P0xxx) — BMW-specific codes need Route B.
## Route B — BMW proprietary (KWP2000 / UDS on `0x6F1` → `0x612`)
## Route B — BMW proprietary (KWP2000 on `0x6F1` → `0x612`) — **VERIFIED WORKING (2026-09-23)**
First live exchange without any scan tool: `diag bmw 12 1A 86` → 65-byte multi-frame ident from `0x612`, containing DDE part numbers (7 799 764 / 7 799 765 / 7 793 887), a 2006-03 date, and the **VIN prefix `WBANC92090` → E60 530d** `(verified bytes / unverified decode)` — full breakdown in [[diag-route-b-2026-09-23]]. `22 F1 90` (UDS) is rejected: the DDE speaks **KWP2000, not UDS** — pointing at DDE6/EDC16. `1A 90` (full VIN) answers busyRepeatRequest to a single-shot probe. **Same day, identifier scans**: the clipping's `22 D1xx` identifiers are confirmed wrong (whole block NRCs), and a `21 xx` sweep shows the measurement blocks are **gated behind a diagnostic session / security access** (NRC 0x22/0x33) — outside the probe's read-only whitelist by design.
**Capture-with-Launch done, and it worked — [[launch-capture-2026-09-23]].** The Launch reads live values via service **`2C`** (dynamicallyDefineLocalIdentifier), not `21`/`22`: poll `2C 10 00 DF` → reply `6C 10 HHLL`. **Rail pressure actual is fully decoded and verified: bar = HHLL × 0.03** (two points against the Launch display: idle 305, 2500 rpm 430). The method generalises to any value the Launch will display; self-polling it would need the connect-time session/define handshake (captured, but a transmit-on-the-bus design decision).
This depends on the DDE variant, which is still open ([[open-questions]] #2, [[bmw-m57n-engine]]):
@@ -82,11 +97,16 @@ Controller A now has **one** transmit path onto the PT-CAN: `CANDriver::transmit
| `diag pid <hex>` | one mode-01 request | raw reply bytes + a decoded value for the PIDs in the Route A table |
| `diag vin` | mode 09 PID 02 | the VIN as text — identifies the donor ([[open-questions]] #2) |
| `diag ecu` | mode 09 PID 0A | the ECU name string |
| `diag dtc` | mode 03 on `0x7DF` | the stored generic DTCs, decoded (added 2026-09-23) |
| `diag ident [addr]` | BMW KWP `1A 80` on `0x6F1` (default addr `12` = DDE) | ECU identification, full hex+ASCII dump (added 2026-09-23) |
| `diag bmw <addr> <hex...>` | one raw BMW-addressed request | reply dump; **whitelisted read-only services only** (`1A` ident, `18` DTCs, `21`/`22` read data — never session control or writes) |
| `diag status` | nothing | request/reply/timeout counters, responders seen, tester-guard timer |
Safety rules baked in: one request in flight at a time; frames are **single-shot** (no retransmit storm if nobody ACKs, the failure is just counted); **refused for 3 s after any foreign tester frame** (`0x7DF`, `0x7E0–7`, `0x6F1`), so it cannot collide with the Launch; only services `01` and `09`, never session control or writes; multi-frame replies are reassembled with a standard flow-control frame (`30 00 00`) to the responder's physical ID. Every transmitted frame is echoed as `CANTX,<ts>,<id>,0,<dlc>,<hex>` next to the `CANRAW` lines, so a saved console log holds both halves of every exchange.
### Test-day procedure (Route A probe)
### Test-day procedure (Route A probe) — executed 2026-09-23, outcome: Route A works
Run via `tools/diag_session.py` (one serial session, logs straight into `wiki/raw/`); results in [[diag-route-a-2026-09-23]]. Procedure kept for re-runs (e.g. the boost-clip drive test):
1. Engine running, **Launch unplugged** (the probe refuses to send for 3 s after any tester frame, and the Launch keeps polling while attached).
2. Laptop on the 5B's USB, console at 115200 with the output saved to a file, e.g. from the repo root:
@@ -105,7 +125,8 @@ Safety rules baked in: one request in flight at a time; frames are **single-shot
## Beyond the probe `(repo)`
- A continuous poller (Route A or B) would reuse the same transmit path with a fixed request list: one request per ≥100 ms, one identifier at a time, only while no scan tool is connected, never a session-control or write service. Still a design decision: a request storm or a malformed frame can disturb the DDE/EGS, and diagnostic sessions can change what an ECU broadcasts.
- **The decode recipe (proven 2026-09-23):** log `CANRAW` while the Launch shows a live value → find the `2C 10 <id>` / `6C 10 <data>` pair whose data tracks the reading → calibrate scale against the display at two operating points (idle + a blip). One session per parameter. Boost, MAF, injection quantity, EGTs all reachable this way. Worked example: [[launch-capture-2026-09-23]] (rail pressure).
- A continuous poller (Route A or B) would reuse the same transmit path with a fixed request list: one request per ≥100 ms, one identifier at a time, only while no scan tool is connected, never a session-control or write service. Still a design decision: a request storm or a malformed frame can disturb the DDE/EGS, and diagnostic sessions can change what an ECU broadcasts. **Route B self-polling additionally needs the connect-time session/define handshake** the Launch performs (the blind `21` scan hit NRC 0x22/0x33 without it) — captured in [[launch-capture-2026-09-23]] if we ever choose to replay it.
- Protocol v2 dropped the `fault_codes` field in favour of the alert bitmap ([[dual-controller-architecture]]); polled values would need new DATA fields.
- The same request path would also be the only way to read DTCs (service `0x18`/`0x19`, variant-dependent) → [[open-questions]] #7.
+3 -3
View File
@@ -1,7 +1,7 @@
---
type: synthesis
tags: [meta, todo]
updated: 2026-09-21
updated: 2026-09-23
---
# Open Questions
@@ -24,7 +24,7 @@ The research frontier. Answering any of these should trigger updates across the
## Project context
2. **Exact donor model year / DDE version and EGS variant?** *Partly answered 2026-07-17.* The gearbox is a **ZF 6HP26X** (user-confirmed) — the X is the xDrive output variant, which means the donor is an **E60/E61, not an E65**: the 7-series never took M57N + xDrive. Remaining: model year and DDE version. **Cheap to close (2026-09-21):** the Launch scanner's ECU-identification page (or any INPA "control unit found" string) names the variant — `D60M57D0`/`D62M57B0` = DDE6 (EDC16), `D73N57C0` = DDE7.3 (EDC17). → [[bmw-m57n-engine]], [[obd-diagnostic-polling]]
2. **Exact donor model year / DDE version and EGS variant?** *Partly answered 2026-07-17.* The gearbox is a **ZF 6HP26X** (user-confirmed) — the X is the xDrive output variant, which means the donor is an **E60/E61, not an E65**: the 7-series never took M57N + xDrive. Remaining: model year and DDE version. **Cheap to close (2026-09-21):** the Launch scanner's ECU-identification page (or any INPA "control unit found" string) names the variant — `D60M57D0`/`D62M57B0` = DDE6 (EDC16), `D73N57C0` = DDE7.3 (EDC17). **Update 2026-09-23:** generic OBD can NOT close this — mode 09 (VIN `09 02`, ECU name `09 0A`) is ACKed but never answered ([[diag-route-a-2026-09-23]]). **Same afternoon, mostly ANSWERED via Route B**: `1A 86` on `0x6F1` returned the DDE ident — **VIN prefix `WBANC92090` → E60 530d** `(unverified decode)`, DDE part numbers **7 799 764 / 7 799 765 / 7 793 887**, date 2006-03, and the DDE speaks **KWP2000 not UDS** ([[diag-route-b-2026-09-23]]). Remaining sliver: look up the part numbers / NC9x model code online to pin the exact DDE variant (DDE6.1 vs 6.2, M57N vs M57N2) — a web/parts-catalogue task now, no more hardware needed. → [[bmw-m57n-engine]], [[obd-diagnostic-polling]]
3. **Standalone harness or full donor loom? Which BMW modules were retained?** Affects which modules broadcast on the swap's bus. → [[nissan-patrol-swap]]
4. **Which Patrol generation, and how is the display being mounted/powered?** → [[nissan-patrol-swap]]
@@ -32,7 +32,7 @@ The research frontier. Answering any of these should trigger updates across the
5. **Operating temperature 0–65 °C** (source: waveshare-wiki) — outside automotive norms at both ends (sub-zero winter cabins, sun-baked dashboards). Is the mounting location temperature-controlled enough? Any mitigation (mounting away from vents/sun, accepting reduced lifespan)?
6. **Transient protection on the 7–36 V input**: the board takes vehicle 12 V directly, but ISO 7637 load-dump spikes can exceed 36 V `(unverified)`. Consider an upstream TVS diode / automotive-rated buck. Also: ignition-switched vs constant power (the isolated digital input could sense ignition).
7. **Fault codes**: the UART packet reserves a field for fault codes — DDE fault codes are read via diagnostic protocols (KWP2000/UDS over K-line or CAN), not passively broadcast. Is passive reading even possible? `(unverified)` — **update 2026-07-17**: the same barrier explains why the Launch scanner shows boost/gearbox data our dump lacks (it polls; nothing broadcasts them). A capture *while the Launch is connected* would record both request and reply frames, handing us the exact bytes to replay. **Update 2026-09-21**: the user has seen `0x612` appear on the tapped bus while the Launch is connected — that is the DDE *replying* (`0x600` + DDE address `0x12`); the requests go out on `0x6F1`. Diagnostic traffic therefore reaches our tap, so the capture will contain both halves. Page written with the capture procedure and the firmware implications (polling = transmitting on the bus). **Cheapest first experiment** (from [[dwr-335d-torque-pids]]): one generic `01 00` supported-PID query on `0x7DF` — tells whether this DDE answers EOBD on the PT-CAN and which mode-01 PIDs it has, with zero BMW-specific knowledge. → [[obd-diagnostic-polling]]
7. **Fault codes**: the UART packet reserves a field for fault codes — DDE fault codes are read via diagnostic protocols (KWP2000/UDS over K-line or CAN), not passively broadcast. Is passive reading even possible? `(unverified)` — **update 2026-07-17**: the same barrier explains why the Launch scanner shows boost/gearbox data our dump lacks (it polls; nothing broadcasts them). A capture *while the Launch is connected* would record both request and reply frames, handing us the exact bytes to replay. **Update 2026-09-21**: the user has seen `0x612` appear on the tapped bus while the Launch is connected — that is the DDE *replying* (`0x600` + DDE address `0x12`); the requests go out on `0x6F1`. Diagnostic traffic therefore reaches our tap, so the capture will contain both halves. Page written with the capture procedure and the firmware implications (polling = transmitting on the bus). **Cheapest first experiment** (from [[dwr-335d-torque-pids]]): one generic `01 00` supported-PID query on `0x7DF` — tells whether this DDE answers EOBD on the PT-CAN and which mode-01 PIDs it has, with zero BMW-specific knowledge. **Update 2026-09-23 — experiment run, answer: YES.** The DDE serves mode 01 on `0x7E8` `(verified)`, and PID `01` shows **MIL off with 5 stored DTCs** ([[diag-route-a-2026-09-23]]). **Same afternoon: `diag dtc` (mode 03) read them** `(verified)`: P0101 (MAF), P0113 (IAT), P0500 (VSS), P0545 (EGT), P0030 (O2 heater) — all disconnected-sensor swap leftovers, and the first two explain the garbage MAF/IAT PID values ([[diag-route-b-2026-09-23]]). Route B addressing also verified live (`0x6F1 [12]` → `0x612`). What remains of this question: BMW-specific (non-P0xxx) codes and the live-data identifiers. **Update 2026-09-23 — Launch capture done ([[launch-capture-2026-09-23]]):** live data comes via service `2C` (not `22 D1xx`, which don't exist here); **rail pressure fully decoded and verified** (`2C 10 00 DF` → `6C 10 HHLL`, bar = HHLL × 0.03). The recipe now generalises to any Launch-visible value (boost, MAF, injection… one capture session each). Reading them *without* the Launch needs replaying the session/define handshake — a transmit-on-the-bus design decision, deferred. → [[obd-diagnostic-polling]]
## Answered
+55
View File
@@ -0,0 +1,55 @@
---
type: entity
tags: [hardware, gauges, nissan-patrol, controller-b, electronics]
updated: 2026-09-22
---
# Patrol instrument cluster — signal expectations
What the target vehicle's cluster ([[nissan-patrol-swap]]) needs on its tach and temp inputs, from the first day of driving it with Controller B's outputs through the low-side FET stage ([[canny-5-3-pico-gauge-drive]]). Patrol generation still unidentified — Y60/GQ vs Y61/GU matters for gauge internals → [[open-questions]].
## Tachometer
- **Empirical calibration `(verified 2026-09-22)`: 2 pulses per revolution.** With the firmware's original `tach_ppr=4` the cluster read double; `cfg` ppr set to 2 makes it track the BMW's CAN rpm. Signal: 50 % square wave, low-side switched (2SK3069), i.e. 3000 rpm → 100 Hz.
- Background on what these clusters normally get `(source: patrol4x4.com / nissanpatrol.com.au threads)`:
- TD42 diesels had **no factory tach signal**; aftermarket/factory tachs run from the **alternator W terminal** (a phase tap — frequency scales with pulley ratio × pole pairs, far more than 2/rev, usually via an adapter box).
- A clean **2 ppr** expectation matches an **ECU-driven 4-cylinder-style tach input** (e.g. ZD30-era Y61) `(unverified)` — a hint the cluster may be from that generation, worth checking against the actual vehicle.
- Practical consequence: the doubled reading at ppr=4 was calibration, not a signal-quality problem. The FET stage works.
- **Scale calibration `(verified 2026-09-23, override ramps)`**: with ppr=2 the cluster over-reads by a factor that shrinks with rpm — ×1.20 at 1000–2000, ×1.15 at 6000 (commanded 6000 with trim −20 read exactly 5500). The response is mildly nonlinear, so a linear trim cannot be exact everywhere; **`tach_trim = −13 %` chosen as the realistic compromise** (user-tuned on the dial). Saved on A, pushed in CONFIG.
### The steppy-needle saga (2026-09-22/23) — resolved
Observed on the road: needle holds then jumps 200–500 rpm. Diagnosis took four firmware iterations on B, each eliminating one layer `(repo, verified by override ramp tests with ignition on / engine off)`:
1. **5 Hz staircase**: B refreshed the tach frequency once per 200 ms packet. Added a slew limiter (glide 25 %/20 ms). *Result: worse* — because of layer 2.
2. **LEDC restarts**: Arduino 2.x `ledcChangeFrequency()` re-inits the timer and truncates the waveform mid-period; calling it 50×/s corrupted the counting window constantly. Replaced LEDC with an esp_timer toggling IO7. *Result: better, not smooth* — because of layer 3.
3. **Task-dispatch jitter**: esp_timer callbacks run in a task; WiFi/ESP-NOW bursts on core 0 delay edges by ms and bunch them. Replaced with a **hardware-timer ISR** (1 MHz, auto-reload): phase-continuous, immune to scheduling. *Result: rock-steady at fixed rpm, but ramps still stepped* — because of layer 4, which is the cluster itself.
4. **Cluster count quantization** — the floor: on a clean 25 rpm/40 ms synthetic ramp the needle jumped alternately +100/+200 → the cluster counts pulses in **~150 rpm quanta** on a dial that rounds to 100. A perfectly stable synthetic frequency parks on a quantum and snaps to the next; a real engine's pulse jitter straddles the boundary so the damped needle averages in between — factory setups are smooth *because* their signal is dirty. Emulated with **random dither ±45 rpm (±1.2 Hz) per 20 ms tick**, with an **adaptive envelope** (full while the target moves, fades to zero within ~1.2 s at rest) so steady rpm stays flicker-free.
Final state (2026-09-23): sweep and hold "fairly good" per user; possible future refinement of dither constants (`DITHER_HZ`, envelope times in B's `gauge_outputs.cpp`). Also explains the CANNY's high-rpm jumpiness ([[canny-5-3-pico-gauge-drive]]): a PLC toggling on a ms-resolution timer gets coarse at ≥100 Hz output `(unverified)`.
## Temperature gauge
- The stock sender is an **NTC thermistor to ground** `(source: patrol4x4.com forum, sensorgal.com)`:
| Coolant | Sender resistance |
|---|---|
| 20 °C | 2.1–2.9 kΩ |
| 50 °C | 0.68–1 kΩ |
| 90 °C | 236–260 Ω |
The gauge is a current-measuring device; its useful span is roughly the "tens of Ω to a few kΩ" region. Duty-cycle PWM through a low-side switch emulates an average conductance in this range `(repo)`.
- **Needle flutter at `temp_pwm_hz` = 1 kHz — RESOLVED at 20 kHz `(verified 2026-09-22)`.** At 1 kHz the needle fluttered at any duty between the endpoints (steady at 0 and 255 — i.e. it was following the chopping itself); raising `temp_hz` to 20000 (the current firmware clamp) removed the fluctuation completely. Matches community experience that PWM-driven automotive gauges need tens-of-kHz `(source: allaboutcircuits.com, pjrc forum)`.
- Lesson from the same session: a **missing chassis/board common ground makes the gauge read nothing at all** — check grounds before debugging frequencies.
- Still open as optional hardening: a series resistor in the FET drain (~100–240 Ω) to bound the current swing to the sender's real range (full-on duty = dead short, i.e. "hotter than the sender can ever read").
- After the flutter is fixed, re-derive `temp_slope`/`temp_offset` against the sender table above (the FET inverts duty sense vs the direct-drive law used before).
## Open items
- Identify the Patrol generation / cluster origin (2 ppr hint above; ask the user / photograph the cluster).
- Temp law recalibration table (duty ↔ needle position ↔ implied °C) — gauge works and is stable at 20 kHz; the slope/offset mapping to real °C has not been re-derived since the FET stage inverted the duty sense.
- Tach dither constants may deserve another tuning pass ("maybe in the future we will get back to RPMs" — user, 2026-09-23).
## Related
[[canny-5-3-pico-gauge-drive]] · [[nissan-patrol-swap]] · [[dual-controller-architecture]] · [[open-questions]]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+30
View File
@@ -0,0 +1,30 @@
[ 8546][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[ 8741][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #25 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=29 fail=0]
[ 10025][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[ 13558][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
>>> diag dtc
CANTX,13676,7DF,0,8,0103000000000000
[ 13676][W][can_driver.cpp:554] canTask(): [CANTask] Bus error detected (count: 1)
[ 13684][W][can_driver.cpp:563] canTask(): [CANTask] TX failed (no ACK / bus error) - 1 so far
[diag] -> 0x7DF 03
[ 14024][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #50 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=55 fail=0]
[diag] no reply within 500 ms (request 03) - frame was not ACKed by any node
[ 15034][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
>>> diag ident
CANTX,17669,6F1,0,8,12021A8000000000
[ 17669][W][can_driver.cpp:554] canTask(): [CANTask] Bus error detected (count: 2)
[ 17677][W][can_driver.cpp:563] canTask(): [CANTask] TX failed (no ACK / bus error) - 2 so far
[diag] -> 0x6F1 [12] 1A 80 (reply expected on 0x612)
[diag] no reply within 500 ms (request 1A 80) - frame was not ACKed by any node
[ 18574][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[ 19308][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #75 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=81 fail=0]
[ 20114][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
>>> diag status
[diag] state=idle requests=2 replies=0 timeouts=2 negative=0 | CAN tx=2 tx_failed=2
[diag] no foreign tester seen since boot
[ 23585][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[ 24591][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #100 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=107 fail=0]
[ 25185][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
+3
View File
@@ -0,0 +1,3 @@
[ 28574][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[ 29850][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #125 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=133 fail=0]
[ 30324][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+24
View File
@@ -0,0 +1,24 @@
[ 3619][I][main.cpp:187] setup(): [MAIN] - Console: type 'cfg help' to tune the Patrol gauge outputs
[ 3628][I][main.cpp:188] setup(): [MAIN] - Screens: Driveline (boot) <- left: Settings | right: Gauge tuning ->
[ 3638][I][main.cpp:189] setup(): [MAIN] - Settings screen has WiFi and UART toggles
[ 3646][I][main.cpp:190] setup(): [MAIN] - WiFi scan updates every 10 seconds when enabled
[ 3654][I][main.cpp:191] setup(): [MAIN] - UART transmits at 5Hz (200ms) when enabled
[ 3800][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #2 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=5 fail=0]
[ 4027][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #3 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=6 fail=0]
[ 4253][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #4 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=7 fail=0]
[ 4479][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #5 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=8 fail=0]
[ 5006][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[ 8518][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[ 8712][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #25 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=29 fail=0]
>>> diag raw on
[ 9768][I][can_driver.cpp:709] setRawLogging(): [CANDrv] Raw frame logging ENABLED
[diag] CANRAW logging on
[ 10079][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[ 13531][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
>>> diag status
[diag] state=idle requests=0 replies=0 timeouts=0 negative=0 | CAN tx=0 tx_failed=0
[diag] no foreign tester seen since boot
[ 13996][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #50 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=55 fail=0]
[ 15142][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
[234147][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[235901][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #76 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1149 fail=0]
[237817][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[239159][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[241185][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #101 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1175 fail=0]
[242880][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[244173][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[246469][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #126 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1201 fail=0]
[247945][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[249187][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[251753][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #151 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1227 fail=0]
[253006][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[254202][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[257037][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #176 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1253 fail=0]
[258096][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[259214][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[262322][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #201 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1279 fail=0]
[263178][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[264231][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[267607][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #226 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1305 fail=0]
[268243][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[269245][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[272889][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #251 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1331 fail=0]
[273334][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[274257][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[278172][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #20 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1357 fail=0]
[278382][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[279268][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[283424][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[283459][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #45 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1383 fail=0]
[284286][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[288486][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[288741][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #70 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1409 fail=0]
[289298][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[293503][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[294025][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #95 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1435 fail=0]
[294312][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[298517][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[299309][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #120 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1461 fail=0]
[299356][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[303609][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[304386][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[304580][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #145 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1488 fail=0]
[308631][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[309397][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[309861][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #170 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1514 fail=0]
[313721][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[314410][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[315145][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #195 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1540 fail=0]
[318782][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[319423][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[320428][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #220 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1566 fail=0]
[323848][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[324438][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[325713][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #245 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1592 fail=0]
[328909][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[329451][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[330997][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #14 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1618 fail=0]
[333933][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[334465][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[336280][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #39 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1644 fail=0]
[338997][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[339479][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[341563][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #64 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1670 fail=0]
[344060][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[344491][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[346847][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #89 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1696 fail=0]
[349152][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[349504][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[352129][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #114 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1722 fail=0]
[354215][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[354516][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[357411][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #139 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1748 fail=0]
[359280][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[359529][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
[362697][I][uart_manager.cpp:126] sendDataFrame(): [UARTTask] TX #164 gear=P(t0/e0) rpm=0 cool=89.0 gb=85.0 batt=12.45 alerts=0x00 valid=0x3F [27 B uart+espnow, espnow tx=1774 fail=0]
[364368][I][main.cpp:201] loop(): [LOOP] Heartbeat - system running
[364545][I][uart_manager.cpp:158] sendConfigFrame(): [UARTTask] TX CONFIG v107 (periodic): ppr=2 trim=-13 temp_hz=20000 slope=150 offset=50 min=40 override=0
File diff suppressed because it is too large Load Diff
+57
View File
@@ -0,0 +1,57 @@
---
type: source
tags: [can-bus, obd, dde, diagnostics, capture]
updated: 2026-09-23
---
# Route A probe — first live run (2026-09-23)
First execution of the [[obd-diagnostic-polling]] Route A test: the `diag` console probe on Controller A, engine idling, Launch unplugged, tapped PT-CAN. Two sessions, raw console logs (CANRAW + CANTX + diag output interleaved):
- `raw/diag-20260923-111737.log` — `pids`, `pid 0C`, `pid 05`, `pid 0B`, `pid 70`, `vin`, `ecu`, `status`
- `raw/diag-20260923-111851.log` — `pid 10`, `pid 04`, `pid 0F`, `pid 0D`, `pid 1C`, `pid 01`, `pid 21`, `status`
## Headline
**The DDE answers generic OBD-II (mode 01) on the PT-CAN at `0x7E8`.** `(verified 2026-09-23)` Route A works; no BMW-specific knowledge needed for the PIDs it supports. Only one responder — the EGS does not answer generic OBD (nothing from `0x7E9`).
## Supported-PID bitmap (`diag pids`)
Blocks `01 00` and `01 20` answered; bitmap `41 20 80 00 00 00` → no blocks past 0x21. Full supported set:
`01, 04, 05, 0B, 0C, 0D, 0F, 10, 1C, 20, 21` — a minimal EOBD set. None of the 2007+ diesel PIDs (`70` boost, `78` EGT…), no `33` barometric, no `5E` fuel rate. Consistent with an EDC16-era DDE6 `(unverified)`.
## Readings at idle, engine warm-ish (coolant 63–66 °C during the runs)
| PID | Raw reply | Decoded (J1979) | Verdict |
|---|---|---|---|
| `0C` rpm | `41 0C 0A A4` | **681 rpm** | `(verified)` — CAN `0x0AA` read 678–682 simultaneously |
| `05` coolant | `41 05 68` | **64 °C** | `(verified)` — CAN `0x1D0` read 63–64 °C simultaneously |
| `0B` MAP | `41 0B 68` | **104 kPa abs** | plausible at idle (baro + a touch); the 255 kPa clip untested — needs a boost run |
| `0D` speed | `41 0D 00` | 0 km/h | `(verified)` — parked |
| `1C` OBD standard | `41 1C 06` | 6 = **EOBD (Europe)** | as expected |
| `10` MAF | `41 10 64 E5` | 258.29 g/s | **implausible** — see warning |
| `0F` intake air | `41 0F C3` | 155 °C | **implausible** — see warning |
| `04` load | `41 04 43` | 26 % | plausible idle load |
| `01` monitor status | `41 01 05 46 80 80` | MIL **off**, **5 stored DTCs** | see below |
| `21` distance w/ MIL | `41 21 00 00` | 0 km | consistent with MIL off |
| `70` boost | — | no reply (ACKed, silent) | PID absent, as predicted for EDC16 |
> [!warning]
> **MAF and IAT come back with non-standard-looking scalings.** By the book, `0x64E5`/100 = 258 g/s and `0xC3`−40 = 155 °C — both absurd at idle (expect ~20–30 g/s and <60 °C). ×0.1 on the MAF gives a very plausible 25.8 g/s; the IAT law is unknown (BMW's internal 0.75·x−48 would give 98 °C — still hot). Treat both PIDs as **present but unscaled** `(unverified)` until cross-checked against the Launch's live-data page or a cold-engine reading.
## Mode 09: silent
`09 02` (VIN) and `09 0A` (ECU name) were ACKed but never answered. **The donor cannot be identified over generic OBD** — [[open-questions]] #2 still needs the Launch's ECU-identification page (or a Route B `0x6F1` capture).
## The 5 stored DTCs
PID `01` byte A = `0x05`: MIL off, 5 confirmed DTCs in memory. Reading them is generic mode `03` — a small, read-only extension to the probe (currently services 01/09 only), or one Launch session. Feeds [[open-questions]] #7.
## Probe behaviour `(repo)`
Counters across both runs: 15 requests, 12 replies, 3 timeouts (the three unsupported/silent ones), 0 negatives, 0 tx failures, no foreign tester seen. Single-shot + guard logic worked as designed; the bus never saw a retry storm.
## Related
[[obd-diagnostic-polling]] · [[dwr-335d-torque-pids]] · [[can-id-candidates]] · [[open-questions]]
+65
View File
@@ -0,0 +1,65 @@
---
type: source
tags: [can-bus, obd, dde, diagnostics, kwp2000, dtc, vin, capture]
updated: 2026-09-23
---
# Route B probe + DTC read — same day, second session (2026-09-23)
Follow-up to [[diag-route-a-2026-09-23]], same setup (tapped PT-CAN, no Launch). The `diag` probe gained three read-only commands (`dtc` = generic mode 03, `ident` = BMW KWP `1A 80`, `bmw <addr> <hex>` = raw whitelisted request on `0x6F1`) and they paid off immediately. Raw console logs in `raw/`: `diag-20260923-124138.log` (DTCs), `diag-20260923-124226.log` (first `1A 86` hit), `diag-20260923-124544.log` (full ident dump), `diag-20260923-124331.log` / `-124643.log` (negative-response probes).
## Headline 1: Route B works — BMW addressing verified on our own bus
**`(verified 2026-09-23)`** Request `0x6F1` `[12] 02 1A 86` → the DDE answers on **`0x612`** with a 65-byte multi-frame KWP reply (our flow control `[12] 30 00 00` on `0x6F1` accepted). This settles the addressing question from [[google-ai-dde7m57-pids]] in favour of dieslg8's scheme: **tester `0x6F1` + target address byte, ECU replies on `0x600`+address** — from our own exchange now, no longer just sources.
## Headline 2: the stored DTCs — all five are swap leftovers
`diag dtc` (generic mode 03 on `0x7DF`, ignition on, engine off) — reply `43 05 00 30 05 00 05 45 01 13 01 01` `(verified)`:
| Code | Generic meaning | Swap interpretation `(unverified)` |
|---|---|---|
| **P0101** | MAF circuit range/performance | explains the absurd 258 g/s MAF PID reading — sensor unplugged/failed, not a scaling issue |
| **P0113** | intake air temp circuit **high input** | explains the absurd 155 °C IAT PID reading — open circuit reads max |
| **P0500** | vehicle speed sensor A | expected: no DSC/ABS module on the swap bus, nothing sends road speed |
| **P0545** | EGT sensor 1 circuit low | sensor presumably gone with the donor exhaust |
| **P0030** | O2/lambda heater control circuit (B1S1) | lambda presumably gone with the donor exhaust |
Consequences: the Route A "MAF/IAT non-standard scaling" warning is **withdrawn — they are sensor faults, not scalings**. And with a dead MAF the DDE almost certainly runs its fallback air-mass map (less precise fuelling/EGR) `(unverified)` — worth knowing for how the engine behaves.
## Headline 3: the donor identifies itself
`diag bmw 12 1A 86` full reply (65 B):
```
5A 86 40 42 38 39 32 35 32 34 20 06 03 07 00 00 07 79 97 64 00 00 07 79 97 65
00 00 07 79 38 87 01 11 11 31 32 33 34 35 00 30 30 38 39 51 35 30 41 39 36 32
42 57 42 41 4E 43 39 32 30 39 30 FF FF FF
```
Parsed `(verified bytes; field meanings unverified)`:
- ASCII `"B892524"` + BCD `06 03 07` — looks like an ident string and a date (2006-03-07 or 07.03.06).
- Three BCD **BMW part numbers**: **7 799 764**, **7 799 765**, **7 793 887** — DDE hardware/software numbers; a parts-catalogue lookup would name the exact DDE variant. → [[open-questions]] #2
- Trailing ASCII `"12345"`, `"0089Q50"`, `"A962B"`, then **`"WBANC92090"`** + `FF` padding.
- **`WBANC92090` is a VIN prefix**: WBA = BMW, **NC9x = E60 530d** `(unverified model-code decode — check against a VIN table)`. The 7-char serial tail is not in this block. Consistent with everything else known (E60/E61, M57N + 6HP26X); a 2006 build date would make it a **530d LCI-era M57N2 (231 hp), DDE6.2-generation** `(unverified)`.
## What did NOT answer
- `1A 80` — ACKed, silent. `1A 88` — NRC 0x12 (not supported). `21 80` — NRC 0x12.
- `1A 90` (dedicated VIN read) — NRC **0x21 busyRepeatRequest** on every try (ignition-only *and* engine running once); a single-shot probe won't get it (KWP expects the tester to retry, possibly within a session). Not needed — `1A 86` gave the prefix.
- `22 F1 90` (UDS-style VIN DID) — NRC 0x10: **not a UDS ECU**, KWP2000 only — another DDE6/EDC16-era hint `(unverified)`.
## Third session: identifier scans — live data is session-locked
Engine idling, `tools/diag_scan.py` (new: sweeps an identifier space via `diag bmw`, CANRAW muted with the new `diag raw off`). Raw: `raw/diagscan-22D1-20260923-155515.log`, `raw/diagscan-21-20260923-155831.log`.
- **`22 D1 00`–`D1 FF`: nothing.** Every identifier NRCs 0x12 — the [[google-ai-dde7m57-pids]] clipping's `22 D1xx` identifiers (`D10C` boost etc.) are **confirmed wrong for this DDE** `(verified)`. (First scan ran with CANRAW on; its two "hits" are garbled NRC lines.)
- **`21 00`–`21 FF`: sparse.** Positive: `21 20` → ASCII **" O_269962 "** (Bosch software reference? — lookup candidate), `21 06`/`21 08` → one byte `05` each, `21 10` → empty reply. Many identifiers ACKed-but-silent.
- **The telling refusals:** `21 90` NRC 0x21 (busy), `21 91` NRC 0x22 (conditions not correct), `21 F0` NRC **0x33 security access denied**.
Conclusion `(verified behaviour, unverified interpretation)`: the DDE's measurement blocks exist but are **gated behind a diagnostic session** (KWP `10 xx` startDiagnosticSession, possibly plus `27` securityAccess for some) — both deliberately outside the probe's read-only whitelist. Blind probing has hit its safe limit; **the Launch capture is now the only sensible next step for live data**: it will reveal the session setup *and* the identifiers, and then replaying them is an informed decision instead of a guess.
Multi-frame TX flow control on `0x6F1` with extended addressing worked first try; `MAX_PAYLOAD` had to grow 64 → 384 (the first `1A 86` capture clipped at 192 mid-VIN). All requests single-shot, whitelisted read-only services (`1A`/`18`/`21`/`22`), zero TX failures once the bus was awake. Reminder from the first attempt of the day: **a silent bus (ignition off) shows up as "not ACKed by any node" + TWAI bus errors** — check ignition before suspecting wiring.
## Related
[[diag-route-a-2026-09-23]] · [[obd-diagnostic-polling]] · [[bmw-m57n-engine]] · [[open-questions]]
+41
View File
@@ -0,0 +1,41 @@
---
type: source
tags: [can-bus, obd, dde, kwp2000, launch, rail-pressure, live-data, capture]
updated: 2026-09-23
---
# Launch live-data capture — rail pressure decoded (2026-09-23)
The capture-with-Launch session that [[obd-diagnostic-polling]] had been pointing at since July, finally run. Engine idling, our read-only logger (`tools/serial_logger.py`) on Controller A's USB recording the full `CANRAW` stream while the Launch polled the DDE; then the user selected **Rail Pressure (actual)** and blipped to 2500 rpm for a second calibration point. Raw: `raw/serial-COM10-20260923-163511.log` (~13 MB, both halves of every exchange).
## Headline: rail pressure actual is decoded and VERIFIED
**`(verified 2026-09-23, two operating points against the Launch display)`**
| Direction | CAN ID | Payload | Meaning |
|---|---|---|---|
| Launch → DDE | `0x6F1` | `12 04 2C 10 00 DF` | target `12` (DDE), 4-byte req, service `2C` local-id `10`, operand `00 DF` |
| DDE → Launch | `0x612` | `F1 04 6C 10 HH LL` | `6C` = `2C`+0x40, id `10`, then **16-bit rail value `HHLL`** |
**Rail pressure (bar) = (HH·256 + LL) × 0.03** — linear through zero, no offset.
Calibration points (sustained, not transient):
- idle: raw `0x27EF` (10223) → 307 bar vs Launch **~305** ✓
- 2500 rpm: raw `0x3768` (14184) → 425 bar vs Launch **~430** ✓
- factor from the two points: 0.0298 and 0.0303 → adopt **0.03 bar/count** (≈ raw / 33.3)
Transient spikes to `0x4E31` (20017 → 600 bar) occurred at the instant of throttle tip-in (rail overshoot); they are real but not the steady value the gauge reads.
## How the Launch reads it — the mechanism `(observed, semantics unverified)`
Not the simple `21`/`22` identifier reads the [[diag-route-b-2026-09-23]] blind scan tried (those NRC'd — session/security gated). The live poll is **service `2C`** (KWP dynamicallyDefineLocalIdentifier family): on connect the Launch sends `2C 10 15 E0` once (define), then polls `2C 10 00 DF` repeatedly (~200 ms), each returning a fresh `6C 10 HHLL`. So the value ID `00 DF` is the rail-pressure block. Interpreting `00 DF` / `15 E0` as memory addresses vs block numbers is unconfirmed — for replay only the request bytes matter. The Launch also runs a constant `1A 80` ident keep-alive and did `23` (readMemoryByAddress) reads on connect (ident/programming data, ASCII `"090"` etc.).
## Consequences
- **The method generalises**: any value the Launch will display can be decoded the same way — capture the `2C`/`6C` pair while its screen shows the number, calibrate scale against the display at two points. Boost, MAF, injection quantity, EGTs are each one session away. See [[obd-diagnostic-polling]] "Beyond the probe".
- **Decode ≠ self-poll.** Replaying `2C 10 00 DF` ourselves needs the connect-time session/define handshake first (`2C 10 15 E0`, and the session the blind `21` scan showed is required). Stepping a running DDE into a diagnostic session is a transmit-on-the-bus **design decision**, not something the read-only probe does today. The bytes to do it are in this log if we choose to.
- No EGS traffic (`0x618`) — only the DDE (`0x612`) answered; the Launch was on an engine page.
## Related
[[obd-diagnostic-polling]] · [[diag-route-b-2026-09-23]] · [[diag-route-a-2026-09-23]] · [[bmw-m57n-engine]] · [[open-questions]]