feat: expand 0x210 telemetry layout (state/udc/idc/uaux@5/soc) #2

Merged
bastian merged 1 commits from feat/skudak-448-expanded-0x210-telemetry into main 2026-05-08 17:00:31 -04:00
Owner

Summary

Replaces the single uaux-at-byte-0 broadcast with a 7-byte expanded telemetry frame. Standardizes the layout the VCU has been intermittently consuming.

Why

Bench capture on the green car (PCAN, 500 kbit/s) showed two distinct 0x210 frames every 100 ms:

DLC=8  85 00 00 00 00 00 00 00     ← matches origin/main (uaux at byte 0)
DLC=7  00 00 E4 06 06 88 00         ← matches an unmerged expanded layout

Both arrive on a 100 ms cadence, ~0.7 ms apart. The downstream VCU (stm32-hal-vcu) reads message.data[0] for uaux — half the time it gets 0x85 (real 13.3 V), the other half it gets 0x00 (the state byte when OBC is OFF). The 12 V tender's voltage-fault check fires POLARITY_ERR_VOLT12_TENDER_VOLTAGE_MEASUREMENT_FAULT (0x00EF) whenever the 0V sample lands in the validation window.

Root cause: the flashed firmware on the green car contains both AddSend sets active. This PR commits a clean canonical layout to main so a single rebuild + reflash eliminates the dual-frame ambiguity.

Byte layout

Byte Field Source param Gain Meaning
0 State state 1 0=Off, 1=WaitStart, 2=Enable, 3=Activate, 4=Run, 5=Stop
1-2 DC Voltage udc 1 HV bus voltage (V)
3-4 DC Current idc 10 DC current (0.1A)
5 12V Aux uaux 10 12V rail voltage (decivolts)
6 SOC soc 1 State of charge (%)
7 Reserved

Matches the byte table already documented in CLAUDE.md (untracked locally, will be committed separately).

Test plan

  • make get-deps && make — builds cleanly (only pre-existing pedantic + RWX-segment warnings)
  • Flash via the OpenInverter ESP8266 web UI on the green car
  • PCAN re-capture at 500 kbit/s — only DLC=7 frames at 0x210, no DLC=8 frames
  • Verify byte 5 carries decivolts in the 0x70-0x90 range (~11.2 V to 14.4 V) when the car's 12 V system is healthy
  • Coordinate with stm32-hal-vcu PR #37 follow-up (Phase 4B) which updates the VCU handler to read uaux from byte 5

Compatibility

The downstream VCU handler in stm32-hal-vcu Core/Src/main.c CHARGER_CAN_ID_OI_OBC_AUX currently reads byte 0. After flashing this firmware before updating the VCU, the VCU will see state (typically 0) at byte 0 and report 0V → 0x00EF faults will increase, not decrease, until the matching VCU update lands. Coordinate the two reflashes.

🤖 Generated with Claude Code

## Summary Replaces the single `uaux`-at-byte-0 broadcast with a 7-byte expanded telemetry frame. Standardizes the layout the VCU has been intermittently consuming. ## Why Bench capture on the green car (PCAN, 500 kbit/s) showed **two distinct `0x210` frames every 100 ms**: ``` DLC=8 85 00 00 00 00 00 00 00 ← matches origin/main (uaux at byte 0) DLC=7 00 00 E4 06 06 88 00 ← matches an unmerged expanded layout ``` Both arrive on a 100 ms cadence, ~0.7 ms apart. The downstream VCU (`stm32-hal-vcu`) reads `message.data[0]` for uaux — half the time it gets `0x85` (real 13.3 V), the other half it gets `0x00` (the `state` byte when OBC is OFF). The 12 V tender's voltage-fault check fires `POLARITY_ERR_VOLT12_TENDER_VOLTAGE_MEASUREMENT_FAULT` (`0x00EF`) whenever the 0V sample lands in the validation window. Root cause: the flashed firmware on the green car contains both AddSend sets active. This PR commits a clean canonical layout to `main` so a single rebuild + reflash eliminates the dual-frame ambiguity. ## Byte layout | Byte | Field | Source param | Gain | Meaning | |---|---|---|---|---| | 0 | State | `state` | 1 | 0=Off, 1=WaitStart, 2=Enable, 3=Activate, **4=Run**, 5=Stop | | 1-2 | DC Voltage | `udc` | 1 | HV bus voltage (V) | | 3-4 | DC Current | `idc` | 10 | DC current (0.1A) | | 5 | 12V Aux | `uaux` | 10 | 12V rail voltage (decivolts) | | 6 | SOC | `soc` | 1 | State of charge (%) | | 7 | Reserved | — | — | — | Matches the byte table already documented in `CLAUDE.md` (untracked locally, will be committed separately). ## Test plan - [x] `make get-deps && make` — builds cleanly (only pre-existing pedantic + RWX-segment warnings) - [ ] Flash via the OpenInverter ESP8266 web UI on the green car - [ ] PCAN re-capture at 500 kbit/s — only DLC=7 frames at `0x210`, no DLC=8 frames - [ ] Verify byte 5 carries decivolts in the 0x70-0x90 range (~11.2 V to 14.4 V) when the car's 12 V system is healthy - [ ] Coordinate with `stm32-hal-vcu` PR #37 follow-up (Phase 4B) which updates the VCU handler to read uaux from byte 5 ## Compatibility The downstream VCU handler in `stm32-hal-vcu` `Core/Src/main.c` `CHARGER_CAN_ID_OI_OBC_AUX` currently reads byte 0. After flashing this firmware **before** updating the VCU, the VCU will see `state` (typically 0) at byte 0 and report 0V → `0x00EF` faults will increase, not decrease, until the matching VCU update lands. Coordinate the two reflashes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bastian added 1 commit 2026-05-08 16:49:13 -04:00
feat: expand 0x210 telemetry layout (state/udc/idc/uaux@5/soc) for SKUDAK-448
Build Firmware / Build stm32-teslacharger (pull_request) Successful in 59s
3580123a39
Replaces the single uaux-at-byte-0 broadcast (commit d209a47) with a
7-byte expanded telemetry frame. Bench capture on green car showed dual
0x210 frames colliding (DLC=8 simple + DLC=7 expanded) because Kyle's
flashed image had both AddSend sets active; standardising on the
expanded layout eliminates that ambiguity.

Byte layout:
  byte 0     state    (0=Off, 1=WaitStart, 2=Enable, 3=Activate, 4=Run, 5=Stop)
  bytes 1-2  udc      (V, gain=1)
  bytes 3-4  idc      (0.1A, gain=10)
  byte 5     uaux     (decivolts, gain=10) — 12V aux battery rail
  byte 6     soc      (%, gain=1)
  byte 7     reserved

Consumed by stm32-hal-vcu Core/Src/main.c CHARGER_CAN_ID_OI_OBC_AUX
handler. The state byte enables future VCU_IsCharging integration via
state == 4 (Run) without requiring a second CAN ID.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bastian merged commit 20339b738b into main 2026-05-08 17:00:31 -04:00
bastian deleted branch feat/skudak-448-expanded-0x210-telemetry 2026-05-08 17:00:31 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Skudak/stm32-openinverter-teslacharger#2