Fix GPS UART consuming +8mA when disabled (nRF52)#1633
Open
weebl2000 wants to merge 1 commit intomeshcore-dev:devfrom
Open
Fix GPS UART consuming +8mA when disabled (nRF52)#1633weebl2000 wants to merge 1 commit intomeshcore-dev:devfrom
weebl2000 wants to merge 1 commit intomeshcore-dev:devfrom
Conversation
When GPS is disabled (or not detected), Serial1.begin() was called during initBasicGPS() but never ended. On nRF52840 the UARTE peripheral stays active, drawing ~8mA through the peripheral itself and current leaking via TX pin into the GPS module's ESD diodes. - Call Serial1.end() in initBasicGPS() and stop_gps() to disable UART - Re-initialize Serial1 in start_gps() so GPS can be toggled back on - Gate _location->loop() behind gps_active to prevent accessing ended Serial (and avoid pointless NMEA polling when GPS is off) Fixes meshcore-dev#1628
|
I tried fixing it this way. Like in your case, it resulted in a persistent "Loading..." message. |
Contributor
Author
|
The key difference from your Fix 2 is the This PR gates that call behind Would you be able to test this branch on your T114? |
|
I cloned your branch and compiled a firmware from it - the first thing i did, flashed it to my T114, and got an infinite "Loading..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I don't have a Heltec T114 so I cannot test this myself.
Summary
Fixes #1628 — GPS causes +8mA power consumption even when disabled on Heltec T114 (nRF52840).
Serial1.begin()is called duringinitBasicGPS()to probe for GPS hardware, but never ended when GPS is subsequently disabled. On nRF52840, the UARTE peripheral stays active, drawing ~8mA through the peripheral itself and current leaking via the TX pin (held HIGH in idle UART state) into the GPS module's ESD protection diodes._location->loop()was called unconditionally in the main loop, reading from Serial1 even when GPS was disabled. This both prevented simply addingSerial1.end()(would crash) and wasted cycles.Changes
Serial1.end()ininitBasicGPS()andstop_gps()to fully disable the UART peripheral when GPS is offSerial1instart_gps()so GPS can be toggled back on via settings_location->loop()behindgps_activecheck to prevent accessing an ended SerialWhy Heltec V4 (ESP32) is unaffected
ESP32 UART peripherals consume negligible power when idle (more aggressively clock-gated). On nRF52840, the UARTE keeps the HFCLK running for start-bit detection.
Note: the RAK board path already correctly calls
Serial1.end()when no GPS is found, confirming this approach is valid. RAK paths are unaffected by this change (they return early via#ifdef RAK_WISBLOCK_GPSguards).Test plan
ENV_INCLUDE_GPS=1, verify idle current returns to ~14-16mA with GPS disabled