Repeater, room server, sensor, companion: disconnect GPS UART pins when GPS is powered off on nRF52

This commit is contained in:
tth committed 2026-11-24 19:44:05 +01:00
1 parent c454dcba54
commit 6a5ec9debc
2 files changed
+10 -1

No files matched your search

+3
View File
@@ -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
+7 -1
View File
@@ -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;
}