HL8548 How to create a TCP connection


#1

My AT command is as follows:

AT+CREG?

+CREG: 0,1

OK
AT+CGATT=1

OK
AT+CGACT=0

OK
AT+CGDCONT=1,“IP”,“CMNET”

OK
AT+CGACT=1

OK
AT+KTCPCFG=1,0,“translate.google.cn”,80,1,

+KTCPCFG: 1

OK
AT+KTCPCNX=1

+CME ERROR: 921
AT+KTCPSTART=1

+CME ERROR: 921

Did I miss any order?

How do I connect to a TCP service?

Thanks for all the suggestions.

sorry The English you see is not my mother tongue!!!


#2

Hello,

Please check page 801 of AirPrime_HL6_and_HL8_Series_AT_Commands_Interface_Guide_Rev18_0.pdf (How to Use TCP Commands - Client Mode)

I usually do:

AT+KCNXCFG=1,“GPRS”,yourapn

AT+KTCPCFG=1,0,“youripserver”,yourportserver

AT+KTCPCNX=1

Wait until +KTCP_IND: 1,1

AT+KTCPSND=1,10 //to send 10 characters

0123456789 //Data sent (send without enter)

–EOF–Pattern-- //to return to AT mode (send without enter>

AT+KTCPCLOSE=1,1 //to close TCP connection

Done

Best regards,


#3

If possible, could you post example commands for receiving a TCP reply message from the server during the same TCP connection session as the data send?


#4

You can find the answer in the same document section showed above. Anyway, when you send --EOF–Pattern-- in order to finish your sending data, you will receive +KTCP_DATA: 1,xxxx (xxxx = number of bytes received and pending to be read), so you shall AT+KTCPRCV=1,xxxx to read all those bytes received. After that, you can close this TCP connection by the same way: AT+KTCPCLOSE=1,1

Best regards,


#5

Thanks dlopeziot! Reading the documentation was my first step and I repeatedly review it when things don’t work. Trouble is it sometimes leaves out some subtle details or parts of it are confusing, at least for me. For example, the step you included in your example above for sending, i.e., “Wait until +KTCP_IND: 1,1” was not included in the example from the AT command reference for the modules I’m using (HL7588 & HL7648). I had already figured that much out since I actually get three separate +KTCP_IND unsolicited responses during execution with “…: 1.1” being the final one. Also, since I am using Verizon version modules, it took some digging for me to figure out that I have to use a of 3 in AT+CGDCONT command and the same value of 3 for <cnx_cnf> in AT+KCNXCFG command. I was just hoping I might gain more insight from better actual examples. Thanks again though.


#6

I agree with you. For those that have not messed with cellular and AT commands much, the documentation is not very good. I am trying to follow some TCP examples from my document for the HL7748, but I get an error on the AT+KCNXCFG command.


#7

Alex, Did you resolve your issue? I’m using different modules but for the 3 HL modules I’ve used they seem fairly consistent (mostly). Anyway, I may be able to give you some advice if you still need it. Cheers!


#8

Yeah , the issue is the 7748 does not support TCP. So I am waiting on a 7800, and will have to figure out how to update it with beta firmware so the 7800 can support TCP. I have not updated firmware with the HL chips. Hopefully it is straightforward ? Because trying to install USB drivers was complicated for the HL7748