Skip to content
IoT Crest

3GPP AT commands for cellular modules

By Hamza Rivera, published , 6 min read

Short answer: AT commands are short text instructions, starting with the letters AT, that a host sends to a cellular module to set a value, read it back or run a function. 3GPP TS 27.007 defines a set of these commands for cellular modules, with the same names and syntax in each module that follows it. Each module's own manual says which commands and values that module supports.

The AT commands that cellular modules share under 3GPP TS 27.007, including AT+CGSN, AT+CIMI, AT+COPS, AT+CEREG, AT+CPSMS and AT+CEDRXS, and what each returns.

This article covers the AT command line format, the shared 3GPP commands for identity, operator selection, network registration and power saving, and what the standard leaves to module manuals It does not cover SMS and call commands, vendor-only commands such as AT+CCID, module firmware updates, and SIM profile provisioning

AT commands are short text instructions, starting with the letters AT, that a host sends to a cellular module to set a value, read it back or run a function. ITU-T V.250 defines the line format, and 3GPP TS 27.007 defines the cellular commands that modules share. This guide sets out how a command line is built, what the shared commands return, and where a module’s own manual takes over. It belongs with the connectivity guides. The identifiers several of these commands return are explained in IMEI explained, IMSI explained and ICCID explained.

CommandWhat it doesTS 27.007 clause
AT+CGSNReturns the product serial number, or the IMEI with =1 and IMEISV with =25.4
AT+CIMIReturns the IMSI of the SIM or active application5.6
AT+COPSSets automatic or manual operator selection, or deregisters from the network7.3
AT+CEREGReports EPS (LTE) registration status, with optional location and reject cause details10.1.22
AT+CPSMSSets the power saving mode (PSM) parameters, or disables PSM with =27.38
AT+CEDRXSSets the extended discontinuous reception (eDRX) parameters, or disables eDRX with =37.40

How a command line is built

V.250, clause 5.2.1, says the command line prefix is the characters “AT” or “at”. The clause then sorts commands into two types. Action commands may be “executed”, to run a function of the equipment, or “tested”, to find out whether the equipment implements them. Parameter commands may be “set” to store a value, “read” to see the stored value, or “tested” to find the values supported.

TS 27.007 names each command with a plus sign, as in “+CGSN” or “+CEREG”, and gives the syntax of each form in a table. Most commands follow one pattern. A set form takes parameters after an equals sign, a read form adds a question mark, and a test form adds =? to list the values the module accepts. When a command fails, the module returns an error response such as “+CME ERROR: ”.

Not every module implements every command. V.250 says a test form shows “whether or not the equipment implements” a command, so a host should test a command before it depends on it.

Identity commands: AT+CGSN and AT+CIMI

AT+CGSN reads a module’s identity. Its execution form returns “the IMEI … and related information to identify” the device the host is connected to. The parameter selects what comes back. With no parameter, or with 0, the response is the product serial number. With 1 the response is the IMEI, and with 2 it is the IMEISV. With 3 it returns the value the standard calls the SVN. TS 27.007 adds that “for a TA which does not support , only OK is returned”, so a host that is unsure which values a module accepts should use the test form first.

AT+CIMI returns the subscriber identity. The standard says the response “is intended to permit the TE to identify the individual SIM card or active application in the UICC (GSM or USIM) which is attached to MT”. The IMSI is returned as a string without double quotes. The value follows the SIM or active application, so a device that changes its SIM should read the IMSI again.

TS 27.007 does not define AT+CCID, the command some module manuals use to read the ICCID printed on the SIM. For that reason this guide does not describe it. Check the manual for your module before you rely on it.

Operator selection: AT+COPS

AT+COPS sets how the module chooses a network. Its mode parameter has five values in the standard. 0 is automatic, where the operator field is ignored. 1 is manual, where the operator must be given. 2 “forces an attempt to deregister from the network”. 3 sets only the format used by the read form, without attempting registration or deregistration. 4 tries manual selection and falls back to automatic mode if it fails.

