Cellular: AT Client
The AT Client sample demonstrates the asynchronous serial communication taking place over UART to the cellular 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 nRF91 Series device.
The sample supports the following development kits:
When built for an
_ns build target, the sample is configured to compile and run as a non-secure application with Cortex-M Security Extensions enabled.
Therefore, it automatically includes Trusted Firmware-M that prepares the required peripherals and secure services to be available for the application.
The AT Client sample acts as a proxy for sending directives to the cellular modem using AT commands. This facilitates the reading of responses or analyzing of events related to the cellular modem. You can initiate the commands manually from a terminal such as the nRF Connect Serial Terminal, or visually using the Cellular Monitor app. Both apps are part of nRF Connect for Desktop.
To send modem traces over UART on an nRF91 Series DK, configuration must be added for the UART device in the devicetree and Kconfig. This is done by adding the modem trace UART snippet when building and programming.
Use the Cellular Monitor app for capturing and analyzing modem traces.
TF-M logging must use the same UART as the application. For more details, see shared TF-M logging.
This sample can be found under
samples/cellular/at_client in the nRF Connect SDK folder structure.
When built as firmware image for the
_ns build target, the sample has Cortex-M Security Extensions (CMSE) enabled and separates the firmware between Non-Secure Processing Environment (NSPE) and Secure Processing Environment (SPE).
Because of this, it automatically includes the Trusted Firmware-M (TF-M).
To read more about CMSE, see Processing environments.
To build the sample with Visual Studio Code, follow the steps listed on the How to build an application page in the nRF Connect for VS Code extension documentation. See Building and programming an application for other building and programming scenarios and Testing and debugging an application for general information about testing and debugging in the nRF Connect SDK.
After programming the sample to your development kit, test it by performing the following steps:
Press the reset button on the nRF91 Series DK to reboot the kit and start the AT Client sample.
Run the following commands from the Serial 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%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 you add the device 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.
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 nRF Connect SDK libraries:
It uses the following sdk-nrfxlib library:
In addition, it uses the following secure firmware component: