# Pure Python 3 CAN decoder for a 8-byte payload.
FRAME_LEN = 8
def dbc_1_motor_speed_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 0) & 0xFFFF
if raw & (1 << 15):
raw -= 1 << 16
return raw * (1.0) + (0.0)
def dbc_2_motor_torque_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 16) & 0xFFFF
if raw & (1 << 15):
raw -= 1 << 16
return raw * (0.1) + (0.0)
def dbc_3_dc_bus_voltage_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 32) & 0xFFFF
return raw * (0.1) + (0.0)
def dbc_4_igbt_temp_physical(data: bytes) -> float:
if len(data) < 8:
raise ValueError("Expected at least 8 payload bytes")
raw = (int.from_bytes(data[:8], "little") >> 48) & 0xFF
return raw * (1.0) + (-40.0)
def decode_frame(data: bytes) -> dict[str, float]:
return {
"dbc_1_motor_speed": dbc_1_motor_speed_physical(data),
"dbc_2_motor_torque": dbc_2_motor_torque_physical(data),
"dbc_3_dc_bus_voltage": dbc_3_dc_bus_voltage_physical(data),
"dbc_4_igbt_temp": dbc_4_igbt_temp_physical(data),
}
Extract EV traction inverter RPM, signed torque and DC bus telemetry
Commercial EV traction inverters (Cascadia Motion / Rinehart PM100, Curtis, Sevcon, BorgWarner) broadcast J1939-style 29-bit or standard 11-bit Intel little-endian frames packing signed motor speed, signed shaft torque, DC bus voltage and IGBT junction temperature into 8 bytes.
In payload 80 0C B9 05 10 0E 55 00, Intel LE 0x0C80 decodes to 3,200 rpm, signed 0x05B9 decodes to +1,465 (+146.5 Nm acceleration torque; regen preset 0xFCAE = −85.0 Nm), 0x0E10 decodes to 360.0 V DC bus, and 0x55 (85 − 40) gives 45 °C IGBT temperature.
DC Bus = 0x0E10 × 0.1 = 360.0 V · IGBT Temp = 0x55 − 40 = 45 °C
Worked example
Payload 80 0C B9 05 10 0E 55 00 decodes to 3,200 rpm, +146.5 Nm, 360 V DC bus and 45 °C IGBT temp; the regen braking preset switches torque to −85 Nm and raises DC bus voltage to 368 V.
Frequently asked questions
Why do J1939 EV inverter temperature bytes use a −40 °C offset?
Using an unsigned 8-bit integer with −40 °C offset represents −40 °C to +215 °C cleanly without negative two’s-complement handling—matching SAE J1939 SPN 110 / 175 conventions.
How do I check whether a negative torque value indicates regenerative braking or reverse?
Compare the signs of Motor Speed and Motor Torque: opposite signs (positive RPM with negative torque) represent regenerative braking pushing energy back into the DC bus.
Can I load a Cascadia Motion or J1939 .dbc file to decode multiple inverter messages?
Yes—load your vendor .dbc file in the Local .dbc bar above to switch between motor speed, current, fault and thermal CAN messages with instant C99 and Python 3 code output.