TCP/IP testing with Simcom SIM7070/SIM7080 Modules
Steps to test TCP/IP with SIM7070 and SIM7080 Modules
- Verify that the device is registered with the network provider
- Verify that APN is assigned usingĀ the AT+CGNAPN command
- Activate the network using the AT+CNACT command
- Configure the device for TCP connection using the AT+CNCFG command
- Open a TCP connection to the remote server using the AT+CAOPEN command.
- Send TCP data using the AT+CASEND command
- Get the response from the remote server using the AT+CARECV command.
AT Command Tester Tool provides an interface to test the TCP connection with the Simcom modules.
In this example,
- TCP connection is made to remote server ‘postman-echo.com’
- HTTP formatted data is sent to the remote server
- The remote server echos the IP address of the device which is received by the module.
TCP Testing in script mode
TCP function can be tested with script mode in the AT Command Tester tool.
Try the script in AT Command Tester tool.
//Script: TCP testing with SIM7070/SIM7080 modules //Check SIMCOM Module AT Command documentaiton //Get the current TCP configuration AT+CACFG? //Wait WAIT=1 //TCP/UDP wait time AT+CACFG="TRANSWAITTM",5 //Wait WAIT=1 //TCP/UDP packet size AT+CACFG="TRANSPKTSIZE",1024 //Wait WAIT=1 //TCP/UDP timeout AT+CACFG="TIMEOUT",0,10 //Wait WAIT=1 //Activate the network AT+CNACT=0,1 //Wait WAIT=5 //Open TCP connection //CID, PDP Index, connection type, server address, port AT+CAOPEN=0,0,"TCP","postman-echo.com",80 //Wait WAIT=5 //Send AT+CASEND=0,46 //Send HTTP get as the TCP dataGET https://postman-echo.com/ip HTTP/1.0 //Wait for response WAIT=5 //Get the response from the remote server AT+CARECV=0,500 //Wait for response WAIT=3 //Close the connection AT+CACLOSE=0
Output of the script in the AT Command Tester tool.
AT+CACFG? +CACFG: TRANSWAITTM,2 +CACFG: TRANSPKTSIZE,1024 OK AT+CACFG="TRANSWAITTM",5 OK AT+CACFG="TRANSPKTSIZE",1024 OK AT+CACFG="TIMEOUT",0,10 OK AT+CNACT=0,1 OK +APP PDP: 0,ACTIVE AT+CAOPEN=0,0,"TCP","postman-echo.com",80 +CAOPEN: 0,0 OK AT+CASEND=0,46 > OK +CASEND: 0,0,46 +CADATAIND: 0 +CASTATE: 0,0 AT+CARECV=0,500 +CARECV: 351,HTTP/1.1 200 OK Date: Sun, 21 Jun 2020 15:53:47 GMT Content-Type: application/json; charset=utf-8 Content-Length: 22 Connection: close ETag: W/"16-oWgnR5OcW0cDXWFy//pdWkFPX5Y" Vary: Accept-Encoding set-cookie: sails.sid=s%3ASdk9zJoskd7lyjdQqqL1KXCTZfHOdI7e.A0fAwOW7CSujaLee93RvJkFEVCrQUnXQn6G082bheNw; Path=/; HttpOnly {"ip":"54.244.63.216"} OK AT+CACLOSE=0 TCP connection is closed by remote server OKKeywords: Module , M2M , GPRS , 3G , through AT commands,