Generic AT commands

This page describes generic AT commands.

UART baud rate AT+IPR

The AT+IPR command sets the UART baud rate.

Set command

The set command sets the UART baud rate. Serial Modem does not support automatic baud rate detection. When the device resets, the baud rate is set to the default value set in the devicetree.

Syntax

AT+IPR=<baud_rate>

The <baud_rate> parameter is an integer value specifying the desired baud rate.

Note

The baud rate change takes effect after the modem responds with OK. The host must switch to the new baud rate to continue communication.

Example

Set the baud rate to 115200.

AT+IPR=115200
OK

Read command

The read command reads the current UART baud rate.

Syntax

AT+IPR?

Response syntax

+IPR: <baud_rate>

Example

AT+IPR?
+IPR: 115200
OK

Test command

The test command lists the supported baud rates.

Syntax

AT+IPR=?

Response syntax

+IPR: (list of supported autodetectable baud rates)[,(list of fixed-only baud rates)]

Example

AT+IPR=?
+IPR: (),(115200,230400,460800,921600,1000000)
OK

Serial Modem echo E0/E1

The E command enables or disables the AT command echo feature of the Serial Modem application.

Set command

The set command enables or disables the AT command echo feature. While enabled, the Serial Modem application echoes back all the characters that are received in the AT command mode.

Note

When working with a terminal, you should disable local echo to avoid double echoing of characters.

Syntax

ATE1 - Enable AT command echo.
ATE0 - Disable AT command echo (default).

Example

Set the AT command echo:

ATE1
OK

AT
AT    // Echoed command
OK

ATE0
ATE0  // Echoed command
OK

AT
OK

Read command

The read command is not supported.

Test command

The test command is not supported.

Serial Modem version #XSMVER

The #XSMVER command return the versions of the Serial Modem and nRF Connect SDK in which the Serial Modem application is built.

Set command

The set command returns the versions of the Serial Modem and nRF Connect SDK.

Syntax

AT#XSMVER

Response syntax

#XSMVER: "<sm_version>","<ncs_version>"[,"<customer_version>"]

The <sm_version> parameter is the version of the Serial Modem application in Git-describe style. The major.minor.patch prefix comes from app/VERSION; the optional -N-g<hash> suffix (and -dirty) comes from git describe in the application tree. Example: "v1.99.0-68-gb2d3dde4dfa2" uses 1.99.0 from app/VERSION and -68-gb2d3dde4dfa2 from Git.

