Sony Sunny
IoT Solutions Consultant
Cavli Wireless
AT Commands or ‘ATtention’ Commands is the basis of communication between any cellular (or RF) modems and its host controller. Any firmware or hardware developer working with these modems will make use of these modem AT commands to essentially send instructions on various functions.
AT Command set , which are now a universal instruction standard for all cellular modems, even by different manufacturers, was originally created by Dennis Heyes as the Heyes Command Set for the ‘Heyes 300 Baud Smart Modem’ in 1981.
AT Commands are mainly used to configure and debug modems as well as to enable network connection to a carrier in GSM, GPRS, and mobile phone modems. 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:
Even today, AT Commands, are still being used to establish and configure network connections on modern 5G modems as well.
AT Command instructions are single-line instructions that need to be sent to the device in sequential order while the user has to wait for the response (in most cases) before sending the next command. Sending across the relevant AT Commands and receiving its responses usually requires a host device such as a microcontroller that is connected to the modem via a UART (Universal Asynchronous Receiver/Transmitter). 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.
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>
Any AT Command will need to be preceded by “AT” in order to invoke the AT Command functions within the modem which is then followed by the actual command that needs to be sent to the modem which is trailed by the suffix in order to indicate the command mode or ‘type’ and then the data that is needed to be sent, although this field might not be required 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.
AT Commands can be broadly classified into two sets, Basic Commands, and Extended Commands.
These are cellular modem AT Commands that do not begin with the “+” symbol. Some of the common AT commands under the basic set are D (Dial), A (Answer), H (Hook control), and O (Return to online data state).
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
Type | Suffix | Role |
---|---|---|
Read |
?
|
Get a modem configuration setting |
Set |
=
|
Set a modem configuration setting |
Execute | None | Trigger 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:
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 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 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 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 |
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
There are 7 basic universal AT Commands that can be easily familiarized with for any modem.
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.
This command sets up the SMS mode of the modem. By preceding the command with a 0 or a 1, text or PDU mode can be selected. 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 |
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 |
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 is the simplest command to dial a provided number.
Syntax: | ATD<Phone Number>; |
---|---|
For example: | ATD+123456789; |
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
|
ATH is a command used to disconnect a remote user connects to the modem.
Syntax: | ATH(Enter) |
---|
Major AT Commands for GSM modems areas listed below. Not all commands are supposed by all modems due to hardware or software limitations
Command | Description |
---|---|
AT | Checking communication between the module and computer. |
Command | Description |
---|---|
ATA | Answer command |
ATD | Dial command |
ATH | Hang up call |
ATL | Monitor speaker loudness |
ATM | Monitor speaker mode |
ATO | Go on-line |
ATP | Set pulse dial as default |
ATT | Set tone dial as default |
AT+CSTA | Select type of address |
AT+CRC | Cellular result codes |
Command | Description |
---|---|
ATI | Identification. |
ATS | Select an S-register |
ATZ | Recall stored profile |
AT&F | Restore factory settings |
AT&V | View active configuration |
AT&W | Store parameters in given profile |
AT&Y | Select Set as power up option |
AT+CLCK | Facility lock command |
AT+COLP | Connected line identification presentation |
AT+GCAP | Request complete capabilities list |
AT+GMI | Request manufacturer identification |
AT+GMM | Request model identification |
AT+GMR | Request revision identification |
AT+GSN | Request product serial number identification (IMEI) |
Command | Description |
---|---|
ATE | Command Echo |
ATQ | Result code suppression |
ATV | Define response format |
ATX | Response range selection |
AT&C | Define DCD usage |
AT&D | Define DTR usage |
AT&K | Select flow control |
AT&Q | Define communications mode option |
AT&S | Define DSR option |
AT+ICF | DTE-DCE character framing |
AT+IFC | DTE-DCE Local flow control |
AT+IPR | Fixed DTE rate |
Command | Description |
---|---|
AT+CLIP | Calling line identification presentation |
AT+CR | Service reporting control |
AT+DR | Data compression reporting |
AT+ILRR | DTE-DCE local rate reporting |
Command | Description |
---|---|
ATB | Communications standard option |
AT+CBST | Select bearer service type |
AT+CEER | Extended error report |
AT+CRLP | Radio link protocol |
AT+DS | Data compression |
Command | Description |
---|---|
A/ | Re-execute command line |
AT? | Command help |
AT*C | Start SMS interpreter |
AT*T | Enter SMS block mode protocol |
AT*V | Activate V.25bis mode |
AT*NOKIATEST | Test command |
AT+CESP | Enter SMS block mode protocol |
Command | Description |
---|---|
AT+CSMS | Select message service |
AT+CPMS | Preferred message storage |
AT+CMGF | Message format |
AT+CSCA | Service center address |
AT+CSMP | Set text mode parameters |
AT+CSDH | Show text mode parameters |
AT+CSCB | Select cell broadcast message types |
AT+CSAS | Save settings |
AT+CRES | Restore settings |
AT+CNMI | New message indications to TE |
AT+CMGL | List messages |
AT+CMGR | Read message |
AT+CMGS | Send message |
AT+CMSS | Send message from storage |
AT+CMGW | Writes message to memory |
AT+CMGD | Delete message |
Command | Description |
---|---|
AT+CMGL | List Messages |
AT+CMGR | Read message |
AT+CMGS | Send message |
AT+CMGW | Writes message to memory |
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.
With this in mind, Cavli has engineered our SmartModules with the capability to receive AT Commands over cellular networks through Cavli Hubble IoT platform. 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.
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:
The AT command list of messages varies depending on the modem and its manufacturer. Generally, it includes 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
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.
There are two main ways to send multiple AT commands:
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.
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).
AT commands in Bluetooth modems enable functions like device pairing, initiating or terminating connections, and setting device discoverability and naming.