Cavli Wireless

What are AT Commands?

AT Commands, short for 'Attention' Commands, are the foundational protocol for communication between cellular (or RF) modems and their host controllers. These commands are crucial for controlling modem functions, managing network connections, and enabling features like remote diagnostics and firmware updates—key for modern IoT and 5G networks. Any firmware or hardware developer working with these modems will make use of these modem AT commands to essentially send instructions on various functions.

The AT Command set, now a universal standard for controlling cellular modems, was originally developed by Dennis Hayes in 1981 as part of the Hayes Command Set for the ‘Hayes 300 Baud Smart Modem’. This set has since evolved into a key tool in modem communication across a variety of devices and manufacturers.

Use of 3GPP AT Commands for GSM Modems

AT Commands are primarily used to configure, troubleshoot, and establish network connections with carriers across GSM, GPRS, LTE, and 5G modems. As the 5G ecosystem evolves, AT commands continue to play a critical role in managing network parameters like connection quality, roaming status, and advanced network features. These AT Commands for GSM allow developers to send and receive several device and network parameters from the modem such as the current network status indication, roaming, network technology currently being used (4G, NB-IoT, 2G, etc. ), and other such information. The data being transmitted is crucial during any debugging or developing activities.

The AT commands for GSM/IoT modules can be used to access a few crucial services such as:

  • Device and SIM information
  • SMS & MMS services
  • Fax services (if supported)
  • Voice & data services

Even today, AT Commands, are still being used to establish and configure network connections on modern 5G modems as well.

How are AT Commands being communicated?

AT Command instructions are single-line commands sent sequentially. The user must wait for the modem's response before sending the next command. In modern modems, these commands can be sent through UART, USB, or even wirelessly over the network for remote diagnostics, providing greater flexibility for IoT applications. To send AT Commands and receive responses, a host device (e.g., microcontroller or single-board computer) typically communicates with the modem through a UART (Universal Asynchronous Receiver/Transmitter) or USB, depending on the modem type. Modern solutions also support wireless communication for remote diagnostics. A UART is a two-wire communication protocol that allows two devices to communicate with each other in a half-duplex fashion. In newer modems, the AT Command instructions can be directly sent across via a USB connection or even wirelessly over the network for remote diagnostics.

List of AT Commands -Syntax and Types

Similar to a programming language syntax, AT Commands also have syntaxes that the user has to follow in order to send valid commands to the device. The general syntax for a command is as follows:

AT<COMMAND><SUFFIX><DATA>

Each AT Command must begin with the prefix “AT” to activate the modem’s command function. This is followed by the actual command, an optional suffix to indicate the command type or mode, and any relevant data (if required). The data field is not always necessary for all commands, making this structure versatile across different modem functions. Additionally, the relevant data (if required) follows the command. Note that the data field is not necessary for all commands.

This structure is known as the command line structure and is terminated by a single carrier return or the user can send multiple commands in a single line separated by a semi-colon.

GSM AT Commands Types

AT Commands can be broadly classified into two sets, Basic Commands, and Extended Commands.

Basic AT Commands

"Basic AT Commands do not begin with the ‘+’ symbol. Examples include commands like 'D' (Dial), 'A' (Answer), 'H' (Hook Control), and 'O' (Return to online data state).

Extended AT Commands

Extended Commands are those that start with the “+” symbol. All AT Commands for GSM fall under this category and a few of the common commands are +CMGS (Send SMS message), +CMGL (List SMS messages), and +CMGR (Read SMS messages).

Further, the AT Commands are of 4 categories primarily - Test Commands, Read Commands, Set & Execution Commands.

Classification of AT Commands

Classification of AT Commands

TypeSuffixRole
Read?Get a modem configuration setting
Set=Set a modem configuration setting
ExecuteNoneTrigger a modem operation
Test=?Check whether a modem supports the named command

The response given by the modem is known as the ‘Result Code’. This code lets the user know the status of the given command response. An ‘OK’response signifies that the command has been executed successfully while an ‘ERROR’response may be returned for the following reasons:

  • Syntax of the AT Command is Incorrect
  • The modem is incompatible with the AT Command issued
  • The modem is currently unable to process the command (eg. when trying to change settings while the modem is active and transmitting)

Test Commands

These are primarily used to check whether the given command is supported by the modem or not. Depending on the specific modem, some AT Commands may or may not be supported due to hardware or software limitations. The test commands allow the user to confirm the support of the modem before pushing the instruction.

Syntax:AT<COMMAND NAME>=?
For example:ATD=?

ATD stands for Dial Command and ATD=? Is used to check if the modem supports Dialing functionality.

Read Commands

Read Commands are used to extract information from the modem. This information can be regarding certain parameters or settings that have been configured in the modem or even network-related parameters.

Syntax:AT<COMMAND NAME>?
For example:AT+CBC?

Set Commands

Set Commands are used to modify and configure modem parameters/settings. This is mostly used during the initial setup of the modem

