nRF9160: AT monitor
The AT monitor sample demonstrates how to use the AT monitor library and define AT monitors to receive AT notifications from the Modem library.
Requirements
The sample supports the following development kit:
Hardware platforms |
PCA |
Board name |
Build target |
---|---|---|---|
PCA10090 |
|
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.
You can also configure it to use TF-M instead of Secure Partition Manager.
Overview
The sample defines two AT monitors, one for network status notifications (+CEREG
) and one for received signal quality parameters notifications (+CESQ
) through the AT_MONITOR()
macro.
The sample then subscribes to both notifications and switches the modem to function mode one to register to the network.
While the device is registering to the network, the sample uses one of the AT monitors to determine if the registration is complete and monitors the signal quality using the other monitor.
Once the device registers with the network, the sample reads the modem PSM mode status, enables it, and reads the PSM mode status again.
Building and running
This sample can be found under samples/nrf9160/at_monitor
in the nRF Connect SDK folder structure.
The sample is built as a non-secure firmware image for the nrf9160dk_nrf9160_ns build target. Because of this, it automatically includes the Secure Partition Manager. You can also configure it to use TF-M instead of SPM.
See Building and programming an application for information about how to build and program the application.
Testing
After programming the sample to your development kit, test it by performing the following steps:
Connect the kit to the computer using a USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.
Connect to the kit with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.
Power on or reset your nRF9160 DK.
Observe that the sample starts and connects to the LTE network, while displaying both the network registration status and signal quality during the process.
Observe that the sample displays the PSM status twice on the terminal, once when it is disabled, and once when it is enabled.
Observe that the sample completes with a message on the terminal.
Sample Output
The sample shows the following output:
AT Monitor sample started
Subscribing to notifications
Connecting to network
Resuming link quality monitor for AT notifications
Waiting for network
Link quality: -61 dBm
Network registration status: searching
Link quality: -59 dBm
Network registration status: home
Network connection ready
Pausing link quality monitor for AT notifications
Reading PSM info...
PSM: disabled
Enabling PSM
Reading PSM info...
PSM: enabled
Periodic TAU string: 00000110
Active time string: 00100001
Modem response:
+CEREG: 1,1
OK
Shutting down modem
Network registration status: no network
Bye
Dependencies
This sample uses the following nRF Connect SDK libraries:
It uses the following sdk-nrfxlib library:
In addition, it uses the following sample: