arduinoat-commandgprs

Problem with the command AT+CIPSTART for A7 GSM/GPRS/GPS MOdules


I have two boards AiThinker A7 and A9G GSM/GPRS/GPS MOdules. I am using the same SIM with both the boards to send data to TCP server. It works fine with A7 module, while gives error on A9G module. The log is as follows:

For AiThinker A7 Board

AT
OK
AT+GPS=1
OK
AT+COPS=0
OK
AT+CGATT=1
+CTZV:21/02/11,03:10:47,+01
OK
AT+CSTT="pinternet.interkom.de","",""
OK
AT+CIICR 
OK
AT+CIPSTART="TCP","0.tcp.ngrok.io",16939
CONNECT OK
OK
AT+CIPSEND=138,"{ scooterId: 'C45ZA1', pm25: 234, pm10: 110 }"
OK
+CIPRCV:160,127.0.0.1:49915 said { scooterId: 'C45ZA1', pm25: 234, pm10: 110 }

For A9G Board

AT+GPS=1
OK
AT+COPS=0
OK
AT+CREG?
+CREG: 1,5
OK
AT+CGACT?
+CGACT: 0,0
OK
AT+CGACT=1
OK
AT+CGATT=1
+CGATT:1
OK
AT+CGACT?
+CGACT: 0,0
OK
AT+CSTT="pinternet.interkom.de","",""
OK
AT+CIICR
OK
AT+CIPSTART="TCP","0.tcp.ngrok.io",16939
+CME ERROR: 50

+CME ERROR: 50 means EXE_FAIL. Please help me out. I could not figure it out. I tried a lot.

Here it is another set of command sent to understand what was going on.

For A7 (Working):

AT+CGACT?
+CGACT: 0,0
OK
AT+CGACT=1
OK
AT+CGACT?
+CGACT: 0,0
AT+CGDCONT?
+CGDCONT:1,,"pinternet.interkom.de",,0,0
OK

For A9G (not working):

AT+CGATT=1
+CGATT:1
OK
AT+CGACT?
+CGACT: 0,0
OK
AT+CGACT=1
OK
AT+CGACT?
+CGACT: 0,0
OK
AT+CGACT=1,1
OK
AT+CGACT?
+CGACT: 1,1
OK
AT+CGDCONT?
+CGDCONT:1,,,"10.163.72.91",0,0
OK
AT+CGDCONT=1,"","pinternet.interkom.de","",0,0 
+CME ERROR: 3

(error 3 => OPERATION_NOT_ALLOWED)


Solution

  • TL;DR

    You need to correctly set the APN name with the command

    AT+CGDCONT=1,"IP","pinternet.interkom.de"
    

    Explanation

    In order to reach the packet network, a cellular device needs to enable a PDP context, and that is done connecting to an access point, identified by a specific APN (Access Point Name).

    In your latter compared test it is clear how the APN in the working module is correctly set to "pinternet.interkom.de", while in the A9G device is seems to be set to a private IP address. Without a valid APN the device cannot reach the network.

    You later tried to set it with +CGDCONT command, but you used a wrong syntax. Correct syntax is, as explained in the specification , is

    AT+CGDCONT=[<cid>[,<PDP_type>[,<APN>[,<PDP_addr>[,<d_comp>[,<h_comp>[,<IPv4AddrAlloc>,<request_type>[,<PCSCF_discovery>[,<IM_CN_Signalling_Flag_Ind>[,<NSLPI>[,<securePCO>]]]]]]]]]]]]
    

    You don't need most of the optional parameters. You just need

    AT+CGDCONT=<cid>,<PDP_type>,<APN>
    

    so basically you missed <PDP_type> parameter. It can be set to the values "IP", "IPV6", IPV4V6 and so on, according to the capabilities of the network you are camped in. For your needs you'll need to set it to "IP".