Why does HL8548-G cut the TCP connection after GPS is used?


#1

I couldn’t solve this problem. Please give me any advice.

I want to execute the following things
①Open a TCP connection
AT+KTCPCLOSE=1
AT+KTCPDEL=1
AT+CGATT=0
AT+KCNXCFG=1,“GPRS”,“xxx.com”,"xx@xxx.com",“xxx”
AT+CGDCONT=4,“IP”,“xxx.com
AT+KCNXPROFILE=1
AT+KGNSSAD=1
AT+CGATT=1
AT+KTCPCFG=1,0,“some_url”,some_port
AT+KCNXUP=1
AT+KTCPCNX=1

②Turn on GPS function and receive NEMA data
AT+GPSNMEA=01,1
AT+GPSSTART=0
[NEMA data storing process]

③Turn off the GPS function
AT+GPSSTOP
AT+GPSNMEA=01,0

④Send NEMA data on TCP connection
AT+KTCPSND=1,[word count]
[Data sending process]

In this flow, TCP connection is cut on process④
Data can be sent if I do process④ after I redo process① right before process④
Why does this happen?
How can I use GPS function without cutting TCP connection?


#2

Hi fyusuke,

I cannot see your issue my side (I test with v5.5.24.2).
Could you kindly to show me your full AT log with the following?

ATI3
AT+CGREG?
AT+CGDCONT=4,“IP”,“xxx”
AT+KCNXCFG=1,“GPRS”,“xxx”
AT+GPSSUPLCFG=0,“suplcn.sirf.com”,7276,1,0
AT+GPSSUPLCFG?
AT+CGDCONT?
AT+KTCPCFG=1,0,“xx.xx.xx.xxx”,5045
AT+KCNXUP=1
AT+KTCPCNX=1
AT+GPSNMEA=01 //NMEA output on UART1
AT+GPSSTART=0
AT+CGDCONT?
AT+CGPADDR
AT+GPSSTOP
AT+KTCPSND=1,10
AAAAAAAAAA–EOF–Pattern–
+KTCP_DATA: 1,10
AT+KTCPRCV=1,10
AT+CGDCONT?
AT+GPSSTOP
AT+KTCPCLOSE=1,1
AT+KTCPDEL=1
AT+KCNXDOWN=1,1


#3

Thank you for your comment.

[Environment]
・STM32L053
・use MQTT protocol
・receive return values of AT commands by interrupt

I sent the following command.
AT
AT&K3
ATE0
ATI3
AT+CGREG?
AT+CGDCONT=4,“IP”,“xxxcom”
AT+KCNXCFG=1,“GPRS”,“xxxcom”,“xxx@xxxcom”,“xxx”
AT+GPSSUPLCFG=0,“suplcn.sirf。com”,7276,1,0
AT+GPSSUPLCFG?
AT+CGDCONT?
AT+KTCPCFG=1,0,“xxxxxxxxcom”,1883
AT+KCNXUP=1
AT+KTCPCNX=1
AT+GPSNMEA=01
AT+GPSSTART=0
AT+CGDCONT?
AT+CGPADDR
AT+GPSSTOP
AT+KTCPSTAT=1
AT+KTCPSND=1,23
AAAAAAAAAA,bty=0–EOF–Pattern–
AT+KTCPSTAT=1
AT+CGDCONT?
AT+GPSSTOP
AT+KTCPCLOSE=1,1
AT+KTCPDEL=1
AT+KCNXDOWN=1,1

And I got the following result.


AT

AT

OK


AT&K3

AT&K3

OK


ATE0

ATE0

OK


ATI3

RHL85xx.5.5.22.0.201603171544.x6250_3

OK


AT+CGREG?

+CGREG: 0,1

OK


AT+CGDCONT=4,“IP”,“xxxcom”

OK


AT+KCNXCFG=1,“GPRS”,“xxxcom”,“xxx@xxxcom”,“xxx”

OK

+GPSEVINIT: 1


AT+GPSSUPLCFG=0,“suplcn.sirf。com”,7276,1,0

OK


AT+GPSSUPLCFG?

+GPSSUPLCFG: 0,“suplcn.sirf。com”,7276,1,0
+GPSSUPLCFG: 1,-1,1,1

OK


AT+CGDCONT?

+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK


AT+KTCPCFG=1,0,“xxxxxxxxcom”,1883

+KTCPCFG: 1

OK


AT+KCNXUP=1

OK

+KCNX_IND: 1,4,1


AT+KTCPCNX=1

OK


AT+GPSNMEA=01

+KCNX_IND: 1,1,0

+KTCP_IND: 1,1

OK


AT+GPSSTART=0

OK


AT+CGDCONT?

+CGDCONT: 1,“IP”,“xxxcom”,“100.90.200.180”,0,0
+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK

