@rryansilva ,
Thanks for the information. I have a BRN402 but it should work similarly.
As for cloud debug, you can get most of the same information by setting the logging level to “ALL” and using the SerialLogHandler:
SerialLogHandler logHandler(LOG_LEVEL_ALL); // All the loggings
or, you can use the default logging level to get less messages.
I modified your code to add logging and inserted a few statements to see what is going on. My device also failed to connect the first time but was successful in the next two attempts. I believe what is going on here is that there is a timeout for the reconnection of about 30 seconds. If your device does not connect in that time, the program execution will progress and your geolocation will not reflect the current state.
I inserted this line into the code just after sleep that fixed the issue:
while(!Particle.connected()) Particle.process();
This works but the cellular modem does not seem to be happy, as it went through a series of resets before finally connecting. The Logs showed this as:
0000200975 [ncp.client] INFO: Using internal SIM card
0000206893 [gsm0710muxer] INFO: Starting GSM07.10 muxer
0000206893 [gsm0710muxer] INFO: Openning mux channel 0
0000206894 [gsm0710muxer] INFO: GSM07.10 muxer thread started
0000206898 [gsm0710muxer] INFO: Openning mux channel 1
0000212258 [gsm0710muxer] INFO: Openning mux channel 2
0000219452 [ncp.client] ERROR: Failed to enter data mode
0000219452 [net.ppp.client] ERROR: Failed to dial
0000219778 [gsm0710muxer] INFO: Stopping GSM07.10 muxer
0000219779 [gsm0710muxer] INFO: Gracefully stopping GSM07.10 muxer
0000219779 [gsm0710muxer] INFO: Closing all muxed channels
0000219780 [gsm0710muxer] INFO: Closing mux channel 1
0000219780 [gsm0710muxer] INFO: Closing mux channel 2
0000219781 [gsm0710muxer] INFO: Muxed channel 3 already closed
0000219782 [gsm0710muxer] INFO: Muxed channel 4 already closed
0000219782 [gsm0710muxer] INFO: GSM07.10 muxer thread exiting
0000219783 [gsm0710muxer] INFO: GSM07.10 muxer stopped
0000219784 [ncp.client] ERROR: Failed to enter data mode
0000219785 [net.ppp.client] ERROR: Failed to dial
That said, if you were going to run this code for a while with sleep of only 3minutes, you need to change your sleep configuration to maintain your connection to the network as described here:
I believe that this may be at the core of your issue, so I changed the sleep configuration and this code works well for me:
#include <google-maps-device-locator.h>
GoogleMapsDeviceLocator locator;
SystemSleepConfiguration config;
void setup() {
}
void loop() {
locator.publishLocation();
delay(1001);
config.mode(SystemSleepMode::ULTRA_LOW_POWER)
.duration(3min)
.network(NETWORK_INTERFACE_CELLULAR, SystemSleepNetworkFlag::INACTIVE_STANDBY);
System.sleep(config);
}
If you start sleeping for longer than 10 minutes, you will not need to keep the network active but, at that point, I would recommend you use additional steps to control connection to the Particle cloud and make sure the modem is shut down gracefully before sleeping - topics for another day.
Let us know how this works for you.
Chip