Hold GC1109 PA_POWER during deep sleep for LNA RX wake#1600
Hold GC1109 PA_POWER during deep sleep for LNA RX wake#1600weebl2000 wants to merge 2 commits intomeshcore-dev:devfrom
Conversation
6b2d2c5 to
624b40e
Compare
|
Nice, hope this fix will get merged soon for cases when powersave is enabled. Awesome. |
|
@weebl2000 Thank you for replacing the original PR with this one. It is much simpler and straightforward code, and easy to see what exactly it's doing. |
|
I finally got the meshcore build env working. Dont know how to enable powersaving mode on the companion but I'm drawing ~0.74 watts (.143 amps at 5.15V) with the screen off where on the 1.11 ver I was previously running just under .6 watts in idle mode. Maybe this is because the LNA is now staying powered on while the esp32 is in idle or light sleep? Edit. If I disconnect from bluetooth and reconnect the watttage drops back down under .6 watts for a like ~30 seconds but then jumps back up to .74 watts and never comes back down. Edit. This build doesn't have good powersaving for repeaters and higher power usage for companions. My build from the dev branch must have brought something bad in. But the RX fix seems to be working at least! The dev put a repeater .bin with his fixes here which has the good power savings. |
624b40e to
08880bf
Compare
|
@Socalix I think the current order is correct. The key distinction here is between the GPIO peripheral registers and the pad hold logic. digitalWrite() updates the GPIO output registers unconditionally — even while the pad is held. The hold only freezes the pad, not the register state. When rtc_gpio_hold_dis() is called, the pad immediately reflects whatever level is already programmed in the GPIO registers. This is why the ESP-IDF docs for gpio_hold_dis() state: “If you don't want the level changes, the gpio should be configured to a known state before this function is called.” That instruction only makes sense if register writes are expected to occur while the pad is held. With the current order: Configure GPIO output HIGH (register updated, pad still held HIGH) Release hold → pad transitions from held-HIGH to register-HIGH (no glitch) Reversing the order would cause the pad to briefly revert to its default state on hold release, which would momentarily remove power from the GC1109 FEM. So the existing order is intentional and avoids a power glitch during wake from deep sleep.
https://docs.espressif.com/projects/esp-idf/en/stable/esp32s3/api-reference/peripherals/gpio.html
|
|
@weebl2000 adding this as a comment to the code might be valuable so it does not get changed in the future because "it looks wrong" |
08880bf to
eb1aa2f
Compare
done |
I haven't tried it myself yet with the companion. It might be difficult to test if you're receiving messages all the time btw. Unless you have a faraday cage. 😋 |
@weebl2000 This is interesting. Before commenting above, I checked the same documentation specifically for I don't know why there's difference between
|
The GC1109 FEM needs its VFEM_Ctrl pin held HIGH during deep sleep to keep the LNA active, enabling proper RX sensitivity for wake-on-packet. Without this, the LNA is unpowered during sleep and RX wake sensitivity is degraded by ~17dB. Release RTC holds in begin() after configuring GPIO registers (not before) to ensure glitch-free pin transitions on wake. Trade-off: ~6.5mA additional sleep current for significantly improved wake-on-packet range.
eb1aa2f to
d7ff722
Compare
|
I've updated the code comments to clarify a bit more. |
|
@beachmiles I have tested your 1398 / 1600 rxfix.rev2 repeater firm file and V4 draws 37mA. I loaded stock firm 1.12 and then yours. I also tried the no display firm that brings down to 11mA and then yours and it jumps to 37mA again. |
|
@weebl2000 can we please get steps how to test this? Reading through the comments I think people are talking about different things and possibly testing incorrectly. |
Realistically, you can test by running a repeater with power saving enabled. Then, when it goes to sleep you should measure voltage across the GC1109 pins and see that it's still being powered. The GC1109 is behind the screen so you would have to remove your heltec v4's screen. But the real fix is in keeping it alive during sleep/wake cycles. You can also "test" by checking RSSI during receive that happen when the v4 is sleeping. |
Use rtc_gpio_hold_en to latch PA_POWER (LDO) and PA_EN (CSD) HIGH during deep sleep so the GC1109 LNA remains powered for wake-on-packet RX. Previously these pins used weak pull-ups which could lose state. On deep sleep wake, skip these pins in the blanket RTC hold release and instead release them in SX126xInterface::init() after GPIO registers are set HIGH first, avoiding a power glitch on the GC1109. Trade-off: ~6.5mA additional deep sleep current for significantly improved wake-on-packet RX sensitivity (~17dB). Reference: meshcore-dev/MeshCore#1600
|
@weebl2000 I'm measuring the GC1109 now. Pin 15 and 16 both have 3.7 volts. It looks like possibly that your file has the OLED screen still powered. This was found to be the case with 1.12 and then both there was a temporary "no display" firm file made by @Socalix to fix this. Then Kevin @IoTThinks made a more perm fix after that. was PR1570 and then looks like another opened with 1608 even though not much clarity there. If I load the "no display" firmware, then I see 11mA....... Now, there is NO power on the GC1109 once sleep delay ends. pin 15 and 16 go to zero. When I do a telemetry check I see a SNR of -116 and then after that it goes up to -104 that shows in fact the LNA did NOT have power - so your correct. Power then stays on for the long delay and then once powersaving goes back into effect, GC1109 goes dark. Lets test this and see if it truly draws 6 ish mA more on top of the 11mA. look forward to your next file. |
Try building this branch, it contains all my open PRs + dev: https://github.com/weebl2000/MeshCore/tree/dev_plus |
|
@weebl2000 there are a ton of files there. Not my strong suit. But if another test bin is created I will test. |
https://x230.weebl.me/public/v4_dev_plus.bin - v4 repeater build with all fixes. Flash without erase. |
|
@weebl2000 Yes sir, we went from 11.1 mA to now 12.3mA and the GC1109 has power in sleep. I'm still testing but when I see the current drop from 47ma after the last signal is received, it holds, then after 20 seconds, sleeps and then drops back to 12.3 ish.......GC1109 power remains on |
Could you please make a .bin for the companion Bluetooth as well for me to test? Not sure if companions ever deep sleep since there is no way to run the "powersaving on" command that I know of, but am curious to see if there is less power usage on your build. Sounds like something else in the dev branch I built from with your fix maybe broke powersaving on the repeater version that towercams tested? |
|
Here's a build for Heltec v4 companion (BLE): https://x230.weebl.me/public/v4_companion_ble_dev_plus_25c7ec3d.bin This includes the deep sleep LNA fix from this PR, plus BLE companion power saving (#1347) — power saving kicks in when you disable Bluetooth with the button. |


Summary
Without this, the GC1109 LNA could be unpowered during sleep, degrading RX wake sensitivity by ~17dB.
Trade-off: ~1.2mA additional deep sleep current (measured: 11.1mA → 12.3mA) for significantly improved wake-on-packet range.
Test plan
Supersedes #1249