+GPSEVSTART: 1
$GPVTG…

+GPSEVPOS: 0
$GPVTG,0

AT+CGPADDR

0,T,…
$GNGNS…
+CGPADDR: 4,“100.90.200.180”

OK
$GPVTG…

AT+GPSSTOP

.0,T,…
$GNGNS…

OK

+GPSEVSTOP: 1

+GPSEVPOS: 0


AT+KTCPSTAT=1

+KTCPSTAT: 3,-1,0,0

OK


AT+KTCPSND=1,23

CONNECT

OK


OK

End of transmission

AT+KTCPSTAT=1

CNX_IND: 1,0,0

+KTCP_NOTIF: 1,0

+KTCPSTAT: 1,0,0,0

OK


AT+CGDCONT?

+CGDCONT: 1,“IP”,“xxxcom”,“0.0.0.0”,0,0
+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK


AT+GPSSTOP

ERROR


AT+KTCPCLOSE=1,1

ERROR


AT+KTCPDEL=1

OK


AT+KCNXDOWN=1,1

OK


#4

I replaced suplcn.sirf.com with suplcn.sirf。com because new user can post only two links. I can write “.com” only two times.


#5

Hi fyusuke,

Please check result of AT+KIPOPT? and pay attention to the following settings:
AT+KIPOPT=3,<stop_on_error>,<stop_on_peer>
Suggest to set AT+KIPOPT=3,0,0.

<stop_on_error> PDP connection deactivation behavior when a session is closed due to any error
0 Do not request to stop the connection
1 Request to stop the connection

<stop_on_peer> PDP connection deactivation behavior when a session is closed by a peer/server
0 Do not request to stop the connection
1 Request to stop the connection


#6

Sierra_klin1

Thank you for your advice.
I checked it and result is following

AT+KIPOPT?

+KIPOPT: 0,"TCPC",1,0,0

+KIPOPT: 0,"TCPS",1,0,0

+KIPOPT: 0,"UDPC",2,1020,1020

+KIPOPT: 0,"UDPS",2,1020,1020

+KIPOPT: 0,"FTP",1,0,0

+KIPOPT: 0,"HTTP",1,0,0

+KIPOPT: 0,"HTTPS",1,0,0

+KIPOPT: 1,0

+KIPOPT: 2,0

+KIPOPT: 3,0,0

+KIPOPT: 4,0

OK

It seems to be OK.


#7

I checked if the server receives the data when I send data after GPS func is used, and it doesn’t. However, it does, when I skipped the GPS func at command. why…


#8

Hi fyusuke,
I just noticed that with your SIM/Network, it seems the fixed and only ONE IP 100.90.200.180 is allocated for the PDP context #1 and #4. That’s why when the AGPS finished the connection(PDP#4), the TCP(PDP#1) is released as well.
AT+CGDCONT?
+CGDCONT: 1,“IP”,“xxxcom”,“100.90.200.180”,0,0
+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0
OK
+GPSEVSTART: 1
+GPSEVPOS: 0
AT+CGPADDR
+CGPADDR: 4,“100.90.200.180”
OK
The solution could be:
1) Disable the AGPS
AT+CGDCONT=4
AT+GPSSUPLCFG=0,“suplcn.sirf.com”,7276,0,0 // as 0(SUPL disable) for URC
2) Start the TCP after AGPS.


#9

Hi, Sierra_lin1

I see. What about the result with YOUR SIM. Is this problem caused by my SIM network, or the device itself?


#10

Hi fyusuke,

Yes, this problem is caused by your SIM network(Only ONE IP allowed).
No issue my side. Here’s my test result:

ATI
HL8548-G
OK
AT+GPSAUTOINIT=0
OK
AT+COPS?
+COPS: 0,0,“CHN-UNICOM”,2
OK
AT+CGDCONT=4,“IP”,“3gnet”
OK
AT+KCNXCFG=1,“GPRS”,“3gnet”
OK
AT+GPSSUPLCFG=0,“suplcn.sirf.com”,7276,1,0
OK
AT+KTCPCFG=1,0,“xxx.xxx.xxx.xxx”,5045
+KTCPCFG: 1
OK
AT+KCNXUP=1
OK
+KCNX_IND: 1,4,1
+KCNX_IND: 1,1,0
AT+CGDCONT?
+CGDCONT: 1,“IP”,“3gnet”,“10.66.41.101”,0,0
+CGDCONT: 4,“IP”,“3gnet”,“0.0.0.0”,0,0
OK
AT+KTCPCNX=1
OK
+KTCP_IND: 1,1
AT+GPSNMEA=01
OK
AT+GPSSTART=0 //10:44:53.980
OK
+GPSEVINIT: 1
+GPSEVSUPL: 1
+GPSEVSTART: 1
AT+CGDCONT? //10:45:05.375
+CGDCONT: 1,“IP”,“3gnet”,“10.66.41.101”,0,0
+CGDCONT: 4,“IP”,“3gnet”,“0.0.0.0”,0,0
OK
+GPSEVPOS: 0
AT+CGDCONT? //10:45:06.373
+CGDCONT: 1,“IP”,“3gnet”,“10.66.41.101”,0,0
+CGDCONT: 4,“IP”,“3gnet”,“10.166.121.96”,0,0
OK
AT+GPSSTOP
OK
+GPSEVSTOP: 1
+GPSEVPOS: 0
AT+CGDCONT?
+CGDCONT: 1,“IP”,“3gnet”,“10.66.41.101”,0,0
+CGDCONT: 4,“IP”,“3gnet”,“0.0.0.0”,0,0
OK


