1. Help Center
  2. Testing / Debugging

How do I test connectivity with AT commands?

By using this sequence of AT commands you can establish a data connection to Onomondo.

Warning: This article requires knowledge of connecting to your device's cellular module/modem.

Once you are connected to your device's cellular module/modem, you are ready to start establishing a connection.

Establishing a data connection

In order to establish a data connection, follow this sequence of AT commands:

1. AT

Checks the connection to the modem, it should respond OK (this step is not strictly needed).

2. AT+CGREG? / AT+CEREG?

Queries for the packet-switched network status. If the response is +CGREG: x, 5 or +CEREG: x,5 then you can jump ahead to step 5. The x in the x,5 part indicates the URC status and is not important for this step, the indicates that the modem is registered to a network and is roaming. With Onomondo SIMs you will always be roaming which is why the response x,5 is always expected.

Note: You should use the latter, i.e. AT+CEREG?, if the modem you are testing with supports LTE or newer technologies. If you are using modems with both types of technology, use both. The modem will report x,4 to the technology that is currently not active.

3. AT+CGREG=1 or AT+CEREG=1

Activates Unsolicited Response Codes (URCs) for the packet-switched network status. Basically, this tells the modem to respond when the network status changes, without having to check connectivity using AT+CGREG? / AT+CEREG?

Note: Commands should be based on the same as step 2 (CGREG and/or CEREG).

4. AT+COPS?

Checks if the modem is in automatic selection mode. Some modems are set by default and don't need to be set manually. If the response is anything other than +COPS: 0, you will need to set it to choose network operator automatically using AT+COPS=0.

Beware of manually using AT+COPS=0 and AT+COPS=2, however. It can lead to unforeseen consequences which you can read more about in this developer blog: Why you shouldn't tell IoT modems to detach/attach.

Note: Some modules have their own automatic selection mode. Consult your specific modem's documentation for more information.

5. AT+CGDCONT=1,"IP","onomondo"

Defines the PDP context (this step could come prior to AT+COPS=0).

Make sure the context type is set to "IP" and not "IPV4V6" when setting the APN to avoid issues on networks.

6. AT+CGACT=1,1

Activates the PDP context (will also call AT+CGATT=1, which is a packet-switched network attach command if not already attached).

Note: Some modems will not register the PDP context in their own state if the proprietary AT command for the given modem is used, e.g. for Quectel modems AT+QIACT=1,1 should be used to activate the PDP context. Consult your modem's documentation for more information.

This sequence should work with any modem that adheres to 3GPP TS 27.007.

You can verify that the data connection has indeed been established with the Network Logs tab under the SIM page. (see example below)

Note: Sending data, using AT commands, varies from modem manufacturer, unless you are using a PPP connection through dial-up – so in order to test sending data please consult the documentation for your particular modem.

Additionally, the activation of the PDP context usually has to be done using a proprietary AT command if you want to use any of the modem's proprietary commands, e.g. pinging or establishing a TCP connection.

What does this look like in action?

Below is an example of the Network Logs tab that you can find under the detail page of an individual SIM.

test-connectivity-with-at-commands-gif

Is this your first rodeo? If this is the attempting to attach to a network for the first time or from another network you will also see Network Logs for:

- allowed to use GSM

- allowed to use data

- attached GSM connection

My data connection was attached, what's next?

If this works then it means that you are able to send data and that the connectivity with Onomondo is working. From here you can move to the Traffic Monitor tab and send some data through the network and see the results.

A simple way to do this is by sending a ping through the modem. This is not a standard AT command, so each manufacturer slightly differs. You can find the information in the AT command manual of your cellular module. For example:

I am not getting the expected results 

There are a couple of common things you can look at when a device is not connecting.

AT+COPS=?

The output of this command will tell you which networks are available. If you get a result that looks like this:


+COPS: ,,(0,1,2,3,4),(0,1,2)

Then unfortunately your device has no available networks to connect to. Check the bands/technologies the device can connect to and a coverage map if available. GSMA has a good starting point. Local base station databases or coverage maps from local providers are however usually better.

Clearing the Forbidden Network List

Typically, when a device attempts to connect to a network and it is not on the network-whitelist, it will add that network to the SIM's FPLMN list, so in the future, it will not attempt to connect to that network.

How and when devices write to the SIM's FPLMN list differ from manufacturer to manufacturer, as well as product to product. For example, some devices have been seen to write networks to the FPLMN list when it tries to connect when the SIM has been deactivated in our system.

To check if the list is empty and clear it if it is not, follow these instructions: How to clear the FPLMN (forbidden network) list on a SIM.

Delays between AT commands

If you are finding a network, but are having trouble attaching and getting a data connection it can be good to add a small delay, e.g. 50-100ms, in between AT commands. This can differ from each manufacturer, and if needed it is usually specified in their technical specifications.

Do you still not have a connection?

If you are not getting the expected results please contact us. Please provide the details of the problem, any logs from your tests, as well as contextual information, e.g. what device and modem are you using.

The more information we have, the better we work together to solve the issue.