-
-
Notifications
You must be signed in to change notification settings - Fork 2k
🔧 Fix LNA/PA power control for Heltec v4, wireless tracker v2 #9029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Great detective work! Thanks for the pull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical bug in the GC1109 Front-End Module (FEM) control logic for Heltec v4 and Wireless Tracker v2 devices that caused 10-20 dB RX sensitivity loss. The root cause was incorrect initialization of the PA_EN pin, which must remain HIGH for both RX and TX operations, not LOW as it was previously set.
Key changes:
- Fixed GC1109 PA_EN pin initialization from LOW to HIGH in SX126xInterface.cpp
- Added RadioLib RF switch control definitions (SX126X_RXEN/TXEN) to both variant files
- Improved inline documentation explaining GC1109 pin behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| variants/esp32s3/heltec_v4/variant.h | Added RadioLib RF switch control definitions and improved comments documenting GC1109 pin functions |
| variants/esp32s3/heltec_wireless_tracker_v2/variant.h | Added RadioLib RF switch control definitions and improved comments documenting GC1109 pin functions |
| src/mesh/SX126xInterface.cpp | Fixed critical bug by changing PA_EN initialization from LOW to HIGH, and added detailed comments explaining GC1109 FEM chip initialization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I vaguely recall there are several other Heltec v4 specific ifdefs in the code that toggle this - we might want to double check to see if they are still needed. |
|
This is interesting swapping between my v4 and t114 at work the better rx on the t114 was noticed. |
With the regular firmware I'm guessing? |
a740319 to
416436b
Compare
yes regular, t114 = 2.6.11, v4 = 2.7.13. v4 firmware flashed from |
If you want I can build meshtastic firmware that includes this fix for the heltec v4. |
i'm fine thanks, not in a high pop area (Norfolk UK) were flat area and i'm using a sensecap 8dbi for my main base node. Away from work now as it Christmas so i can't test a mobile node atm but i hope the patch gets pulled if it helps us. |
4aeb63b to
35d187c
Compare
|
Updated with the latest findings, GPIO 46 is not TX pin, it should be treated as the CPS pin. Just informing the firmware that the TX/RX path is handled by the SX1262 will make sure the proper RX/TX pathways are used. We shouldn't be trying to override ourselves. |
35d187c to
a5f975a
Compare
|
Hi @weebl2000 do you have a build i can test for the v4? |
Let me build that for you. |
Meshtastic companion node. but scratch that, decided to have a go at compiling myself from your repo/branch. EDIT: responds to traceroutes but doesn't seem to be accessible via bluetooth, |
In my autopilot I thought this was a different repository. Weird that the Bluetooth isn't working. Does it work with the regular build? |
a5f975a to
38f0c89
Compare
reflashed from the web flasher and bluetooth worked again, i did check via web serial and wifi was off. |
|
Flashed your OTA and bluetooth works, i'll give it a try. |
38f0c89 to
49f1e91
Compare
Thanks for the build. 👍 I flashed the OTA update but also encounter Bluetooth issues. - BT works with the factory FW. I'd apreciate if someone has an idea why that is. Would be great to get a working V4.🙏 |
…shtastic#9029) The GC1109 FEM chip enable (CSD) must be HIGH for both RX and TX modes. Previously it was initialized LOW, preventing proper RX operation and causing 10-20 dB sensitivity loss. Key changes: - Set LORA_PA_EN (CSD) HIGH during init to enable GC1109 chip - Added comprehensive GC1109 control logic documentation to variant headers - Clarified that GPIO46 is CPS (PA mode select), not TX control Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
I switched on/off WiFi and Bluetooth again and now Bluetooth works with my V4. 👍 Now I was able to see an improvement in RX sensitivity but it’s still far off from what you would expect. The received signal on the V4 is 2-4 times weaker than with another node (Wio Tracker L1 or a Heltec V3). The difference in my quick tests were within a range of 2dB to 6dB. |
…stic#9029) * Fix LNA/PA power control for Heltec v4, wireless tracker v2 * Stop using pin 46 as RF switch, just let DIO2 switch handle the RF path --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
…stic#9029) * Fix LNA/PA power control for Heltec v4, wireless tracker v2 * Stop using pin 46 as RF switch, just let DIO2 switch handle the RF path --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
|
Flashed a Heltec v4 from develop commit 91dd39a (2.7.18). Flashed a second Heltec v4 with 2.7.15 beta. The 2.7.15 build RX performance was markedly better. Several TR tests to a node approx 1 mi. away and RX level on the 2.7.18 build was approx 1dB lower. TRs to a distant node I would consistently receive direct RX at approx -11 dB on the 2.7.15 build and never get a direct RX on 2.7.18. To ensure this wasn't hardware related I swapped the builds and re-tested. The lower RX performance followed the 2.7.18 build. Both hardware are Heltec V4 with kit antenna directly connected and powered via USB-C from the same source. |
|
@ascendr This is somewhat strange, because apart from adding some comments, the only real change made to this commit was this line on line 65.Could you try reverting this sentence back to its original form? digitalWrite(LORA_PA_EN, HIGH);
|
|
I'm wondering if by setting to CSD ( |
|
Looks like the GC1109 has a "turn-on time" of 1.5-3uS. I'm going to test with a 5uS sleep in between |
|
There's also this in sleep.cpp and In the sleep function in SX126xInterface.cpp. When CSD is pulled low on the GC1109 it enters shutdown mode, and when CSD is pulled high again, I can only assume the turn-on time applies. |
|
@ascendr @lindorffs Interesting: Per the schematic at https://resource.heltec.cn/download/WiFi_LoRa_32_V4/Schematic/WiFi_LoRa_32_V4.2.pdf , The TLV757P datasheet lists a
So if you're testing this, you may want to try sleeping much longer, like 600us - 1000us, immediately after |
|
My tests show LORA_PA_EN (purple trace) switching to high logic ~12.5us after VFEM / LORA_PA_POWER (yellow trace). I am also looking at firmware/src/mesh/SX126xInterface.cpp Line 394 in 0770f25
I'm not sure there is any advantage to switching LORA_PA_TX_EN low when not transmitting. The truth table states LORA_PA_TX_EN state doesn't matter for RX or Standby. |
|
Hi @weebl2000 does this patch include the undocumented register patch? |
…stic#9029) * Fix LNA/PA power control for Heltec v4, wireless tracker v2 * Stop using pin 46 as RF switch, just let DIO2 switch handle the RF path --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
See #9571 |
The TLV75733P LDO powering the GC1109 FEM has a ~550us startup time (datasheet tSTR). Wait 1ms after enabling PA_POWER before driving CSD HIGH, per the GC1109 power-on sequence requirement that VBAT must be stable before CSD/CPS/CTX. Oscilloscope measurements showed CSD going HIGH only ~12.5us after PA_POWER, well before the LDO output stabilises. Reference: meshtastic#9029
The TLV75733P LDO powering the GC1109 FEM has a ~550us startup time (datasheet tSTR). Wait 1ms after enabling PA_POWER before driving CSD HIGH, per the GC1109 power-on sequence requirement that VBAT must be stable before CSD/CPS/CTX. Only applied on cold boot - on deep sleep wake the LDO was held on via RTC latch so no delay is needed. Oscilloscope measurements showed CSD going HIGH only ~12.5us after PA_POWER, well before the LDO output stabilises. Reference: meshtastic#9029
|
Thanks for your work on this @weebl2000, looks like you've found some good stuff. Some of my tests with delays on startup seemed to result in better rx, #2f246ef specifically looks like what I had. I'll give this a test later this week. |



Root Cause
UPDATE 23/12/2025:
Actually, we should just the SX1262 chip handle the RF path. Operating pin 46 as a TX switch is not the right way, it should be treated as CPS pin.
Key fixes:
The GC1109 FEM (Front-End Module) chip requires specific control logic:- PA_EN (pin 2): Must be HIGH for both RX and TX modes- PA_TX_EN (pin 46): RF switch control - LOW=RX path (LNA), HIGH=TX path (PA)The bugs prevented proper RX operation, causing 10-20 dB sensitivity loss.🤝 Attestations
I haven't tested yet, but derived from HERE. But someone please do.