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:
2026-09-23 12:54:24 +02:00
parent e9fc24778a
commit 7a7398243b
20 changed files with 87140 additions and 51 deletions
+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))