Skip to content

Latest commit

 

History

History
123 lines (96 loc) · 5.57 KB

DEBUGGING.md

File metadata and controls

123 lines (96 loc) · 5.57 KB

Debugging Reference

TESTING.md is the step-by-step bring-up ladder — start there. This document is the reference for fixing a specific failed rung: hardware checks, log interpretation, and symptom → cause tables.

Enable full logging

logger:
  level: VERBOSE
  logs:
    proflame2: VERBOSE
esphome logs proflame2_test.yaml

Key log lines and what they tell you:

Log line Meaning
CC1101 Part Number: 0x00, Version: 0x14 SPI works, chip alive (0x04/0x17 versions also fine)
FREQ: 0x0C1D46 314.973 MHz programmed correctly
Frame: id=... cmd1=... err1=... Exactly what rtl_433 should decode — compare field-for-field
TX start: primed=64 bytes, MARCSTATE=0x01 FIFO loaded, radio was IDLE, STX sent
TX refill: ... (VERBOSE) FIFO streaming is working
TX complete Full 120-byte burst clocked out
TX error: ... underflow=1 Main loop starved the FIFO — check for blocking lambdas/components
TX timeout Radio never drained the FIFO — usually SPI or calibration failure
Calibration may have failed, MARCSTATE=... VCO didn't lock — check crystal, supply voltage

Hardware checklist

  • Power: CC1101 is 3.3 V only — 5 V kills it. Add a 100 nF decoupling cap near VCC if you see erratic behavior; long dupont wires on SPI are a common source of flakiness (keep under ~15 cm).
  • Wiring (must match your YAML, not the diagram — check both): CLK→SCLK, MISO→SO(GDO1), MOSI→SI, plus CS and optional GDO0.
  • Antenna: a quarter-wave wire for 315 MHz is 23.8 cm (not the 17.3 cm used for 433 MHz). Solder it to the ANT pad; no antenna = millimeters of range and a possibly stressed PA.
  • Module band: "433 MHz" CC1101 modules tune to 315 MHz fine (the chip covers 300–348 MHz), but their antenna matching network is optimized for 433 — expect reduced range. A 315 MHz module (e.g. E07-M1101S variant) is better.
  • Crystal: this component assumes a 26 MHz crystal. A 27 MHz module would transmit at ~327 MHz instead of 315 (see frequency sweep below to detect this).

Symptom → cause

Part Number: 0xFF (or all registers read 0xFF/0x00)

SPI failure. In order of likelihood: CS pin doesn't match YAML; MISO not connected; 5 V on VCC (chip dead); swapped MOSI/MISO. The "DEBUG: Verify CC1101 Hardware" button does a register write/read-back test that isolates this.

rtl_433 sees nothing when the ESP transmits

  1. Confirm the ESP thinks it transmitted (TX start → TX complete in logs). If MARCSTATE errors appear, it's a radio/SPI problem, not RF.
  2. Check the PA table via "DEBUG: Check CC1101 Config": must be OFF=0x00, ON=0xC0.
  3. Antenna connected?
  4. Frequency sweep: run rtl_433 -f 315M -A and press transmit. Nothing? Try scanning wider — a 27 MHz-crystal module lands near 327 MHz: rtl_433 -f 327M -A. Or watch a waterfall (GQRX/SDR++/URH) from 310–330 MHz.

rtl_433 sees pulses but won't decode (-R 207 silent)

Compare rtl_433 -A pulse analysis of the ESP vs the remote (you saved the remote's baseline per CAPTURE.md):

  • Pulse widths should be ~396/804/1212 µs. If everything is 2× too wide, the data rate is 1200 instead of 2400 baud (MDMCFG4 must be 0xF6).
  • 35 sync pulses (1212 µs) per burst. Wrong count → word/packet structure.
  • Try rtl_433 -f 315M -R 207 -M bits to see the raw decoded rows.

rtl_433 decodes, but fields don't match the ESP's Frame: log

  • Wrong id → serial_number: typo (remember rtl_433 JSON prints decimal).
  • Wrong err1/err2 → checksum constants; re-derive per CAPTURE.md and confirm with python3 tools/verify_protocol.py selftest that the code itself is sound.
  • Wrong cmd1/cmd2 → entity state isn't what you think; check the ESP log.

rtl_433 decodes perfectly, fireplace doesn't respond

The information is right; the RF link to the fireplace's receiver isn't.

  1. Frequency match: compare the freq field of ESP captures vs remote captures taken with the same dongle — dongle ppm error cancels out. Adjust frequency: in the YAML until they match (try 314.973MHz → 315.000MHz → 315.070MHz).
  2. Power/distance: start with the ESP a meter from the fireplace. The remote reaches ~10 m; a mismatched 433 MHz antenna may manage far less.
  3. Pairing: the receiver only obeys serials it has learned. If the original remote still works, your cloned serial is paired; if you changed serials, re-pair (LEARN button on the IFC board).
  4. Watch for the echo: the receiver echoes accepted commands back over RF. python3 tools/pf2_monitor.py flags it automatically as ECHO (receiver ACK). Echo present = fireplace accepted the command (any remaining problem is fireplace-side, e.g. pilot mode, valve).

Commands work but are occasionally missed

  • RF is fire-and-forget with no retry above the 5-in-burst repetition; increase ESP proximity or antenna quality.
  • Check for TX error ... underflow in logs under WiFi load; the FIFO refill runs in the main loop, so a component that blocks for >200 ms mid-burst can starve it.

Capturing evidence for a bug report

For anything you can't resolve, capture:

tools/pf2_capture.sh bug-report-1                 # decodes + raw .cu8 samples + env info
esphome logs proflame2_test.yaml | tee esp.log    # VERBOSE component logs

plus your YAML (redact secrets) and dump_config output. The .cu8 files can be re-decoded offline (rtl_433 -r file.cu8 ...) — they make the failure reproducible for anyone helping.