Syntax:AT<COMMAND NAME>=value1, value2, …, valueN
For example:AT+CSCA=”+123456789”, 120

Execution Commands

Execution Commands are used to perform an operation with or on the modem. This command is the most common type of command.

Syntax:AT<COMMAND NAME>=parameter1,…, parameterN
For example:AT+CMSS=1,”+123456789”, 120

Most Commonly used AT Commands Lists

AT Command with Examples

AT Command with Examples

Although different vendors have different lists of AT Commands for their specific modems, there are two common AT Command sets that are used by all

  • Universal AT Commands:Common commands can be used on any modem.
  • Proprietary AT Commands:Specific commands developed by the modem’s vendor for use with their modems.

There are 7 basic universal AT Commands that can be easily familiarized with for any modem.

AT

This is the most basic AT command that lets the user check whether a connection has been established between the modem and the host system. If the interface is correct, the modem returns “OK” else, it will return an “ERROR” if there is a misconfiguration in the connection, and in cases where the physical connection is not correct, no response would be received.

+CMGF

The AT+CMGF command configures the SMS mode of the modem. The mode can be set to ‘0’ for PDU mode or ‘1’ for text mode, enabling text-based or hexadecimal encoding for SMS operations. The text-mode operation is quite simple with a direct textual interface but is quite limited by its capabilities. PDU on the other hand allows the user to gain more detailed access to the SMS service with HEX values being used in place of plain text.

Syntax:AT+CMGF=<mode>
For example:AT+CMGF=1

+CMGW

The +CMGW command is used to store a message in the SIM card of the modem. After executing the command, the ‘>’ sign will be displayed and the user can enter the message to be stored. These messages are stored in a serial fashion.

Syntax:AT+CMGW=”Phone number” > <Message to be stored>
For example:AT+CMGW=’+123456789’ >Hello world

CMGS

The CMGS command allows the user to send a saved SMS message from the SIM card.

Syntax:AT+CMGS=<Serial Number of SMS to be sent>
For example:AT+CMGS=1

ATD

ATD is the simplest command to dial a provided number.

Syntax:ATD<Phone Number>;
For example:ATD+123456789;

ATA

ATA is a command used to answer any incoming calls to the modem. The call will be denoted by a message “RING” which is repeated at every ring of the incoming call. If the user does not answer/the call ends, “NO CARRIER” will be displayed.

Syntax:ATA(Enter)
For example:RING 
RING
ATA

ATH

ATH is a command used to disconnect a remote user connects to the modem.

Syntax:ATH(Enter)

List of GSM Modem AT Commands

Major AT Commands for GSM modems areas listed below. Not all commands are supposed by all modems due to hardware or software limitations

AT Commands for Testing

CommandDescription
ATChecking communication between the module and computer.

AT Commands for Call Control

CommandDescription
ATAAnswer command
ATDDial command
ATHHang up call
ATLMonitor speaker loudness
ATMMonitor speaker mode
ATOGo on-line
ATPSet pulse dial as default
ATTSet tone dial as default
AT+CSTASelect type of address
AT+CRCCellular result codes

AT Commands for Data Card Control

CommandDescription
ATIIdentification.
ATSSelect an S-register
ATZRecall stored profile
AT&FRestore factory settings
AT&VView active configuration
AT&WStore parameters in given profile
AT&YSelect Set as power up option
AT+CLCKFacility lock command
AT+COLPConnected line identification presentation
AT+GCAPRequest complete capabilities list
AT+GMIRequest manufacturer identification
AT+GMMRequest model identification
AT+GMRRequest revision identification
AT+GSNRequest product serial number identification (IMEI)

AT Commands for Computer Data Interface

CommandDescription
ATECommand Echo
ATQResult code suppression
ATVDefine response format
ATXResponse range selection
AT&CDefine DCD usage
AT&DDefine DTR usage
AT&KSelect flow control
AT&QDefine communications mode option
AT&SDefine DSR option
AT+ICFDTE-DCE character framing
AT+IFCDTE-DCE Local flow control
AT+IPRFixed DTE rate

AT Commands for Service

CommandDescription
AT+CLIPCalling line identification presentation
AT+CRService reporting control
AT+DRData compression reporting
AT+ILRRDTE-DCE local rate reporting

AT Commands for Network Communication Parameter

CommandDescription
ATBCommunications standard option
AT+CBSTSelect bearer service type
AT+CEERExtended error report
AT+CRLPRadio link protocol
AT+DSData compression

Miscellaneous AT Command Examples

CommandDescription
A/Re-execute command line
AT?Command help
AT*CStart SMS interpreter
AT*TEnter SMS block mode protocol
AT*VActivate V.25bis mode
AT*NOKIATESTTest command
AT+CESPEnter SMS block mode protocol

AT Commands for SMS Text mode