The format parameter sets how an operator appears in responses. 0 gives the long alphanumeric name, 1 the short name and 2 the numeric code. The standard says the selected format “shall apply to further read commands (+COPS?) also”, so one set command decides how later reads look.

Registration status: AT+CEREG

AT+CEREG reports whether the module is registered on an LTE network. The status field, <stat>, is the value firmware usually reads first. The standard gives these values:

  • 0: not registered, and the module is not currently searching for an operator.
  • 1: registered, home network.
  • 2: not registered, but the module is currently trying to attach or searching.
  • 4: unknown, for example when the module is outside E-UTRAN coverage.
  • 5: registered, roaming.

The <n> parameter sets the unsolicited result code, the message the module sends by itself when the status changes. 0 turns the message off, 1 sends the status alone, and 2 adds location details. The standard says those location fields are “provided only if available”, so a host should check for them rather than assume they are there.

TS 27.007 links this command to power saving. Its text says that “if the UE wants to apply PSM for reducing its power consumption, see +CPSMS command” and points to 3GPP TS 23.682 for the power saving mode itself.

Power saving: AT+CPSMS and AT+CEDRXS

AT+CPSMS sets the power saving mode parameters. The set form “controls whether the UE wants to apply PSM or not”, along with the requested timer values. The standard adds that “a special form of the command can be given as +CPSMS=2”, which disables PSM and removes the parameters, or sets them to the manufacturer’s defaults. The read form returns the current values.

AT+CEDRXS controls extended discontinuous reception. Its set form controls “whether the UE wants to apply eDRX or not, as well as the requested eDRX value for each specified type of access technology”. The special form +CEDRXS=3 turns eDRX off and clears its parameters, as =2 does for PSM.

Both commands are requests. The values the network grants come back in the responses and unsolicited messages of other commands, such as the Active Time value that TS 27.007 links to +CEREG. A host should read those responses after it sets a value, and not assume the request was granted.

Where module manuals take over

The standard fixes the syntax and the meaning of each command it defines. Commands outside the standard, such as AT+CCID, are not in TS 27.007, so the module’s own manual is the place to check them. Use TS 27.007 for the shared commands, the module manual for everything beyond them, and test each command on the module before it goes into firmware.

For the cellular module hardware these commands run on, and what to check on its datasheet, see the LTE-M and NB-IoT modem guide.

Sources

Common questions

What is an AT command?

An AT command is a line of text that starts with AT and tells a modem what to do. The host sends it over a serial link, and the module replies with the data the command asks for, OK, or an error such as +CME ERROR. The line format is defined in the ITU's V.250 recommendation.

Does AT+CGSN return the IMEI?

Only with a parameter. A bare AT+CGSN returns the product serial number, and AT+CGSN=1 returns the IMEI. TS 27.007 also defines AT+CGSN=2, which returns the IMEISV.

What is the difference between AT+CPSMS and AT+CEDRXS?

AT+CPSMS sets the power saving mode parameters, and AT+CEDRXS sets the extended discontinuous reception parameters. Both are requests for a behaviour, and the standard ties the granted values to the responses of other commands. Each one turns off with its own special form, =2 for PSM and =3 for eDRX.

Where do I find the AT commands for my module?

Use TS 27.007 for the commands the standard defines. The module's own AT command manual lists the commands it adds and the values it accepts, and it is the reference for that exact module.

Written by Hamza Rivera. Facts in this article follow the editorial policy: each one is behavior that is well established or set by the standard named in the text. A confirmed error is fixed in the article and its Updated date changes.

More from Connectivity

All connectivity articles

Sponsor an article in this topic

Sponsored articles and in-article link placements for IoT vendors, agencies and SEO buyers. Every sponsored piece is labeled, edited to the same standard as the rest of the site, and placed in the hub its readers already visit. Rates on request.