Hosts can use that major.minor.patch prefix to verify that application DFU moved to a newer image (compare AT#XSMVER before and after update). MCUboot applies the same ordering using the sign version from app/VERSION (major.minor.patch+tweak); the Git suffix is not part of that check. See Releasing Serial Modem for release version updates.

The <ncs_version> parameter is a string containing the version of the nRF Connect SDK.

The <customer_version> parameter is the CONFIG_SM_CUSTOMER_VERSION string, if defined.

Example

The following command example reads the versions:

// First v2.0.0 pre-release
AT#XSMVER
#XSMVER: "v1.99.0","3.3.99"
OK

// Development build
AT#XSMVER
#XSMVER: "v1.99.0-67-ga9e396bc3d58","3.3.99"
OK

// Second v2.0.0 pre-release (VERSION 1.99.1)
AT#XSMVER
#XSMVER: "v1.99.1","3.3.99"
OK

// v2.0.0 release
AT#XSMVER
#XSMVER: "v2.0.0","3.4.0"
OK

// Pre-release with customer version
AT#XSMVER
#XSMVER: "v1.99.0","3.3.99","Onomondo 2.1.0"
OK

Read command

The read command is not supported.

Test command

The test command is not supported.

SM proprietary command list #XCLAC

The #XCLAC command requests the list of the proprietary Serial Modem commands.

Set command

The set command requests the list of the proprietary Serial Modem commands. It is an add-on for AT+CLAC, which lists all modem AT commands.

Syntax

AT#XCLAC

Response syntax

<command list>

The <command list> parameter returns a list of values representing all the #X* commands followed by <CR><LF>.

Example

AT#XCLAC
AT#XSMVER
AT#XSLEEP
AT#XCLAC
AT#XSOCKET
AT#XBIND
AT#XCONNECT
AT#XSEND
AT#XRECV
AT#XSENDTO
AT#XRECVFROM
AT#XPING
AT#XGNSS
OK

Read command

The read command is not supported.

Test command

The test command is not supported.

:

Data mode control #XDATACTRL

The #XDATACTRL command allows you to configure the time limit used to trigger data transmissions. It can be applied only after entering data mode.

When the time limit is configured, small-size packets will be sent only after the timeout.

Set command

The set command allows you to configure the time limit for the data mode.

Syntax

AT#XDATACTRL=<time_limit>
  • The <time_limit> parameter sets the timeout value in milliseconds. The default value is the minimum required value, based on the configured UART baud rate. This value must be long enough to allow for a DMA transmission of an UART receive (RX) buffer (CONFIG_SM_UART_RX_BUF_SIZE).

Read command

The read command allows you to check the current time limit configuration and the minimum value required, based on the configured UART baud rate.

Syntax

AT#XDATACTRL?

Response syntax

#XDATACTRL: <current_time_limit>,<minimal_time_limit>

Test command

The test command tests the existence of the command and provides information about the type of its subparameters.

Syntax

AT#XDATACTRL=?

Response syntax

#XDATACTRL=<time_limit>

Exit data mode #XDATAMODE

When the application receives the termination command CONFIG_SM_DATAMODE_TERMINATOR in data mode, it sends the #XDATAMODE unsolicited notification.

Unsolicited notification

#XDATAMODE: <status>
  • The <status> parameter is an integer that indicates the status of the data mode operation. It can have one of the following values:

    • 0 - Success

    • -1 - Failure

Example

AT#XSEND=0,2,0

OK
Test datamode
+++
#XDATAMODE: 0

Power saving #XSLEEP

The #XSLEEP command makes the Serial Modem application to enter idle or sleep mode.

Note

The #XSLEEP command is intended for experimentation and power consumption measurements and must not be used in production.

You can use the DTR (Data Terminal Ready) and RI (Ring Indicator) signals to control the power state of the UART between the Serial Modem and the host. See the UART configuration section for more information about DTR and RI.

Note

If you want to do power measurements on the nRF91 Series development kit while running the Serial Modem application, remember to disable unused peripherals.

Set command

The set command makes the Serial Modem application enter either Idle or Sleep mode.

Syntax

AT#XSLEEP=<sleep_mode>

The <sleep_mode> parameter accepts only the following integer values:

  • 1 - Enter Sleep. In this mode, both the Serial Modem service and the LTE connection are terminated.

    Serial Modem can be woken up using the DTR pin (dtr-gpios).

  • 2 - Enter Idle. In this mode, both the Serial Modem service and the LTE connection are maintained, but the UART is disabled to save power. Received data is buffered and sent to the host after idle mode is exited.

    Serial Modem can exit the idle mode using the DTR pin (dtr-gpios). When the Serial Modem is in idle mode, and there is data to be read by the host, the RI pin (ri-gpios) is asserted for a short period of time to notify the host. The host can then deassert and assert DTR to exit idle mode and read the data.

The DTR pin is defined either in the boards/*_ns.overlay overlay file matching your board or in the overlay-external-mcu.overlay overlay file, if it is included.

Note

  • If the modem is on, entering Sleep mode (by issuing AT#XSLEEP=1 ) sends a +CFUN=0 command to the modem, which causes a write to non-volatile memory (NVM). Take the NVM wear into account, or put the modem in flight mode by issuing AT+CFUN=4 before Sleep mode.

Examples

AT#XSLEEP=0
ERROR
AT#XSLEEP=1
OK

See the following for an example of when the modem is on:

AT+CFUN=4
OK

AT#XSLEEP=1
OK
AT#XSLEEP=2
OK

Read command

The read command is not supported.

Test command

The test command tests the existence of the AT command and provides information about the type of its subparameters.

Syntax

AT#XSLEEP=?

Response syntax

#XSLEEP: <list of shutdown_mode>

Example

AT#XSLEEP=?
#XSLEEP: (1,2)
OK

Power off #XSHUTDOWN

The #XSHUTDOWN command makes the nRF91 Series SiP enter System OFF mode, which is the deepest power saving mode.

Set command

The set command makes the nRF91 Series SiP enter System OFF mode.

Syntax

AT#XSHUTDOWN

Note

In this case the nRF91 Series SiP cannot be woken up using the DTR pin (dtr-gpios).

Example

AT#XSHUTDOWN
OK

Read command

The read command is not supported.

Test command

The test command is not supported.

Reset #XRESET

The #XRESET command performs a soft reset of the nRF91 Series SiP.

Set command

The set command resets the nRF91 Series SiP.

Syntax

AT#XRESET

Example

AT#XRESET
OK
Ready

Read command

The read command is not supported.

Test command

The test command is not supported.

Modem reset #XMODEMRESET

The #XMODEMRESET command performs a reset of the modem.

The modem is set to minimal function mode (via +CFUN=0) before being reset. The Serial Modem application is not restarted. After the command returns, the modem will be in minimal function mode.

Set command

The set command resets the modem.

Syntax

AT#XMODEMRESET

Response syntax

#XMODEMRESET: <result>[,<error_code>]
  • The <result> parameter is an integer indicating the result of the command. It can have the following values:

    • 0 - Success.

    • Positive value - On failure, indicates the step that failed.

  • The <error_code> parameter is an integer. It is only printed when the modem reset was not successful and is the error code indicating the reason for the failure.

Example

AT#XMODEMRESET

#XMODEMRESET: 0

OK

Read command

The read command is not supported.

Test command

The test command is not supported.

Device UUID #XUUID

The #XUUID command requests the device UUID.

Set command

The set command returns the device UUID.

Syntax

AT#XUUID

Response syntax

#XUUID: <device-uuid>

The <device-uuid> parameter returns a string indicating the UUID of the device.

Example

AT#XUUID

#XUUID: 50503041-3633-4261-803d-1e2b8f70111a

OK

Read command

The read command is not supported.

Test command

The test command is not supported.

MCUboot bootloader info #XBOOTINFO

Query information about the MCUboot second-stage bootloader.

This command is only available when the firmware is built with the NSIB (B0) and MCUboot as a second-stage bootloader.

Set command

AT#XBOOTINFO=<op>
  • <op> - Operation to perform:

    • 0 - Query the firmware version of the active MCUboot slot.

    • 1 - Query which MCUboot slot is currently active.

Response syntax

#XBOOTINFO: <value>
  • When <op> is 0 - <value> is an unsigned integer representing fw_info.version of the active MCUboot slot, set at build time using CONFIG_FW_INFO_FIRMWARE_VERSION and used by NSIB as a downgrade-protection counter.

  • When <op> is 1 - <value> is 0 if slot s0 is active and 1 if slot s1 is active.

Examples

Query the firmware version of the active MCUboot slot:

AT#XBOOTINFO=0

#XBOOTINFO: 1

OK

Query the active MCUboot slot:

AT#XBOOTINFO=1

#XBOOTINFO: 0

OK

Test command

AT#XBOOTINFO=?

Response syntax

#XBOOTINFO: (0,1)

Example

AT#XBOOTINFO=?
#XBOOTINFO: (0,1)
OK

Modem fault #XMODEM

The application monitors the modem status. When the application detects a modem fault, it sends the #XMODEM unsolicited notification.

Unsolicited notification

The application sends the following unsolicited notification when it detects a modem fault:

#XMODEM: FAULT,<reason>,<program_count>

The <reason> parameter returns a hexadecimal integer indicating the reason of the modem fault. The <program_count> parameter returns a hexadecimal integer indicating the address of the modem fault.

The application sends the following unsolicited notification when it shuts down libmodem:

#XMODEM: SHUTDOWN,<result>

The <result> parameter returns an integer indicating the result of the shutdown of libmodem.

The application sends the following unsolicited notification when it re-initializes libmodem:

#XMODEM: INIT,<result>

The <result> parameter returns an integer indicating the result of the re-initialization of libmodem.

Note

After libmodem is re-initialized, the MCU side must restart the current active service as follows:

  1. Stopping the service. For example, disconnecting the TCP connection and closing the socket.

  2. Connecting again using LTE.

  3. Restarting the service. For example, opening the socket and re-establishing the TCP connection.