Files
KAT/docs/kia_v1.md
T
KaraZajac 48ee413c9b v1.2.0: Add 4 new protocols, fix 5 existing, port Kia V6 encoder
New protocols (from ProtoPirate):
- Mazda V0: 433MHz, pair-based decoding, XOR deobfuscation
- Mitsubishi V0: 868MHz, PWM, bit negation + XOR unscrambling
- Porsche Touareg: 433/868MHz, sync preamble, 24-bit rotate cipher
- Fiat V1 (Magneti Marelli BSI): 433MHz, auto-detected timing variants

Protocol fixes aligned with ProtoPirate reference:
- Kia V1: Fix Manchester level mapping (inverted convention), off-by-one
  bit count, CRC4 simplified to 7 bytes + offset 1
- Kia V2: Fix CRC byte layout (was double-counting nibbles), off-by-one
  bit count, preamble short-HIGH handling
- Fiat V0: Fix endbyte transform (remove (<<1)|1), standard Manchester
  encoder (was differential), 7 btn bits (was 6), gap path fallback
- PSA: Fix modified TEA (XTEA-like dynamic key selection), XOR decrypt
  byte mapping, critical key2_low construction bug, encoder polarity and
  preamble, add key1_high nibble validation, dual preamble patterns
- Ford V0: Add calculate_checksum (sums all serial+count bytes) for encoder

Kia V6 encoder ported:
- Forward AES-128 (SubBytes, ShiftRows, MixColumns, encrypt)
- encrypt_payload: build plaintext, AES encrypt, pack into 3 parts
- Two-pass Manchester upload (640 + 38 preamble pairs)
- fx_field extraction stored in DecodedSignal.extra for encode roundtrip

Updated README, protocol docs, and version bump to 1.2.0.
2026-03-22 12:05:01 -04:00

46 lines
1.1 KiB
Markdown

---
layout: default
---
# Kia V1 Protocol
**Rust module:** `src/protocols/kia_v1.rs`
**Reference:** `REFERENCES/ProtoPirate/protocols/kia_v1.c`
## Overview
Kia V1 uses Manchester encoding at 800/1600 us. 57 bits total: 32 serial + 8 button + 12 counter + 4 CRC. Long preamble (~90 long pairs). CRC4 uses XOR of nibbles over 7 bytes (serial + button + cnt_low + cnt_high) with offset 1.
## Timing
| Parameter | Value | Notes |
|-----------|---------|---------|
| Short | 800 µs | ±200 µs |
| Long | 1600 µs | ±200 µs |
| Min bits | 57 | |
## Encoding
Manchester: symbol duration short or long; bit value from transition direction.
## Frame Layout (57 bits)
- 32 bits: serial
- 8 bits: button
- 12 bits: counter
- 4 bits: CRC4 (XOR of nibbles, 7 bytes, offset 1)
## Decoder Steps
1. **Reset** — Wait for long pulse (preamble).
2. **CheckPreamble** — Count long pairs until enough; then transition to data.
3. **DecodeData** — Manchester decode; at 57 bits validate CRC4 and return.
## Encoder
Supported; builds preamble and Manchester-encoded 57-bit frame.
## Frequencies
433.92 MHz.