# AT Commands

Command reference for controlling modems and communication modules.

AT commands are text-based instructions sent to a modem (communication module) over a serial interface. They are used to control the modem's behavior, check its status, and configure its connection settings. The name comes from the word "attention" - each command begins with the prefix `AT` to signal the modem that an instruction follows.

AT commands are standardized by 3GPP and ETSI, which means that a core set of commands works across modems from different manufacturers. However, each manufacturer may also provide additional vendor-specific commands. This page covers the generic, standards-based commands that apply to most cellular modems.

## Overview

When working with cellular IoT devices, you may need to interact directly with the modem to:

- Verify that the modem detects the SIM and reads its identity
- Check whether the modem is registered to a network
- Inspect the signal quality at the device's location
- View or change the selected network operator
- Configure the APN (Access Point Name) and data connection settings
- Enable or disable modem functionality

AT commands give you direct control over these operations, making them essential for initial device setup, [troubleshooting connectivity issues](https://docs.soracom.io/en/services/air/troubleshooting), and verifying modem behavior in the field.

## Accessing the AT Command Interface

To send AT commands, you need a serial or USB connection between your computer (or terminal) and the modem. The typical setup involves:

1. Connect your computer to the modem's serial or USB interface using an appropriate cable or adapter.
2. Open a serial terminal application and connect to the correct port at the modem's configured baud rate.

Common serial terminal applications include:

- **Windows**: [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) or [Tera Term](https://teratermproject.github.io/index-en.html), connected to the COM port where the modem is attached.
- **macOS / Linux**: The `screen` or `minicom` command, connected to a device file such as `/dev/tty.usbmodem*` or `/dev/ttyUSB*`. For example: `screen /dev/ttyUSB0 115200` or `minicom -D /dev/ttyUSB0 -b 115200`.

Some devices also provide access to the AT command interface through a built-in console, web interface, or debug port. Check your device's documentation for details.

> [!WARNING]
>
> Not all devices expose the modem's serial interface. If you are unsure whether your device allows direct access, review the device manual or contact the device manufacturer.

> [!NOTE]
>
> Soracom does not provide a way to send AT commands to a modem that does not already support them. While Soracom offers remote access services that can be used to reach a device over the network, these services only work if the device itself natively supports and has been configured for remote access to its AT command interface. The ability to execute AT commands depends entirely on your device's capabilities and configuration.

## Command Format and Responses

Every AT command starts with the `AT` prefix and ends with a carriage return. Commands are not case-sensitive, but uppercase is conventional.

There are three standard forms for most commands:

| Form | Syntax | Purpose |
| - | - | - |
| **Test** | `AT+CMD=?` | Query the range of supported parameters |
| **Read** | `AT+CMD?` | Query the current value or setting |
| **Write** | `AT+CMD=<value>` | Set a new value |

After you send a command, the modem responds with one of the following:

- `OK` indicates the command was accepted and executed successfully.
- `ERROR` or `+CME ERROR: <code>` indicates the command failed. The error code provides details about what went wrong. By default, some modems return only a generic `ERROR` response. Setting `AT+CMEE=2` configures the modem to return readable error descriptions instead of numeric codes, which can simplify troubleshooting. Look up CME error codes in your modem's AT command manual for specific details about each error.

> [!WARNING]
>
> Some commands produce one or more lines of output before the final `OK` or `ERROR` response. For example, `AT+CSQ` responds with `+CSQ: 15,99` followed by `OK` on a separate line.

## Safety Considerations

Before sending AT commands, be aware of the following:

- **Persistent settings**: Some commands change modem settings that survive a reboot. Incorrect values can affect the modem's ability to connect until they are corrected.
- **Connection loss**: Commands such as `AT+CFUN=0` disable the modem's radio, which immediately drops any active connection. If you are connected to the device remotely, this can make it unreachable.
- **Network disruption**: Changing the APN, authentication, or operator selection to incorrect values can prevent the modem from reconnecting to the network.
- **Read before write**: Use the read form (`AT+CMD?`) before using the write form (`AT+CMD=<value>`) so you understand the current configuration before changing it.

> [!NOTE]
>
> Always have your modem's AT command manual available. Incorrect parameters can leave the modem in a state that requires a factory reset to recover. If you are unsure about a command or its parameters, consult the manual or contact the modem manufacturer before proceeding.

The following commands are defined by 3GPP standards and are supported by most cellular modems. For each command, the expected response format and key values to look for are described.

## Error Reporting

### AT+CMEE=2

Enable verbose error reporting. By default, some modems return only a generic `ERROR` response when a command fails. This command configures the modem to return readable error descriptions, which simplifies troubleshooting.

```text
AT+CMEE=2
OK
```

The available modes are:

| Value | Behavior |
| - | - |
| `0` | Disable extended error reporting (modem returns only `ERROR`) |
| `1` | Enable numeric error codes (e.g., `+CME ERROR: 10`) |
| `2` | Enable verbose error descriptions (e.g., `+CME ERROR: SIM not inserted`) |

> [!WARNING]
>
> It is recommended to set `AT+CMEE=2` at the beginning of any troubleshooting session. This setting may not persist across modem restarts on all devices.

## Modem and SIM Identification

### ATI

Display modem identification information.

```text
ATI
Quectel
BG96
Revision: BG96MAR02A07M1G

OK
```

The response format varies by manufacturer but typically includes the modem model and firmware version.

### AT+CIMI

Display the IMSI (International Mobile Subscriber Identity) stored on the SIM.

```text
AT+CIMI
295050012345678

OK
```

The response should be a 15-digit number that matches the IMSI of your Soracom IoT SIM.

### AT+CCID

Display the ICCID (Integrated Circuit Card Identifier) of the SIM.

```text
AT+CCID
+CCID: 8942310000012345678

OK
```

The response should be a 19- or 20-digit number that matches the ICCID of your Soracom IoT SIM.

### AT+CPIN?

Check the SIM card status, including whether a PIN is required.

```text
AT+CPIN?
+CPIN: READY

OK
```

Common response values:

| Value | Meaning |
| - | - |
| `READY` | SIM is unlocked and ready for use |
| `SIM PIN` | SIM is locked and waiting for a PIN |
| `SIM PUK` | SIM is blocked and requires a PUK to unlock |
| `SIM NOT INSERTED` | No SIM detected |

If the response is anything other than `READY`, the modem cannot register to a network. Verify that the SIM is correctly inserted and that the correct PIN has been provided.

## Terminal/Command Session

### ATE

Enable or disable command echo.

```text
ATE1
OK
```

`ATE1` enables echo, causing the modem to send back each character it receives before processing the command. `ATE0` disables modem echo, so only the command response is shown. Note that some terminal programs may display local echo independently of the modem setting.

Disabling echo is typically preferred when sending commands programmatically from scripts or software, while enabling echo can be helpful for interactive debugging in a terminal.

## Modem Functionality

### AT+CFUN?

Query the current modem functionality level.

```text
AT+CFUN?
+CFUN: 1

OK
```

A value of `1` means full functionality is enabled (radio on). A value of `0` means the radio is disabled. A value of `4` means flight mode (radio off, SIM accessible).

### AT+CFUN=0

Disable the modem radio (minimum functionality). The modem deregisters from the network and drops any active data connection.

```text
AT+CFUN=0
OK
```

> [!NOTE]
>
> If you are connected to the device remotely over a cellular connection, sending this command will make the device unreachable until the radio is re-enabled locally.

### AT+CFUN=1

Enable full modem functionality (turn on the radio).

```text
AT+CFUN=1
OK
```

### AT+CFUN=4

Enable flight mode. The radio is turned off, but the SIM remains accessible. This is useful when you need to read SIM data or change modem configuration without maintaining a network connection.

```text
AT+CFUN=4
OK
```

## Operator Selection

> [!WARNING]
>
> When specifying an operator in `AT+COPS` commands, always use the numeric PLMN format (`2`) rather than the alphanumeric name. Alphanumeric operator names can vary between regions, firmware versions, and network configurations. For example, a device configured to select "Verizon" may fail to connect in locations where the network identifies itself as "Verizon Wireless". Numeric PLMN codes are standardized and do not change, so using `AT+COPS=X,2,"PLMN"` avoids these issues.

### AT+COPS=?

Scan for available network operators. This command typically takes 2-3 minutes to complete.

```text
AT+COPS=?
+COPS: (2,"T-Mobile","T-Mo","310260",7),(1,"AT&T","AT&T","310410",7)

OK
```

Each entry follows the format `(status,"long name","short name","PLMN",access technology)`. The status value indicates the operator's availability:

| Status | Meaning |
| - | - |
| `0` | Unknown |
| `1` | Available |
| `2` | Currently registered |
| `3` | Forbidden |

The access technology value indicates the network type. The most common values are listed below; refer to 3GPP TS 27.007 for the full set:

| Value | Network Type |
| - | - |
| `0` | 2G (GSM) |
| `2` | 3G (UTRAN) |
| `7` | 4G (LTE/LTE-M) |
| `9` | NB-IoT |

In the example above, T-Mobile (status `2`) is the currently registered operator on 4G, and AT\&T (status `1`) is available on 4G.

### AT+COPS?

Display the currently selected network operator.

```text
AT+COPS?
+COPS: 0,0,"T-Mobile"

OK
```

The response format is `+COPS: <mode>,<format>,"<operator>"`. The mode indicates how the operator was selected:

| Mode | Meaning |
| - | - |
| `0` | Automatic |
| `1` | Manual |
| `2` | Deregistered |
| `4` | Manual with automatic fallback |

The format indicates how the operator name is displayed (`0` = long alphanumeric, `1` = short alphanumeric, `2` = numeric PLMN). Use `AT+COPS=3,<format>` to change the display format.

### AT+COPS=0

Return to automatic network operator selection.

```text
AT+COPS=0
OK
```

### AT+COPS=1,2,"\<PLMN>"

Manually select a network operator by its PLMN code. For example, to select AT\&T in the United States:

```text
AT+COPS=1,2,"310410"
OK
```

The parameters are: `1` = manual selection mode, `2` = numeric PLMN format.

> [!NOTE]
>
> Using manual selection mode overrides all network steering, including preferences configured with `AT+CPOL`. The modem will only attempt to register on the specified network and will not fall back to any other operator. If the specified network is unavailable due to an outage, a roaming agreement change, or a coverage gap, the device will remain without connectivity until the network becomes available again or the setting is changed manually.

> [!WARNING]
>
> In most cases, using `AT+COPS=4,2,"<PLMN>"` (manual with automatic fallback) is preferred over `AT+COPS=1`, as it allows the modem to automatically select an alternative operator if the specified one is unavailable.

### AT+COPS=3,\<format>

Set the format used when displaying operator information in `AT+COPS?` responses, without changing the current operator selection. The format values are:

| Format | Display Type |
| - | - |
| `0` | Long alphanumeric (e.g., "T-Mobile") |
| `1` | Short alphanumeric (e.g., "T-Mo") |
| `2` | Numeric PLMN (e.g., "310260") |

For example, to display the operator as a numeric PLMN code:

```text
AT+COPS=3,2
OK

AT+COPS?
+COPS: 0,2,"310260"

OK
```

### AT+COPS=4,2,"\<PLMN>"

Attempt manual operator selection first, and fall back to automatic selection if the manual selection fails. This is useful when you prefer a specific operator but want the modem to find an alternative if that operator is unavailable.

```text
AT+COPS=4,2,"310410"
OK
```

The parameters follow the same format as manual selection (`AT+COPS=1`), but with mode `4` instead of `1`.

### AT+CPLS and AT+CPOL

These commands allow you to view and configure the UPLMN (User-controlled PLMN selector with Access Technology) list stored on the SIM. The UPLMN list defines which network operators the modem should prefer when searching for networks, and which radio access technologies to use with each operator.

**AT+CPLS** selects which PLMN list subsequent `AT+CPOL` commands will read or modify:

| Value | List | Description |
| - | - | - |
| `0` | UPLMN | User-controlled preferred list (read/write) |
| `1` | OPLMN | Operator-controlled preferred list (read only) |
| `2` | HPLMN | Home PLMN list (read only) |

**AT+CPOL?** displays the entries in the currently selected PLMN list.

**AT+CPOL=** adds or modifies entries in the UPLMN list. The parameters are: slot number, format (`2` = numeric PLMN), PLMN code, followed by flags for each supported radio access technology.

For example, to configure the UPLMN list with T-Mobile US on all radio access technologies and AT\&T on 4G only:

```text
AT+CPLS=0
OK

AT+CPOL=1,2,"310260",1,0,1,1
OK

AT+CPOL=2,2,"310410",0,0,0,1
OK
```

The radio access technology flags in `AT+CPOL` are positional:

| Position | Radio Access Technology |
| - | - |
| 1st | 2G (GSM) |
| 2nd | GSM Compact (legacy, typically set to `0`) |
| 3rd | 3G (UTRAN) |
| 4th | 4G (LTE, LTE-M, and NB-IoT) |

A value of `1` enables the radio access technology and `0` disables it. In the example above, T-Mobile is configured with 2G, 3G, and 4G enabled (`1,0,1,1`), while AT\&T is configured with 4G only (`0,0,0,1`).

> [!WARNING]
>
> Modifying the UPLMN list changes persistent SIM data. The OPLMN and HPLMN lists are read-only and cannot be modified with `AT+CPOL`.

## Network Registration

### AT+CREG?

Check network registration status (2G/3G networks).

```text
AT+CREG?
+CREG: 0,5

OK
```

### AT+CEREG?

Check network registration status (4G/LTE networks).

```text
AT+CEREG?
+CEREG: 0,5

OK
```

In both responses, the second value indicates the registration status:

| Value | Meaning |
| - | - |
| `0` | Not registered, not searching |
| `1` | Registered, home network |
| `2` | Not registered, searching |
| `3` | Registration denied |
| `4` | Unknown |
| `5` | Registered, roaming |

When using a Soracom IoT SIM with a global coverage plan such as plan01s, the expected value is `5` (registered, roaming). For plans with local coverage, the expected value is `1` (registered, home network).

## Signal Quality

### AT+CSQ

Query signal strength (RSSI) and bit error rate.

```text
AT+CSQ
+CSQ: 15,99

OK
```

The first value is the RSSI index:

| RSSI Value | Approximate Signal Strength |
| - | - |
| `0-9` | Poor (below -95 dBm) |
| `10-14` | Fair (-95 to -85 dBm) |
| `15-19` | Good (-85 to -75 dBm) |
| `20-31` | Excellent (above -75 dBm) |
| `99` | Unknown or not detectable |

The second value is the bit error rate. A value of `99` means it is not available, which is normal for most network types.

### AT+CESQ

Query extended signal quality measurements. This command provides more detailed metrics than `AT+CSQ`, including values specific to 3G and 4G networks.

```text
AT+CESQ
+CESQ: 99,99,255,255,20,55

OK
```

The response contains six values:

| Position | Metric | Network Type |
| - | - | - |
| 1st | RXLEV (received signal level) | 2G |
| 2nd | BER (bit error rate) | 2G |
| 3rd | RSCP (received signal code power) | 3G |
| 4th | Ec/No (energy per chip to noise ratio) | 3G |
| 5th | RSRQ (reference signal received quality) | 4G |
| 6th | RSRP (reference signal received power) | 4G |

Values of `99` or `255` indicate that the measurement is not available, which is expected for metrics that do not apply to the current network type. In the example above, the device is connected to a 4G network, so only RSRQ and RSRP contain valid measurements.

For RSRP, higher values indicate stronger signal. The approximate dBm equivalent is `value - 141`:

| RSRP Value | dBm Range | Approximate Signal Strength |
| - | - | - |
| `0-30` | -141 to -111 dBm | Poor |
| `31-50` | -110 to -91 dBm | Fair |
| `51-70` | -90 to -71 dBm | Good |
| `71-97` | -70 to -44 dBm | Excellent |

For RSRQ, higher values indicate better signal quality. The approximate dB equivalent is `(value / 2) - 20`:

| RSRQ Value | dB Range | Approximate Signal Quality |
| - | - | - |
| `0-9` | -20 to -15.5 dB | Poor |
| `10-19` | -15 to -10.5 dB | Fair |
| `20-29` | -10 to -5.5 dB | Good |
| `30-46` | -5 to 3 dB | Excellent |

> [!WARNING]
>
> `AT+CESQ` is defined in 3GPP TS 27.007 and supported by most modern modems, but some older modems may not support it. If the command returns an error, use `AT+CSQ` instead or check your modem's AT command manual for a vendor-specific alternative.

## APN and Data Connection

### AT+CGDCONT?

Query the current PDP context configuration.

```text
AT+CGDCONT?
+CGDCONT: 1,"IP","soracom.io","",0,0

OK
```

### AT+CGDCONT=1,"IP","soracom.io"

Define a PDP (Packet Data Protocol) context with Soracom's APN settings. This saves the configuration to PDP context slot 1.

```text
AT+CGDCONT=1,"IP","soracom.io"
OK
```

### AT+CGAUTH=1,2,"sora","sora"

Set CHAP (Challenge-Handshake Authentication Protocol) authentication credentials for PDP context 1. The parameters are: `1` = PDP context identifier, `2` = CHAP authentication type, followed by the username and password.

```text
AT+CGAUTH=1,2,"sora","sora"
OK
```

> [!WARNING]
>
> For Soracom APN settings including the APN name, username, password, and authentication type, see [Service Endpoints](https://docs.soracom.io/en/developers/service-endpoints).

### AT+CGATT?

Check whether the modem is attached to the packet domain.

```text
AT+CGATT?
+CGATT: 1

OK
```

A value of `1` means the modem is attached. A value of `0` means it is not attached.

### AT+CGACT?

Check whether a PDP context is activated.

```text
AT+CGACT?
+CGACT: 1,1

OK
```

The first value is the PDP context identifier and the second value is the activation status. `1` = activated, `0` = deactivated.

### AT+CGPADDR=1

Display the IP address assigned to PDP context 1.

```text
AT+CGPADDR=1
+CGPADDR: 1,"10.0.123.45"

OK
```

If the modem has been assigned an IP address, the data connection is established and the device should be able to send and receive data.

## Generic vs. Manufacturer-Specific Commands

The commands described above are defined by 3GPP standards and are supported by most cellular modems. However, modem manufacturers often provide additional proprietary commands that offer:

- More detailed diagnostic information (such as serving cell details, band information, or connection quality metrics)
- Simplified configuration for device-specific features
- Access to hardware-specific functionality not covered by the 3GPP standard

For the full set of commands available on your modem, refer to the AT command manual published by your modem's manufacturer. If you cannot find the manual, contact the manufacturer directly.

### Example: Generic vs. Vendor-Specific Signal Information

The generic `AT+CSQ` command returns a basic signal strength index:

```text
AT+CSQ
+CSQ: 15,99

OK
```

This provides a general indication of signal strength but limited detail. Some modem manufacturers offer proprietary commands that return much more detailed information. For example, a vendor-specific command might return the serving cell details including the frequency band, channel number, and additional signal quality measurements such as SINR:

```text
AT+VENDORCMD="servingcell"
+VENDORCMD: "servingcell","NOCHANGE","LTE","FDD",310,260,BFD3,318E202,100,7,5,5,-95,-8,15,25

OK
```

> [!WARNING]
>
> The vendor-specific command shown above is a fictional example for illustration purposes. The actual command name, syntax, and output format will differ depending on your modem manufacturer and model. Refer to your modem's AT command manual for the correct command.
