Open I-Connect opened 2 years ago
I enabled AT logging to a file to get more data:
This is where I suspect it starts to fail:
AT+CARECV?
+CARECV: 0,0
+CARECV: 1,0
OK
+CASTATE: 0,0
The +CASTATE: 0,0 is returned without querying the state, the AT command manual says:
So it seems the connection is "closed by remote server or internal error" Unfortunately the SIM7000 does not allow me to set/query this CACFG autoclose value.
Obviously this could happen, there are many components that could disturb the connection (only odd thing is that is happens every time after approx 14 hours.)
As you can see in above code I do catch this and eventually reboot the SIM7000 and everything works again for 14 hours.
But before I reboot I also first try to reconnect MQTT, and if this fails 3 times I first do a re connection of GPRS. MQTT reconnect always fails (also after a successful GPRS re connection, I know this is successful as the NTP sync goes oke)
MQTT reconnecting:
AT+CASSLCFG=0,ssl,0
OK
AT+CASSLCFG=0,protocol,0
OK
AT+CSSLCFG="sni",0,"server_url"
OK
AT+CAOPEN=0,"server_url",1883
+CAOPEN: 0,4
OK
The result code 4 means Parameter invalid, but this is the same set of parameters I send each time (also when it succeeds)
Only thing could be that there is something wrong with cid 0 ( the first parameter).
Any thoughts on how I can resolve this without the need of rebooting the module?
thx!
I had a similar problem on a SIM7600E before forcing time syncronization with network by issueing a AT+CTZU=1 command. Since my modem is syncronized with the network I haven't ever more experienced issues.
thx
The Sim7000 documentation does not list CTZU as a AT command.
I do already update the time:
sim7000.NTPServerSync("ntp.time.nl", 0);
byte NTPServerSync(String server = "pool.ntp.org", byte TimeZone = 3) {
// Set GPRS bearer profile to associate with NTP sync
sendAT(GF("+CNTPCID=1"));
if (waitResponse(10000L) != 1) { return -1; }
// Set NTP server and timezone
sendAT(GF("+CNTP="), server, ',', String(TimeZone));
if (waitResponse(10000L) != 1) { return -1; }
// Request network synchronization
sendAT(GF("+CNTP"));
if (waitResponse(10000L, GF(GSM_NL "+CNTP:"))) {
String result = stream.readStringUntil('\n');
Serial.print("NTP server sync result");
Serial.println(result);
result.trim();
if (isValidNumber(result)) { return result.toInt(); }
} else {
return -1;
}
return -1;
}
But I realize I sync using timezone 0 (UTC) and later on in the code I correct that to the correct timezone for use in the application.
Could it be the time difference between the GSM module (UTC) and the MQTT server (UTC +2) could cause the connection to fail over time...?
I will give it a try to using UTC+2
will post the results
unfortunately the correct timezone did not resolve the issue.
Again after approx 14 hours it looses connection and after a reboot of the sim7000 the connection is up again
Were you able to resolve this?
No, I suspect it is a connection that is reset somewhere by a provider. I am planning on moving the backend with MQTT broker to a cloud platform, hopefully this will resolve it.
I have the same issue!! but instead of 14 hours, i get the same problem after each 60 minutes. I live in israel and there everything is working properly. Few days ago i went to (Czechia) in Europe, and the connection is reset after 60 minutes.
I really did not understand why is happen and how to fix it, if someone has ideas that he wants to try, let me know.
I am using in sim7070g, i still did not try to synchronisation the network time, someone may assist with this?
If you have another suggestions i am open to hear. Thanks
The problem solved, if someone has this issue in the future. Please read on the command AT+CRATSRCH in the documentation of sim7070g/7080g
Hi, The problem is not fully solved. I just restarted the network connection before the maximum default timer reached.
It sound so stupid, but in sim7070g, when the network is GSM, the mode of AT+CRATSRCH is enabled by default.
I still did not find any way to turn it off
Hi,
We use a SIM7000E with an ESP32. We use pubsubclient for MQTT. And we do a NTP timesync every 24 hours
We run a task that handles the whole process every 200 ms (see below).
After approx 14 hours we always loose the MQTT connection, reconnecting GPRS is successful but then MQTT re-connect fails. Eventually we do a reboot of the SIM7000 (toggeling the power pin) which fixes the issue.
As it happens only once every 14 hours it is a bit difficult to troubleshoot..
Any ideas on what could be going wrong or how best to troubleshoot? What is more likely, is it a SIM7000 issue or MQTT/pubsubclient issue
thx!
This is the method that calls the pubsubclient (receiving and pingrequest) and sends the MQTT messages that were queued