Quickstart

nRF Connect SDK Integration

Integrate your devices with Nordic nRF Connect SDK using Spotflow west module.

Select your development board
We'll tailor the quickstart guide for your specific hardware

Prerequisites

See the official documentation of nRF Connect SDK to install the following:

  • SEGGER J-Link and related tools
  • nRF Util - either standalone or as a part of nRF Connect for VS Code

The workspace setup script requires Python 3.10+ and Git.

Create West Workspace

The following script will guide you through the creation of a new workspace that contains the Spotflow module and sample applications:

source <(curl --proto '=https' --tlsv1.2 -sSf https://downloads.spotflow.io/spotflowup.sh) --ncs --board other_nordic

Alternatively, you can create the workspace manually by following these steps.

Configure Sample Application

To try out logging to Spotflow, let's configure the sample application. Fill in the required configuration options in <workspace-folder>/spotflow/zephyr/samples/logs/prj.conf:

CONFIG_NET_WIFI_SSID="<Your Wi-Fi SSID>"
CONFIG_NET_WIFI_PASSWORD="<Your Wi-Fi password>"

CONFIG_SPOTFLOW_DEVICE_ID="nordic-device-001" # Set unique identifier of your device
CONFIG_SPOTFLOW_INGEST_KEY="<your-ingest-key>"

If you’re using Ethernet, make sure the Ethernet cable is plugged in into the board and the network has internet access.

The CONFIG_SPOTFLOW_INGEST_KEY is a secret key that allows your device to authenticate with Spotflow. You can manage your ingest keys in the ingest keys page.

Run Sample Application

The following terminal commands are expected to run in the nRF Connect toolchain environment. See the official documentation for more details: VS Code, CLI.

Now, you are ready to build and flash your application to the device and start sending logs to Spotflow:

>_ nRF Connect Terminal
cd spotflow/zephyr/samples/logs
west build --pristine --board <your-board>
west flash

If you open the UART output from the device, it should be similar to this one:

[00:00:00.432,739] <dbg> spotflow_logging: init: Initializing spotflow logging backend
[00:00:00.432,769] <inf> spotflow_net: spotflow_config_init_sent_log_level: Initialized sent log level to 4
[00:00:00.432,800] <dbg> spotflow_net: spotflow_start_mqtt: Thread started with priority 14 and stack size 2560
[00:00:00.432,800] <inf> spotflow_logging: init: Spotflow logging backend initialized.
*** Booting nRF Connect SDK v3.2.2-74845e169be2 ***
*** Using Zephyr OS v4.2.99-ec78104f1569 ***
[00:00:00.641,479] <inf> MAIN: main: Starting Spotflow logging example
[00:00:00.641,754] <inf> wifi_supplicant: handler: wpa_supplicant initialized
[00:00:00.645,385] <dbg> spotflow_net: spotflow_mqtt_thread_entry: Starting Spotflow processing thread
[00:00:00.647,033] <inf> spotflow_net: wait_for_network: Waiting for network...
[00:00:01.641,632] <inf> spotflow_sample_wifi: connect_to_wifi: Connecting to SSID: TP-Link_B4F9

[00:00:03.553,161] <inf> MAIN: main: Hello from Zephyr to Spotflow: 0
[00:00:04.929,412] <inf> spotflow_sample_wifi: wifi_event_handler: Connected to TP-Link_B4F9
[00:00:05.553,222] <inf> MAIN: main: Hello from Zephyr to Spotflow: 1
[00:00:07.553,314] <inf> MAIN: main: Hello from Zephyr to Spotflow: 2
[00:00:07.975,433] <dbg> spotflow_net: l4_event_handler: Network connectivity established and IP address assigned
[00:00:07.976,104] <dbg> spotflow_net: spotflow_tls_init: TLS init
[00:00:07.976,135] <dbg> spotflow_net: spotflow_mqtt_thread_entry: Spotflow registered TLS credentials
[00:00:07.976,165] <dbg> spotflow_net: client_init: Resolving DNS
[00:00:08.001,037] <dbg> spotflow_net: spotflow_conn_helper_resolve_hostname: DNS resolved for mqtt.dev1.o11y.spotflow.dev:8883
[00:00:08.001,068] <inf> spotflow_device_id: spotflow_get_device_id: Using Spotflow device ID: nrf7002dk_test_ncs_321
[00:00:08.001,098] <dbg> spotflow_net: client_init: Using secure transport
[00:00:08.999,298] <dbg> spotflow_net: prepare_fds: Using secure
[00:00:09.058,990] <dbg> spotflow_net: mqtt_evt_handler: MQTT client connected!
[00:00:09.059,020] <inf> spotflow_net: spotflow_mqtt_establish_mqtt: MQTT connected!
[00:00:09.246,612] <dbg> spotflow_net: mqtt_evt_handler: SUBACK packet id: 32268
[00:00:09.246,643] <dbg> spotflow_net: mqtt_evt_handler: Subscription to desired configuration topic acknowledged
[00:00:09.553,405] <inf> MAIN: main: Hello from Zephyr to Spotflow: 3
[00:00:11.553,466] <inf> MAIN: main: Hello from Zephyr to Spotflow: 4
[00:00:13.553,558] <inf> MAIN: main: Hello from Zephyr to Spotflow: 5
[00:00:15.553,649] <inf> MAIN: main: Hello from Zephyr to Spotflow: 6
[00:00:17.553,741] <inf> MAIN: main: Hello from Zephyr to Spotflow: 7
...

Learn more

How is this guide?