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>
This commit is contained in:
@@ -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 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
|
||||
|
||||
|
||||
+196
-36
@@ -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,8 +574,13 @@ void tick() {
|
||||
unlock();
|
||||
|
||||
if (!got_reply) {
|
||||
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 (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) {
|
||||
@@ -474,10 +598,13 @@ 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 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 +634,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 +671,39 @@ 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], "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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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))
|
||||
+4
-2
@@ -1,6 +1,6 @@
|
||||
---
|
||||
type: index
|
||||
updated: 2026-09-21
|
||||
updated: 2026-09-23
|
||||
---
|
||||
|
||||
# Index
|
||||
@@ -19,7 +19,7 @@ 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
|
||||
|
||||
@@ -38,4 +38,6 @@ 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`
|
||||
- [[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
|
||||
|
||||
@@ -89,3 +89,11 @@ User raised temp_pwm_hz to 20000 via the tuning screen; needle now steady at fix
|
||||
## [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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [can-bus, dde, egs, diagnostics, kwp2000, uds, obd, design-decision]
|
||||
updated: 2026-09-21
|
||||
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,9 @@ 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. The `0x22 D1xx` live-data identifiers below remain untested — that is the remaining reason to capture with the Launch.
|
||||
|
||||
|
||||
This depends on the DDE variant, which is still open ([[open-questions]] #2, [[bmw-m57n-engine]]):
|
||||
@@ -82,11 +95,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:
|
||||
|
||||
@@ -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 `22 D1xx` live-data identifiers — that still wants a capture with the Launch polling. → [[obd-diagnostic-polling]]
|
||||
|
||||
## Answered
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -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
@@ -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]]
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
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)`.
|
||||
|
||||
## Probe behaviour `(repo)`
|
||||
|
||||
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]]
|
||||
Reference in New Issue
Block a user