diff --git a/docs/power.md b/docs/power.md index ea4da908..2cc5bf4f 100644 --- a/docs/power.md +++ b/docs/power.md @@ -237,6 +237,9 @@ unnecessary idle draw that affect all nRF52 boards (not only SenseCAP Solar): 2 MHz) from `NRF_SPIM3` to `NRF_SPIM2`. Adafruit `SPIClass::endTransaction()` disables `SPIM3` without the Errata 195 workaround, leaving ~1.2-2 mA idle draw after the first SPI transaction. +- **Disconnect GPS UART pins while GPS is off**: `NmeaGpsDriver::stopHardware()` + now resets the UART TX/RX pins via `nrf_gpio_cfg_default()` after `Uart::end()`, + preventing back-powering of the unpowered GPS receiver through GPIO/ESD paths. ## Measuring this yourself — two traps diff --git a/src/helpers/sensors/NmeaGpsDriver.h b/src/helpers/sensors/NmeaGpsDriver.h index baafc571..29da7fd5 100644 --- a/src/helpers/sensors/NmeaGpsDriver.h +++ b/src/helpers/sensors/NmeaGpsDriver.h @@ -204,7 +204,13 @@ class NmeaGpsDriver : public GpsDriver { // core's own Uart::end()) for all the hours `gps duty` keeps the GPS off, and // its idle-high TX line feeds the unpowered module. sendNmeaSentence() is // gated on _started: a write to a closed Uart takes a deleted semaphore. - if (_hardwareSerial != nullptr) _hardwareSerial->end(); + // Uart::end() clears PSEL but leaves GPIO PIN_CNF unchanged, so disconnect + // the pins explicitly to avoid back-powering the unpowered GPS module. + if (_hardwareSerial != nullptr) { + _hardwareSerial->end(); + if (_txPin != -1) nrf_gpio_cfg_default(g_ADigitalPinMap[_txPin]); + if (_rxPin != -1) nrf_gpio_cfg_default(g_ADigitalPinMap[_rxPin]); + } #endif _started = false; }