# VP44 Protocol Reference Quick reference for hardware protocol constants used in HC_APTBS. Consult this before modifying any protocol-related code. --- ## DFI encoding (EEPROM address 0x0044 on VP44 ECU) **Read (raw byte → DFI value):** ```csharp dfi = (sbyte)raw * 3.0 / 256.0 ``` **Write (DFI value → raw byte):** ```csharp raw = (sbyte)((dfi * 256.0f) / 3.0f) // If raw == 0, use 1 — the ECU rejects zero ``` **Checksum:** ```csharp checksum = (byte)(0 - (byte)rawValue) ``` --- ## IIR low-pass filter (PcanAdapter.PassFilterUpdate) ```csharp result = Math.Round(prev + alpha * (value - prev), 4) ``` Used to smooth CAN bus sensor readings. The `alpha` coefficient controls responsiveness vs. noise rejection. --- ## OEM legitimation (PcanAdapter.Connect) ```csharp token = (20120378UL << 32) | 21200UL ``` Sent as a CAN frame to authenticate with the bench controller. Without this, the bench ignores all commands. --- ## K-Line / KWP timing **Inter-byte delay** (`KW1281Connection.SendPacket`): ```csharp Thread.Sleep(5) // after each byte — KWP protocol requirement, NOT a workaround ``` **5-baud slow-init** (`KwpCommon.WakeUp`): - Bit-bangs the ECU address at 5 baud on the K-Line - Sleep durations in WakeUp are protocol-mandated — do not change **Session lifetime**: - One `FtdiInterface` open/close per KWP operation - ECU expects a fresh session per dialog — do not pool connections --- ## CAN bus (PCAN-Basic, 500 kbps) - Channel: `PCAN_USBBUS1` - Baud: `PCAN_BAUD_500K` - Read thread polls with `Thread.Sleep(2)` in `DrainMessageQueue` (known debt) --- ## Caution Do not change any of these values without understanding the hardware protocol specification. Incorrect values can cause ECU communication failures or bench malfunction.