- Webinar: Introduction to AT commands
- Sequence for a proper connection / disconnection from the network
- Can we send AT commands to reset connectivity instead of using the "Reset Connectivity" button in the EMnify portal?
- Can we send AT commands to cycle through a list of IMSIs?
- Example: How to configure a modem to use LTE-M
Webinar: Introduction to AT Commands
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:
- AT+CSQ [ To measure the signal quality ]
- AT+CREG=1 [ To enable network registration ]
- AT+CREG? [ To return the current state of the network registration : Attach/Detach ]
- AT+COPS=? [ To return the list of available operators ]
- AT+COPS= [ To manually select an available operator ]
- AT+COPS? [ To check the current network ]
- AT+CGATT=1 [ to attach the terminal to GPRS service ]
- AT+CGATT? [ To return the current state of GPRS service : Attach/Detach ]
- AT+CGDCONT=1,"IP","em" [ To define PDP Context ]
- AT+CSQ [ to measure signal quality ]
- AT+CGACT=1 [ To activate a PDP context ]
- AT+CGDCONT? [ To return the current state of the PDP context]
- 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
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
# LTE only scan
# Search only CAT-M Networks
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
# Manually register to Telefonica O2 Germany on CAT-M
The network registration related AT commands differs according to the types of networks:
AT+CREG: Used for CS networks.
AT+CGREG: Used for PS (GPRS) in 2G/3G networks.
AT+CEREG: Used for PS (EPS) in 4G/5G 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.