#11

HI, Sierra_klin1

I used cold start in GPS func, but still error happens. I used the following at commands.

I don’t want to use AGPS. Are the following command correct?

AT
AT&K3
ATE0
AT+KTCPCLOSE=1
AT+KTCPDEL=1
AT+GPSSTOP
ATI3
AT+CGREG?
AT+CGDCONT=4,“IP”,“xxxcom”
AT+KCNXCFG=1,“GPRS”,“xxxcom”,“xxx@xxxcom”,“xxx”
// AT+GPSSUPLCFG=0,“suplcn.sirf。com”,7276,1,0 SKIP THIS AT COMMAND
AT+GPSSUPLCFG?
AT+CGDCONT?
AT+KTCPCFG=1,0,“xxxxxxxxcom”,1883
AT+KCNXUP=1
AT+KTCPCNX=1 // around here, the server detects a new connection
AT+GPSNMEA=01
AT+GPSSTART=3 // CHANGE: 3 means cold start
AT+CGDCONT?
AT+CGPADDR
AT+GPSSTOP
AT+KTCPSTAT=1
AT+KTCPSND=1,17
AAAAAAAAAA–EOF–Pattern– // the server receives nothing.
AT+KTCPSTAT=1
AT+CGDCONT?


AT

AT

OK


AT&K3

AT&K3

OK


ATE0

ATE0

OK


AT+KTCPCLOSE=1

ERROR


AT+KTCPDEL=1

ERROR


AT+GPSSTOP

ERROR


ATI3

RHL85xx.5.5.22.0.201603171544.x6250_3

OK


AT+CGREG?

+CGREG: 0,4

OK

+GPSEVINIT: 1


AT+CGDCONT=4,“IP”,“xxxcom”

OK


AT+KCNXCFG=1,“GPRS”,“xxxcom”,“xxx@xxxcom”,“xxx”

OK


AT+GPSSUPLCFG?

+GPSSUPLCFG: 0,“suplcn.sirf。com”,7276,1,0
+GPSSUPLCFG: 1,-1,1,1

OK


AT+CGDCONT?

+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK


AT+KTCPCFG=1,0,“xxxxxxxxcom”,1883

+KTCPCFG: 1

OK


AT+KCNXUP=1

OK

+KCNX_IND: 1,4,1


AT+KTCPCNX=1

OK


AT+GPSNMEA=01

+KCNX_IND: 1,1,0

OK

+KTCP_IND: 1,1


AT+GPSSTART=3

OK


AT+CGDCONT?

+CGDCONT: 1,“IP”,“xxxcom”,“100.90.200.180”,0,0
+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK

+GPSEVSTART: 1


AT+CGPADDR

+CGPADDR: 4,“100.68.215.140”

OK


AT+GPSSTOP

OK

+GPSEVSTOP: 1

+GPSEVPOS: 0


AT+KTCPSTAT=1

+KTCPSTAT: 3,-1,0,0

OK


AT+KTCPSTAT=1

+KTCPSTAT: 3,-1,0,0

OK


AT+KTCPSND=1,17

CONNECT

AAAAAAAAAA

OK

+KCNX_IND: 1,0,0

+KTCP_NOTIF: 1,0


OK

+KCNX_IND: 1,0,0

+KTCP_NOTIF: 1,0


AT+KTCPSTAT=1

+KTCPSTAT: 1,0,0,0

OK


AT+CGDCONT?

+CGDCONT: 1,“IP”,“xxxcom”,“0.0.0.0”,0,0
+CGDCONT: 4,“IP”,“xxxcom”,“0.0.0.0”,0,0

OK


#12

Hi fyusuke,

To disable the AGPS, please send:
AT+CGDCONT=4 //Delete the APN to disable SUPL
AT+GPSSUPLCFG=0,“suplcn.sirf.com”,7276,0,0 //0: disable SUPL URC


#13

Thanks a lot!
Ill find a Sim which allows several ip setting