hil: LNA A/B experiment scripts, refine health railed check

This commit is contained in:
Lars Nolden
2026-09-01 08:35:08 +02:00
parent a422305059
commit 78a8635ac8
5 changed files with 267 additions and 11 deletions
+37 -9
View File
@@ -45,17 +45,45 @@
## LIKELY
- Fixed 255-byte RX capture adds up to ~20 ms artificial dead time per
frame (by construction; to be measured).
frame (by construction; measured airtimes are consistent with it).
- The remaining CRC failures on long Techem frames are bit errors
accumulating over frame length, not a hard sensitivity floor: the same
meters decode cleanly when a few dB stronger (docs/RF_FRONTEND_TESTS.md).
## DISPROVEN
## CONFIRMED (measurement methodology)
- "rtl_sdr pipeline works out of the box": the PLL wedge cost ~20 minutes
of empty captures. Always energy-probe the SDR before trusting a null
result.
- Heltec RX is competitive with the Nooelec observer on identical traffic:
124 of 127 SDR-classified originals matched byte-exactly in a 30 min run
(97 % across 32 meters).
- Repeat payloads are byte-exact: 63/63 logged `tx_payload` values equalled
mode bytes + the received raw frame. No corruption in the RX->TX path.
- Our repeats DO radiate. IQ capture shows burst pairs at 54-55 ms spacing
with 9-10 ms duration (matches 100 kbps x ~100 bytes) - the repeat is
real RF, independently observed, even when rtl-wmbus cannot decode it.
- The observer, not the repeater, limits repeat decoding: our TX arrives
~36 dB stronger than meter traffic and sits at RTL-SDR full scale.
Raising the repeat delay 50 -> 200 ms improved SDR repeat decoding from
3 % to 30 % (demodulator level-estimate recovery).
- Synthetic C1 bursts from the Heltec (L = 19/40/60/98) are decoded by
rtl-wmbus as valid C1 with correct CRCs, including two airings of the
same frame 50/100/200 ms apart. TX framing is therefore correct and
standards-shaped independently of meter traffic.
- rtl_wmbus runs two demodulators, so one airing yields 1-2 output lines;
and rtl_sdr delivers ~81.92 ms buffers, so decode timestamps are
quantized - SDR timestamps cannot be trusted below ~100 ms resolution.
Correlation must use byte identity plus occurrence counting, not
timestamps alone.
- The Nooelec intermittently enters a deaf state (R820T I2C init failure /
PLL wedge). `hil/sdr_health.py` detects it by checking that noise tracks
tuner gain and the spectrum has structure; the harness aborts rather
than reporting an unattributable empty capture.
- "[R82XX] PLL not locked!" printed during tuning is BENIGN (emitted while
rtl_sdr probes and disables direct-sampling mode); it is not a wedge
indicator. The real symptom is railed, gain-independent noise.
## NEEDS TESTING
- Heltec vs SDR RX match rate on real meters (first HIL run in progress).
- LNA on/off comparison (KCT8103L CSD low in RX = bypass?).
- Repeat delay accuracy, RX deaf time distribution over many events.
- Long-run stability (>=100, >=500 repeats).
- LNA on/off comparison (`set fem_rx_csd 0|1` hook exists, not yet measured).
- Narrower RX bandwidth (156 kHz) vs current 234.3 kHz on weak meters.
- Long-run stability at >=100 and >=500 verified repeat events.
- Early-stop RX (poll GetRxBufferStatus) to cut the ~20 ms deaf tail.
+98
View File
@@ -0,0 +1,98 @@
# RF Front-End (KCT8103L) Observations
## Measured RX performance vs the SDR
The most useful result is not datasheet sensitivity but the head-to-head
comparison against the Nooelec observer on identical real traffic.
30-minute run (`captures/2026-08-31T23-17-47-hil`, gain 42.1 dB,
CSD high / LNA path active):
```
SDR classified originals : 127
Heltec RX (CRC ok) : 124 matched
per-meter match rate : 97 % (32 meters)
```
Per-meter table is in that run's `report.txt`. The Heltec matched the SDR
essentially frame-for-frame, and in earlier runs the Heltec decoded frames
from ~50 distinct meters where the SDR decoded far fewer, i.e. the
SX1262 + KCT8103L RX chain is at least competitive with an R820T dongle
plus whip antenna at the same location.
## RSSI vs CRC success (Heltec, chip-referred RSSI)
15-minute run, 166 candidate frames:
| RSSI bucket | CRC ok | CRC fail | success |
|---|---|---|---|
| >= -50 dBm | 3 | 0 | 100 % |
| -60..-51 | 38 | 3 | 93 % |
| -70..-61 | 24 | 86 | 22 % |
| -80..-71 | 0 | 11 | 0 % |
| <= -100 | 0 | 1 | 0 % |
Interpretation: with the current configuration the usable working point is
about -65 dBm chip-referred and better. Frames below that are received
(sync + length parse succeed) but accumulate bit errors. Most failures are
long (100-118 byte) Techem frames, consistent with errors accumulating over
frame length rather than a hard sensitivity floor.
Open: how much of this is FEM configuration vs modem parameters (RX
bandwidth 234.3 kHz is generous; a narrower filter may improve SNR).
## LNA / CSD experiment
The firmware exposes `set fem_rx_csd 0|1`, which controls the KCT8103L CSD
level while in RX (CSD high = FEM enabled/LNA path, CSD low = FEM disabled).
TX always forces CSD high.
Status: hook implemented and available; a controlled A/B comparison needs
two runs of equal duration on the same meter population. NOT yet measured
- do not claim a result. The RSSI/CRC table above is for CSD high.
## Bench dynamic-range limitation (important)
Measured with IQ capture (`hil/iq_bursts.py`, `captures/iq/repeat.raw`):
```
meter original at the SDR : +8.4 dB over noise floor (IQ std 1.3)
our repeat at the SDR : +44.8 dB over noise floor (IQ std 88.6)
```
Our transmission arrives ~36 dB stronger than the meter traffic and sits at
the RTL-SDR's full scale (u8 amplitude ~125 of 127). Consequences:
- At tuner gain 42.1 dB the meters decode well but our repeats are driven
into ADC compression and mostly fail to decode.
- At tuner gain 20.7 dB our repeats are only marginally compressed but the
meters drop to ~8 dB SNR and decode poorly.
- No single tuner gain serves both, because the required dynamic range
exceeds what an 8-bit dongle provides in this bench geometry.
This is exactly the overload situation the task description warns about.
Mitigations applied in firmware: SX1262 at its minimum configured power
(-9 dBm) and the lowest documented PA table (paDutyCycle 0x01, hpMax 0x00).
Remaining mitigation is physical (antenna separation / attenuator), which
is not scriptable from this host.
Consequences for verification methodology - see docs/TESTING.md:
1. real-meter originals and Heltec RX match rate are measured at high gain;
2. Heltec TX decodability is proven separately with synthetic C1 bursts
that are not preceded by a weak frame (phase A of `hil/run.sh`);
3. RF-level repeat evidence is available from IQ burst-pair timing.
## Repeat-delay dependence of observer decoding
Same bench, same gain (42.1 dB), only the repeat delay changed:
| repeat delay | repeats decoded by SDR |
|---|---|
| 50 ms | 2 / 63 (3 %) |
| 200 ms | 6 / 20 (30 %) |
A longer gap gives the rtl-wmbus demodulator time to recover its level
estimate after the weak original before the very strong repeat arrives.
The HIL default is therefore 200 ms (still inside the 20-200 ms
development range). This is an artefact of the observer, not of the
repeater: the firmware's own timing is accurate to a few microseconds.