Implement 'agc' reset for SX126x & LR11x0 chip families#9705
Implement 'agc' reset for SX126x & LR11x0 chip families#9705thebentern merged 4 commits intomeshtastic:developfrom
Conversation
|
Since I can't request his review, tagging @compumike 😅 |
There was a problem hiding this comment.
Pull request overview
This pull request implements periodic AGC (Automatic Gain Control) reset functionality for SX126x radio chips to prevent stuck AGC gain states. The implementation follows datasheet specifications by performing a warm sleep followed by an aggressive calibration sequence (Calibrate 0x7F) every 60 seconds.
Changes:
- Adds virtual
resetAGC()method to RadioLibInterface base class (no-op by default) - Implements SX126x-specific AGC reset using warm sleep, RC standby, and full calibration
- Integrates periodic AGC reset into main loop with 60-second interval
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mesh/RadioLibInterface.h | Adds AGC_RESET_INTERVAL_MS constant and virtual resetAGC() method declaration |
| src/mesh/RadioLibInterface.cpp | Provides base no-op implementation of resetAGC() |
| src/mesh/SX126xInterface.h | Declares resetAGC() override for SX126x chips |
| src/mesh/SX126xInterface.cpp | Implements AGC reset sequence: warm sleep, RC standby, calibrate all blocks, restore settings, resume receiving |
| src/main.cpp | Adds periodic AGC reset execution in main loop using Throttle pattern |
|
Very nice digging work! Do you have any idea how long the full |
8b35518 to
eb855f2
Compare
Yes, that's the calibration itself, but I'm curious what it is including putting it to sleep, standby, and setting it to |
For SX1262 I guess 10-50 ms max, probably closer to 10-12 ms realistically. LR1110 is probably 6-7 ms. |
|
Okay, that's not too bad, but still enough to miss a preamble especially on the faster presets. I guess for now an interval of 1 minute is acceptable then. |
Do you thinks it's necessary to reset that frequently? I think Jonathon's PR had it at 15 minutes, but I'm not sure either of these numbers are based on empirical data. |
In #8163 it was also set to 1 minute: |
Ideally it would be configurable, but 1 min seems a reasonable start for SX1262 because it does suffer from progressive deafness. I think the 5-10ms deafness during AGC reset weighs up to the deafness that nodes hearing a lot of noise can suffer from. Let's put it like this: most nodes that don't suffer from deafness probably have relatively low interference so the "gain" reset probably won't affect them negatively anyway. |
eb1cc9a to
9d1d9c8
Compare
|
@weebl2000 have we seen any indicators that this happens on the LR11XX series? I noticed you added the reset to that family as well. |
Not that I'm aware of, the LR1110 is a bit more sophisticated in that regard. I'll gate it behind a compile flag so anyone that wants to try it can try it. I don't have any LR1110 device myself but anyone that has can go ahead & try it and let us know if it actually provides a benefit. |
There's no actual agc on SX126x chips but you can reset the analog registers by doing a warm sleep & running calibration.
b5dfe6a to
22d173c
Compare

There's no actual agc on SX126x chips but you can reset the analog registers by doing a warm sleep & running calibration. I saw there were earlier attempts #8163 but reverted in #9702. I've built this firmware for a Heltec Wireless Tracker v1.2 and it builds & runs fine.
I looked into the docs and implemented it here, ported the changes to meshtastic too.
I've referenced SX1262 datasheet to implement the calibration reset.
For LR1110 similar implementation, the 'AGC' is completely black boxed behind firmware so you can only reset it by resetting registers.
LR1110 datasheet page 9 section 1.2.1 states:
•Air interface fully compatible with the SX1261/2/8 family
So reset is very similar.
Also see LR1110 user docs