Files

89 lines
3.9 KiB
Markdown

# RF Configuration — Wireless M-Bus C1 (mode C, meter-to-other)
## PHY parameters (EN 13757-4, cross-checked against rtl-wmbus source)
```
Frequency: 868.95 MHz
Chip/bit rate: 100 kbps NRZ (mode C is NOT 3-of-6 coded, unlike T)
Deviation: +/-45 kHz nominal
Preamble: alternating 01 chips
Sync: 0x543D (shared T/C access code)
Mode bytes: 0x54CD -> frame format A, 0x543D -> frame format B
```
Authority used:
- rtl-wmbus source (`t1_c1_packet_decoder.h`): `ACCESS_CODE_T1_C1 0x543d`,
`C1_MODE_A 0b010101001100`, `C1_MODE_B 0b010101000011`, trailer `0b1101`
— concatenated this yields sync sequences 0x543D54CD (A) / 0x543D543D (B).
- Frame lengths (over-the-air, incl. L and CRCs):
- format A: `1 + L + 2*((L-10+15)/16 + 1)`
- format B: `1 + L`
## SX1262 register-level configuration (firmware/main/sx126x.c)
```
Packet type: GFSK
Bitrate: raw 0x002800 (32*32e6/100e3 = 10240 -> 100 kbps)
Deviation: raw 0x00B852 (45e3*2^25/32e6 = 47186)
Shaping: none (plain 2-FSK; may experiment with BT=0.5)
RX bandwidth: 234.3 kHz DSB (code 0x0A) -- signal occupies ~190 kHz
Sync word: 0x543D, 16 bits; mode bytes handled as payload so RX and
TX share one configuration
Preamble TX: 48 bits
Preamble det: 8 bits
Length mode: fixed, 255-byte capture, truncated in software using the
L-field formulas above (SX1262 variable-length mode cannot
express wM-Bus length semantics)
CRC: radio CRC off; EN 13757 CRC-16 (poly 0x3D65, complemented)
validated per block in software
Whitening: off
RX gain: boosted (reg 0x08AC = 0x96)
TX params: default -9 dBm configured (min), ramp 40 us; PA config
(0x02,0x02,0x00,0x01) = +14 dBm-optimal table, deliberately
capped -- the external KCT8103L PA adds gain on top
```
PA-row invariant: `deviceSel` must remain `0x00` for SX1262, and the other
bytes must come from an SX1262 row. The removed diagnostic
`(0x01,0x00,0x00,0x01)` mixed the SX1261 +10 dBm PA-duty/hpMax values with
SX1262 selection. This undocumented hybrid reduced measured RF by about
32 dB while all chip-side TX diagnostics still passed.
## Consequences of the fixed-255-byte RX capture
RxDone fires ~ (255 - frame_len) * 80 us after the actual end of frame;
the firmware reconstructs the true end-of-frame timestamp. During that
tail the receiver cannot re-arm sync search, adding up to ~20 ms of dead
time per frame. Acceptable for the experiment; optimization candidate
(GetRxBufferStatus polling with early stop).
## TX power
Configured SX1262 power is NOT radiated power: the KCT8103L PA follows.
Development default is the SX1262 minimum (-9 dBm), and the console accepts
only -9..+2 dBm. +2 is the level used by known-good Heltec V4.3 firmware,
not a declaration of legal radiated power. Keep -9 dBm until the complete
FEM/antenna path has a conducted or calibrated e.r.p. measurement.
`wmbus_tx.configured_tx_dbm` records SetTxParams. `airtime_us` is computed
channel occupancy (48-bit preamble + 16-bit sync + payload at 100 kbps);
`tx_operation_us` is the longer firmware-entry-through-TxDone latency.
## T-mode (T1) support
T1 shares the 0x543D access code, so ONE radio configuration receives
both modes: C-mode announces itself with two NRZ mode bytes after the
sync; T-mode continues directly with 3-of-6 coded data (decoded in
software from the same fixed 255-byte capture; wM-Bus C/T share the
100 kchip/s rate). Tables verified against rtl-wmbus.
TX: T1 frames are 3-of-6 encoded in software and sent with 50 kHz FSK
deviation (raw 0x00CCCD) instead of C-mode's 45 kHz; the swap is a lazy
per-TX SetModulationParams (deviation is a TX-only GFSK parameter, RX is
unaffected). Verified: rtl_wmbus decodes our synthetic T1 frames,
including L=140.
Length caps from the fixed 255-byte capture: C1 total <= 253 bytes;
T1 total <= 170 decoded bytes (coded 1.5x).