CommandDescription
AT+CSMSSelect message service
AT+CPMSPreferred message storage
AT+CMGFMessage format
AT+CSCAService center address
AT+CSMPSet text mode parameters
AT+CSDHShow text mode parameters
AT+CSCBSelect cell broadcast message types
AT+CSASSave settings
AT+CRESRestore settings
AT+CNMINew message indications to TE
AT+CMGLList messages
AT+CMGRRead message
AT+CMGSSend message
AT+CMSSSend message from storage
AT+CMGWWrites message to memory
AT+CMGDDelete message

AT Commands for SMS PDU mode

CommandDescription
AT+CMGLList Messages
AT+CMGRRead message
AT+CMGSSend message
AT+CMGWWrites message to memory

 

New AT Commands for 5G and IoT Modems

With the rise of 5G and NB-IoT, new AT commands are evolving to manage advanced features like low-power modes, secure connections, and optimized network usage. Examples of new commands include:

  • AT+NRIND

    Retrieves 5G New Radio (NR) signal strength and connection status.

  • AT+CSQ5G

    Measures 5G signal quality.

  • AT+CGACT

    Activates/deactivates PDP contexts for NB-IoT or LTE-M devices.

Wireless AT Commands and Cavli Hubble IoT Platform

Over the years of modem technology, AT Commands and their implementations have mostly stayed stagnant, and the requirement of physical access in order to push the commands to modems has been proven cumbersome in situations where the device has already been deployed.

Cavli’s SmartModules now feature the ability to receive AT Commands remotely via the Cavli Hubble IoT platform, enabling device configuration and diagnostics over cellular networks, even after deployment. This allows developers to send AT Commands to deployed devices across the world through the Hubble platform which allows for easy and quick device diagnostics and configuration through an easy-to-use terminal interface on the Hubble platform.

Go Beyond and Explore

1.

What are AT commands for?

AT commands are used to communicate with and control modems. They allow users to set parameters, control the modem's operation, and execute specific tasks like:

  • Read/send SMS and USSD
  • Send TCP/IP data
  • Get hardware and SIM information (IMEI, IMSI, etc.)
  • Waking the device or putting it into sleep mode
  • Power-saving mode configurations
  • Scanning and registering to available networks
  • Collecting updates on network conditions
  • Answering phone calls and more
2.

What is the AT command messages?

The AT command list of messages varies depending on the modem and manufacturer. Generally, it commands for dialing, hanging up, sending SMS, setting modem parameters, and querying device information. There are several AT commands related to managing messages on a cellular modem, like

  • AT+CMGL - List Messages
  • AT+CMGL=ALL - Lists all messages
  • AT+CMGL=n - Lists message with index "n"
  • AT+CMGL=REC READ - Lists only received and read messages
  • AT+CMGL=REC UNREAD - Lists only received and unread messages
  • AT+CMGR - Read Message
  • AT+CMGS - Send Message
  • AT+CMGD - Delete Message
3.

What are 3GPP AT commands for?

3GPP AT commands are used to control 3G and 4G cellular modems in accordance with the 3rd Generation Partnership Project (3GPP) standards. They manage network registration, data connection, SMS, and other network-related functions, providing extensive control over modem operations.
4.

How do you send multiple commands?

There are two main ways to send multiple AT commands:

  • 1. Sending commands sequentially:This is the most common approach and involves sending each command one after the other, followed by a newline character (usually represented by \r or \r\n).
  • 2. Combining commands in a single line (limited compatibility): Some devices might allow chaining multiple AT commands in a single line separated by semicolons (;).
  • 5.

    What is the use of AT commands GSM?

    In GSM (Global System for Mobile Communications), AT commands interact with GSM modems. They control various functions, such as making calls, sending texts, and setting network parameters.
    6.

    What is the AT command GPRS?

    The AT command for GPRS (General Packet Radio Service) typically involves commands for setting up the Network Registration, PDP Context Management for bearer profile (e.g., AT+CGDCONT), and activating or deactivating the data service (e.g., AT+CGACT).
    7.

    What is the AT command in Bluetooth?

    AT commands in Bluetooth modems enable functions like device pairing, initiating or terminating connections, and setting device discoverability and naming.

    Author

    Bhaskar Dev

    Bhaskar Dev

    Head of Digital Marketing
    Cavli Wireless

    Sony Sunny

    Sony Sunny

    IoT Solutions Consultant, Cavli Wireless

    Share

    Related Blogs

    MQTT Protocol in IoT

    MQTT Protocol in IoT

    View Blog
    Architectural Advancements in 5G Technology

    Architectural Advancements in 5G Technology

    View Blog

    Featured Videos

    Image

    Use case

    Experience Real-Time Driving Intelligence

    Scaling IoT with Cavli Hubble

    Design with Cavli

    Scaling IoT with Cavli Hubble | Design with Cavli [...]

    Cavli AQ20  Automotive IoT module

    Onboarding Video Automotive

    Unveiling Cavli AQ20: Powering the Future of Autom [...]

    View All