Closed anibald closed 7 years ago
Hello again,
Made some advances in handling the losses of connection, my loop function now looks like this:
void loop()
{
Blynk.run();
timer.run();
int timestamp = millis();
if (!Blynk.connected() || !modem.gprsConnect(apn, user, pass)) {
Serial.println(sprintf("[%d] Connectivity is gone", timestamp));
modem.restart();
Blynk.begin(auth, modem, apn, user, pass);
Serial.println("Modem was restarted and reconfigured... ");
}
}
It's now forcing reboot more frequently but I still get some situation where Blynk.connected and modem.gprsConnect returns TRUE but in fact the serial shows the situation below, where no error is given and that just stops after a hard reset.
Is there some option to put TinyGSM in debug mode?
[53355356] Heartbeat timeout: 53355356, 53269437, 53344450
Connectivity is gone...
[53386370]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v0.4.7 on Arduino Nano
[53386378] Free RAM: 779
[53386380] Modem init...
[53386703] Connecting to network...
[53435635] Network: TIM BRASIL
[53435636] Connecting to tim.br ...
[53445969] Connected to GPRS
[53450073] Connecting to blynk-cloud.com:8442
[53685421] Connecting to blynk-cloud.com:8442
[53920768] Connecting to blynk-cloud.com:8442
[54156113] Connecting to blynk-cloud.com:8442
[54391458] Connecting to blynk-cloud.com:8442
Initializing modem...
Just to be sure, verify that your code does what you wanted to. It looks invalid to me. also, it is recommended to reset your nodem using reset/enable pin of modem or triger power directly.
Hello! Thanks for the great lib and forgive me if it isn´t the proper place to post this. The issue I'm having is related to a lost of connection with the GPRS network. I.e. the modem is still connected but I can't access any host.
System setup: Arduino Nano Neoway M590e GPRS modem
Heres the log:
As you may see the modem initializes, the connection is established but then it loses the heartbeat and keeps trying to reconnect forever. A modem restart seems to solve the problem, but the code it self could´ve been able to handle this situation. Looking on the library code I saw a private function "dnsIpQuery" which could be a good way to check if the connectivity is lost and force a modem restart but I haven't been able to understand how to use it. Dunno if it might help, but here's my sketch code: