Skip to content

Thermal monitoring: surface chip thermal meter + health bucket#103

Merged
josephnef merged 1 commit into
masterfrom
thermal-monitor
Jun 24, 2026
Merged

Thermal monitoring: surface chip thermal meter + health bucket#103
josephnef merged 1 commit into
masterfrom
thermal-monitor

Conversation

@josephnef

Copy link
Copy Markdown
Collaborator

What

Adds a read-only thermal probe across the whole Jaguar family (RTL8812AU / 8811AU / 8814AU / 8821AU) so an operator can attribute a TX drop to the chip heating up.

The thermal meter (RF path-A reg 0x42, bits [15:10]) was already sampled inside the 8812A TX-power-tracking loop — but only there: gated to CHIP_8812, logged at debug, and never surfaced as health. This exposes it independently of the power-track correction, on every chip.

How

  • RadioManagementModule::ReadThermalStatus() — reads RF[A]0x42 standalone (no chip gate, no BB-swing write) and pairs it with the EFUSE baseline → ThermalStatus{raw, baseline, delta, valid}. Path A is readable on all members.
  • ThermalBucket() — classifies delta into cool/warm/hot/critical. The meter has no calibrated °C transfer function on the AU family (it's an RF/PA-bias tracking index), so the health signal is deliberately bucketed rather than presented as a fake temperature.
  • RtlJaguarDeviceGetThermalStatus() (synchronous, owning-thread safe) plus an opt-in background poller (start_thermal_poller / get_thermal_snapshot) mirroring the existing queue-depth poller, with the same shared-handle concurrency caveat documented.
  • Demos — honour DEVOURER_THERMAL_POLL_MS / DEVOURER_THERMAL_WARN_DELTA, emitting <devourer-thermal>raw=.. baseline=.. delta=.. status=.. lines. TX demo reads inline on its own thread (no USB contention); RX demo uses the background poller. A one-shot warn fires when delta crosses the threshold and re-arms on cooldown.
  • tests/thermal_hwcheck.sh — per-chip hardware smoke test.

Jaguar-1 has no automatic hard thermal TX shutdown, so a rising delta is an early warning that the PA is heating and TX power is being backed off — not a shutdown-reason readout.

Verification

  • Build green, ctest green (stream_stdin_binary).
  • Hardware-tested on 8812AU / 8814AU / 8821AU: the meter reads live, delta tracks PA heat from a cold start (e.g. 8812 cold delta=+0 cool → sustained TX equilibrium delta=+10 warm, ~17.5k frames confirmed sending), and the bucket + warn move correctly with physical state (including reading cool right after a physical detach). An 8811AU rides the same code path automatically (none on the bus to test).

🤖 Generated with Claude Code

Add a read-only thermal probe across the whole Jaguar family so an
operator can attribute a TX drop to the chip heating up.

The thermal meter (RF[A] reg 0x42, bits [15:10]) was already sampled
inside the 8812A TX-power-tracking loop, but only there: gated to
CHIP_8812, logged at debug, and never surfaced as health. This exposes
it independently of the power-track correction.

- RadioManagementModule::ReadThermalStatus() reads RF[A][0x42] standalone
  (no chip gate, no BB-swing write) and pairs it with the EFUSE baseline,
  returning a ThermalStatus{raw, baseline, delta, valid}. Works on
  8812/8811/8814/8821 (path A is readable on all members).
- ThermalBucket() classifies the delta into cool/warm/hot/critical. The
  meter has no calibrated degC transfer function on the AU family (it is
  an RF/PA-bias tracking index), so the health signal is deliberately
  bucketed rather than presented as a fake temperature.
- RtlJaguarDevice exposes GetThermalStatus() (synchronous, owning-thread
  safe) plus an opt-in background poller (start_thermal_poller /
  get_thermal_snapshot) mirroring the queue-depth poller, with the same
  shared-handle concurrency caveat.
- Demos honour DEVOURER_THERMAL_POLL_MS / DEVOURER_THERMAL_WARN_DELTA and
  emit <devourer-thermal> lines; the TX demo reads inline on its own
  thread (no USB contention), the RX demo uses the background poller. A
  one-shot warn fires when delta crosses the threshold and re-arms on
  cooldown.
- tests/thermal_hwcheck.sh: per-chip hardware smoke test.

Jaguar-1 has no automatic hard thermal TX shutdown, so a rising delta is
an early warning that the PA is heating and TX power is being backed off,
not a shutdown-reason readout.

Verified on hardware (8812/8814/8821): meter reads live, delta tracks PA
heat from a cold start through to a warm/hot steady state, and the bucket
+ warn move correctly with physical state. Build green, ctest green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@josephnef josephnef merged commit b4b9f52 into master Jun 24, 2026
6 checks passed
@josephnef josephnef deleted the thermal-monitor branch June 24, 2026 14:39
josephnef added a commit that referenced this pull request Jun 26, 2026
…cking bug

Adds an absolute TXAGC-index override and a continuous TX-gain ramp to
WiFiDriverTxDemo, plus a USRP-backed harness to measure the chip thermal
meter (PR #103 probe) against a swept TX gain. Built to answer "does the
8812AU thermal meter degrade over time under sustained TX" — empirically
no: SDR-verified ~12-19 dB on-air power swings leave the meter flat
(steady-state die temp, not TX-induced PA heating).

Driver/demo:
- RadioManagementModule: SetTxPowerOverride(idx) forces the per-rate TXAGC
  index in PHY_SetTxPowerIndexByRateArray (bypassing the EFUSE table);
  ApplyTxPower() re-runs PHY_SetTxPowerLevel8812 for the current channel
  (SetMonitorChannel early-returns on an unchanged channel, so it can't
  re-push TX power mid-session).
- RtlJaguarDevice: SetTxPowerOverride / ApplyTxPower / ReadBBReg passthroughs.
- txdemo: DEVOURER_TX_PWR_START/STOP/STEP/STEP_MS gain ramp (emits
  <devourer-txpwr> markers), DEVOURER_TX_GAP_US duty knob, and a gated
  DEVOURER_TX_PWR_READBACK diagnostic.

Bug fix (surfaced by the override + SDR ground truth):
- phy_SwBand8812 only updated current_band_type when an actual HW band-switch
  ran. After init_hw_mlme_ext resets it to BAND_MAX, a same-band channel-set
  finds the chip already on 2.4G, skips the switch, and leaves the shadow at
  BAND_MAX permanently. That made bIsIn24G false, so CCK TX power was never
  re-programmed after init, and BAND_MAX was fed to the thermal pwrtrk and
  IQK. Fix: set current_band_type = BandToSW unconditionally (the channel's
  band is authoritative). SDR-confirmed CCK on-air power now tracks the index
  (-40 -> -21 dBFS over 0..40); 5G still correctly skips CCK; ctest green.

Harness (tests/, uv): thermal_gain_sweep.py orchestrator merges
<devourer-thermal>/<devourer-txpwr>/SDR streams to CSV + verdicts;
sdr_power_probe.py (UHD B200/B210 relative dBFS); run_thermal_gain_sweep.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant