nRF9160: nRF CoAP Client¶
The nRF CoAP Client sample demonstrates how to receive data from a public CoAP server with an nRF9160 SiP.
The sample connects to a public CoAP test server, sends periodic GET request for a test resource that is available on the server, and prints the data that is received.
The following development board:
nRF9160 DK board (PCA10090) - see Working with nRF9160
The sample is configured to compile and run as a non-secure application on nRF91’s Cortex-M33. Therefore, it automatically includes the nRF9160: 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/coap_client in the nRF Connect SDK folder structure.
The sample is built as a non-secure firmware image for the nrf9160_pca10090ns board. Because of this, it automatically includes the nRF9160: Secure Partition Manager.
See Building and programming a sample application for information about how to build and program the application.
After programming the sample and all prerequisites to the board, test it by performing the following steps:
Connect the USB cable and power on or reset your nRF9160 DK.
Open a terminal emulator and observe that the kit prints the following information:
The nRF CoAP client sample started
Observe that the kit sends periodic CoAP GET requests after it gets LTE connection. The kit sends requests to the configured server (
CONFIG_COAP_SERVER_HOSTNAME) for a configured resource (
Observe that the kit either prints the reponse data received from the server or indicates a time-out.