CL4040 programming user guide
The AT Commands have standardized syntax rules.
Words enclosed in <angle brackets> are references to syntactical elements. Words enclosed in [square brackets] represent optional items that can be left out of the command line at the specified point. The brackets are not used when the words appear in the command line.
<CR>
, <LF>
and <CR><LF>
are allowed in an AT command sent by an application.
A string type parameter input must be enclosed between quotation marks ("string"
).
There are 3 types of AT commands:
Set command
<CMD>[=...]
. Set commands set values or perform actions.Read command
<CMD>?
. Read commands check the current values of subparameters.Test command
<CMD>=?
. Test commands test the existence of the command and provide information about the type of its subparameters. Some test commands can also have other functionality.
AT responds to all commands with a final response.
See the following subpages for documentation of the proprietary AT commands.
Generic AT commands
The following commands list contains generic AT commands.
SLM version #XSLMVER
The #XSLMVER
command return the versions of the CL4040.
It also returns the version of the modem library.
Set command
The set command returns the versions of the CL4040 and the modem library.
Syntax
#XSLMVER
Response syntax
#XSLMVER: <ncs_version>,<libmodem_version>
The <ncs_version>
value returns a string containing the version of the CL4040.
The <libmodem_version>
value returns a string containing the version of the modem library.
Example
The following command example reads the versions:
AT#XSLMVER
#XSLMVER: "2.3.0","2.3.0"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
proprietary command list #XCLAC
The #XCLAC
command requests the list of the proprietary commands.
Set command
The set command requests the list of the proprietary commands.
It is an add-on for AT+CLAC
, which lists all modem AT commands.
Syntax
#XCLAC
Response syntax
<command list>
The <command list>
value returns a list of values representing all the #X*
commands followed by <CR><LF>.
Example
at#xclac
AT#XSLMVER
AT#XSLEEP
AT#XCLAC
AT#XSOCKET
AT#XBIND
AT#XCONNECT
AT#XSEND
AT#XRECV
AT#XSENDTO
AT#XRECVFROM
AT#XPING
AT#XGPS
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Power saving #XSLEEP
The #XSLEEP
command makes the CL4040 System in Package (SiP) enter idle or sleep mode.
Set command
The set command makes the CL4040 SiP enter either Idle or Sleep mode.
Syntax
#XSLEEP=<sleep_mode>
The <sleep_mode>
parameter accepts only the following integer values:
0
- Deprecated.1
- Enter Sleep. In this mode, both the SLM service and the LTE connection are terminated.The CL4040 can be woken up using the CONFIG_SLM_WAKEUP_PIN`.
2
- Enter Idle.In this mode, both the SLM service and the LTE connection are maintained. The CL4040 can be made to exit idle using the CONFIG_SLM_WAKEUP_PIN. If the CONFIG_SLM_INDICATE_PIN is defined, SLM toggle this GPIO when there is data for MCU. MCU could in turn make SLM to exit idle by CONFIG_SLM_WAKEUP_PIN. The data is buffered during the idle status and sent to MCU after exiting the idle status.
Note
This parameter does not accept
0
anymore.If the modem is on, entering Sleep mode sends a
+CFUN=0
command to the modem, which causes a non-volatile memory (NVM) write. Take the NVM wear into account, or put the modem in flight mode by issuing aAT+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
#XSLEEP=?
Response syntax
#XSLEEP: <list of shutdown_mode>
Example
#XSLEEP: (1,2)
OK
Power off #XSHUTDOWN
The #XSHUTDOWN
command makes the CL4040 enter System OFF mode, which is the deepest power saving mode.
Set command
The set command makes the CL4040 enter System OFF mode.
Syntax
#XSHUTDOWN
Note
In this case the CL4040 cannot be woken up using the CONFIG_SLM_WAKEUP_PIN.
Examples
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 to the CL4040.
Set command
The set command resets the CL4040.
Syntax
#XRESET
Examples
AT#XRESET
OK
Ready
Read command
The read command is not supported.
Test command
The test command is not supported.
SLM UART #XSLMUART
The #XSLMUART
command manages the UART settings.
Set command
The set command changes the UART baud rate and hardware flow control settings.
Hardware flow control settings can be changed only if hw-flow-control
is enabled in device tree.
These settings are stored in the flash memory and applied during the application startup.
Syntax
The following is the syntax when hw-flow-control
is enabled in device tree.:
#XSLMUART[=<baud_rate>,<hwfc>]
The following is the syntax when hw-flow-control
is disabled in device tree.:
#XSLMUART[=<baud_rate>]
The <baud_rate>
parameter is an integer.
It accepts the following values:
1200
- 1200 bps2400
- 2400 bps4800
- 4800 bps9600
- 9600 bps14400
- 14400 bps19200
- 19200 bps38400
- 38400 bps57600
- 57600 bps115200
- 115200 bps230400
- 230400 bps460800
- 460800 bps921600
- 921600 bps1000000
- 1000000 bps
Its default value is 115200
.
When not specified, it is set to the last value set for the variable and stored in the flash memory.
If there is no value stored for the variable, it is set to its default value.
If not specified, the previous value is used.
The <hwfc>
parameter accepts the following integer values:
0
- Disable UART hardware flow control.1
- Enable UART hardware flow control. In this mode, SLM configures both the RTS and the CTS pins according to the device-tree file.
Its default value is 1
.
When not specified, it is set to the last value set for the variable and stored in the flash memory.
If there is no value stored for the variable, it is set to its default value.
Response syntax
There is no response.
Example
AT#XSLMUART=1000000,1
OK
Read command
The read command shows the current UART settings.
Syntax
AT#XSLMUART?
Response syntax
#XSLMUART: <baud_rate>,<hwfc>
Example
AT#XSLMUART?
#XSLMUART: 115200,1
OK
Test command
The test command tests the existence of the AT command and provides information about the type of its subparameters.
Syntax
#XSLMUART=?
Response syntax
The following is the syntax when hw-flow-control
is enabled in device tree:
#XSLMUART: (list of the available baud rate options),(disable or enable hwfc)
The following is the syntax when hw-flow-control
is disabled in device tree:
#XSLMUART: (list of the available baud rate options)
Example
The following is an example when hw-flow-control
is enabled in device tree:
AT#XSLMUART=?
#XSLMUART: (1200,2400,4800,9600,14400,19200,38400,57600,115200,230400,460800,921600,1000000),(0,1)
The following is an example when hw-flow-control
is disabled in device tree.:
AT#XSLMUART=?
#XSLMUART: (1200,2400,4800,9600,14400,19200,38400,57600,115200,230400,460800,921600,1000000)
Device UUID #XUUID
The #XUUID
command requests the device UUID.
Set command
The set command returns the device UUID.
Syntax
#XUUID
Response syntax
#XUUID: <device-uuid>
The <device-uuid>
value 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.
Native TLS CMNG #XCMNG
The #XCMNG
command manages the credentials to support CONFIG_SLM_NATIVE_TLS.
This command is similar to the modem %CMNG
command.
Set command
The set command is used for credential storage management. The command writes, reads, deletes, and checks the existence of keys and certificates.
Syntax
The following is the syntax when CONFIG_SLM_NATIVE_TLS is selected:
#XCMNG=<opcode>[,<sec_tag>[,<type>[,<content>]]]
The <opcode>
parameter is an integer.
It accepts the following values:
0
- Write a credential.1
- List credentials (currently not supported).2
- Read a credential (currently not supported).3
- Delete a credential.
The <sec_tag>
parameter is an integer ranging between 0
and 2147483647
.
It is mandatory for write, read, and delete operations.
It is optional for list operations.
The <type>
parameter is an integer.
It accepts the following values:
0
- Root CA certificate (ASCII text)1
- Certificate (ASCII text)2
- Private key (ASCII text)
The <content>
parameter is a string.
It is mandatory if <opcode>
is 0
(write a credential).
It is the content of a Privacy Enhanced Mail (PEM) file enclosed in double quotes (X.509 PEM entities).
An empty string is not allowed.
Response syntax
There is no response.
Example
AT#XCMNG=0,10,0,"-----BEGIN CERTIFICATE-----
MIICpTCCAkugAwIBAgIUS+wVM0VsVmpDIV8NTW8N2KEdRdowCgYIKoZIzj0EAwIw
gacxCzAJBgNVBAYTAlRXMQ8wDQYDVQQIDAZUYWl3YW4xDzANBgNVBAcMBlRhaXBl
aTEWMBQGA1UECgwNTm9yZGljIFRhaXBlaTEOMAwGA1UECwwFU2FsZXMxETAPBgNV
BAMMCExhcnJ5IENBMTswOQYJKoZIhvcNAQkBFixsYXJyeS52ZXJ5bG9uZ2xvbmds
b25nbG9uZ2xvbmdAbm9yZGljc2VtaS5ubzAeFw0yMDExMTcxMTE3MDlaFw0zMDEx
MTUxMTE3MDlaMIGnMQswCQYDVQQGEwJUVzEPMA0GA1UECAwGVGFpd2FuMQ8wDQYD
VQQHDAZUYWlwZWkxFjAUBgNVBAoMDU5vcmRpYyBUYWlwZWkxDjAMBgNVBAsMBVNh
bGVzMREwDwYDVQQDDAhMYXJyeSBDQTE7MDkGCSqGSIb3DQEJARYsbGFycnkudmVy
eWxvbmdsb25nbG9uZ2xvbmdsb25nQG5vcmRpY3NlbWkubm8wWTATBgcqhkjOPQIB
BggqhkjOPQMBBwNCAASvk+LcLXwteWokU1In+FQUWkkbQhkpW61u7d0jV1y/eF3Q
PTDAoEz//SnU1kIZccAqV64fFrrd2nkXknLCrhtxo1MwUTAdBgNVHQ4EFgQUMYSO
cWPI+SQUs1oVatNQvN/F0UowHwYDVR0jBBgwFoAUMYSOcWPI+SQUs1oVatNQvN/F
0UowDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNIADBFAiB2IrzpUmQqcUIw
OVqOMNAlzR6v4YHlI9InxU01quIRtQIhAOTITnLNuA0r0571SSBKZyrNGzxJxcPO
FDkGjew9OVov
-----END CERTIFICATE-----"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
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>
value returns a hexadecimal integer indicating the reason of the modem fault.
The <program_count>
value 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>
value 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>
value 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:
Stopping the service. For example, disconnecting the TCP connection and closing the socket.
Connecting again using LTE.
Restarting the service. For example, opening the socket and re-establishing the TCP connection.
Socket AT commands
The following commands list contains socket-related AT commands. The application can open up to 8 sockets and select the active one among them.
Socket #XSOCKET
The #XSOCKET
command allows you to open or close a socket and to check the socket handle.
Set command
The set command allows you to open or close a socket.
Syntax
#XSOCKET=<op>[,<type>,<role>[,<cid>]]
The
<op>
parameter can accept one of the following values:0
- Close a socket.1
- Open a socket for IP protocol family version 4.2
- Open a socket for IP protocol family version 6.
When
0
, the highest-ranked socket is made active after the current one is closed.The
<type>
parameter can accept one of the following values:1
- SetSOCK_STREAM
for the stream socket type using the TCP protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the UDP protocol.3
- SetSOCK_RAW
for the raw socket type using a generic IP protocol.
The
<role>
parameter can accept one of the following values:0
- Client.1
- Server.
The
<cid>
parameter is an integer. It representscid
in the+CGDCONT
command. Its default value is0
.
Response syntax
#XSOCKET: <handle>,<type>,<protocol>
#XSOCKET: <result>,"closed"
The
<handle>
value is an integer and can be interpreted as follows:Positive or
0
- The socket opened successfully.Negative - The socket failed to open.
The
<type>
value can be one of the following integers:1
- SetSOCK_STREAM
for the stream socket type using the TCP protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the UDP protocol.3
- SetSOCK_RAW
for the raw socket type using a generic IP protocol.
The
<protocol>
value can be one of the following integers:0
- IPPROTO_IP.6
- IPPROTO_TCP.17
- IPPROTO_UDP.
The
<result>
value indicates the result of closing the socket. When0
, the socket closed successfully.
Examples
AT#XSOCKET=1,1,0
#XSOCKET: 3,1,6
OK
AT#XSOCKET=1,2,0
#XSOCKET: 1,2,17
OK
AT#XSOCKET=2,1,0
#XSOCKET: 1,1,6
OK
AT#XSOCKET=1,3,0
#XSOCKET: 1,3,0
OK
AT#XSOCKET=0
#XSOCKET: 0,"closed"
OK
Read command
The read command allows you to check the socket handle.
Syntax
#XSOCKET?
Response syntax
#XSOCKET: <handle>,<family>,<role>,<type>,<cid>
The
<handle>
value is an integer. When positive or0
, the socket is valid.The
<family>
value is present only in the response to a request to open the socket. It can return one of the following values:1
- IP protocol family version 4.2
- IP protocol family version 6.3
- Packet family.
The
<role>
value can be one of the following integers:0
- Client.1
- Server.
The
<type>
value can be one of the following integers:1
- SetSOCK_STREAM
for the stream socket type using the TCP protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the UDP protocol.3
- SetSOCK_RAW
for the raw socket type using a generic IP protocol.
The
<cid>
parameter is an integer. It representscid
in the+CGDCONT
command.
Examples
AT#XSOCKET?
#XSOCKET: 3,1,0,1,0
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XSOCKET=?
Response syntax
#XSOCKET: <list of op>,<list of types>,<list of roles>,<cid>
The
<list of op>
value can be one of the following integers:0
- Close a socket.1
- Open a socket for IP protocol family version 4.2
- Open a socket for IP protocol family version 6.
The
<list of types>
value can be one of the following integers:1
- SetSOCK_STREAM
for the stream socket type using the TCP protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the UDP protocol.3
- SetSOCK_RAW
for the raw socket type using a generic IP protocol.
The
<list of roles>
value can be one of the following integers:0
- Client.1
- Server.
Examples
AT#XSOCKET=?
#XSOCKET: (0,1,2),(1,2,3),(0,1),<cid>
OK
Secure Socket #XSSOCKET
The #XSSOCKET
command allows you to open or close a secure socket, and to check the socket handle.
Note
TLS and DTLS servers are currently not supported.
Set command
The set command allows you to open or close a secure socket.
Syntax
#XSSOCKET=<op>[,<type>,<role>,<sec_tag>[,<peer_verify>[,<cid>]]
The
<op>
parameter can accept one of the following values:0
- Close a socket.1
- Open a socket for IP protocol family version 4.2
- Open a socket for IP protocol family version 6.
When
0
, the highest-ranked socket is made active after the current one is closed.The
<type>
parameter can accept one of the following values:1
- SetSOCK_STREAM
for the stream socket type using the TLS 1.2 protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the DTLS 1.2 protocol.
The
<role>
parameter can accept one of the following values:0
- Client.1
- Server.
The
<sec_tag>
parameter is an integer. It indicates to the modem the credential of the security tag to be used for establishing a secure connection. It is associated with a credential, that is, a certificate or PSK. The credential should be stored on the modem side beforehand.The
<peer_verify>
parameter can accept one of the following values:0
- None (default for server role).1
- Optional.2
- Required (default for client role).
The
<cid>
parameter is an integer. It representscid
in the+CGDCONT
command. Its default value is0
.
Response syntax
#XSSOCKET: <handle>,<type>,<protocol>
#XSOCKET: <result>,"closed"
The
<handle>
value is an integer and can be interpreted as follows:Positive or
0
- The socket opened successfully.Negative - The socket failed to open.
The
<type>
value can be one of the following integers:1
-SOCK_STREAM
for the stream socket type using the TLS 1.2 protocol.2
-SOCK_DGRAM
for the datagram socket type using the DTLS 1.2 protocol.
The
<protocol>
value can be one of the following integers:258
- IPPROTO_TLS_1_2.273
- IPPROTO_DTLS_1_2.
The
<result>
value indicates the result of closing the socket. When0
, the socket closed successfully.
Examples
AT#XSSOCKET=1,1,0,16842753,2
#XSSOCKET: 2,1,258
OK
AT#XSOCKET=0
#XSOCKET: 0,"closed"
OK
AT#XSSOCKET=1,2,0,16842753
#XSSOCKET: 2,2,273
OK
AT#XSOCKET=0
#XSOCKET: 0,"closed"
OK
Read command
The read command allows you to check the secure socket handle.
Syntax
#XSSOCKET?
Response syntax
#XSSOCKET: <handle>,<family>,<role>,<type>,<sec_tag>,<cid>
The
<handle>
value is an integer. When positive or0
, the socket is valid.The
<family>
value can be one of the following integers:1
- IP protocol family version 4.2
- IP protocol family version 6.
The
<role>
value can be one of the following integers:0
- Client1
- Server
The
<type>
value can be one of the following integers:1
-SOCK_STREAM
for the stream socket type using the TLS 1.2 protocol.2
-SOCK_DGRAM
for the datagram socket type using the DTLS 1.2 protocol.
The
<sec_tag>
value is an integer. It indicates to the modem the credential of the security tag to be used for establishing a secure connection.The
<cid>
value is an integer. It representscid
in the+CGDCONT
command.
Examples
AT#XSSOCKET?
#XSSOCKET: 2,1,0,1,16842753,0
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XSSOCKET=?
Response syntax
#XSSOCKET: <list of op>,<list of types>,<list of roles>,<sec_tag>,<peer_verify>,<cid>
The
<list of op>
value can be one of the following integers:0
- Close a secure socket.1
- Open a secure socket for IP protocol family version 4.2
- Open a secure socket for IP protocol family version 6.
The
<list of types>>
value can be one of the following integers.1
-SOCK_STREAM
for the stream socket type using the TLS 1.2 protocol.2
-SOCK_DGRAM
for the datagram socket type using the DTLS 1.2 protocol.
The
<list of roles>
value can be one of the following integers:0
- Client1
- Server
Examples
AT#XSSOCKET=?
#XSSOCKET: (0,1,2),(1,2),<sec_tag>,<peer_verify>,<cid>
OK
Select Socket #XSOCKETSELECT
The #XSOCKETSELECT
command allows you to select an active socket among multiple opened ones.
Set command
The set command allows you to select an active socket.
Syntax
#XSOCKETSELECT=<handle>
The
<handle>
parameter is the handle value returned from the #XSOCKET or #XSSOCKET commands.
Response syntax
#XSOCKETSELECT: <handle>
The
<handle>
value is an integer. When positive or0
, the socket is valid.
Examples
AT#XSOCKETSELECT=4
#XSOCKETSELECT: 4
OK
Read command
The read command allows you to list all sockets that have been opened and the active socket.
Syntax
#XSOCKETSELECT?
Response syntax
#XSOCKETSELECT: <handle>,<family>,<role>,<type>,<sec_tag>,<ranking>,<cid>
#XSOCKETSELECT: <handle_active>
The
<handle>
value is an integer that indicates the handle of the socket.The
<family>
value can be one of the following integers:1
- IP protocol family version 4.2
- IP protocol family version 6.
The
<role>
value can be one of the following integers:0
- Client.1
- Server.
The
<type>
value can return one of the following:1
- SetSOCK_STREAM
for the stream socket type using the TLS 1.2 protocol.2
- SetSOCK_DGRAM
for the datagram socket type using the DTLS 1.2 protocol.
The
<sec_tag>
value is an integer. It indicates to the modem the credential of the security tag to be used for establishing a secure connection. For a non-secure socket, it returns the value of -1.The
<ranking>
value is an integer. It indicates the ranking value of this socket, where the largest value means the highest ranking.The
<cid>
value is an integer. It representscid
in the+CGDCONT
command.The
<handle_active>
value is an integer that indicates the handle of the active socket.
Examples
AT#XSOCKETSELECT?
#XSOCKETSELECT: 0,1,0,1,-1,2,0
#XSOCKETSELECT: 1,1,0,2,-1,3,0
#XSOCKETSELECT: 2,1,0,1,16842755,4,0
#XSOCKETSELECT: 3,1,0,2,16842755,5,0
#XSOCKETSELECT: 4,1,1,1,-1,6,0
#XSOCKETSELECT: 5,1,1,2,-1,7,0
#XSOCKETSELECT: 6,1,1,1,16842755,8,0
#XSOCKETSELECT: 7,1,0,1,-1,9,0
#XSOCKETSELECT: 7
OK
AT#XSOCKETSELECT=4
#XSOCKETSELECT: 4,1,1
OK
AT#XSOCKETSELECT?
#XSOCKETSELECT: 0,1,0,1,-1,2,0
#XSOCKETSELECT: 1,1,0,2,-1,3,0
#XSOCKETSELECT: 2,1,0,1,16842755,4,0
#XSOCKETSELECT: 3,1,0,2,16842755,5,0
#XSOCKETSELECT: 4,1,1,1,-1,6,0
#XSOCKETSELECT: 5,1,1,2,-1,7,0
#XSOCKETSELECT: 6,1,1,1,16842755,8,0
#XSOCKETSELECT: 7,1,0,1,-1,9,0
#XSOCKETSELECT: 4
OK
Test command
The test command is not supported.
Socket options #XSOCKETOPT
The #XSOCKETOPT
command allows you to get and set socket options.
Set command
The set command allows you to get and set socket options.
Syntax
#XSOCKETOPT=<op>,<name>[,<value>]
The
<op>
parameter can accept one of the following values:0
- Get1
- Set
For a complete list of the supported SET <name>
accepted parameters, see the : SETSOCKETOPT Service Spec Reference
For a complete list of the supported GET <name>
accepted parameters, see the : GETSOCKETOPT Service Spec Reference
Examples
AT#XSOCKETOPT=1,20,30
OK
AT#XSOCKETOPT=0,20
#XSOCKETOPT: 30
OK
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XSOCKETOPT=?
Response syntax
#XSOCKETOPT: <list of op>,<name>,<value>
Examples
AT#XSOCKETOPT=?
#XSOCKETOPT: (0,1),<name>,<value>
OK
Secure Socket options #XSSOCKETOPT
The #XSSOCKETOPT
command allows you to set secure socket options.
Set command
The set command allows you to set secure socket options.
Syntax
#XSSOCKETOPT=<op>,<name>[,<value>]
The
<op>
parameter can accept one of the following values:0
- Get.1
- Set.
The
<name>
parameter can accept one of the following values:2
-TLS_HOSTNAME
.<value>
is a string.4
-TLS_CIPHERSUITE_USED
(get-only). It accepts the IANA assigned cipher suite identifier of the chosen cipher suite.5
-TLS_PEER_VERIFY
.<value>
is an integer and can be either0
or1
.12
-TLS_SESSION_CACHE
.<value>
is an integer and can be either0
or1
.13
-TLS_SESSION_CACHE_PURGE
.<value>
can accept any integer value.14
-TLS_DTLS_HANDSHAKE_TIMEO
.<value>
is the timeout in seconds and can be one of the following integers:1
,3
,7
,15
,31
,63
,123
.
For a complete list of the supported <name>
accepted parameters, see the SETSOCKETOPT Service Spec Reference.
Examples
AT#XSSOCKETOPT=1,5,2
OK
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XSSOCKETOPT=?
Response syntax
#XSSOCKETOPT: <list of op>,<name>,<value>
Examples
AT#XSSOCKETOPT=?
#XSSOCKETOPT: (1),<name>,<value>
OK
Socket binding #XBIND
The #XBIND
command allows you to bind a socket with a local port.
This command can be used with TCP servers and both UDP clients and servers.
Set command
The set command allows you to bind a socket with a local port.
Syntax
#XBIND=<port>
The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the specific port to use for binding the socket.
Examples
AT#XBIND=1234
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Connection #XCONNECT
The #XCONNECT
command allows you to connect to a server and to check the connection status.
This command is for TCP and UDP clients.
Set command
The set command allows you to connect to a TCP or UDP server.
Syntax
#XCONNECT=<url>,<port>
The
<url>
parameter is a string. It indicates the hostname or the IP address of the server. The maximum supported size of the hostname is 128 bytes. When using IP addresses, it supports both IPv4 and IPv6.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the port of the TCP or UDP service on the remote server.
Response syntax
#XCONNECT: <status>
The
<status>
value is an integer. It can return one of the following values:1
- Connected.0
- Disconnected.
Examples
AT#XCONNECT="test.server.com",1234
#XCONNECT: 1
OK
AT#XCONNECT="192.168.0.1",1234
#XCONNECT: 1
OK
AT#XCONNECT="2a02:c207:2051:8976::1",4567
#XCONNECT: 1
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Set listen mode #XLISTEN
The #XLISTEN
command allows you to put the TCP socket in listening mode for incoming connections.
This command is for TCP servers.
Set command
The set command allows you to put the TCP socket in listening mode for incoming connections.
Syntax
#XLISTEN
Response syntax
There is no response.
Examples
AT#XLISTEN
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Accept connection #XACCEPT
The #XACCEPT
command allows you to accept an incoming connection from a TCP client.
This command is for TCP servers.
Set command
The set command allows you to wait for the TCP client to connect.
Syntax
#XACCEPT=<timeout>
The
<timeout>
value sets the timeout value in seconds.0
means no timeout, and it makes this request become blocking.
Response syntax
#XACCEPT: <handle>,<ip_addr>
The
<handle>
value is an integer. It represents the socket handle of the accepted connection.The
<ip_addr>
value indicates the IP address of the peer host.
Examples
AT#XACCEPT=60
#XACCEPT: 2,"192.168.0.2"
OK
Read command
The read command allows you to check socket handle of the accepted connection.
Syntax
#XACCEPT?
Response syntax
#XACCEPT: <handle>
The
<handle>
value is an integer and can be interpreted as follows:Positive - The incoming socket is valid.
0
- There is no active incoming connection.
Examples
AT#XACCEPT?
#XACCEPT: 192.168.0.2
OK
Test command
The test command is not supported.
Send data #XSEND
The #XSEND
command allows you to send data over TCP and UDP connections.
Set command
The set command allows you to send data over the connection.
Syntax
#XSEND[=<data>]
The
<data>
parameter is a string that contains the data to be sent. The maximum size of the data is 1024 bytes. When the parameter is not specified, SLM entersslm_data_mode
.
Response syntax
#XSEND: <size>
The
<size>
value is an integer. It represents the actual number of bytes that has been sent.
Examples
AT#XSEND="Test TCP"
#XSEND: 8
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Receive data #XRECV
The #XRECV
command allows you to receive data over TCP or UDP connections.
Set command
The set command allows you to receive data over the connection.
Syntax
#XRECV=<timeout>[,<flags>]
The <timeout>
value sets the timeout value in seconds.
When 0
, it means no timeout, and it makes this request become blocking.
The <flags>
value sets the receiving behavior based on the BSD socket definition.
It can be set to one of the following values:
2
means reading data without removing it from the socket input queue.64
means overriding the operation to non-blocking.256
(TCP only) means blocking until the full amount of data can be returned.
Response syntax
#XRECV: <size>
<data>
The
<data>
value is a string that contains the data being received.The
<size>
value is an integer that represents the actual number of bytes received.
Examples
AT#XRECV=10
#XRECV: 7
Test OK
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
UDP send data #XSENDTO
The #XSENDTO
command allows you to send data over UDP.
Set command
The set command allows you to send data over UDP.
Syntax
#XSENDTO=<url>,<port>[,<data>]
The
<url>
parameter is a string. It indicates the hostname or the IP address of the remote peer. The maximum size of the hostname is 128 bytes. When using IP addresses, it supports both IPv4 and IPv6.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the port of the UDP service on remote peer.The
<data>
parameter is a string that contains the data to be sent. Its maximum size is 1024 bytes. When the parameter is not specified, SLM entersslm_data_mode
.
Response syntax
#XSENDTO: <size>
The
<size>
value is an integer. It represents the actual number of bytes that has been sent.
Examples
AT#XSENDTO="test.server.com",1234,"Test UDP"
#XSENDTO: 8
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
UDP receive data #XRECVFROM
The #XRECVFROM
command allows you to receive data over UDP.
Set command
The set command allows you to receive data over UDP.
Syntax
#XRECVFROM=<timeout>[,<flags>]
The <timeout>
value sets the timeout value in seconds.
When 0
, it means no timeout, and it makes this request become blocking.
The <flags>
value sets the receiving behavior based on the BSD socket definition.
It can be set to one of the following values:
2
means reading data without removing it from the socket input queue.64
means overriding the operation to non-blocking.
Response syntax
#XRECVFROM: <size>,<ip_addr>
<data>
The
<data>
value is a string that contains the data being received.The
<size>
value is an integer that represents the actual number of bytes received.The
<ip_addr>
value is a string that represents the IPv4 or IPv6 address of remote peer.
Examples
AT#XRECVFROM=10
#XRECVFROM: 7,"192.168.1.100"
Test OK
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Poll sockets #XPOLL
The #XPOLL
command allows you to poll selected or all sockets that have already been opened.
Set command
The set command allows you to poll a set of sockets to check whether they are ready for I/O.
Syntax
#XPOLL=<timeout>[,<handle1>[,<handle2> ...<handle8>]
The
<timeout>
value sets the timeout value in milliseconds, and the poll blocks up to this timeout.0
means no timeout, and the poll returns without blocking.-1
means indefinite, and the poll blocks indefinitely until any events are received.The
<handleN>
value sets the socket handles to poll. The handles values could be obtained byAT#XSOCKETSELECT?
command. If no handle values are specified, all opened sockets will be polled.
Response syntax
#XPOLL: <error>
#XPOLL: <handle>,<revents>
The
<error>
value is an error code when the poll fails.The
<handle>
value is an integer. It is the handle of a socket that have events returned, so-calledrevents
.The
<revents>
value is a hexadecimal string. It represents the returned events, which could be a combination of POLLIN, POLLERR, POLLHUP and POLLNVAL.
Examples
AT#XPOLL=2000,0
#XPOLL: 0,"0x0001"
OK
AT#XPOLL=2000,1
#XPOLL: 1,"0x0001"
OK
AT#XPOLL=2000
#XPOLL: 0,"0x0001"
#XPOLL: 1,"0x0001"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Resolve hostname #XGETADDRINFO
The #XGETADDRINFO
command allows you to resolve hostnames to IPv4 and IPv6 addresses.
Set command
The set command allows you to resolve hostnames to IPv4 and IPv6 addresses.
Syntax
#XGETADDRINFO=<hostname>
The
<hostname>
parameter is a string.
Response syntax
#XGETADDRINFO: "<ip_addresses>"
The
<ip_addresses>
value is a string. It indicates the IPv4 or IPv6 address of the resolved hostname.
Examples
at#xgetaddrinfo="www.google.com"
#XGETADDRINFO: "172.217.174.100"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
TCP and UDP AT commands
The following commands list contains TCP-related and UDP-related AT commands.
When native TLS is used, you must store the credentials using the AT#XCMNG
AT command.
TCP server #XTCPSVR
The #XTCPSVR
command allows you to start and stop the TCP/TLS server.
Set command
The set command allows you to start and stop the TCP/TLS server.
Syntax
#XTCPSVR=<op>[<port>[,<sec_tag>]]
The
<op>
parameter can accept one of the following values:0
- Stop the server.1
- Start the server using IP protocol family version 4.2
- Start the server using IP protocol family version 6.
The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the TCP service port. It is mandatory to set it when starting the server.The
<sec_tag>
parameter is an integer. If it is given, a TLS server will be started. It indicates to the modem the credential of the security tag used for establishing a secure connection.
Response syntax
#XTCPSVR: <handle>,"started"
#XTCPSVR: <error>,"not started"
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened listening socket.The
<error>
value is an integer. It represents the error value according to the standard POSIX errno.
Examples
AT#XTCPSVR=1,3442,600
#XTCPSVR: 2,"started"
OK
Read command
The read command allows you to check the TCP server settings.
Syntax
#XTCPSVR?
Response syntax
#XTCPSVR: <listen_socket_handle>,<income_socket_handle>,<family>
The
<xxx_socket_handle>
value is an integer. When positive, it indicates that the socket opened successfully. When negative, it indicates that the socket failed to open or that there is no incoming connection.The
<family>
value is an integer.1
- IP protocol family version 4.2
- IP protocol family version 6.
Examples
AT#XTCPSVR?
#XTCPSVR: 1,2,1
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XTCPSVR=?
Response syntax
#XTCPSVR: (list of op value),<port>,<sec_tag>
Examples
AT#XTCPSVR=?
#XTCPSVR: (0,1,2),<port>,<sec_tag>
OK
TCP/TLS client #XTCPCLI
The #XTCPCLI
command allows you to create a TCP/TLS client and to connect to a server.
Set command
The set command allows you to create a TCP/TLS client and to connect to a server.
Syntax
#XTCPCLI=<op>[,<url>,<port>[,[sec_tag]]
The
<op>
parameter can accept one of the following values:0
- Disconnect.1
- Connect to the server for IP protocol family version 4.2
- Connect to the server for IP protocol family version 6.
The
<url>
parameter is a string. It indicates the hostname or the IP address to connect to. Its maximum size is 128 bytes. When the parameter is an IP address, it supports both IPv4 and IPv6.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the TCP/TLS service port on the remote server.The
<sec_tag>
parameter is an integer. If it is given, a TLS client will be started. It indicates to the modem the credential of the security tag used for establishing a secure connection.
Response syntax
#XTCPCLI: <handle>, "connected"
#XTCPCLI: <error>, "not connected"
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened socket.The
<error>
value is an integer. It represents the error value according to the standard POSIX errno.
Examples
AT#XTCPCLI=1,"remote.ip",1234
#XTCPCLI: 2,"connected"
OK
Read command
The read command allows you to verify the status of the connection.
Syntax
#XTCPCLI?
Response syntax
#XTCPCLI: <handle>,<family>
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened socket. When negative, it indicates that the client socket failed to open.The
<family>
value is an integer.1
- IP protocol family version 4.2
- IP protocol family version 6.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XTCPCLI=?
Response syntax
#XTCPCLI: (op list),<url>,<port>,<sec_tag>
Examples
AT#XTCPCLI=?
#XTCPCLI: (0,1,2),<url>,<port>,<sec_tag>
OK
TCP send data #XTCPSEND
The #XTCPSEND
command allows you to send the data over the connection.
Set command
The set command allows you to send the data over the connection. When used from a TCP/TLS client, it sends the data to the remote TCP server When used from a TCP server, it sends data to the remote TCP client
Syntax
#XTCPSEND=<data>
The
<data>
parameter is a string that contains the data to be sent. The maximum size of the data is 1024 bytes. When the parameter is not specified, SLM entersslm_data_mode
.
Response syntax
#XTCPSEND: <size>
The
<size>
value is an integer. It represents the actual number of the bytes sent.
Examples
AT#XTCPSEND="Test TLS client"
#XTCPSEND: 15
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
TCP hang up #XTCPHANGUP
The #XTCPHANGUP
command allows you to disconnect an incoming connection.
Set command
The set command allows you to disconnect an incoming connection. This function is reserved to TCP server role by its nature.
Syntax
#XTCPHANGUP=<handle>
The
<handle>
parameter is an integer. Refer to#XTCPSVR?
command for the<income_socket_handle>
.
Response syntax
#XTCPSVR: <cause>,"disconnected"
The
<cause>
value is an integer of -111 or ECONNREFUSED.
Examples
AT#XTCPSVR?
#XTCPSVR: 1,2,1
OK
AT#XTCPHANGUP=2
#XTCPSVR: -111,"disconnected"
OK
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#TCPHANGUP=?
Response syntax
#TCPHANGUP: <handle>
Examples
AT#TCPHANGUP=?
#TCPHANGUP: <handle>
OK
TCP receive data
<data>
#XTCPDATA: <size>
The
<data>
parameter is a string that contains the data received.The
<size>
parameter is the size of the string, which is present only when SLM is not operating inslm_data_mode
.
UDP server #XUDPSVR
The #XUDPSVR
command allows you to start and stop the UDP server.
NOTE DTLS server is not supported by nRF9160.
Set command
The set command allows you to start and stop the UDP server.
Syntax
#XUDPSVR=<op>[,<port>]
The
<op>
parameter can accept one of the following values:0
- Stop the server.1
- Start the server for IP protocol family version 4.2
- Start the server for IP protocol family version 6.
The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the UDP service port. It is mandatory for starting the server.
Response syntax
#XUDPSVR: <handle>,"started"
The
<handle>
value is an integer. It indicates the handle of the successfully opened listening socket.
Examples
AT#XUDPSVR=1,3442
#XUDPSVR: 2,"started"
OK
Read command
The read command allows you to check the current value of the subparameters.
Syntax
#XUDPSVR?
Response syntax
#XUDPSVR: <handle>,<family>
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened socket. When negative, it indicates that it failed to open.The
<family>
value is an integer.1
- IP protocol family version 4.2
- IP protocol family version 6.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XUDPSVR=?
Response syntax
#XUDPSVR: (list of op value),<port>
Examples
AT#XUDPSVR=?
#XUDPSVR: (0,1,2),<port>
OK
UDP/DTLS client #XUDPCLI
The #XUDPCLI
command allows you to create a UDP/DTLS client and to connect to a server.
NOTE the UDP/DTLS client always works in a connection-oriented way.
Set command
The set command allows you to create a UDP/DTLS client and connect to a server.
Syntax
#XUDPCLI=<op>[,<url>,<port>[,<sec_tag>]
The
<op>
parameter can accept one of the following values:0
- Disconnect.1
- Connect to the server for IP protocol family version 4.2
- Connect to the server for IP protocol family version 6.
The
<url>
parameter is a string. It indicates the hostname or the IP address to connect to. Its maximum size can be 128 bytes. When the parameter is an IP address, it supports both IPv4 and IPv6.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the UDP/DTLS service port on the remote server.The
<sec_tag>
parameter is an integer. If it is given, a DTLS client will be started. It indicates to the modem the credential of the security tag used for establishing a secure connection.
Response syntax
#XUDPCLI: <handle>,"connected"
#XUDPCLI: <handle>,"not connected"
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened socket.The
<error>
value is an integer. It represents the error value according to the standard POSIX errno.
Examples
AT#XUDPCLI=1,"remote.host",2442
#XUDPCLI: 2,"connected"
OK
Read command
The read command allows you to check the current value of the subparameters.
Syntax
#XUDPCLI?
Response syntax
#XUDPCLI: <handle>,<family>
The
<handle>
value is an integer. When positive, it indicates the handle of the successfully opened socket. When negative, it indicates that it failed to open.The
<family>
value is an integer.1
- IP protocol family version 4.2
- IP protocol family version 6.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XUDPCLI: (op list),<url>,<port>,<sec_tag>
Examples
AT#XUDPCLI=?
#XUDPCLI: (0,1,2),<url>,<port>,<sec_tag>
OK
UDP send data #XUDPSEND
The #XUDPSEND
command allows you to send data over the connection.
Set command
The set command allows you to send data over the connection.
Syntax
#XUDPSEND=<data>
The
<data>
parameter is a string that contains the data to be sent. The maximum size of the data is 1024 bytes. When the parameter is not specified, SLM entersslm_data_mode
.
Response syntax
#XUDPSEND: <size>
The
<size>
value is an integer. It indicates the actual number of bytes sent.
Examples
AT#XUDPSEND="Test UDP by hostname"
#XUDPSEND: 20
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
UDP receive data
<data>
#XUDPDATA: <size>
The
<data>
parameter is a string that contains the data received.The
<size>
parameter is the size of the string, which is present only when SLM is not operating inslm_data_mode
.
ICMP AT commands
The following commands list contains ICMP related AT commands.
ICMP echo request #XPING
The #XPING
command sends an ICMP Echo Request, also known as Ping.
Set command
The set command allows you to send an ICMP Echo Request.
Syntax
#XPING=<url>,<length>,<timeout>[,<count>[,<interval>[,<pdn>]]]
The
<url>
parameter is a string. It represents the hostname, the IPv4, or the IPv6 address of the target host.The
<length>
parameter is an integer. It represents the length of the buffer size.The
<timeout>
parameter is an integer. It represents the time to wait for each reply, in milliseconds.The
<count>
parameter is an integer. It represents the number of echo requests to send. Its default value is1
.The
<interval>
parameter is an integer. It represents the time to wait for sending the next echo request, in milliseconds. Its default value is1000
.The
<pdn>
parameter is an integer. It representscid
in the+CGDCONT
command. Its default value is0
.
Unsolicited notification
#XPING: <response time> seconds
The <response time>
value is a float.
It represents the elapsed time, in seconds, between the echo requests and the echo replies.
Example
AT#XPING="5.189.130.26",45,5000,5,1000
OK
#XPING: 0.386 seconds
#XPING: 0.341 seconds
#XPING: 0.353 seconds
#XPING: 0.313 seconds
#XPING: 0.313 seconds
#XPING: average 0.341 seconds
AT#XGETADDRINFO="ipv6.google.com"
#XGETADDRINFO: "2404:6800:4006:80e::200e"
OK
AT#XPING="ipv6.google.com",45,5000,5,1000
OK
#XPING: 0.286 seconds
#XPING: 0.077 seconds
#XPING: 0.110 seconds
#XPING: 0.037 seconds
#XPING: 0.106 seconds
#XPING: average 0.123 seconds
AT#XPING="5.189.130.26",45,5000,5,1000,1
OK
#XPING: 1.612 seconds
#XPING: 0.349 seconds
#XPING: 0.334 seconds
#XPING: 0.278 seconds
#XPING: 0.278 seconds
#XPING: average 0.570 seconds
Read command
The read command is not supported.
Test command
The test command is not supported.
FOTA AT commands
The following commands list contains AT commands related to firmware-over-the-air updates (FOTA) requests.
FOTA request #XFOTA
The #XFOTA
command sends various types of FOTA requests, based on specific operation codes.
Set command
The set command allows you to send a FOTA request.
Syntax
AT#XFOTA=<op>,<file_url>[,<sec_tag>[,<pdn_id>]]
The
<op>
parameter can accept one of the following values:0
- Cancel FOTA (during download only).1
- Start FOTA for application update.2
- Start FOTA for modem delta update.3
- Start FOTA for bootloader update (optional if Bootloader (NSIB) enabled).6
- Read application image size and version (optional for application FOTA).7
- Read modem scratch space size and offset (optional for modem FOTA).8
- Erase MCUboot secondary slot (optional for application FOTA).9
- Erase modem scratch space (optional for modem FOTA).
The
<file url>
parameter is a string. It represents the full HTTP or HTTPS path of the target image to download.The
<sec_tag>
parameter is an integer. It indicates to the modem the credential of the security tag used for establishing a secure connection for downloading the image. It is associated with the certificate or PSK. Specifying the<sec_tag>
is mandatory when using HTTPS.The
<pdn_id>
parameter is an integer. It represents the Packet Data Network (PDN) ID that can be used instead of the default PDN for downloading.
Response syntax
#XFOTA: <primary_partition_id>,<MCUBOOT_version>,<img_size>,<img_version>
#XFOTA: <secondary_partition_id>,<MCUBOOT_version>,<img_size>,<img_version>
The
<primary_partition_id>
and<secondary_partition_id>
integers give the partition ID.The
<MCUBOOT_version>
major version integer. Value 1 corresponds to MCUboot versions 1.x.y.The
<img_size>
integer gives the size of the application image in this partition in bytes.The
<img_version>
string gives the version of the application image as “<major>.<minor>.<revision>+<build_number>”.
#XFOTA: <size>,<offset>
The
<size>
integer gives the size of the modem DFU area in bytes.The
<offset>
integer gives the offset of the firmware image in the modem DFU area.
Example
Read image size and version
at#xfota=6
#XFOTA: 3,1,295288,"0.0.0+0"
#XFOTA: 7,1,294376,"0.0.0+0"
OK
Application download and activate
AT#XFOTA=1,"http://remote.host/fota/slm_app_update.bin"
OK
#XFOTA: 1,0,0
...
#XFOTA:4,0
AT#XRESET
OK
READY
#XFOTA: 5,0
Erase previous image after FOTA
AT#XFOTA=8
OK
Read modem scratch space size and offset
at#xfota=7
#XFOTA: 368640,0
OK
Erase modem scratch space before FOTA
AT#XFOTA=9
OK
Modem download and activate
AT#XFOTA=2,"http://remote.host/fota/mfw_nrf9160_update_from_1.3.0_to_1.3.0-FOTA-TEST.bin"
OK
#XFOTA: 1,0,0
...
#XFOTA: 4,0
AT#XRESET
OK
READY
#XFOTA: 5,0
Application download and activate if NSIB is enabled
AT#XFOTA=1,"http://remote.host/fota/slm_app_update.bin+slm_app_update.bin"
OK
#XFOTA: 1,0,0
...
#XFOTA:4,0
AT#XRESET
OK
READY
#XFOTA: 5,0
Bootloader download and activate if NSIB is enabled
AT#XFOTA=3,"http://remote.host/fota/signed_by_mcuboot_and_b0_s0_image_update.bin+signed_by_mcuboot_and_b0_s1_image_update.bin"
OK
#XFOTA: 1,0,0
...
#XFOTA:4,0
AT#XRESET
OK
READY
#XFOTA: 5,0
Unsolicited notification
#XFOTA: <fota_stage>,<fota_status>[,<fota_info>]
The
<fota_stage>
value is an integer and can return one of the following values:0
- Init1
- Download2
- Download, erase pending (modem FOTA only)3
- Download, erased (modem FOTA only)4
- Downloaded, to be activated5
- Complete
The
<fota_status>
value is an integer and can return one of the following values:0
- OK1
- Error2
- Cancelled3
- Reverted (application FOTA only)
The
<fota_info>
value is an integer. Its value can have different meanings based on the values returned by<fota_stage>
and<fota_status>
. See the following table:<fota_stage>
value<fota_status>
value<fota_info>
value1
(namely Download)0
(namely OK)Percentage of the download
1
(namely Download)1
(namely ERROR)Error Code
5
(namely Complete)1
(namely ERROR)Error Code
1
(namely Download)2
(namely CANCELLED)0
- Downloading is cancelled before completionThe error codes can be the following:
1
- Download failed2
- Update image rejected (for example modem firmware version error)3
- Update image mismatch (for example<op>
is1
but<file_url>
points to a modem image)
For modem FOTA, the error codes can be the following:
0x4400001u
- The modem encountered a fatal internal error during firmware update.0x4400002u
- The modem encountered a fatal hardware error during firmware update.0x4400003u
- Modem firmware update failed, due to an authentication error.0x4400004u
- Modem firmware update failed, due to UUID mismatch.
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XFOTA=?
Response syntax
#XFOTA: <list of op value>,<file_url>,<sec_tag>,<apn>
Examples
AT#XFOTA=?
#XFOTA: (0,1,2,6,7,8,9),<file_url>,<sec_tag>,<apn>
OK
Examples(if NSIB is enabled)
AT#XFOTA=?
#XFOTA: (0,1,2,3,6,7,8,9),<file_url>,<sec_tag>,<apn>
OK
DFU AT commands
The following commands list contains AT commands related to DFU requests.
The SLM application supports the following types of cloud-to-device Device Firmware Update (DFU) for the nRF52 Series of MCUs:
The application DFU based on MCUboot. This is supported by CL4040. To use this, define CONFIG_SLM_NRF52_DFU but leave CONFIG_SLM_NRF52_DFU_LEGACY undefined.
The legacy serial DFU. This is supported by the legacy nRF5 SDK. To use this, define both CONFIG_SLM_NRF52_DFU and CONFIG_SLM_NRF52_DFU_LEGACY.
Note
You must configure SLM to use UART_2
for the DFU service.
Get request #XDFUGET
The #XDFUGET
command sends various types of requests based on specific operation codes.
Set command
The set command allows you to send a DFU download request.
Syntax
AT#XDFUGET=<op>[,<host>,<image_1>[,<image_2>[,<sec_tag>]]]
The
<op>
parameter can accept one of the following values:0
- Cancel DFU (during download only).1
- Start downloading<image_1>
and<image_2>
.8
- Erase MCUboot secondary slot.
The
<host>
parameter is a string. It indicates the HTTP or HTTPS server name and optionally a port number.The
<image_1>
parameter is a string. It indicates the first file image to download. If CONFIG_SLM_NRF52_DFU_LEGACY is defined, you must set<image_1>
as the path to the init packet file (.dat
). Otherwise, you must set<image_1>
as the path to the MCUboot application update file (.bin
).The
<image_2>
parameter is a string. It indicates the second file image to download. If CONFIG_SLM_NRF52_DFU_LEGACY is defined, you must set<image_2>
as the path to the file image (.bin
). Otherwise, this parameter should not be set.The
<sec_tag>
parameter is an integer. It indicates to the modem the credential of the security tag used for establishing a secure connection for downloading the image. It is associated with the certificate or PSK. Specifying the<sec_tag>
is mandatory when using HTTPS.
Unsolicited notification
#XDFUGET: <dfu_step>,<info>
The
<dfu_step>
value is an integer. It indicates which image is being downloaded.The
<info>
value is an integer. It can return the following values:A value between
1
and100
- The percentage of the download.Any other value - Error code.
Examples
Get the image files for the legacy DFU from http://myserver.com/path/*.*
:
AT#XDFUGET=1,"http://myserver.com","path/nrf52840_xxaa.dat","path/nrf52840_xxaa.bin"
OK
#XDFUGET: 1,14
...
#XDFUGET: 1,100
Erase the previous image after DFU:
AT#XDFUGET=8
OK
Get the image files for the CL4040 DFU from http://myserver.com/path/*.*
:
AT#XDFUGET=1,"https://myserver.com","path/nrf52_app_update.bin","",1234
OK
#XDFUGET: 0,14
...
#XDFUGET: 0,100
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XDFUGET=?
Response syntax
#XDFUGET: <list of op value>,<host>,<image_1>,<image_2>,<sec_tag>
Examples
AT#XDFUGET=?
#XDFUGET: (0,1,8),<host>,<image_1>,<image_2>,<sec_tag>
OK
Get file size #XDFUSIZE
The #XDFUSIZE
command returns the size of the downloaded (.bin
) image file.
Set command
The set command allows you to get the size of the downloaded image file.
Syntax
AT#XDFUSIZE
Response syntax
XDFUSIZE: <file_size>,<download_size>,<crc32_checksum>
The
<file_size>
is an integer. It indicates the size of the DFU image file.The
<download_size>
is an integer. It indicates the size that has been downloaded so far.The
<crc32_checksum>
is a 32-bit unsigned integer. It indicates the IEEE CRC32 of the image content that has been downloaded. You can use this CRC32 to check data integrity when you use MCUboot to perform a DFU.You should check the CRC checksum after
#XDFURUN
has transferred the downloaded data image from nRF91 to nRF5x, before configuring MCUboot to use the new image.
Examples
#XDFUGET: 1,100
OK
AT#XDFUSIZE
#XDFUSIZE: 17048,17048,2316010324
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Run request #XDFURUN
The #XDFURUN
command starts to run the DFU protocol over the UART connection.
Set command
The set command allows you to send a DFU run request.
Syntax
AT#XDFURUN=<start_delay>[,<mtu>,<pause>]
The
<start_delay>
parameter is an integer. It indicates the duration of the delay, in seconds, before the application starts to run the DFU protocol. This allows the nRF52 SoC to make the necessary preparations, like swapping to bootloader mode.The
<mtu>
parameter is an integer. It indicates the size of the data chunk that is sent from the SLM to the nRF52. This parameter should be a multiple of 256 bytes and should not be greater than 4096 bytes. This parameter is ignored if CONFIG_SLM_NRF52_DFU_LEGACY is defined.The
<pause>
parameter is an integer. It indicates the time, in milliseconds, that the SLM pauses after sending the data chunk of<mtu>
size. This parameter must not be zero. This parameter is ignored if CONFIG_SLM_NRF52_DFU_LEGACY is defined.
Response syntax
#XDFURUN: <dfu_step>,<info>
The
<dfu_step>
is an integer. It indicates which step of the DFU protocol is being executed.The
<info>
is an integer. It returns an error code when an error happens.
Examples
Run the legacy serial DFU protocol:
AT#XDFURUN=2
OK
Run the MCUboot-based DFU protocol:
AT#XDFURUN=1,1024,200
OK
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XDFURUN=?
Response syntax
#XDFURUN: <start_delay>,<mtu>,<pause>
Examples
AT#XDFURUN=?
#XDFURUN: <start_delay>,<mtu>,<pause>
OK
.. _SLM_AT_SMS:
SMS AT commands
The following commands list contains SMS-related AT commands.
SMS support #XSMS
The #XSMS
command supports functionalities for sending and receiving SMS messages.
Set command
The set command allows you to start or stop SMS, as well as send SMS text. Only GSM-7 encoding is supported, 8-bit and UCS2 encodings are not supported.
Syntax
#XSMS=<op>[,<number>,<text>]
The
<op>
parameter can accept one of the following values:0
- Stop SMS.1
- Start SMS, ready to receive.2
- Send SMS.
The
<number>
parameter is a string. It represents the SMS recipient’s phone number, including the country code (for example+81xxxxxxx
).The
<text>
parameter is a string. It is the SMS text to be sent.
Unsolicited notification
This is the notification syntax when an SMS message is received:
#XSMS: <datetime>,<number>,<text>
The
<datetime>
value is a string. It represents the time when the SMS is received. It has a format of “YY-MM-DD HH:MM:SS”.The
<number>
value is a string. It represents the SMS sender’s phone number.The
<text>
value is a string. It represents the SMS text that has been received.When receiving concatenated SMS messages, there will be only one notification.
Example
at#xsms=1
OK
at#xsms=2,"+8190xxxxxxxx","SLM test"
OK
#XSMS: "21-05-24 11:58:22","090xxxxxxxx","Tested OK"
at#xsms=2,"+8190xxxxxxxx","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
OK
#XSMS: "21-05-24 13:29:47","090xxxxxxxx","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XSMS=?
Response syntax
#XSMS: <list of op value>,<number>,<text>
Examples
at#xsms=?
#XSMS: (0,1,2),<number>,<text>
OK
FTP AT commands
The following commands list contains FTP related AT commands.
FTP client #XFTP
The #XFTP
command allows you to send FTP commands.
Set command
The set command allows you to send FTP commands.
Syntax
#AT#XFTP=<cmd>[,<param1>[<param2]..]]
The <cmd>
command is a string, and can be used as follows:
AT#XFTP="open",<username>,<password>,<hostname>[,<port>[,<sec_tag>]]
AT#XFTP="status"
AT#XFTP="ascii"
AT#XFTP="binary"
AT#XFTP="close"
AT#XFTP="verbose","on|off"
AT#XFTP="pwd"
AT#XFTP="cd",<folder>
AT#XFTP="ls"[,<options>[,<folder or file>]]
AT#XFTP="mkdir",<folder>
AT#XFTP="rmdir",<folder>
AT#XFTP="rename",<filename_old>,<filename_new>
AT#XFTP="delete",<file>
AT#XFTP="get",<file>
AT#XFTP="put",<file>[,<data>]
AT#XFTP="uput"[,<data>]
AT#XFTP="mput",<file>[,<data>]
The values of the parameters depend on the command string used.
When using the put
, uput
and mput
commands, if the <data>
attribute is not specified, SLM enters slm_data_mode
.
Response syntax
The response syntax depends on the commands used.
Examples
AT#XFTP="open",,,"speedtest.tele2.net"
220 (vsFTPd 3.0.3)
200 Always in UTF8 mode.
331 Please specify the password.
230 Login successful.
OK
AT#XFTP="status"
215 UNIX Type: L8
211-FTP server status:
Connected to ::ffff:202.238.218.44
Logged in as ftp
TYPE: ASCII
No session bandwidth limit
Session timeout in seconds is 300
Control connection is plain text
Data connections will be plain text
At session startup, client count was 38
vsFTPd 3.0.3 - secure, fast, stable
211 End of status
OK
AT#XFTP="ascii"
200 Switching to ASCII mode.
OK
AT#XFTP="binary"
200 Switching to Binary mode.
OK
AT#XFTP="close"
221 Goodbye.
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
TFTP client #XTFTP
The #XTFTP
command allows you to send TFTP commands.
Set command
The set command allows you to send TFTP commands based on RFC1350.
Syntax
AT#XTFTP=<op>,<url>,<port>,<file_path>[,<mode>,<data>]
The
<op>
parameter can accept one of the following values:1
- TFTP read request using IP protocol family version 4.2
- TFTP write request using IP protocol family version 4.3
- TFTP read request using IP protocol family version 6.4
- TFTP write request using IP protocol family version 6.
The
<url>
parameter is a string. It indicates the hostname or the IP address of the TFTP server. Its maximum size is 128 bytes. When the parameter is an IP address, it supports both IPv4 and IPv6.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the TFTP service port on the remote server, which is usually port 69.The
<file_path>
parameter is a string. It indicates the file path on the TFTP server to read from or write to. Its maximum size is 128 bytes.The
<mode>
parameter is a string. It indicates the three modes defined in TFTP protocol. Valid values arenetascii
,octet
andmail
. The default valueoctet
is applied if this parameter is omitted.The
<data>
parameter is a string. When<op>
has a value of2
or4
, this is the data to be put to the remote server.Note
The maximum data size supported in WRITE request is 1024 bytes. The TFTP connection is terminated by writing less than 512 bytes, as defined in the protocol specification (RFC 1350).
Response syntax
#XTFTP: <size>, "success"
<data>
#XTFTP: <error>, "<error_msg>"
The
<size>
value is an integer. When positive, it indicates the size of data in bytes read from TFTP server.The
<data>
value is the arbitrary data read from TFTP server.The
<error>
value is an integer. It is a negative integer based on the type of error.The
<error_msg>
value is a string. It is the description that corresponds to the<error>
value.
Examples
AT#XTFTP=2,"tftp-server.com",69,"test_put_01.txt","octet","test send TFTP PUT"
#XTFTP: 18,"success"
OK
AT#XTFTP=1,"tftp-server.com",69,"test_put_01.txt"
test send TFTP PUT
#XTFTP: 18,"success"
OK
AT#XTFTP=2,"tftp-server.com",69,"test_put_02.txt""octet","012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
#XTFTP: 540,"success"
OK
AT#XTFTP=1,"tftp-server.com",69,"test_put_02.txt"
012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
#XTFTP: 540,"success"
OK
AT#XTFTP=1,"tftp-server.com",69,"test_put_not_exist.txt"
#XTFTP: -4, "remote error"
ERROR
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
AT#XTFTP=?
Examples
AT#XTFTP=?
#XTFTP: (1,2,3,4),<url>,<port>,<file_path>,<mode>
OK
GNSS AT commands
The following commands list contains GNSS-related AT commands.
GNSS
The #XGPS
command controls the GNSS.
Set command
The set command allows you to start and stop the GNSS.
Syntax
#XGPS=<op>[,<interval>[,<timeout>]]
The <op>
parameter accepts the following integer values:
0
- Stop GNSS1
- Start GNSS
The <interval>
parameter represents the GNSS fix interval in seconds.
It must be set when starting the GNSS.
It accepts the following integer values:
0
- Single-fix navigation mode.1
- Continuous navigation mode. The fix interval is set to 1 secondRanging from
10
to65535
- Periodic navigation mode. The fix interval is set to the specified value.
In periodic navigation mode, the <timeout>
parameter controls the maximum time in seconds that the GNSS receiver is allowed to run while trying to produce a valid PVT estimate.
In continuous navigation mode, this parameter does not have any effect.
It accepts the following integer values:
0
- The GNSS receiver runs indefinitely until a valid PVT estimate is produced.Any positive integer lower than the
<interval>
value - The GNSS receiver is turned off after the specified time is up, even if a valid PVT estimate was not produced.
When not specified, it defaults to a timeout value of 60 seconds.
Unsolicited notification
#XGPS: <latitude>,<longitude>,<altitude>,<accuracy>,<speed>,<heading>,<datetime>
The
<latitude>
value represents the latitude in degrees.The
<longitude>
value represents the longitude in degrees.The
<altitude>
value represents the altitude above the WGS-84 ellipsoid in meters.The
<accuracy>
value represents the accuracy (2D 1-sigma) in meters.The
<speed>
value represents the horizontal speed in meters.The
<heading>
value represents the heading of the movement of the user in degrees.The
<datetime>
value represents the UTC date-time.
#XGPS: <NMEA message>
The <NMEA message>
is the $GPGGA
(Global Positioning System Fix Data) NMEA sentence.
#XGPS: <gnss_service>,<gnss_status>
Refer to the READ command.
Example
AT%XSYSTEMMODE=0,0,1,0
OK
AT%XCOEX0=1,1,1565,1586
OK
AT+CFUN=31
OK
AT#XGPS=1,1
#XGPS: 1,1
OK
#XGPS: 35.457576,139.625090,121.473785,22.199919,0.442868,0.000000,"2021-06-02 06:25:48"
#XGPS: 35.457550,139.625115,124.293533,15.679427,0.263094,0.000000,"2021-06-02 06:25:49"
#XGPS: 35.457517,139.625094,120.865372,12.768595,0.166673,0.000000,"2021-06-02 06:25:50"
Read command
The read command allows you to check GNSS support and service status.
Syntax
#XGPS?
Response syntax
#XGPS: <gnss_service>,<gnss_status>
The
<gnss_service>
value is an integer. When it returns the value of1
, it means that GNSS is supported in%XSYSTEMMODE
and activated in+CFUN
.The
<gnss_status>
value is an integer.0
- GNSS is stopped.1
- GNSS is started.2
- GNSS wakes up in periodic mode.3
- GNSS enters sleep because of timeout.4
- GNSS enters sleep because a fix is achieved.
Example
AT#XGPS?
#XGPS: 1,1
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XGPS=?
Example
AT#XGPS=?
#XGPS: (0,1),<interval>,<timeout>
OK
Connect to nRF Cloud
The #XNRFCLOUD
command controls the connection to the nRF Cloud service.
Note
To use #XNRFCLOUD
, you must first provision the device to nRF Cloud, using the UUID from the modem firmware as device ID.
Set command
The set command allows you to connect and disconnect the nRF Cloud service.
Syntax
#XNRFCLOUD=<op>[,<signify>]
The <op>
parameter accepts the following integer values:
0
- Disconnect from the nRF Cloud service.1
- Connect to the nRF Cloud service.2
- Send a message in the JSON format to the nRF Cloud service.
When <op>
is 2
, SLM enters slm_data_mode
.
The <signify>
parameter is used only when the <op>
value is 1
It accepts the following integer values:
0
- It does not signify the location info to nRF Cloud.1
- It does signify the location info to nRF Cloud.
When the <signify>
parameter is not specified, it does not signify the location info to nRF Cloud.
Note
The application signifies the location info to nRF Cloud in a best-effort way. The minimal report interval is 5 seconds.
Note
The application supports nRF Cloud cloud2device appId MODEM
to send AT command from cloud:
cloud2device schema:
{"appId":"MODEM", "messageType":"CMD", "data":"<AT_command>"}.
device2cloud schema:
{"appId":"MODEM", "messageType":"RSP", "data":"<AT_response>"}.
The application executes the AT command in a best-effort way.
Note
The application supports nRF Cloud cloud2device appId DEVICE
to gracefully disconnect from cloud:
cloud2device schema:
{"appId":"DEVICE", "messageType":"DISCON"}.
There is no response sending to nRF Cloud for this appId.
Unsolicited notification
#XNRFCLOUD: <ready>,<signify>
The
<ready>
value indicates whether the nRF Cloud connection is ready or not.The
<signify>
value indicates whether the location info will be signified to nRF Cloud or not.
#XNRFCLOUD: <message>
The
<message>
value indicates the nRF Cloud data received when A-GPS, P-GPS, and Cell_Pos are not active.
Example
AT#XNRFCLOUD=1
OK
#XNRFCLOUD: 1,0
AT#XNRFCLOUD=2
OK
{"msg":"Hello, nRF Cloud"}+++
#XDATAMODE: 0
#XNRFCLOUD: {"msg":"Hello"}
AT#XNRFCLOUD=0
AT#XNRFCLOUD: 0,0
OK
AT#XNRFCLOUD=1,1
OK
#XNRFCLOUD: 1,1
AT#XNRFCLOUD=0
AT#XNRFCLOUD: 0,1
OK
Read command
The read command checks if nRF Cloud is connected or not.
Syntax
#XNRFCLOUD?
Response syntax
#XNRFCLOUD: <ready>,<signify>,<sec_tag>,<device_id>
The
<ready>
value indicates whether the nRF Cloud connection is ready or not.The
<signify>
value indicates whether the location info will be signified to nRF Cloud or not.The
<sec_tag>
value indicates thesec_tag
used for accessing nRF Cloud.The
<device_id>
value indicates the device ID used for accessing nRF Cloud.
Example
AT#XNRFCLOUD?
#XNRFCLOUD: 1,0,16842753,"nrf-352656106443792"
OK
AT#XNRFCLOUD?
#XNRFCLOUD: 1,0,8888,"50503041-3633-4261-803d-1e2b8f70111a"
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XNRFCLOUD=?
Example
AT#XXNRFCLOUD=?
#XNRFCLOUD: (0,1,2),<signify>
OK
GNSS with nRF Cloud A-GPS
The #XAGPS
command runs the GNSS together with the nRF Cloud A-GPS service.
Note
To use #XAGPS
, the following preconditions apply:
You must define CONFIG_SLM_AGPS.
You must have access to nRF Cloud through the LTE network for receiving A-GPS data.
Set command
The set command allows you to start and stop the GNSS together with the nRF Cloud A-GPS service.
Syntax
#XAGPS=<op>[,<interval>[,<timeout>]]
The <op>
parameter accepts the following integer values:
0
- Stop GNSS with A-GPS1
- Start GNSS with A-GPS
The <interval>
parameter represents the GNSS fix interval in seconds.
It must be set when starting the GNSS.
It accepts the following integer values:
0
- Single-fix navigation mode.1
- Continuous navigation mode. The fix interval is set to 1 secondRanging from
10
to65535
- Periodic navigation mode. The fix interval is set to the specified value.
In periodic navigation mode, the <timeout>
parameter controls the maximum time in seconds that the GNSS receiver is allowed to run while trying to produce a valid PVT estimate.
In continuous navigation mode, this parameter does not have any effect.
It accepts the following integer values:
0
- The GNSS receiver runs indefinitely until a valid PVT estimate is produced.Any positive integer lower than the
<interval>
value - the GNSS receiver is turned off after the specified time is up, even if a valid PVT estimate was not produced.
When not specified, it defaults to a timeout value of 60 seconds.
Unsolicited notification
#XGPS: <latitude>,<longitude>,<altitude>,<accuracy>,<speed>,<heading>,<datetime>
The
<latitude>
value represents the latitude in degrees.The
<longitude>
value represents the longitude in degrees.The
<altitude>
value represents the altitude above the WGS-84 ellipsoid in meters.The
<accuracy>
value represents the accuracy (2D 1-sigma) in meters.The
<speed>
value represents the horizontal speed in meters.The
<heading>
value represents the heading of the movement of the user in degrees.The
<datetime>
value represents the UTC date-time.
#XGPS: <NMEA message>
The <NMEA message>
is the $GPGGA
(Global Positioning System Fix Data) NMEA sentence.
#XAGPS: <gnss_service>,<agps_status>
Refer to the READ command.
Example
AT%XSYSTEMMODE=1,0,1,0
OK
AT%XCOEX0=1,1,1565,1586
OK
AT+CPSMS=1
OK
AT+CFUN=1
OK
AT#XNRFCLOUD=1
OK
#XNRFCLOUD: 1,0
AT#XAGPS=1,1
#XAGPS: 1,1
OK
#XGPS: 35.457417,139.625211,162.850952,15.621976,1.418092,0.000000,"2021-06-02 05:21:31"
#XGPS: 35.457435,139.625348,176.104797,14.245458,1.598184,69.148659,"2021-06-02 05:21:32"
#XGPS: 35.457417,139.625415,179.132980,13.318132,1.235241,69.148659,"2021-06-02 05:21:33"
#XGPS: 35.457410,139.625469,181.223541,12.667312,0.803951,69.148659,"2021-06-02 05:21:34"
Read command
The read command allows you to check GNSS support and AGPS service status.
Syntax
#XAGPS?
Response syntax
#XAGPS: <gnss_service>,<agps_status>
The
<gnss_service>
value is an integer. When it returns the value of1
, it means that GNSS is supported in%XSYSTEMMODE
and activated in+CFUN
.The
<agps_status>
value is an integer.0
- AGPS is stopped.1
- AGPS is started.2
- GNSS wakes up in periodic mode.3
- GNSS enters sleep because of timeout.4
- GNSS enters sleep because a fix is achieved.
Example
AT#XAGPS?
#XAGPS: 1,1
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XAGPS=?
Example
AT#XAGPS=?
#XAGPS: (0,1),<interval>,<timeout>
OK
GNSS with nRF Cloud P-GPS
The #XPGPS
command runs the GNSS together with the nRF Cloud P-GPS service.
Note
To use #XPGPS
, the following preconditions apply:
You must define CONFIG_SLM_PGPS.
You must have access to nRF Cloud through the LTE network for receiving P-GPS data.
Set command
The set command allows you to start and stop the GNSS together with the nRF Cloud P-GPS service.
Syntax
#XPGPS=<op>[,<interval>[,<timeout>]]
The <op>
parameter accepts the following integer values:
0
- Stop GNSS with P-GPS1
- Start GNSS with P-GPS
The <interval>
parameter represents the GNSS fix interval in seconds.
It must be set when starting the GNSS.
It accepts the following integer values:
Ranging from
10
to65535
- Periodic navigation mode. The fix interval is set to the specified value.
In periodic navigation mode, the <timeout>
parameter controls the maximum time in seconds that the GNSS receiver is allowed to run while trying to produce a valid PVT estimate.
In continuous navigation mode, this parameter does not have any effect.
It accepts the following integer values:
0
- The GNSS receiver runs indefinitely until a valid PVT estimate is produced.Any positive integer lower than the
<interval>
value - The GNSS receiver is turned off after the specified time is up, even if a valid PVT estimate was not produced.
When not specified, it defaults to a timeout value of 60 seconds.
Unsolicited notification
#XGPS: <latitude>,<longitude>,<altitude>,<accuracy>,<speed>,<heading>,<datetime>
The
<latitude>
value represents the latitude in degrees.The
<longitude>
value represents the longitude in degrees.The
<altitude>
value represents the altitude above the WGS-84 ellipsoid in meters.The
<accuracy>
value represents the accuracy (2D 1-sigma) in meters.The
<speed>
value represents the horizontal speed in meters.The
<heading>
value represents the heading of the movement of the user in degrees.The
<datetime>
value represents the UTC date-time.
#XGPS: <NMEA message>
The <NMEA message>
is the $GPGGA
(Global Positioning System Fix Data) NMEA sentence.
#XPGPS: <gnss_service>,<pgps_status>
Refer to the READ command.
Example
AT%XSYSTEMMODE=1,0,1,0
OK
AT%XCOEX0=1,1,1565,1586
OK
AT+CPSMS=1
OK
AT+CFUN=1
OK
AT#XNRFCLOUD=1
OK
#XNRFCLOUD: 1,0
AT#XPGPS=1,30
#XPGPS: 1,1
OK
#XGPS: 35.457243,139.625435,149.005020,28.184258,10.431827,281.446014,"2021-06-24 04:35:52"
#XGPS: 35.457189,139.625602,176.811203,43.015198,0.601837,281.446014,"2021-06-24 04:36:28"
#XGPS: 35.457498,139.625422,168.243591,31.753956,0.191195,281.446014,"2021-06-24 04:36:41"
#XGPS: 35.457524,139.624667,100.745979,25.324850,6.347160,94.699837,"2021-06-24 04:37:10"
Read command
The read command allows you to check GNSS support and PGPS service status.
Syntax
#XPGPS?
Response syntax
#XPGPS: <gnss_service>,<pgps_status>
The
<gnss_service>
value is an integer. When it returns the value of1
, it means that GNSS is supported in%XSYSTEMMODE
and is activated in+CFUN
.The
<pgps_status>
value is an integer.0
- PGPS is stopped.1
- PGPS is started.2
- GNSS wakes up in periodic mode.3
- GNSS enters sleep because of timeout.4
- GNSS enters sleep because a fix is achieved.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XPGPS=?
Example
AT#XPGPS=?
#XPGPS: (0,1),<interval>,<timeout>
OK
Delete GNSS data
The #XGPSDEL
command deletes GNSS data from non-volatile memory.
This command should be issued when GNSS is activated but not started yet.
Note
This is considered a debug feature, and is not supposed to be used in production code.
Set command
The set command allows you to delete old GNSS data. Using this command does not trigger A-GPS request event. The execution of the command may delay the full functionality of A-GPS and P-GPS until the next periodic A-GPS request has been received.
Syntax
#XGPSDEL=<mask>
The <mask>
parameter accepts an integer that is the OR
value of the following bitmasks :
0x001
- Ephemerides0x002
- Almanacs (excluding leap second and ionospheric correction)0x004
- Ionospheric correction parameters0x008
- Last good fix (the last position)0x010
- GPS time-of-week (TOW)0x020
- GPS week number0x040
- Leap second (UTC parameters)0x080
- Local clock (TCXO) frequency offset0x100
- Precision estimate of GPS time-of-week (TOW)511
- All of the above
Example
AT%XSYSTEMMODE=0,0,1,0
OK
AT+CFUN=31
OK
AT#XGPSDEL=511
OK
AT+CFUN=0
OK
Read command
The read command is not supported.
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XGPSDEL=?
Example
AT#XGPSDEL=?
#XGPSDEL: <mask>
OK
nRF Cloud cellular location
The #XCELLPOS
command runs the nRF Cloud cellular location service for location information.
Note
To use #XCELLPOS
, the following preconditions apply:
You must define CONFIG_SLM_LOCATION.
You must have access to nRF Cloud through the LTE network.
Set command
The set command allows you to start and stop the nRF Cloud cellular location service.
Syntax
#XCELLPOS=<op>
The <op>
parameter accepts the following integer values:
0
- Stop cellular location.1
- Start cellular location in single-cell mode.2
- Start cellular location in multi-cell mode. To use2
, you must issue theAT%NCELLMEAS
command with <search_type> of0-2
first.
Unsolicited notification
#XCELLPOS: <type>,<latitude>,<longitude>,<uncertainty>
The
<type>
value indicates in which mode the cellular location service is running:0
- The service is running in single-cell mode1
- The service is running in multi-cell mode
The
<latitude>
value represents the latitude in degrees.The
<longitude>
value represents the longitude in degrees.The
<uncertainty>
value represents the certainty of the result.
Example
AT%XSYSTEMMODE=1,0,0,0
OK
AT+CFUN=1
OK
AT#XNRFCLOUD=1
OK
#XNRFCLOUD: 1,0
AT#XCELLPOS=1
OK
#XCELLPOS: 0,35.455833,139.626111,1094
AT%NCELLMEAS
OK
%NCELLMEAS: 0,"0199F10A","44020","107E",65535,3750,5,49,27,107504,3750,251,33,4,0,475,107,26,14,25,475,58,26,17,25,475,277,24,9,25,475,51,18,1,25
AT#XCELLPOS=2
OK
#XCELLPOS: 1,35.534999,139.722362,1801
AT#XCELLPOS=0
OK
Read command
The read command allows you to check the cellular location service status.
Syntax
#XCELLPOS?
Response syntax
#XCELLPOS: <cellpos_status>
The
<cellpos_status>
value is an integer. When it returns the value of1
, it means that the cellular location service is started.
Example
AT#XCELLPOS?
#XCELLPOS: 1
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XCELLPOS=?
Example
AT#XCELLPOS=?
#XCELLPOS: (0,1,2)
OK
nRF Cloud Wi-Fi location
The #XWIFIPOS
command runs the nRF Cloud Wi-Fi location service for location information.
Note
To use #XWIFIPOS
, the following preconditions apply:
You must define CONFIG_SLM_LOCATION.
You must have access to nRF Cloud through the LTE network.
Set command
The set command allows you to start and stop the nRF Cloud Wi-Fi location service.
Syntax
#XWIFIPOS=<op>[,<ssid0>,<mac0>[,<ssid1>,<mac1>[...]]]
The <op>
parameter accepts the following integer values:
0
- Stop Wi-Fi location.1
- Start Wi-Fi location.The
<ssidX>
parameter is a string. It indicates the SSID of the Wi-Fi access point.The
<macX>
parameter is a string. It indicates the MAC address string of the Wi-Fi access point. The string should be formatted as “%02x:%02x:%02x:%02x:%02x:%02x”.
The command accepts <ssidX>
and <macX>
of up to 5 access points.
Unsolicited notification
#XWIFIPOS: <type>,<latitude>,<longitude>,<uncertainty>
The
<type>
value indicates in which mode the Wi-Fi location service is running:2
- The service is running in Wi-Fi mode
The
<latitude>
value represents the latitude in degrees.The
<longitude>
value represents the longitude in degrees.The
<uncertainty>
value represents the certainty of the result.
Example
AT%XSYSTEMMODE=1,0,0,0
OK
AT+CFUN=1
OK
AT#XNRFCLOUD=1
OK
#XNRFCLOUD: 1,0
AT#XWIFIPOS=1,"Nordic_WLAN_5GHz","40:9b:cd:c1:5a:40","Nordic_Guest","00:90:fe:eb:4f:42"
OK
#XWIFIPOS: 2,35.457272,139.624395,60
AT#XWIFIPOS=0
OK
Read command
The read command allows you to check the Wi-Fi location service status.
Syntax
#XWIFIPOS?
Response syntax
#XWIFIPOS: <wifipos_status>
The
<wifipos_status>
value is an integer. When it returns the value of1
, it means that the Wi-Fi location service is started.
Example
AT#XWIFIPOS?
#XWIFIPOS: 0
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Syntax
#XWIFIPOS=?
Example
AT#XWIFIPOS=?
#XWIFIPOS: (0,1)
OK
MQTT client AT commands
The following commands list contains the AT commands used to operate the MQTT client.
MQTT event #XMQTTEVT
The #XMQTTEVT
is an unsolicited notification that indicates the event of the MQTT client.
Unsolicited notification
It indicates the event of the MQTT client.
Syntax
#XMQTTEVT=<evt_type>,<result>
The
<evt_type>
value is an integer indicating the type of the event. It can return the following values:0
- Connection request.1
- Disconnection. The MQTT client is disconnected from the MQTT broker once this event is notified.2
- Message received on a topic the client is subscribed to.3
- Acknowledgment for the published message with QoS 1.4
- Confirmation of the reception for the published message with QoS 2.5
- Release of the published message with QoS 2.6
- Confirmation to a publish release message with QoS 2.7
- Reception of the subscribe request.8
- Reception of the unsubscription request.9
- Ping response from the MQTT broker.
The
<result>
value is an integer indicating the result of the event. It can return the following values:0
- Success.Negative value - Failure. It is the error code indicating the reason for the failure.
MQTT connect #XMQTTCON
The #XMQTTCON
command allows you to connect to and disconnect from the MQTT broker.
Set command
The set command allows you to connect to and disconnect from the MQTT broker.
Syntax
AT#XMQTTCON=<op>[,<client_id>,<username>,<password>,<url>,<port>[,<sec_tag>]]
The
<op>
parameter is an integer. It can accept one of the following values:0
- Disconnect from the MQTT broker.1
- Connect to the MQTT broker using IP protocol family version 4.2
- Connect to the MQTT broker using IP protocol family version 6.
The
<client_id>
parameter is a string. It indicates the MQTT Client ID.The
<username>
parameter is a string. It indicates the MQTT Client username.The
<password>
parameter is a string. It indicates the MQTT Client password in cleartext.The
<url>
parameter is a string. It indicates the MQTT broker hostname.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It indicates the MQTT broker port.The
<sec_tag>
parameter is an integer. It indicates the credential of the security tag used for establishing a secure connection.
Response syntax
#XMQTTEVT: <evt_type>,<result>
The
<evt_type>
value is an integer. When0
, it indicates the acknowledgment of the connection request.The
<result>
value is an integer. It can return the following values:0
- Connection succeeded.Negative Value - Error code. It indicates the reason for the failure.
Examples
AT#XMQTTCON=1,"MyMQTT-Client-ID","","","mqtt.server.com",1883
OK
#XMQTTEVT: 0,0
AT#XMQTTCON=0
OK
#XMQTTEVT: 1,0
Read command
The read command shows MQTT client information.
Syntax
AT#XMQTTCON?
Response syntax
#XMQTTCON: <client_id>,<url>,<port>[,<sec_tag>]]
The
<client_id>
value is a string. It indicates the MQTT client ID.The
<url>
value is a string. It indicates the MQTT broker hostname.The
<port>
value is an unsigned 16-bit integer (0 - 65535). It indicates the MQTT broker port.The
<sec_tag>
value is an integer. It indicates the credential of the security tag used for establishing a secure connection.
Examples
AT#XMQTTCON?
#XMQTTCON: "MyMQTT-Client-ID","","","mqtt.server.com",1883
OK
Test command
The test command is not supported.
MQTT subscribe #XMQTTSUB
The #XMQTTSUB
command allows you to subscribe to an MQTT topic.
Set command
The set command allows you to subscribe to an MQTT topic.
Syntax
AT#XMQTTSUB=<topic>,<qos>
The
<topic>
parameter is a string. It indicates the topic to be subscribed to.The
<qos>
parameter is an integer. It indicates the MQTT Quality of Service types. It can accept the following values:0
- Lowest Quality of Service. No acknowledgment of the reception is needed for the published message.1
- Medium Quality of Service. If the acknowledgment of the reception is expected for the published message, publishing duplicate messages is permitted.2
- Highest Quality of Service. The acknowledgment of the reception is expected and the message should be published only once.
Response syntax
#XMQTTEVT: <evt_type>,<result>
The
<evt_type>
value is an integer. It can return the following values:2
- Notification that a publish event has been received on a topic the client is subscribed to.7
- Acknowledgment of the subscribe request.
The
<result>
value is an integer. It can return the following values:0
- Value indicating the acknowledgment of the connection request.Negative Value - Error code indicating the reason for the failure.
Unsolicited notification
If the MQTT client successfully subscribes to a topic, the following unsolicited notification indicates that a message from the topic is received:
#XMQTTMSG: <topic_length>,<message_length><CR><LF>
<topic_received><CR><LF>
<message>
The
<topic_length>
value is an integer. It indicates the length of the<topic_received>
field.The
<message_length>
parameter is an integer. It indicates the length of the<message>
field.The
<topic_received>
value is a string. It indicates the topic that receives the message.The
<message>
value can be a string or a HEX. It contains the message received from a topic.
Examples
AT#XMQTTSUB="nrf91/slm/mqtt/topic0",0
OK
#XMQTTEVT: 7,0
AT#XMQTTSUB="nrf91/slm/mqtt/topic1",1
OK
#XMQTTEVT: 7,0
AT#XMQTTSUB="nrf91/slm/mqtt/topic2",2
OK
#XMQTTEVT: 7,0
Read command
The read command is not supported.
Test command
The test command is not supported.
MQTT unsubscribe #XMQTTUNSUB
The #XMQTTUNSUB
command allows you to unsubscribe from an MQTT topic.
Set command
The set command allows you to unsubscribe from an MQTT topic.
Syntax
AT#XMQTTUNSUB=<topic>
The
<topic>
parameter is a string. It indicates the topic to unsubscribe from.
Response syntax
#XMQTTEVT: <evt_type>,<result>
The
<evt_type>
value is an integer. When8
, it acknowledges the reception of the unsubscription request.The
<result>
value is an integer. It can return the following values:0
- Value indicating the successful unsubscription.Negative Value - Error code indicating the reason for the failure.
Examples
AT#XMQTTUNSUB="nrf91/slm/mqtt/topic0"
OK
#XMQTTEVT: 8,0
Read command
The read command is not supported.
Test command
The test command is not supported.
MQTT publish #XMQTTPUB
The #XMQTTPUB
command allows you to publish messages on MQTT topics.
Set command
The set command allows you to publish messages on MQTT topics.
Syntax
AT#XMQTTPUB=<topic>[,<msg>[,<qos>[,<retain>]]]
The
<topic>
parameter is a string. It indicates the topic on which data is published.The
<msg>
parameter is a string. It contains the payload on the topic being published.The maximum size of the payload is 1024 bytes when not empty. If the payload is empty (for example,
""
), SLM entersslm_data_mode
.The
<qos>
parameter is an integer. It indicates the MQTT Quality of Service types. It can accept the following values:0
- Lowest Quality of Service (default value). No acknowledgment of the reception is needed for the published message.1
- Medium Quality of Service. If the acknowledgment of the reception is expected for the published message, publishing duplicate messages is permitted.2
- Highest Quality of Service. The acknowledgment of the reception is expected and the message should be published only once.
The
<retain>
parameter is an integer. Its default value is0
. When1
, it indicates that the broker should store the message persistently.
Response syntax
#XMQTTEVT: <evt_type>,<result>
The
<evt_type>
value is an integer. It can return the following values:3
- Acknowledgment for the published message with QoS 1.4
- Reception confirmation for the published message with QoS 2.It is notified when PUBREC is received from the broker.
5
- Release of the published message with QoS 2.6
- Confirmation (PUBREL) to a publish release message with QoS 2.It is notified when PUBREL is received from the broker.
The
<result>
value is an integer. It can return the following values:0
- Value indicating the acknowledgment of the connection request.Negative Value - Error code indicating the reason for the failure.
Examples
AT#XMQTTPUB="nrf91/slm/mqtt/topic0","Test message with QoS 0",0,0
OK
#XMQTTMSG: 21,23
nrf91/slm/mqtt/topic0
Test message with QoS 0
#XMQTTEVT: 2,0
AT#XMQTTPUB="nrf91/slm/mqtt/topic0"
OK
{"msg":"Test Json publish"}+++
#XDATAMODE: 0
#XMQTTMSG: 21,27
nrf91/slm/mqtt/topic0
{"msg":"Test Json publish"}
#XMQTTEVT: 2,0
AT#XMQTTPUB="nrf91/slm/mqtt/topic1","Test message with QoS 1",1,0
OK
#XMQTTEVT: 3,0
#XMQTTMSG: 21,23
nrf91/slm/mqtt/topic1
Test message with QoS 1
#XMQTTEVT: 2,0
AT#XMQTTPUB="nrf91/slm/mqtt/topic2","",2,0
OK
Test message with QoS 2+++
#XDATAMODE: 0
#XMQTTEVT: 4,0
#XMQTTEVT: 6,0
#XMQTTMSG: 21,23
nrf91/slm/mqtt/topic2
Test message with QoS 2
#XMQTTEVT: 2,0
Read command
The read command is not supported.
Test command
The test command is not supported.
HTTP client AT commands
The following commands list contains the HTTP client AT commands.
HTTP client connection #XHTTPCCON
The #XHTTPCCON
command allows you to connect to and disconnect from an HTTP server and to show the HTTP connection information.
Set command
The set command allows you to connect to and disconnect from an HTTP server.
Syntax
AT#XHTTPCCON=<op>[,<host>,<port>[,<sec_tag>]]
The
<op>
parameter can accept one of the following values:0
- Disconnect from the HTTP server.1
- Connect to the HTTP server for IP protocol family version 4.2
- Connect to the HTTP server for IP protocol family version 6.
The
<host>
parameter is a string. It represents the HTTP server hostname.The
<port>
parameter is an unsigned 16-bit integer (0 - 65535). It represents the HTTP server port.The
<sec_tag>
parameter is an integer. It indicates to the modem the credential of the security tag used for establishing a secure connection.
Response syntax
#XHTTPCCON=<state>
The
<state>
value can return one of the following:0
- Disconnected1
- Connected
Example
AT#XHTTPCCON=1,"postman-echo.com",80
#XHTTPCCON:1
OK
Read command
The read command shows the HTTP connection information.
Syntax
AT#XHTTPCCON?
Response syntax
XHTTPCCON: <state>,<host>,<port>[,<sec_tag>]]
Example
AT#XHTTPCCON?
#XHTTPCCON: 1,"postman-echo.com",80
OK
Test command
The test command tests the existence of the command and provides information about the type of its subparameters.
Example
AT#XHTTPCCON=?
#XHTTPCCON: (0,1),<host>,<port>,<sec_tag>
OK
HTTP request #XHTTPCREQ
The #XHTTPCREQ
command allows you to send an HTTP request to the server.
Set command
The set command allows you to send an HTTP request to the server.
Syntax
AT#XHTTPCREQ=<method>,<resource>[,<headers>[,<content_type>,<content_length>[,<chunked_transfer>]]]
The
<method>
is a string. It represents the request method string.The
<resource>
is a string. It represents the target resource to apply the request.The
<headers>
parameter is a string. It represents the optional headers field of the request. Each header field should end with<CR><LF>
. Any occurrence of “\r\n” (4 bytes) inside is replaced by<CR><LF>
(2 bytes).Note
Host
,Content-Type
andContent-Length
must not be included.The
<content_type>
is a string. It represents the HTTP/1.1Content-Type
of the payload.The
<content_length>
is an integer. It represents the HTTP/1.1Content-Length
of the payload. This parameter is ignored if<chunked_transfer>
is not0
.The
<chunked_transfer>
is an integer. It indicates if the payload will be sent in chunked mode or not.0
- normal mode (default)1
- chunked mode
If
<content_length>
is greater than0
orchunked_transfer
is not0
, the SLM application entersslm_data_mode
. The SLM sends the payload to the HTTP server until the terminator string defined in CONFIG_SLM_DATAMODE_TERMINATOR is received.
Response syntax
#XHTTPCREQ:<state>
The <state>
value can return one of the following:
0
- Request sent successfully1
- Wait for payload dataNegative integer - Error code
Example
The following example sends a GET request to retrieve data from the server without any optional header:
AT#XHTTPCCON=1,"postman-echo.com",80
#XHTTPCCON: 1
OK
AT#XHTTPCREQ="GET","/get?foo1=bar1&foo2=bar2"
OK
#XHTTPCREQ: 0
HTTP/1.1 200 OK
Date: Tue, 01 Mar 2022 05:22:27 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 244
Connection: keep-alive
ETag: W/"f4-/OfnvALw5zFsaujZvrn62iBBcKo"
Vary: Accept-Encoding
set-cookie: sails.sid=s%3AzTRyDH581ybGp-7K1k78tkBmVLeybFTY.Z7c5iNEaK0hH5hIMsuJpuZEH18d%2FbtSqOuhRAh1GmYM; Path=/; HttpOnly
#XHTTPCRSP:337,1
{"args":{"foo1":"bar1","foo2":"bar2"},"headers":{"x-forwarded-proto":"http","x-forwarded-port":"80","host":"postman-echo.com","x-amzn-trace-id":"Root=1-621dad93-79bf415c46aa37f925498d97"},"url":"http://postman-echo.com/get?foo1=bar1&foo2=bar2"}
#XHTTPCRSP:244,1
The following example sends a POST request, with headers delimited by “\r\n”, and with a JSON payload:
AT#XHTTPCREQ="POST","/post","User-Agent: slm\r\naccept: */*\r\n","application/json",17
OK
#XHTTPCREQ: 1
{"hello":"world"}+++
#XHTTPCREQ: 0
#XDATAMODE: 0
HTTP/1.1 200 OK
Date: Tue, 01 Mar 2022 05:22:28 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 359
Connection: keep-alive
ETag: W/"167-2YuosrP0ARLW1c5oeDiW7MId014"
Vary: Accept-Encoding
set-cookie: sails.sid=s%3A_b9-1rOslsmoczQUGjv93SicuBw8f6lb.x%2B6xkThAVld5%2FpykDn7trZ9JGh%2Fir3MVU0izYBfB0Kg; Path=/; HttpOnly
#XHTTPCRSP:342,1
{"args":{},"data":{"hello":"world"},"files":{},"form":{},"headers":{"x-forwarded-proto":"http","x-forwarded-port":"80","host":"postman-echo.com","x-amzn-trace-id":"Root=1-621dad94-2fcac1637dc28f172c6346e6","content-length":"17","user-agent":"slm","accept":"*/*","content-type":"application/json"},"json":{"hello":"world"},"url":"http://postman-echo.com/post"}
#XHTTPCRSP:359,1
Read command
The read command is not supported.
Test command
The test command is not supported.
HTTP response #XHTTPCRSP
The #XHTTPCRSP
is an unsolicited notification that indicates that a part of the HTTP response has been received.
Unsolicited notification
It indicates that a part of the HTTP response has been received.
Syntax
#XHTTPCRSP=<byte_received>,<state><CR><LF><response>
The
<byte_received>
is an integer. It represents the length of a partially received HTTP response.The
<state>
value can return one of the following:0
- There is more HTTP response data to come.1
- The entire HTTP response has been received.
The
<response>
is the raw data of the HTTP response, including headers and body.
TWI AT commands
The following commands list contains AT commands related to the two-wire interface (TWI).
List TWI instances #XTWILS
The #XTWILS
command lists all available TWI instances.
Set command
The set command allows you to list all available TWI instances.
Response syntax
#XTWILS: <index>[[[,<index>],<index>],<index>]
The <index>
parameter corresponds to the following TWI instances:
0
- TWI0 (i2c0
).1
- TWI1 (i2c1
).2
- TWI2 (i2c2
).3
- TWI3 (i2c3
).
Example
The following example is meant for Thingy:91.
It shows that TWI2 (i2c2
) is available.
AT#XTWILS
#XTWILS: 2
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Write to TWI peripheral device #XTWIW
The #XTWIW
command writes data to a TWI peripheral device.
Set command
The set command allows you to write data to a TWI peripheral device.
Syntax
#XTWIW=<index>,<dev_addr>,<data>
The
<index>
parameter accepts the following integer values:0
- Use TWI0 (i2c0
).1
- Use TWI1 (i2c1
).2
- Use TWI2 (i2c2
).3
- Use TWI3 (i2c3
).
The
<dev_addr>
parameter is a hexadecimal string. It represents the peripheral device address to write to. The maximum length is 2 characters (for example, “DE” for 0xDE).The
<data>
parameter is a hexadecimal string. It represents the data to be written to the peripheral device. The maximum length is 255 characters (for example, “DEADBEEF” for 0xDEADBEEF).
Response syntax
There is no response.
Example
The following example is meant for Thingy:91.
It performs a write operation to the device address 0x76
(BME680), and it writes D0
to the device.
AT#XTWIW=2,"76","D0"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Read from TWI peripheral device #XTWIR
The #XTWIR
command reads data from a TWI peripheral device.
Set command
The set command allows you to read data from a TWI peripheral device.
Syntax
#XTWIR=<index>,<dev_addr>,<num_read>
The
<index>
parameter accepts the following integer values:0
- Use TWI0 (i2c0
).1
- Use TWI1 (i2c1
).2
- Use TWI2 (i2c2
).3
- Use TWI3 (i2c3
).
The
<dev_addr>
parameter is a hexadecimal string. It represents the peripheral device address to read from. The maximum length is 2 characters (for example, “DE” for 0xDE).The
<num_read>
parameter is an unsigned 8-bit integer. It represents the amount of data to read from the peripheral device. The available range is from 0 to 255 bytes.
Response syntax
#XTWIR:
<data>
The
<data>
parameter is a hexadecimal string. It represents the data read from the peripheral device.
Example
The following example is meant for Thingy:91.
It performs a read operation to the device address 0x76
(BME680), and it reads 1 byte from the device.
The value returned (61
) indicates 0x61
as the CHIP ID
.
AT#XTWIR=2,"76",1
#XTWIR: 61
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
Write data and read from TWI peripheral device #XTWIWR
The #XTWIWR
command writes data to a TWI peripheral device and then reads data from the device.
Set command
The set command allows you to first write data to a TWI peripheral device and then read the returned data.
Syntax
#XTWIW=<index>,<dev_addr>,<data>,<num_read>
The
<index>
parameter accepts the following integer values:0
- Use TWI0 (i2c0
).1
- Use TWI1 (i2c1
).2
- Use TWI2 (i2c2
).3
- Use TWI3 (i2c3
).
The
<dev_addr>
parameter is a hexadecimal string. It represents the peripheral device address to write to. The maximum length is 2 characters (for example, “DE” for 0xDE).The
<data>
parameter is a hexadecimal string. It represents the data to be written to the peripheral device. The maximum length is 255 characters (for example, “DEADBEEF” for 0xDEADBEEF).The
<num_read>
parameter is an unsigned 8-bit integer. It represents the amount of data to read from the peripheral device. The available range is from 0 to 255 bytes.
Response syntax
#XTWIWR:
<data>
The
<data>
parameter is a hexadecimal string. It represents the data read from the peripheral device.
Examples
The following example is meant for Thingy:91.
It performs a write-then-read operation to the device address
0x76
(BME680) to get theCHIP ID
of the device. The value returned (61
) indicates0x61
as theCHIP ID
.AT#XTWIWR=2,"76","D0",1 #XTWIWR: 61 OK
The following example is meant for Thingy:91.
It performs a write-then-read operation to the device address
0x38
(BH1749) to get theMANUFACTURER ID
of the device. The value returned (E0
) indicates0xE0
as theMANUFACTURER ID
of the device.AT#XTWIWR=2,"38","92",1 #XTWIWR: E0 OK
Read command
The read command is not supported.
Test command
The test command is not supported.
GPIO AT commands
The following commands list contains AT commands related to the General Purpose Input/Output (GPIO).
Configure GPIO pins function #XGPIOCFG
The #XGPIOCFG
command configures the specified GPIO function.
Set command
The set command allows you to list all available GPIO instances.
Syntax
#XGPIOCFG=<op>,<pin>
The <op>
parameter indicates the function to be configured.
It accepts the following integer values:
0
- Disable GPIO.
1
- Output.
21
- Input using internal pull up register.
22
- Input using internal pull down register.
The <pin>
parameter indicates the GPIO pin to be configured.
It ranges between 0
and 31
.
Example
Configure GPIO pin 2 as output:
AT#XGPIOCFG=1,2
OK
Configure GPIO pin 6 as input pull up:
AT#XGPIOCFG=21,6
OK
Read command
The read command lists any GPIOs configured by the #XGPIOCFG command.
Example
AT#XGPIOCFG?
#XGPIOCFG
1,2
21,6
OK
Test command
The test command is not supported.
Access GPIO pins #XGPIO
The #XGPIO
command writes, reads, or toggles GPIO pins state.
Set command
The set command allows you to write, read, or toggle GPIO pins state.
Syntax
#XGPIO=<op>,<pin>[,<value>]
The
<op>
parameter accepts the following integer values:0
- Write output GPIO state.1
- Read input GPIO state.2
- Toggle output GPIO state.
The
<pin>
parameter indicates the GPIO pin to be accessed. It ranges between0
and31
.The
<value>
parameter indicates the value to be written to the GPIO pin. It accepts one of the following values:0
- Logic low.1
- Logic high.
Response syntax
Response example when <op>
values are write and toggle:
OK
Response example when the <op>
value is read:
#XGPIO: <pin>,<value>
Example
Example of a write operation:
AT#XGPIO=0,2,1
OK
Example of a read operation:
AT#XGPIO=1,2
#XGPIO: 2,1
OK
Example of a toggle operation:
AT#XGPIO=2,2
OK
Read command
The read command is not supported.
Test command
The test command is not supported.
LwM2M carrier library AT commands
The following commands list contains AT commands related to the LwM2M carrier library.
Carrier event #XCARRIEREVT
The #XCARRIEREVT
is an unsolicited notification that indicates the event of the LwM2M carrier library.
Unsolicited notification
It indicates the event of the LwM2M carrier library.
Syntax
#XCARRIEREVT: <evt_type>,<info>
<data>
The
<evt_type>
value is an integer indicating the type of the event. It can return the following values:1
- LwM2M carrier library initialized.2
- Request to set modem to full functional mode.3
- Request to set modem to flight functional mode.4
- Request to set modem to minimum functional mode.6
- Bootstrap sequence complete.7
- Device registered successfully to the device management servers.8
- Connection to the server failed.9
- Firmware update started.10
- Request application reboot.12
- Modem domain event received.13
- Data received through the App Data Container object.20
- LwM2M carrier library error occurred.
The
<info>
value is an integer providing additional information about the event. It can return the following values:0
- Success or nothing to report.Negative value - Failure or request to defer an application reboot or modem functional mode change.
Positive value - Number of bytes received through the App Data Container object.
The
<data>
parameter is a string that contains the data received through the App Data Container object.
The events of type 2
, 3
and 4
will typically be followed by an error event of type 20
.
This indicates to the application that the library is waiting for the appropriate modem functional mode change.
LwM2M Carrier library #XCARRIER
The #XCARRIER
command allows you to send LwM2M carrier library commands.
Set command
The set command allows you to send LwM2M carrier library commands.
Syntax
AT#XCARRIER=<cmd>[,<param1>[<param2]..]]
The <cmd>
command is a string, and can be used as follows:
AT#XCARRIER="app_data"[,<data>]
AT#XCARRIER="battery_level",<battery_level>
AT#XCARRIER="battery_status",<battery_status>
AT#XCARRIER="current",<power_source>,<current>
AT#XCARRIER="error","add|remove",<error>
AT#XCARRIER="link_down"
AT#XCARRIER="link_up"
AT#XCARRIER="memory_free","read|write"[,<memory>]
AT#XCARRIER="memory_total",<memory>
AT#XCARRIER="portfolio","create|read|write",<instance_id>[,<identity_type>[,<identity>]]
AT#XCARRIER="power_sources"[,<source1>[,<source2>[,...[,<source8>]]]]
AT#XCARRIER="position",<latitude>,<longitude>,<altitude>,<timestamp>,<uncertainty>
AT#XCARRIER="reboot"
AT#XCARRIER="time"
AT#XCARRIER="timezone","read|write"[,<timezone>]
AT#XCARRIER="utc_offset","read|write"[,<utc_offset>]
AT#XCARRIER="utc_time","read|write"[,<utc_time>]
AT#XCARRIER="velocity",<heading>,<speed_h>,<speed_v>,<uncertainty_h>,<uncertainty_v>
AT#XCARRIER="voltage",<power_source>,<voltage>
The values of the parameters depend on the command string used.
When using the app_data
command, if the <data>
attribute is not specified, SLM enters slm_data_mode
.
Response syntax
The response syntax depends on the commands used.
Examples
AT#XCARRIER="time","read"
#XCARRIER: UTC_TIME: 2022-12-30T14:56:46Z, UTC_OFFSET: 60, TIMEZONE: Europe/Paris
OK
AT#XCARRIER="error","add",5
OK
AT#XCARRIER="error","remove",5
OK
AT#XCARRIER="power_sources",1,2,6
OK
AT#XCARRIER="portfolio","read",2,3
#XCARRIER: LwM2M carrier 3.1.0
OK
AT#XCARRIER="reboot"
OK
Read command
The read command is not supported.
Test command
The test command is not supported.