Skip to content

S3: pin the forced RX gain into the high gain table - #20

Open
m31nr4d wants to merge 1 commit into
ESPARGOS:mainfrom
m31nr4d:s3-pin-high-gain-table
Open

m31nr4d wants to merge 1 commit into
ESPARGOS:mainfrom
m31nr4d:s3-pin-high-gain-table

Conversation

@m31nr4d

@m31nr4d m31nr4d commented Oct 26, 2026

Copy link
Copy Markdown

With a strong signal, a forced gain on the ESP32-S3 can silently switch to an entry of the second RX gain table (83…165) while GAIN? still reports the forced index (#19). This mirrors the C61's burst_gain_mirror idea for the S3: capture the calibrated gain words through g_phyFuns slot 11 (hooked from a --wrap of set_rx_gain_table), write the forced entry into every high slot, restore them on GAIN HARDWARE. S3-only; other targets unchanged. If the hook is not installed, behaviour is exactly as before.

g_phyFuns slot 11 (rom_write_gain_mem), the high table starting at 83, and set_rx_gain_table's call from bb_init come from disassembling the libphy of the pinned IDF (25fe69f); they are undocumented and may move with another IDF.

Measured from 2300 to 2600 MHz: 5 of 1014 gain changes at the wrong gain with the patch vs 83 of 858 before, gain table unchanged (details in #19). The remaining cases were all right after a retune.

Refs #19

🤖 Generated with Claude Code

With a strong signal, a forced gain on the ESP32-S3 can silently switch to
an entry of the second RX gain table (83..165) while GAIN? still reports
the forced index (ESPARGOS#19). Same idea as the C61's burst_gain_mirror, adapted
to the S3: its PHY writes the gain tables through g_phyFuns slot 11
(rom_write_gain_mem) rather than a wrappable function, so set_rx_gain_table
is wrapped to hook that slot and capture the calibrated words. GAIN MANUAL n
writes entry n into every high slot; GAIN HARDWARE restores them. S3 only;
without the hook the behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <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