2022 CAN support (WIP) for DU #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/dir-2022-canbus-mia"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The infotainment stack ships the full per-build catalogs as exported relocated data, richer than anything else in the dump: - so_candata: libQtCarCANData.so holds the 446-message ETH signal catalog (names, units, value tables) vs 140 messages in a per-revision compact.json. No bit layout -- pair with candata_to_dbc to overlay a compact.json donor. - so_alerts: libQtCarAlerts.so holds 6308 alerts with names, descriptions, cause / clear / effect, and the signals each one logs -- in the clear, where bus-alerts-map.json stores only salted hashes (dump_alerts). - tesla_alertlog: decodes <NODE>_alertLog frames (38 ids). byte0 = alert code mux -> NODE_aNNN. CAN-rationality alerts resolve the offending message and error type on the reversed DU and PCS layouts. One field decodes for ANY alert: a094 pins the payload's first log signal to bit 16, so masking to its value table's maximum bit width reads it correctly without knowing the field's true width -- every defined value fits. That field is the alert's reason on the 507 alerts that lead with an enum: 0x527 A2 80 04 00 00 01 22 7C -> DI_a162_shiftDenied, shiftDeniedReason = SYS_STATE_NOT_ENABLED The remaining per-alert field widths exist in no shipped artifact (the .so catalog has no bit layout; neither compact.json nor the year DBCs carry an alertLog message), so they are reported by name as undecoded rather than guessed at -- brute force over a real a162 frame left 61 self-consistent packings, so a single frame cannot pin them. can_decoder overlays the decode onto alertLog frames, lazily and best-effort, so a viewer without a firmware root is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>The shipped artifacts name an alert's log signals but never place them (the .so catalog has no bit layout; compact.json and the year DBCs carry no alertLog message at all), so until now everything past the leading enum was reported as undecoded. Statically extracting each alert's snapshot packer from the drive-unit firmware supplies the missing bit positions. alertlog_layouts.json holds them as node -> aNNN -> field -> [bit, width, signed], over the log-payload area (frame bytes 2-7, little-endian, bit 0 == byte2 bit0). 33 alerts across DI and DIR. Field counts are verified against the catalog's log_signals, packings are gated on non-overlap and <= 48 bits, and a162 cross-checks against an independent hand reverse-engineering. decode() is now three tiers: a reversed layout decodes every field, else the CAN-rationality packing, else the leading-enum reason alone. Enum and unit labelling still comes from the per-revision catalog at decode time, so one layout serves every revision that keeps the fields, and a field the catalog drops is skipped. A missing or unreadable layouts file degrades to the reason-only tier rather than failing. 0x527 A2 80 04 00 00 01 46 7C -> DI_a162_shiftDenied, reason SYS_STATE_NOT_ENABLED, currentGear N, requestedGear D (a refused N->D shift) WIP: the extractor output is checked in as data, but the extraction itself still needs a pass to make it scalable -- coverage is 33 of ~3000 alerts with log signals, and the signedness heuristic (unsigned unless wide torque/speed/accel telemetry) is not yet derived from the firmware. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>RC 0x0201 (checkModuleProgrammedCorrectly) is a verify, not just a CRC check: on legacy bootloaders it recomputes the image CRC, but on secure bootloaders (e.g. 2026+ PMR) the same routine also enforces an ECC signature and SVN rollback check, so a non-zero status can mean an unsigned/wrongly-signed/ rolled-back image rather than a CRC mismatch. Rename step_verify_crc -> step_verify and _RC_VERIFY_CRC -> _RC_VERIFY, and reword the progress/error output ("CRC check"/"MISMATCH" -> "Verify"/"Verify FAILED (CRC mismatch, or signature/rollback rejection on secure bootloaders)"). Also renames the CLI named routine verify-crc -> verify and updates the docs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>