Modem AT commands to connect/disconnect from the network

Sequence for connecting / disconnecting from the network

When configuring a new device, you need to configure the AT command sequence to fit with your use-case.

To avoid any wrong configuration in the device, we recommend you to implement the following AT command sequence to connect and disconnect properly from/to the mobile network:

  1. AT+CSQ [ To measure the signal quality ]
  2. AT+CREG=1 [ To enable network registration ]
  3. AT+CREG? [ To return the current state of the network registration : Attach/Detach ]
  4. AT+COPS=? [ To return the list of available operators ]
  5. AT+COPS= [ To manually select an available operator ]
  6. AT+COPS? [ To check the current network ]
  7. AT+CGATT=1 [ to attach the terminal to GPRS service ]
  8. AT+CGATT? [ To return the current state of GPRS service : Attach/Detach ]
  9. AT+CGDCONT=1,"IP","em" [ To define PDP Context ]
  10. AT+CSQ [ to measure signal quality ]
  11. AT+CGACT=1 [ To activate a PDP context ]
  12. AT+CGDCONT? [ To return the current state of the PDP context]
  13. AT+CGACT=0 [ To deactivate a PDP context ]

*Please check with the module vendor for the exact AT commands. This may change depending on the manufacturer

Can we send AT commands to reset connectivity instead of using the "Reset Connectivity" button in the EMnify portal?

Power cycling (power down and back up again) is different from reset in the portal. The Reset connectivity in the user interface performs a Network Initiated reset. This sends a Cancel Location message from our platform to the BTS (Base Transceiver Station) where the device was (or is) registered to. Thus, the next time this station sees the device, an update location is required by the network.

Can we send AT commands to cycle through a list of IMSIs?

Cycling through IMSIs is done by the SIM applet and AT commands does not have any influence on this. The ideal way to encourage the device to switch IMSIs would be the following:

1. Switch the operator selection mode to AUTOMATIC (AT+COPS=0)

2. Wait for automatic operator registration for at least 70 seconds (i.e. resetting the terminal too soon may reset the SIM applet timer).

Example: How to configure a modem to use LTE-M

Overview:

Depending on the device used, a specific network selection procedure needs to be chosen:

- If the device supports only CAT M, automatic operator selection can be on.

- if the device supports Cat M and other Radio Access Technologies (RAT) types (2G, Nb IoT), it is needed to define the network selection procedure by setting the scan sequence via AT Commands or restrict the RAT types it can access to Cat M.

Here is an example for Quectel's BG96:
(the AT commands starting with "AT+Q..." are Quectel specific)

With the following AT Commands sequence, we force the BG96 to connect to Cat M. It won't be able to connect to any other RAT Type.

# Only scan for CAT-M Networks
AT+QCFG="nwscanseq",02,1
# LTE only scan
AT+QCFG="nwscanmode",3,1
# Search only CAT-M Networks
AT+QCFG="iotopmode",0,1

For testing purposes or to speed up the network registration procedure, you can limit the registration to one specific network by entering its MCC/MNC as below:

# Set PDP Context
AT+CGDCONT=1,"IP","em",,

# Manually register to Telefonica O2 Germany on CAT-M
AT+COPS=1,2,"26203",8

The network registration related AT commands differs according to the types of the networks:

AT+CREG: Used for CS networks.
AT+CGREG: Used for PS (GPRS) in 2G/3G networks.

So, for NB-IoT and LTE-M (Cat-M) (and also for LTE), the correct command for checking the PS network registration is AT+CEREG.


More information