Add diag console probe (OBD-II mode 01/09 on 0x7DF); wiki: diagnostic polling, two sources

Firmware:
- CANDriver::transmit(): the single sanctioned transmit path (single-shot,
  echoed as CANTX lines, TX_FAILED alert counted); CAN-task warnings now take
  the serial lock
- DiagProbe module: `diag pids` supported-PID bitmap scan, `diag pid <hex>`,
  `diag vin`, `diag ecu`, `diag status`; ISO-TP reassembly with flow control;
  one request in flight, refused for 3 s after any foreign tester frame
- Console dispatch chained via Tunables::setExtraCommandHandler()
- CLAUDE.md and docs/UART_PROTOCOL.md updated

Wiki:
- New page obd-diagnostic-polling (broadcast vs polled, 0x6F1->0x612 addressing,
  Route A generic OBD PID table, Route B, test-day procedure, firmware probe)
- New sources: google-ai-dde7m57-pids (clipping, unverified, 0x612 direction
  contradicted), dwr-335d-torque-pids (thread + raw/BMW 335d.csv decoded)
- Clippings/ folder added to the schema (Obsidian Web Clipper, treated as raw/)
- bmw-m57n-engine, can-bus-integration, open-questions, index, log updated
This commit is contained in:
2026-09-21 19:51:49 +02:00
parent f60bdac268
commit 974082cb3e
21 changed files with 1357 additions and 24 deletions
+16 -3
View File
@@ -6,9 +6,10 @@
*
* Hardware: GPIO 15 (TX), GPIO 16 (RX)
* Mode: TWAI_MODE_NORMAL — the board ACKs the bus (LISTEN_ONLY can't ACK, which
* makes transmitters flood it with retries). We never call twai_transmit(),
* so behaviour is read-only in practice, but note this is a policy, not a
* hardware guarantee: nothing but discipline prevents a write.
* makes transmitters flood it with retries). The driver is read-only in
* normal operation; the single sanctioned transmit path is transmit(),
* used ONLY by DiagProbe for on-demand OBD-II requests (see
* src/modules/diag_probe.h). Nothing else may call it.
* Baud: 500 Kbps
*/
@@ -58,6 +59,8 @@ typedef struct {
uint32_t messages_parsed;
uint32_t parse_errors;
uint32_t last_receive_time;
uint32_t messages_transmitted; // frames handed to the TWAI TX queue (DiagProbe only)
uint32_t tx_failures; // queue refusals + TWAI_ALERT_TX_FAILED (no ACK / bus error)
} can_stats_t;
// ============================================================================
@@ -141,6 +144,16 @@ namespace CANDriver {
*/
bool isActive();
/**
* Transmit ONE standard (11-bit) frame, single-shot (no automatic
* retransmission if nobody ACKs). The only write path onto the vehicle
* bus; reserved for DiagProbe's on-demand diagnostic requests. Echoes the
* frame on the console as a "CANTX," line (same shape as CANRAW) so
* captures hold both halves of an exchange.
* @return true if the frame was queued (delivery is reported via stats)
*/
bool transmit(uint32_t id, const uint8_t* data, uint8_t len);
/**
* Enable/disable raw frame logging (candump-style capture of EVERY frame).
* When enabled, each received frame is printed to Serial as a compact,