Files
KAT/docs/kia_v0.md
T
leviathan 655f019469 v1.0.0
2026-02-13 22:00:42 -05:00

46 lines
1.8 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Kia V0 Protocol
**Rust module:** `src/protocols/kia_v0.rs`
**Reference:** `REFERENCES/ProtoPirate/protocols/kia_v0.c`
## Overview
Kia V0 is a PWM keyfob protocol: short pulse = 0, long pulse = 1. No Manchester encoding. 61 bits per frame (1 sync bit + 60 data bits). CRC8 over bits 855; polynomial 0x7F, init 0x00.
## Timing
| Parameter | Value | Notes |
|------------|--------|--------------------|
| Short (0) | 250 µs | ±100 µs (te_delta) |
| Long (1) | 500 µs | ±100 µs |
| Min bits | 61 | |
## Frame Layout (61 bits)
- **Sync:** 1 bit (the long-long pattern also counts as first data bit = 1).
- **Data:** 60 bits MSB first:
- Bits 5659: 4-bit prefix (often preserved from capture).
- Bits 4055: 16-bit counter.
- Bits 1239: 28-bit serial.
- Bits 811: 4-bit button.
- Bits 07: 8-bit CRC (over bits 855, 6 bytes).
## Decoder Steps
1. **Reset** — Wait for short HIGH (250 µs ±100).
2. **CheckPreamble** — Count preamble: alternating short pulses; on LOW, if shortshort pair then `header_count++`; if longlong and `header_count > 15` → go to SaveDuration, add first bit 1.
3. **SaveDuration** — On HIGH: if duration ≥ 500 + 200 µs (end marker), check `decode_count_bit == 61` and return decode; else store duration and go to CheckDuration. On LOW → Reset.
4. **CheckDuration** — On LOW: shortshort → add bit 0, back to SaveDuration; longlong → add bit 1, back to SaveDuration; else Reset.
## Encoder
- 2 bursts; inter-burst gap 25000 µs.
- 32 alternating short (250 µs) preamble pairs.
- Sync: long HIGH, long LOW (500 µs each).
- Data: 59 bits sent (mask 1ULL << (58 - bit_num)), i.e. bits 58 down to 0 (per reference).
- End marker: long × 2 (1000 µs HIGH).
## Frequencies
433.92 MHz.