nRF9160: AT Client¶
The AT Client sample demonstrates the asynchronous serial communication taking place over UART to the nRF9160 modem. The sample enables you to use an external computer or MCU to send AT commands to the LTE-M/NB-IoT modem of your nRF9160 device.
The AT Client sample acts as a proxy for sending directives to the nRF9160 modem via AT commands. This facilitates the reading of responses or analyzing of events related to the nRF9160 modem. The commands can be initiated from a terminal or the LTE Link Monitor, which is an application implemented as part of nRF Connect for Desktop.
For more information on the AT commands, see the AT Commands Reference Guide.
The sample supports the following development kit:
The sample is configured to compile and run as a non-secure application on nRF91’s Cortex-M33. Therefore, it automatically includes the Secure Partition Manager that prepares the required peripherals to be available for the application.
Building and running¶
This sample can be found under
samples/nrf9160/at_client in the nRF Connect SDK folder structure.
The sample is built as a non-secure firmware image for the nrf9160dk_nrf9160ns build target. Because of this, it automatically includes the Secure Partition Manager.
See Building and programming a sample application for information about how to build and program the application.
After programming the sample to your board, test the sample by performing the following steps:
Press the reset button on the nRF9160 DK to reboot the board and start the AT Client sample.
Make sure that Automatic requests is enabled in LTE Link Monitor.
Observe that initially the command AT+CFUN? is automatically sent to the modem, which returns a value 4, indicating that the modem is in the offline mode.
Observe that the LTE Link Monitor terminal display also shows AT+CFUN=1 followed by
OKindicating that the modem has changed to the normal mode.
Run the following commands from the LTE Link Monitor terminal:
Enter the command: AT+CFUN?
This command reads the current functional mode of the modem and triggers the command AT+CFUN=1 which sets the functional mode of the modem to normal.
Enter the command AT+CFUN? into the LTE Link Monitor terminal again.
The UART/Modem/UICC/LTE/PDN indicators in the LTE Link Monitor side panel turn green. This command also automatically launches a series of commands like:
AT+CGSN=1 which displays the product serial identification number (IMEI).
AT+CGMI which displays the manufacturer name.
AT+CGMM which displays the model identification name.
AT+CGMR which displays the revision identification.
AT+CEMODE which displays the current mode of operation.
Enter the command: AT%XOPERID
This command returns the network operator ID.
Enter the command: AT%XMONITOR
This command returns the modem parameters.
Enter the command: AT%XTEMP?
This command displays the current modem temperature.
Enter the command: AT%CMNG=1
This command displays a list of all certificates that are stored on your device. If the device has been added to nRF Cloud, a CA certificate, a client certificate, and a private key with security tag 16842753 (which is the security tag for nRF Cloud credentials) are displayed.
The following is a sample output of the command: AT%XMONITOR
AT%XMONITOR %XMONITOR: 5,"","","24201","76C1",7,20,"0102DA03",105,6400,53,24,"","11100000","11100000" OK
This sample uses the following libraries:
- From nRF Connect SDK
- From nrfxlib
In addition, it uses the following samples:
- From nRF Connect SDK