Persist Si4684 crystal calibration (ibias/ctun/xtalFreqHz) to EEPROM
Extends the existing FM/DAB ANTCAP EEPROM persistence pattern
(Eeprom24aa::writeFmAntCap/writeDabAntCap) to the crystal trim found by
POST /api/tuner/xtal-calibrate, which previously only applied live and
was lost on every reboot.
- Eeprom24aa gains readXtalCalibration()/writeXtalCalibration() at word
addresses 0x02 (ibias), 0x03 (ctun), 0x04-0x07 (xtalFreqHz,
big-endian), right after the existing FM/DAB ANTCAP bytes.
- HardwareBootstrap::boot() now boots ADAU1701 before Si4684 (needed so
the EEPROM read, which borrows ADAU1701's I2C bus, can happen before
Si4684's boot() call, which takes the crystal trim as an argument),
loads the saved trim if present, and falls back to the compiled-in
defaults (ibias=72, ctun=0, xtalFreqHz=19199750) otherwise.
- POST /api/tuner/xtal-calibrate now persists every successful live
recalibration automatically ("persisted":true/false in the response)
via a new saveXtalCalibration()/net::AntennaCalibration::saveXtal
bridge, mirroring the ANTCAP save pattern.
Verified live: boot log confirms "Xtal not calibrated" before the first
save, "Xtal calibration loaded: ibias=72 ctun=0 xtal_freq_hz=19199750"
after, surviving a reboot; DAB/FM tuning unaffected (DAB CNR 17-19dB,
locked).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+19
-5
@@ -204,7 +204,7 @@ Done in fw 0.8.5 unless noted:
|
||||
|
||||
---
|
||||
|
||||
## TODO — calibration functions need to become permanent, in-firmware, on-demand tools (2026-08-23)
|
||||
## DONE (2026-08-24) — calibration functions are now permanent, in-firmware, on-demand tools
|
||||
|
||||
Both ANTCAP calibration (`tools/si4684_antenna_calibration.py`) and Si4684
|
||||
crystal calibration (`tools/si4684_xtal_calibration.py`,
|
||||
@@ -236,10 +236,24 @@ convergence-loop logic (currently in `tools/si4684_xtal_calibration.py`)
|
||||
moves into firmware, or stays host-side with just an EEPROM-persist step
|
||||
added at the end of the existing HTTP flow.
|
||||
|
||||
Not started — explicitly deferred to a future session, noted here only so
|
||||
it isn't lost. See `docs/si4684-rf-investigation-report.md`'s 2026-08-23
|
||||
entry for full context on why this calibration was needed and how it
|
||||
currently works.
|
||||
**Resolved 2026-08-24.** `Eeprom24aa` gained `readXtalCalibration()` /
|
||||
`writeXtalCalibration()` (word addresses 0x02 ibias, 0x03 ctun, 0x04-0x07
|
||||
xtalFreqHz big-endian, right after the existing FM/DAB ANTCAP bytes at
|
||||
0x00/0x01). `HardwareBootstrap::boot()` now reads the ADAU1701 boot
|
||||
earlier (moved before Si4684's, since the EEPROM read needs ADAU1701's
|
||||
I2C bus) and loads the saved crystal trim before calling
|
||||
`gSi4684.boot(...)`, falling back to the compiled-in defaults
|
||||
(ibias=72, ctun=0, xtalFreqHz=19199750) when the EEPROM has never been
|
||||
calibrated. `POST /api/tuner/xtal-calibrate` now persists every
|
||||
successful live recalibration automatically (`"persisted":true/false` in
|
||||
the response) via a new `saveXtalCalibration()` /
|
||||
`net::AntennaCalibration::saveXtal` bridge, mirroring the existing
|
||||
ANTCAP save pattern. The convergence-loop logic
|
||||
(`tools/si4684_xtal_calibration.py`) stays host-side, unchanged — only
|
||||
the persistence gap was closed.
|
||||
|
||||
See `docs/si4684-rf-investigation-report.md`'s 2026-08-23 entry for full
|
||||
context on why this calibration was needed and how it currently works.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user