Open gorghino opened 3 years ago
I don't if it's related but it fails whenAT+CGREG?
gets +CGREG: 0,5
from the beginning; the connection works when AT+CGREG?
gets 0,0
, then 0,2
and eventually 0,5
.
I don't have a SIM7x00 to test myself. My experience with all of the modules is that the connection process is really hard to get just right. If you find something more stable, please submit a pull request.
Thank you @SRGDamia1 for the feedback. I have a related question (or bug?) to ask: Is it possible to keep the network open between different connections? So far I always see examples where the loop resets the modem at the beginning, request the IP, open a socket, do something (e.g. GET), close the socket, shutdown the module. This works most of the times.
What if I want to open the network, request an IP and keep it until I disconnect or the signal is too low? In general, I'd like to loop between different sensors and send their values to a server without registering to the network every time.
I tried to check network's status after finishing a loop in AllFunction.ino
but apparently isGprsConnected()
becomes false once the connection with the server is over.
14:38:23.209 -> AT+CIPCLOSE? 14:38:23.209 -> 14:38:23.209 -> +CIPCLOSE: 1,0,0,0,0,0,0,0,0,0 14:38:23.209 -> 14:38:23.209 -> OK 14:38:23.674 -> AT+NETOPEN? 14:38:23.674 -> 14:38:23.674 -> +NETOPEN: 1 14:38:23.674 -> 14:38:23.674 -> OK 14:38:23.674 -> AT+IPADDR 14:38:23.674 -> 14:38:23.674 -> +IPADDR: 10.193.107.73 14:38:23.674 -> 14:38:23.674 -> OK 14:38:23.674 -> [10508] GPRS status: connected 14:38:24.702 -> AT+NETOPEN? 14:38:24.702 -> 14:38:24.702 -> +NETOPEN: 0 14:38:24.702 -> 14:38:24.702 -> OK 14:38:25.696 -> [12510] ### Unhandled: +NETOPEN: 0 14:38:26.691 -> 14:38:26.691 -> OK 14:38:26.691 -> [12510] GPRS status: not connected 14:38:26.691 -> AT+NETOPEN? 14:38:26.691 -> 14:38:26.691 -> +NETOPEN: 0 14:38:26.691 -> 14:38:26.691 -> OK 14:38:27.686 -> [14511] ### Unhandled: +NETOPEN: 0 14:38:28.712 -> 14:38:28.712 -> OK 14:38:28.712 -> [14511] GPRS status: not connected
To check the network, I added a for(;;)
after client.stop()
:
for(;;){
res = modem.isGprsConnected();
DBG("GPRS status:", res ? "connected" : "not connected");
light_sleep(1);
}
Removing client.stop() doesn't prevent disconnections.
I read your instructions here and I edited connection:close
with:
client.print("Connection: keep-alive\r\n");
client.print("Keep-Alive: timeout=30, max=100\r\n\r\n");
without success.
I used different some GPRS platforms in the past (e.g. Particle Electron that uses the U-blox SARA-U201/U260/U270) but once it registered to the network, it used to keep it UP and running until it was powered.
Full log: https://pastebin.com/4ea74TYC
[ X ] I have read the Troubleshooting section of the ReadMe
What type of issues is this?
[ ] Request to support a new module
[ ] Bug or problem compiling the library [ X ] Bug or issue with library functionality (ie, sending data over TCP/IP) [ ] Question or request for help
What are you working with?
Modem: SIMCOM INCORPORATED SIMCOM_SIM7600E-H Revision: SIM7600M22_V1.1 Main processor board: ESP32-WROVER-B TinyGSM version: 0.10.9 Code: main.ino from Lilygo Producer: https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7600X/blob/master/examples/Arduino_TinyGSM/AllFunctions/AllFunctions.ino with a couple of changes in the lib:
Scenario, steps to reproduce
I'm trying to connect my module to ThingsMobile network. The signal quality is very good (99) but sometimes I get +NETOPEN: 1 always followed by SMS DONE and a long timeout before restarting the loop. In the test I reported on pastebin (links below) the second loop got connection. I suspect there're some wrong delays for my module or similar. I don't get why the first loop has two AT+CRESET with one OK/SMS DONE/PB DONE while the second has OK/SMS DONE(x2)/RDY/PB DONE and if it may conflict with the following connection phase.
I'm powering the module via USB (pin VIN as described here https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7600X/blob/master/README.MD) using a fast-charge USB-C cable.
Expected result
Consistent connection phase
Actual result
Sometimes NETOPEN fails
Debug and AT command log
First loop - connection fails: https://pastebin.com/ruzzymeN Second loop - connection OK: https://pastebin.com/VECGe2EY