A9G GSM and GPS module AT+CGDCONT=1 command failed pppos

If you are asking a question, please follow this template:

  1. My goal is: Connect to the internet through A9G GSM&GPS module using pppos library of Mongoose OS.
  2. My actions are: I followed the tutorial in this link: https://medium.com/google-cloud/gps-cellular-asset-tracking-using-google-cloud-iot-core-firestore-and-mongooseos-4dd74921f582.
    My config schema is:
  - ["mqtt.server", "iot.eclipse.org:1883"]
  - ["i2c.enable", true]
  - ["pppos.enable", true]
  - ["pppos.uart_no", 2]
  - ["pppos.rx_gpio", 16]
  - ["pppos.tx_gpio", 17]
  - ["pppos.baud_rate", 115200]
  - ["pppos.connect_cmd", "ATD*99***1#"]
  - ["pppos.apn", "APN"]
  - ["pppos.user", "USER"]
  - ["pppos.pass", "PWD"]
  1. The result I see is: I get this error message.
[Aug  6 21:52:10.255] A9/A9G
[Aug  6 21:52:10.258] V02.02.20190915R, IMEI: 867959034204627
[Aug  6 21:52:10.563] mgos_pppos.c:336        SIM is not ready (EADY), proceeding anyway
[Aug  6 21:52:10.749] mgos_pppos.c:388        Connected to mobile network (home)
[Aug  6 21:52:11.040] mgos_pppos.c:406        Operator: GLOBE
[Aug  6 21:52:11.147] mgos_pppos.c:416        RSSI: -89
[Aug  6 21:52:11.361] mgos_pppos.c:702        Command failed: AT+CGDCONT=1,"IP","APN"
[Aug  6 21:52:11.361] mgos_net.c:86           PPP: connecting
[Aug  6 21:52:11.363] mgos_pppos.c:613        Connecting (UART2, APN 'APN')...
[Aug  6 21:52:11.757] mgos_pppos.c:263        Ai_Thinker_Co._Ltd.
  1. My expectation & question is: My expectation is to connect to the GCP IoT Core through GPRS. Somehow I get this certain message Command failed: AT+CGDCONT=1,“IP”,“APN”. I can’t connect to my GCP server as well.

You should first connect your GSM module to your computer, open a terminal emulator software, manually try the AT commands the module will use to connect, and once you know that works, then see why it doesn’t work with your device.
Besides the tutorial, you should have the docs for your module.
If we assume your module is a commom one and will take commonly used AT commands, then the APN is usually an APN name, not the acronym APN itself. That is provided by your cell phone provider (Globe ?) somehow in their documentation. A useful workaround is to search the Internet and manually try on a terminal emulator the AT commands until the combination is successful.
The next thing to check is the dial command to go PPP.

PS: The library is expecting “READY” but it is seeing “EADY” something might be wrong on your serial hardware, also.

1 Like

I was able to get it to work using SIM800L module. When I am using the A9G module, the mgos_pppos.c:702 Command failed: AT+CGDCONT=1,“IP”,“APN” is now gone but I am getting an error “Error 6 (phase 0), reconnect”. Do you have any idea what the error 6 phase 0 means or at least reference?

phase 0 may refer to the PPP session establishment, you can check that in lwIP forums (the TCP/IP stack in use, including PPP, is lwIP).
I don’t recognize your dial command for PPP initiation and that is a probable cause. As I said, you should connect with a terminal, type commands manually, and check the module behaves as expected. There are many variations in the way each module will start a PPP session, and how to configure the module to carry that session data over the cellular network.

1 Like

Here is the commands from the module documentation.2 3
While these are the commands I sent to the module. The last 2 commands from the documentation was not included but I was able to get it to work.

.
When I try to use the Mongoose OS PPPoS library I get this error 4 .
I still don’t get why I am receiving EADY instead of READY. The baudrate is the same/correct.

Are you sure cmnet is the operator’s apn?

I tried using my actual APN (internet.globe.com.ph & http.globe.com.ph) and the module’s default APN (CMNET). Still the same error.

The commands and APN seem to be fine, but I don’t like that CONNECT alone, you should see a PPP handshake (some string of unreadable characters) unless your “serial tool” is filtering that out.
I also don’t like that “EADY” when it is expecting “READY” nor its companion “proceeding anyway”; but …
Now, are you sure the library sends those commands ?
Can you the opposite process ? That is, connect to the processor (with the terminal emulator) and simulate the module responses

1 Like

The reason for the proceeding anyway is that the device does not respond to the AT+CPIN? as expected

The module was transmitting READY but the esp32 was reading a EADY instead of READY.

Ok was able to run the AT commands from the Mongoose OS PPPoS library. All seems fine however I got stucked after the ATD99**1# command. Seems like I having problem at sending PPPoS messages. I don’t have an idea what PPP messages that Mongoose sends.

I would get an error from this part of the Mongoose library.
5
Then the error will be printed at this part.
6

That is why I told you to check your hardware.
Long thin wires + “a serial resistor just in case” form an RC filter that may disrupt comms, sometimes just the first char in the row.

PPP is used to carry IP through the serial connection, you need to signal the module you want to establish a PPP session and that is usually done via some fancy ad hoc number you “dial”.
If the number is correct and the module supports PPP, it starts sending the required frames to establish the session, that is HDLC and starts with the character 0x7E so you should usually see some ‘~’ chars. The library should stay waiting for the HDLC initiation and then respond and establish the session.

I don’t like not seeing anything after the dial command, that may not be the correct one, check your module docs. The command we’ve used so far for PPP over GPRS has been ATD*99**#

I use a shorter version of the regular male to male pin. I don’t have any electronics component added. I am just connecting the 2 modules (A9G and ESP32). The A9G module is powered by external 5V 2A power, while the ESP32 is powered through the micro USB. I also tried to reprogram the ESP32 just to echo the messages from the Serial of the A9G using the same setup. It was able to show +CPIN: READY message just as stated in the module. When I am using Mongoose OS demo project, I am only getting EADY.

Ok looks like I found out why it only shows EADY. The SIM800L returns +CPIN: READY, with a space before +CPIN, while A9G returns +CPIN:READY no space. I am starting to feel that this issue is more on the firmware of the A9G module.

Looks like a firmware problem. :expressionless: More on about ppp authentication despite no password and username

EADY vs READY: then it is not a hw problem, the parser could be better.
PPP: to develop networking systems, sometimes you need to have some tools of the trade.
You should be able to sniff the serial port and decode the PPP frames and see what is going on. Try to initiate the PPP session from a client on a computer and sniff it with Wireshark.
Perhaps you can also raise a debug level somewhere and see some extra info on the logs, but I can’t help you there.
Perhaps someone might be able to help on the lwIP forum

1 Like

Where is this lwIP forum?

Well, it is a mailing list actually, but you can search its archives here.

1 Like

I was able to get it to work. I just changed the pppos settings from
- ["pppos.user", ""] - ["pppos.pass", ""] to - ["pppos.user", " "] - ["pppos.pass", " "]. Just added space to the settings.:expressionless::expressionless::expressionless::expressionless:. The no spaces works in SIM800L but not on A9G module. I am using the same SIM card. Thanks for the help.