Tools

AT commands for cellular modems

A cheat-sheet of the AT commands you reach for most when bringing up and debugging a cellular module, each with a copy-ready snippet and the standard clause that defines it (3GPP TS 27.007 and 27.005). Below it, a generator that builds AT+CGDCONT from your APN and a decoder for the network-registration status.

Identification

AT

Check the modem responds (should return OK).

OKITU-T V.250
ATI

Show manufacturer, model and firmware revision.

ITU-T V.250
AT+CGMI

Return the module manufacturer.

3GPP TS 27.007 §5.1
AT+CGMM

Return the module model.

3GPP TS 27.007 §5.2
AT+CGMR

Return the firmware version.

3GPP TS 27.007 §5.3
AT+CGSN

Return the device IMEI.

4901542032375183GPP TS 27.007 §5.4

SIM / card

AT+CPIN?

Check whether the SIM needs a PIN (READY if already unlocked).

+CPIN: READY3GPP TS 27.007 §8.3
AT+CIMI

Read the subscriber IMSI (identifies country and operator).

2140700000000003GPP TS 27.007 §5.6
AT+CCID

Read the SIM's ICCID (vendor command: +CCID, +QCCID or +ICCID depending on the module).

+CCID: 8934...ETSI TS 131.101 (vendor +CCID/+QCCID/+ICCID)

Network & registration

AT+COPS?

Show the registered operator and access technology.

+COPS: 0,0,"Operator",73GPP TS 27.007 §7.3
AT+COPS=?

Scan available networks (slow; the modem de-registers briefly).

3GPP TS 27.007 §7.3
AT+CREG?

Circuit-switched 2G/3G network registration status.

+CREG: 0,13GPP TS 27.007 §7.2
AT+CGREG?

GPRS/UMTS packet-data registration status.

+CGREG: 0,13GPP TS 27.007 §7.2
AT+CEREG?

EPS registration status (LTE, NB-IoT and LTE-M).

+CEREG: 0,13GPP TS 27.007 §7.2

Signal

AT+CSQ

Signal quality: CSQ index and bit-error rate.

+CSQ: 17,993GPP TS 27.007 §8.5

PDP context / APN

AT+CGDCONT=1,"IP","<apn>"

Define the PDP context with the APN before connecting.

3GPP TS 27.007 §10.1.1
AT+CGAUTH=1,1,"<user>","<pass>"

Set the APN username, password and authentication protocol.

3GPP TS 27.007 §10.1.31
AT+CGACT=1,1

Activate (or deactivate) the defined PDP context.

3GPP TS 27.007 §10.1.10
AT+CGPADDR=1

Show the IP address assigned to the context.

+CGPADDR: 1,"10.0.0.2"3GPP TS 27.007 §10.1.14

Power / radio

AT+CFUN=1

Control the functionality level: turn the radio off or on.

3GPP TS 27.007 §8.2

SMS

AT+CMGF=1

Select the SMS mode (1 = text, 0 = PDU).

3GPP TS 27.005 §3.2.3
AT+CMGS="<number>"

Send an SMS to the given number.

3GPP TS 27.005 §3.5.1

AT+CGDCONT generator

Compose the command that defines the PDP context from your APN.

AT+CGDCONT=1,"IP","internet"

Registration-status decoder

Enter the <stat> value from the +CREG / +CGREG / +CEREG response.

Where to start debugging

The bring-up order is the same on almost any module: first AT to confirm it responds, then AT+CPIN? to rule out a SIM PIN, then AT+CSQ to check there is signal, and AT+CEREG? (or +CREG on 2G/3G) to check network registration. Only once the registration state is 1 (home network) or 5 (roaming) does it make sense to define the data context with AT+CGDCONT, activate it with AT+CGACT and confirm the IP with AT+CGPADDR. If registration stays at 2, the modem is still searching for a network — almost always a coverage, band or operator-profile issue, not the APN configuration. If it stays at 3, the network has rejected the registration, which is usually a SIM or subscription matter, not the firmware.

Frequently asked questions

What's the difference between AT+CREG, AT+CGREG and AT+CEREG?
All three query the registration state, but in different domains: +CREG covers circuit-switched 2G/3G registration (voice and SMS), +CGREG the GPRS/UMTS packet-data service registration, and +CEREG the EPS registration of LTE, which is also what NB-IoT and LTE-M use. On an IoT device over LTE the relevant query is AT+CEREG?.
What does the response +CEREG: 0,1 mean?
The first number is the notification mode (0 = no unsolicited notifications) and the second is the registration state <stat>. A 1 means registered on the home network and a 5 means registered while roaming; both indicate the device is attached. A 2 means it is still searching for a network and a 3 means the network has denied registration. The decoder on this page translates each value.
How do I configure the APN over AT commands?
AT+CGDCONT defines the PDP context by giving the CID, the PDP type (IP, IPV6, IPV4V6 or Non-IP) and the APN, for example AT+CGDCONT=1,"IP","internet.iot". If the APN requires a username and password you add AT+CGAUTH with the protocol (PAP or CHAP). The generator on this page composes both lines for you; for more targets (ModemManager, Android) use the APN generator.
Are AT commands the same on every module?
The 3GPP TS 27.007 and 27.005 commands (CREG, CEREG, CSQ, CGDCONT, CIMI…) are standard and behave the same on most modules. What varies are each manufacturer's extensions, which start with a vendor prefix: reading the ICCID, for instance, is AT+CCID, AT+QCCID or AT+ICCID depending on the module. When in doubt, check the manufacturer's AT manual for the extensions.

Integrating cellular connectivity?

Multi-carrier SIMs with a configurable APN, optional static IP and a management API. Test kit for €15 with shipping included in Spain.