meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
2.97k stars 706 forks source link

[Bug]: uBlox M10 GPS doesn't sleep if device is switched off #4061

Closed craft4tnt closed 2 weeks ago

craft4tnt commented 2 weeks ago

Category

Other

Hardware

Not Applicable

Firmware Version

2.3.12

Description

UBlox M10x GPS module stays in aquisition mode (~12mA) and does not enter sleep mode (~50uA) if meshtastic device is switched off. The receivers power states are controlled by UBX-RXM-PMREQ commands. UART_RX activity is defined as a wakeup source. During normal operation, M10 GPS power control works fine. As soon as the meshtastic device is switched off / to deep sleep, the GPS receiver will stay in aquisition mode and drains the battery.

Power consumtion was measured with Current Ranger

Will provide PR with fix immediately

Relevant log output

No response

GPSFan commented 2 weeks ago

The prepareDeepSleep method in GPS.cpp probably could be used to send a PMREQ to the GPS with the duration set to max (12 days). When Meshtastic (esp32) wakes up from DeepSleep it reboots so the GPS will be re-configured to normal operation then, as long as the PMREQ wakeup sources can wake it up. Not sure how the other platforms handle DeepSleep.

craft4tnt commented 2 weeks ago

The wierd thing is that a UBX-RXM-PMREQ with duration=0 and wakeupSources->uartrx=1 never set the module to sleep even if there are no level changes on the UART line. I tried keeping it pulled high and low, both didn't work. It might be a bug which is specific to the M10, since the PMREQ messages seem deprecated but still supported for the newer models. I didn't try the maximum duration value of 12 days but it also doesn't really fix the issue. Thats why I decided to go with the external control since the PIN_GPS_EN signal is already implemented.

GPSFan commented 2 weeks ago

What firmware version is your M10? PMREQ is not deprecated (as yet) according to the SPG 5.10 and 6.00 firmware release notes. I'll see if I can set up a Neo-7, M8N and M10 with my esp32 test bench and try out the duration=0 as you described.

craft4tnt commented 2 weeks ago

You are right, PMREQ is not deprecated but I get the impression it's not the favoured way of doing power management for the M10 anymore because it is only briefly mentioned in the Integration manual among all the new features from the CFG-PM group.