Cellular: AT Client
The AT Client sample demonstrates the asynchronous serial communication taking place over UART to the nRF91 Series 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.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
Board target |
---|---|---|---|
PCA20065 |
thingy91x |
|
|
PCA10153 |
|
||
PCA10090 |
|
||
PCA10171 |
|
When built for a board target with the */ns
variant, 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.
Overview
The AT Client sample acts as a proxy for sending directives to the nRF91 Series modem using AT commands. This facilitates the reading of responses or analyzing of events related to the nRF91 Series 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.
For more information on the AT commands, see the nRF91x1 AT Commands Reference Guide or nRF9160 AT Commands Reference Guide depending on the SiP you are using.
Sending traces over UART on an nRF91 Series DK
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.
Building and running
This sample can be found under samples/cellular/at_client
in the nRF Connect SDK folder structure.
When built as firmware image for a board target with the */ns
variant, 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, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the SDK repositories, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild
parameter to every build command or configure west to always use it.
Testing
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.
Connect to the nRF91 Series DK with nRF Connect Serial Terminal.
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.
Sample output
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
References
Dependencies
This sample uses the following nRF Connect SDK libraries:
AT Host which includes:
It uses the following sdk-nrfxlib library:
In addition, it uses the following secure firmware component: