Open Jeronimo17 opened 2 years ago
Hi, I got everything to work fine but after the idle time when trying to send a new data it does not work.
I was using:
if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { SerialMon.println(" fail"); delay(10000); return; }
[18:14:19:707] +CLIP: "634*****",161,"",0,"",0␍␊ [18:14:19:707] ␍␊ [18:14:19:707] OK␍␊ [18:14:19:707] ␍␊ [18:14:19:707] OK␍␊ [18:14:19:707] ␍␊ [18:14:19:707] +CGATT: 1␍␊ [18:14:19:707] ␍␊ [18:14:19:707] OK␍␊ [18:14:19:707] AT+CIFSR;E0␍␊ [18:14:19:714] ␍␊ [18:14:19:719] 10.157.**␍␊ [18:14:19:719] ␍␊ [18:14:19:719] OK␍␊ [18:14:19:719] Connecting GET to ***********.com␍␊ [18:14:19:719] AT+CIPCLOSE=0,1␍␊ [18:14:19:719] ␍␊ [18:14:19:719] ERROR␍␊ [18:14:19:719] AT+CIPSSL=0␍␊ [18:14:19:719] ␍␊ [18:14:19:719] OK␍␊ [18:14:19:719] AT+CIPSTART=0,"TCP","********.com",80␍␊ [18:14:19:734] ␍␊ [18:14:19:734] OK␍␊ [18:14:33:741] ␍␊ [18:14:33:741] 0, CONNECT FAIL␍␊ [18:14:33:748] fail␍␊ [18:14:43:747] ␍␊ [18:14:43:751] OK␍␊ [18:43:39:720] AT+CGATT?␍␊ [18:43:39:730] ␍␊ [18:43:39:730] OK␍␊ [18:43:39:730] ␍␊ [18:43:39:730] +CGATT: 1␍␊ [18:43:39:730] ␍␊ [18:43:39:730] OK␍␊ [18:43:39:730] AT+CIFSR;E0␍␊ [18:43:39:730] ␍␊ [18:43:39:738] 10.157.*.*␍␊
If I do so:
if (!modem.isNetworkConnected()) { SerialMon.print(F("Esperando red...")); if (!modem.waitForNetwork()) { SerialMon.println(" fallo"); delay(10000); return; } SerialMon.println(" OK"); SerialMon.print(F("Conectando a ")); SerialMon.print(apn); } if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { SerialMon.println(" fail"); delay(10000); return; }
It works but every time it sends a data it seems to reestablish the connection even though it is already established.
[22:11:46:087] +CLIP: "634****,161,"",0,"",0␍␊ [22:11:46:087] ␍␊ [22:11:46:087] OK␍␊ [22:11:46:087] ␍␊ [22:11:46:087] OK␍␊ [22:11:46:087] ␍␊ [22:11:46:087] +CREG: 0,1␍␊ [22:11:46:087] ␍␊ [22:11:46:087] OK␍␊ [22:11:46:087] AT+CIPSHUT␍␊ [22:11:46:092] ␍␊ [22:11:46:092] SHUT OK␍␊ [22:11:46:092] AT+CGATT=0␍␊ [22:11:46:110] ␍␊ [22:11:46:115] +SAPBR 1: DEACT␍␊ [22:11:46:654] ␍␊ [22:11:46:654] OK␍␊ [22:11:46:654] AT+SAPBR=3,1,"Contype","GPRS"␍␊ [22:11:46:662] ␍␊ [22:11:46:662] OK␍␊ [22:11:46:662] AT+SAPBR=3,1,"APN","tel.hitsmobile.es"␍␊ [22:11:46:670] ␍␊ [22:11:46:670] OK␍␊ [22:11:46:670] AT+CGDCONT=1,"IP","tel.hitsmobile.es"␍␊ [22:11:46:678] ␍␊ [22:11:46:678] OK␍␊ [22:11:46:678] AT+CGACT=1,1␍␊ [22:11:50:387] ␍␊ [22:11:50:388] OK␍␊ [22:11:50:388] AT+SAPBR=1,1␍␊ [22:11:50:732] ␍␊ [22:11:50:734] OK␍␊ [22:11:50:734] AT+SAPBR=2,1␍␊ [22:11:50:741] ␍␊ [22:11:50:741] +SAPBR: 1,1,"10.154.*.*"␍␊ [22:11:50:741] ␍␊ [22:11:50:741] OK␍␊ [22:11:50:741] AT+CGATT=1␍␊ [22:11:50:744] ␍␊ [22:11:50:744] OK␍␊ [22:11:50:744] AT+CIPMUX=1␍␊ [22:11:50:749] ␍␊ [22:11:50:749] OK␍␊ [22:11:50:749] AT+CIPQSEND=1␍␊ [22:11:50:751] ␍␊ [22:11:50:754] OK␍␊ [22:11:50:754] AT+CIPRXGET=1␍␊ [22:11:50:758] ␍␊ [22:11:50:758] OK␍␊ [22:11:50:758] AT+CSTT="tel.hitsmobile.es","",""␍␊ [22:11:50:760] ␍␊ [22:11:50:761] OK␍␊ [22:11:50:761] AT+CIICR␍␊ [22:11:50:766] ␍␊ [22:11:50:766] OK␍␊ [22:11:50:766] AT+CIFSR;E0␍␊ [22:11:50:768] ␍␊ [22:11:50:773] 10.154.127.191␍␊ [22:11:50:773] ␍␊ [22:11:50:773] OK␍␊ [22:11:50:773] AT+CDNSCFG="8.8.8.8","8.8.4.4"␍␊ [22:11:50:783] ␍␊ [22:11:50:783] OK␍␊ [22:11:50:783] Connecting GET to ******.com␍␊ [22:11:50:783] AT+CIPCLOSE=0,1␍␊ [22:11:50:783] ␍␊ [22:11:50:783] ERROR␍␊ [22:11:50:783] AT+CIPSSL=0␍␊ [22:11:50:783] ␍␊ [22:11:50:791] OK␍␊ [22:11:50:791] AT+CIPSTART=0,"TCP","******.com",80␍␊ [22:11:50:791] ␍␊ [22:11:50:791] OK␍␊ [22:11:51:188] ␍␊ [22:11:51:188] 0, CONNECT OK␍␊ [22:11:51:198] success␍␊ [22:11:51:198] Performing HTTP GET request...␍␊ [22:11:51:198] AT+CIPSEND=0,33␍␊ [22:11:51:198] ␍␊ [22:11:51:198] >GET /**** HTTP/1.1␍␊ [22:11:51:198] ␍␊ [22:11:51:210] DATA ACCEPT:0,33␍␊ [22:11:51:210] AT+CIPSEND=0,33␍␊ [22:11:51:215] ␍␊ [22:11:51:215] >Host: ********.com␍␊ [22:11:51:215] ␍␊ [22:11:51:228] DATA ACCEPT:0,33␍␊ [22:11:51:228] AT+CIPSEND=0,21␍␊ [22:11:51:232] ␍␊ [22:11:51:233] >Connection: close␍␊ [22:11:51:233] ␍␊ [22:11:51:233] ␍␊ [22:11:51:243] DATA ACCEPT:0,21␍␊ [22:11:51:243] AT+CIPSEND=0,2␍␊ [22:11:51:248] ␍␊ [22:11:51:248] >␍␊ [22:11:51:248] ␍␊ [22:11:51:256] DATA ACCEPT:0,2␍␊ [22:11:51:256] AT+CIPRXGET=4,0␍␊ [22:11:51:261] ␍␊ [22:11:51:262] +CIPRXGET: 4,0,0␍␊ [22:11:51:262] ␍␊ [22:11:51:262] OK␍␊ [22:11:51:262] AT+CIPSTATUS=0␍␊ [22:11:51:267] ␍␊ [22:11:51:267] +CIPSTATUS: 0,0,"TCP","185.176.*.*","80","CONNECTED"␍␊ [22:11:51:272] ␍␊ [22:11:51:272] OK␍␊ [22:11:51:688] ␍␊ [22:11:51:689] +CIPRXGET: 1,0␍␊ [22:11:51:703] AT+CIPRXGET=4,0␍␊ [22:11:51:714] ␍␊ [22:11:51:714] +CIPRXGET: 4,0,269␍␊ [22:11:51:714] ␍␊
What is the correct way to know that you are connected? Thank you
Hi, I got everything to work fine but after the idle time when trying to send a new data it does not work.
I was using:
If I do so:
It works but every time it sends a data it seems to reestablish the connection even though it is already established.
What is the correct way to know that you are connected? Thank you