Zephyr Blueprint

1NCE Zephyr blueprint

🧭 Overview

The 1NCE Zephyr Blueprint is a reference application that showcases how to integrate and use various 1NCE OS features with Zephyr RTOS, including:

  • Device Authenticator
  • 📡 IoT Integrator
  • 🔋 Energy Saver
  • 📥 Device Controller for UDP and CoAP-based downlink and real-time remote interaction
  • 🧩 Plugin Integrations with partners like Mender for FOTA and Memfault for device observability

It is based on the 1NCE IoT C SDK and runs on Nordic Semiconductor boards.

The Zephyr OS is a scalable, secure, real-time operating system designed for resource-constrained embedded devices — from smart sensors to full-featured gateways.


🧱 Supported Boards

The demo supports the following Nordic boards:


🚀 Getting Started

This guide walks you through:

  • Setting up the 1NCE IoT C SDK
  • Getting the source code
  • Building and flashing the blueprint demo

📦 Prerequisites


🧩 Integrating 1NCE IoT C SDK

The 1NCE IoT C SDK provides C-based modules to easily use 1NCE OS services.

Follow these steps:

  1. Open west.yml:

    %HOMEPATH%\ncs\v2.8.0\nrf\west.yml
    
  2. Add the module to name-allowlist:
    Ensure nce-sdk is listed in alphabetical order.

  3. Activate the SDK via submanifest:

    Rename and edit the file:

    %HOMEPATH%\ncs\v2.8.0\zephyr\submanifests\example.yaml
    
    manifest:
      projects:
        - name: nce-sdk
          url: https://github.com/1NCE-GmbH/1nce-iot-c-sdk
          revision: main
    
  4. Run West update:
    Open a terminal (e.g., cmd.exe on Windows, Terminal on macOS/Linux) and run:

    cd %HOMEPATH%\ncs\v2.8.0
    west update
    

▶️ Running the Demo

  1. Clone the Blueprint Repository:

    git clone https://github.com/1NCE-GmbH/blueprint-zephyr.git
    
  2. Open VS Code and Launch nRF Connect Extension

  3. Add the project:

    • Click Add Existing Application
    • Choose the folder where the blueprint was cloned
  4. Create a Build Configuration:

    • Select your board target, e.g.:
      • nrf9160dk/nrf9160/ns
      • nrf9151dk/nrf9151/ns
      • thingy91/nrf9160/ns
  5. Flash the board:

    • Connect your board via USB
    • Click Flash or Debug to deploy the firmware

📖 Need help with board connection?
👉 Nordic Docs: Connect Using Serial Port


🧪 Testing Instructions for Thingy:91

To easily test the default setup on the Thingy:91, follow these steps using the provided binaries for the specific demo you'd like to run:

  1. Remove the plastic cover from the Thingy:91.
  2. Connect the device to your computer using a micro-USB cable.
  3. Enter DFU mode:
    • Power off the Thingy:91.
    • Hold down the black button while switching the power back to ON.
  4. Open nRF Connect for Desktop and launch the Programmer tool.
  5. Click SELECT DEVICE and choose Thingy:91 from the dropdown list.
  6. In the left panel, go to File > Add file > Browse and choose the appropriate .hex file from the thingy_binaries folder of your desired demo.
  7. Scroll down to Enable MCUboot and ensure it is checked.
  8. Click Write on the left panel, then confirm again in the MCUboot DFU pop-up by pressing Write.
  9. Wait for the update to finish. A message saying "Completed successfully" will confirm a successful flash.

📂 Available Firmware for Thingy:91

💡

Note: For Memfault diagnostics and debugging, you should upload zephyr.elf file to the Memfault portal.

Refer to the Memfault documentation for instructions on setting up symbol files and debugging integration.
For a faster getting started experience, you can directly use the documentation under plugin_system/nce_debug_memfault_demo.

📘 For more detailed device guidance, check the official Thingy:91 Getting Started Guide


📚 Demos in This Blueprint

The blueprint includes the following applications:

Demo PathSummary
nce_coap_demoSecure CoAP communication using DTLS from Device Authenticator, with Energy Saver & Device Controller support
nce_udp_demoLightweight UDP communication with compressed payloads and Device Controller
nce_lwm2m_demoLwM2M client for LED, buzzer, and sensor control over CoAP/DTLS with support for 1NCE Action API
plugin_system/nce_debug_memfault_demoDevice diagnostics and crash reporting using Memfault over the 1NCE CoAP Proxy
plugin_system/nce_fota_mender_demoFirmware-over-the-air updates via Mender.io using the 1NCE CoAP Proxy and secure onboarding

Sample Demos

1NCE Zephyr blueprint - UDP Demo

Overview

1NCE Zephyr UDP Demo allows customers to communicate with 1NCE endpoints via UDP Protocol, and it can send compressed payload using the Energy Saver feature.

On the Thingy:91 device, LED indicators show the following statuses:

  • 🔴 RED – Connecting to the network
  • 🔵 BLUE – Network connection established
  • 🟢 GREEN – Message sent to 1NCE OS

⚡ Using 1NCE Energy Saver

The demo can send optimized payload using 1NCE Energy Saver. To enable this feature, add the following flag to prj.conf

CONFIG_NCE_ENERGY_SAVER=y

When enabled, the device will send compressed messages based on a translation template defined in 1NCE OS portal.

📖

Learn more: See the 1NCE Energy Saver documentation for details on how this feature works and how to configure templates.

🕵️

Tip: You can view incoming messages in the Device Inspector in the 1NCE OS portal.

💡

Note:

Add the template located in ./nce_udp_demo/template/template.json to the 1NCE OS portal, and enable it for the UDP protocol to ensure correct decoding of the compressed payload.

⚙️ Configuration Options

The available configuration parameters for the UDP demo:

Config OptionDescriptionDefault
CONFIG_UDP_SERVER_HOSTNAMEUDP server hostnameudp.os.1nce.com
CONFIG_UDP_SERVER_PORTUDP server port number4445
CONFIG_UDP_DATA_UPLOAD_FREQUENCY_SECONDSInterval between UDP transmissions (in seconds)20
CONFIG_UDP_PSM_ENABLEEnable LTE Power Saving Mode (PSM)n
CONFIG_UDP_EDRX_ENABLEEnable LTE enhanced Discontinuous Reception (eDRX)n
CONFIG_UDP_RAI_ENABLEEnable LTE Release Assistance Indication (RAI)n

🔋 Payload Configuration

Depending on whether the Energy Saver feature is enabled:

  • If CONFIG_NCE_ENERGY_SAVER is disabled:
Config OptionDescriptionDefault
CONFIG_PAYLOADMessage sent to 1NCE IoT Integrator{"text": "Hi, this is a test message!"}
  • If CONFIG_NCE_ENERGY_SAVER is enabled:
Config OptionDescriptionDefault
CONFIG_NCE_PAYLOAD_DATA_SIZEPayload data size for the Energy Saver template10

🧠 Device Controller

The Device Controller allows your device to receive CoAP downlink messages using the 1NCE Management API. It supports sending downlink requests that your device can process in real-time.

📘 More info: 1NCE DevHub – Device Controller

🔁 Sending a Request

You can trigger a downlink using the following curl command:

curl -X 'POST' 'https://api.1nce.com/management-api/v1/integrate/devices/<ICCID>/actions/UDP' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your Access Token >' \
-H 'Content-Type: application/json' \
-d '{
  "payload": "enable_sensor",
  "payloadType": "STRING",
  "port": 3000,
  "requestMode": "SEND_NOW"
}'

Replace:

  • <ICCID> with your SIM's ICCID
  • <your Access Token> with your OAuth token

📩 Request Parameters

ParameterDescriptionExample
payloadData to send to the device"enable_sensor"
payloadTypeType of payload (STRING, HEX, etc.)"STRING"
portUDP port to receive the message (CONFIG_NCE_RECV_PORT)3000
requestModeRequest mode (SEND_NOW or SEND_WHEN_ACTIVE)"SEND_NOW"

🔧 Zephyr Device Controller Configuration

To enable and handle downlink messages on your device, use the following configs:

Config OptionDescriptionDefault
CONFIG_NCE_ENABLE_DEVICE_CONTROLLEREnables the device controller featurey
CONFIG_NCE_RECV_PORTUDP port to listen for incoming messages3000
CONFIG_NCE_RECEIVE_BUFFER_SIZEBuffer size for incoming UDP payloads1024

📤 Zephyr Output Example

When the Zephyr application receives a UDP downlink from the 1NCE API:

[00:00:02.996,978] <inf> [downlink_thread] NCE_UDP_DEMO: Downlink thread started...
[00:00:02.997,802] <inf> [downlink_thread] NCE_UDP_DEMO: Listening on port: 3000
[00:00:11.325,683] <inf> [downlink_thread] NCE_UDP_DEMO: Received message: enable_sensor

📦 Ready-to-Flash Firmware for Thingy:91

We provide a prebuilt HEX file for Thingy:91 that you can flash directly to your device for quick testing.
No build setup is required — just flash and go.

👉 Download: Thingy:91 Prebuilt HEX

Note: The firmware is configured with all LTE bands enabled, which may cause a delay of several minutes during the initial network connection while scanning for available bands. This is normal.


1NCE Zephyr blueprint - CoAP Demo

Overview

1NCE Zephyr CoAP Demo allows customers to establish a secure communication with 1NCE endpoints via CoAPs after receiving DTLS credentials from Device Authenticator using the SDK. It can also send compressed payload using the Energy Saver feature.

On the Thingy:91 device, LED indicators show the following statuses:

  • 🔴 RED – Connecting to the network
  • 🔵 BLUE – Network connection established
  • 🟢 GREEN – Message sent to 1NCE OS

Secure Communication with DTLS using 1NCE SDK

By default, the demo uses 1NCE SDK to send a CoAP GET request to 1NCE OS Device Authenticator. The response is then processed by the SDK and the credentials are used to connect to 1NCE endpoint via CoAP with DTLS.

⚠️

Note: If the Pre-shared Key for DTLS is set manually, STRING format should be used.

Unsecure CoAP Communication

To test unsecure communication (plain CoAP), disable the device authenticator by adding the following flag to prj.conf

CONFIG_NCE_DEVICE_AUTHENTICATOR=n

⚡ Using 1NCE Energy saver

The demo can send compressed, optimized payloads using 1NCE Energy Saver. This reduces payload size and improves energy efficiency.
Enable in prj.conf:

CONFIG_NCE_ENERGY_SAVER=y

When enabled, the device will send compressed messages based on a translation template defined in 1NCE OS portal.

💡

Note:

Add the template located in ./nce_coap_demo/template/template.json to the 1NCE OS portal, and enable it for the COAP protocol to ensure correct decoding of the compressed payload.

📖

Learn more: See the 1NCE Energy Saver documentation for details on how this feature works and how to configure templates.

🕵️

Tip: You can view incoming messages in the Device Inspector in the 1NCE OS portal.

If disabled, a plain-text message will be sent instead.

⚙️ Configuration options

The following configuration options are available for customizing the CoAP client behavior:

Config OptionDescriptionDefault
CONFIG_COAP_SAMPLE_SERVER_HOSTNAMECoAP server hostnamecoap.os.1nce.com
CONFIG_COAP_SAMPLE_SERVER_PORTCoAP server port (5684 if DTLS enabled, otherwise 5683)Auto
CONFIG_COAP_URI_QUERYURI query string used as topic parametert=test
CONFIG_COAP_SAMPLE_REQUEST_INTERVAL_SECONDSInterval between uplink messages (in seconds)60
CONFIG_NCE_DEVICE_AUTHENTICATOREnables device onboarding with 1NCE SDKy
CONFIG_NCE_UPLINK_MAX_RETRIESMax retry attempts for uplink CoAP requests5
CONFIG_NCE_DTLS_HANDSHAKE_TIMEOUT_SECONDSDTLS handshake timeout15
CONFIG_NCE_MAX_DTLS_CONNECTION_ATTEMPTSMax DTLS failures before retrying onboarding3
CONFIG_NCE_DTLS_SECURITY_TAGDTLS TAG used to store credentials on the modem1111
CONFIG_NCE_ENABLE_DTLSEnables DTLS for secure CoAP communication. This is automatically enabled when both ZEPHYR_NCE_SDK_MODULE and NCE_DEVICE_AUTHENTICATOR are enabled.y if ZEPHYR_NCE_SDK_MODULE && NCE_DEVICE_AUTHENTICATOR, else n

🔋 Payload Configuration

Depending on whether the Energy Saver feature is enabled:

  • If CONFIG_NCE_ENERGY_SAVER is disabled:
Config OptionDescriptionDefault
CONFIG_PAYLOADMessage sent to 1NCE IoT Integrator{"text": "Hi, this is a test message!"}

  • If CONFIG_NCE_ENERGY_SAVER is enabled:
Config OptionDescriptionDefault
CONFIG_NCE_PAYLOAD_DATA_SIZEPayload data size for the Energy Saver template10

⚠️

Note: The default maximum length for CONFIG_COAP_URI_QUERY is 12 bytes.

To increase this limit, set:

CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=<your_desired_length>

🧠 Device Controller

The Device Controller allows your device to receive CoAP downlink messages using the 1NCE Management API. It supports sending downlink requests that your device can process in real-time.

📘 More info: 1NCE DevHub – Device Controller

🔁 Sending a Request

Use the following curl command to send a CoAP request to your device:

curl -X 'POST' 'https://api.1nce.com/management-api/v1/integrate/devices/<ICCID>/actions/COAP' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <your Access Token >' \
-H 'Content-Type: application/json' \
-d '{
  "payload": "Data to send to the device",
  "payloadType": "STRING",
  "port": <NCE_RECV_PORT>,
  "path": "/example?param1=query_example1",
  "requestType": "POST",
  "requestMode": "SEND_NOW"
}'

Replace:

  • <ICCID> with your SIM’s ICCID
  • <your Access Token> with your OAuth token

📩 Request Parameters

ParameterDescriptionExample
payloadData to send to the device"enable_sensor"
payloadTypeType of payload (STRING, HEX, etc.)"STRING"
portDevice port to receive the message3000
pathRequest path and optional query"/example?param1=query"
requestTypeCoAP method to use (POST, GET, etc.)"POST"
requestModeRequest mode (SEND_NOW, SEND_WHEN_ACTIVE)"SEND_NOW"

🔧 Zephyr Device Controller Configuration

If CONFIG_NCE_ENABLE_DEVICE_CONTROLLER is enabled:

Config OptionDescriptionDefault
CONFIG_NCE_ENABLE_DEVICE_CONTROLLEREnables the device controller featurey
CONFIG_NCE_RECV_PORTUDP port to listen for incoming CoAP messages3000
CONFIG_NCE_RECEIVE_BUFFER_SIZEBuffer size for CoAP message handling1024
CONFIG_NCE_DOWNLINK_MAX_RETRIESMax retry attempts for setting up downlink socket5
CONFIG_NCE_COAP_MAX_URI_PATH_SEGMENTSMaximum number of URI path segments to support in CoAP requests5
CONFIG_NCE_COAP_MAX_URI_QUERY_PARAMSMaximum number of query parameters allowed in CoAP requests5

⚠️ CoAP Limitations

CoAP messages — including uplink and downlink — are subject to strict option length limitations (especially for URI-QUERY and extended paths).
Make sure to increase buffer sizes if your topic or query strings exceed the default 12 bytes using:

CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=<length>

📤 Zephyr Output Example

When the Zephyr application receives a CoAP message from the 1NCE API:

[00:00:02.275,817] <inf> [downlink_thread] NCE_COAP_DEMO: Downlink thread started...
[00:00:02.276,336] <inf> [downlink_thread] NCE_COAP_DEMO: Listening on port: 3000

[00:00:07.847,869] <inf> [downlink_thread] NCE_COAP_DEMO: Received 72 bytes from server
[00:00:07.847,930] <inf> [downlink_thread] NCE_COAP_DEMO: Received raw data:
                                                          48 02 1e 02 98 73 d5 1f  d7 3a 5a 1c b7 65 78 61 |H....s.. .:Z..exa
                                                          6d 70 6c 65 10 3d 08 70  61 72 61 6d 31 3d 71 75 |mple.=.p aram1=qu
                                                          65 72 79 5f 65 78 61 6d  70 6c 65 31 ff 44 61 74 |ery_exam ple1.Dat
                                                          61 20 74 6f 20 73 65 6e  64 20 74 6f 20 74 68 65 |a to sen d to the
                                                          20 64 65 76 69 63 65 0a                          | device.         
[00:00:07.847,961] <inf> [downlink_thread] NCE_COAP_DEMO: CoAP Header:
[00:00:07.847,991] <inf> [downlink_thread] NCE_COAP_DEMO: Version: 1
[00:00:07.848,022] <inf> [downlink_thread] NCE_COAP_DEMO: Type: CON
[00:00:07.848,022] <inf> [downlink_thread] NCE_COAP_DEMO: CoAP Request Method: POST (0.02)
[00:00:07.848,052] <inf> [downlink_thread] NCE_COAP_DEMO: Message ID: 7682
[00:00:07.848,052] <inf> [downlink_thread] NCE_COAP_DEMO: CoAP Options:
[00:00:07.848,083] <inf> [downlink_thread] NCE_COAP_DEMO: Complete Path: 
[00:00:07.848,114] <inf> [downlink_thread] NCE_COAP_DEMO: /example

[00:00:07.848,175] <inf> [downlink_thread] NCE_COAP_DEMO: CoAP Payload (binary):
                                                          44 61 74 61 20 74 6f 20  73 65 6e 64 20 74 6f 20 |Data to  send to 
                                                          74 68 65 20 64 65 76 69  63 65 0a                |the devi ce.     
[00:00:07.848,236] <inf> [downlink_thread] NCE_COAP_DEMO: sent ack:
                                                          68 44 1e 02 98 73 d5 1f  d7 3a 5a 1c             |hD...s.. .:Z.    
[00:00:07.848,632] <inf> [downlink_thread] NCE_COAP_DEMO: CoAP ACK sent successfully

📦 Ready-to-Flash Firmware for Thingy:91

We provide a prebuilt HEX file for Thingy:91 that you can flash directly to your device for quick testing.
No build setup is required — just flash and go.

👉 Download: Thingy:91 Prebuilt HEX

Note: The firmware is configured with all LTE bands enabled, which may cause a delay of several minutes during the initial network connection while scanning for available bands. This is normal.


1NCE Zephyr blueprint - LwM2M Demo

Overview

The 1NCE LwM2M Demo enables devices to communicate with 1NCE endpoints using the LwM2M protocol over CoAP, with optional DTLS for secure messaging. It supports control of LEDs, buzzers, sensors, and other objects via LwM2M standard object models.

On the Thingy:91 device, LED indicators show the following statuses:

  • 🔴 RED – the device is currently connecting to the network
  • 🔵 BLUE – the device is currently bootstrapping
  • 🟢 GREEN (10 seconds) – the device is registered with 1NCE LwM2M server

✅ Supported Objects for LwM2M Actions

🔗 LwM2M actions can be tested using the 1NCE Action API or from the device controller tab in 1NCE OS UI.

ObjectPath(s)DescriptionSupported Boards
Light Control/3311/0/5850 (1 Thingy:91 LED)
/3311/<0–3>/5850 (4 DK LEDS)
Boolean: LED on/offAll boards
Light Color/3311/0/5706RGB LED color in HEX (e.g., 0xFF0000)Thingy:91 only
Buzzer/3338/0/5850Boolean: Audible alertThingy:91 only

⚙️ Configuration Options

🔐 Authentication & Server Setup

Config OptionDescriptionDefault
CONFIG_NCE_ICCIDICCID used as endpoint name and device identity""
CONFIG_NCE_LWM2M_BOOTSTRAP_PSKPre-shared key in HEX for bootstrap/auth""
CONFIG_LWM2M_CLIENT_UTILS_SERVERLwM2M server URI (e.g., coaps://lwm2m.os.1nce.com:5684)-
CONFIG_LWM2M_CLIENT_UTILS_BOOTSTRAP_TLS_TAGSecurity tag for bootstrap server (credentials storage)1111
CONFIG_LWM2M_CLIENT_UTILS_SERVER_TLS_TAGSecurity tag for main server (replaced after bootstrap)1112
CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIMEDefault LwM2M Server lifetime (in seconds)180

📌 The PSK (Pre-Shared Key) must match the credentials registered using the 1NCE PSK API

⚠️

The PSK must be provided in HEX format, not plain text.

💡 Example:
If your desired PSK is the string KeyPass123, you must convert it to its hexadecimal representation.

Conversion:

  • Input string: KeyPass123
  • HEX format: 4b657950617373313233

Use this HEX value (4b657950617373313233) when setting CONFIG_NCE_LWM2M_BOOTSTRAP_PSK.

✅ Tools for conversion:

echo -n 'KeyPass123' | xxd -p

🔓 Unsecured LwM2M (Testing Only)

To run without DTLS (e.g., during integration testing):

CONFIG_LWM2M_DTLS_SUPPORT=n
CONFIG_LWM2M_CLIENT_UTILS_SERVER="coap://lwm2m.os.1nce.com:5683"

🧩 Feature Modules

Input Controls

ModuleDescriptionCondition
CONFIG_APP_PUSH_BUTTONEnable push button support (Object 3347)All boards:
• Thingy:91 (1 button)
• nRF9160 DK & nRF9151 DK (2 buttons)
CONFIG_APP_ONOFF_SWITCHEnable on/off switch input support (Object 3342)DK boards only:
• nRF9160 DK (2 switches)
• nRF9151 DK (Buttons 3 and 4 are used as switches)

Main LwM2M Resources for Push Button and On/Off Switch Objects

Resource IDNameTypeDescription
5500Digital Input StateBooleantrue if pressed/on, false if released/off
5501Digital Input CounterIntegerNumber of times the button/switch has toggled
5518Timestamp of Last ChangeTimeTime of the last change (press/release or on/off toggle)

💡 Note:

  • Resource values can be monitored by sending an observe-start request to the relevant object (e.g., /3347) using 1NCE OS device controller.

Output Controls

ModuleDescriptionCondition
CONFIG_APP_LIGHT_CONTROLEnable LED output (Object 3311)All boards
CONFIG_APP_BUZZEREnable buzzer output (Object 3338)Thingy:91 only

🧾 Device Identity

Set device manufacturer and type:

CONFIG_APP_MANUFACTURER="Nordic Semiconductor ASA"
CONFIG_APP_DEVICE_TYPE="OMA-LWM2M Client"

💡 Notes:

  • Those values are stored in the /3/0/0 and /3/0/17 resources of the device object.
  • The device object is not included in passive reporting, but it can be retrieved by sending a Read request to object /3 using 1NCE OS device controller.

🔧 Logging

Configure log levels for the application:

CONFIG_APP_LOG_LEVEL_INF=y
CONFIG_LOG=y

1NCE Zephyr blueprint - 1NCE FOTA Mender Demo

Overview

The 1NCE FOTA Mender Demo enables firmware-over-the-air (FOTA) updates through Mender.io using the 1NCE CoAP Proxy for secure and efficient communication. The device securely connects, authenticates, checks for firmware updates, downloads new versions, and updates itself.

On the Thingy:91, the LED colors indicate the following statuses:

  • Flashing White – Connecting to the network
  • 🟢 Solid Green – Firmware version 1 running
  • 🟡 Flashing Green / Flashing Blue – Firmware is being downloaded
  • 🔵 Solid Blue – Firmware version 2 running

📟 Development Kits (nRF9160DK / nRF9151DK)

While the firmware is being downloaded, the DKs show a circular LED pattern across the four LEDs:

  • 🔄 LEDs 1 → 2 → 3 → 4 blink in sequence, repeating until the download is complete.

Mender Integration

This demo requires the 1NCE Mender Plugin to be installed and enabled.

You can use prebuilt binaries and artifacts for quick testing.


Running the demo

1️⃣ Build & Flash

Flash the demo to the board using VS Code or nRF Connect for Desktop:

  • For Thingy:91, use nRF Connect Programmer.

  • For nrf9151DK & nrf9160DK, the firmware can be flashed directly from VS Code.

⚠️

Windows Path Length Warning

On Windows, long file paths may cause build errors during the demo compilation.
👉 To avoid this issue, move the project folder to a shorter path such as:

C:\dev\fota_mender_demo

2️⃣ Accept the Device in Mender

When starting the demo for the first time, the device will attempt to register with the Mender server.

🛡️ Manual Approval Required:
You must manually accept the device in the Mender Dashboard before it can receive any updates.

🔁 After acceptance:

  • The device will periodically check for firmware updates
  • Its inventory (such as IMEI, artifact name, and device type) will be updated in the Mender dashboard

💡

You can view this info under the Devices section after the device is authorized.

Device listed in Mender dashboard after acceptance.

Device listed in Mender dashboard after acceptance.

3️⃣ Bump Version & Rebuild

To simulate a firmware update:

  1. Open your prj.conf file
  2. Update the following configuration options to reflect the new version:
CONFIG_APPLICATION_VERSION=2
CONFIG_ARTIFACT_NAME="release-v2"
  1. Rebuild the firmware using your preferred method (e.g., west build, VS Code)

4️⃣ Create & Upload Mender Artifact

📦 Firmware updates in Mender are distributed as artifacts.

🛠️ Create Artifact with mender-artifact

  1. Install the Mender Artifact Tool

  2. Run the following command to generate a new artifact:

    ⚙️

    Replace the placeholders with your actual values.

mender-artifact write module-image \
  -t thingy \
  -o release-v2.mender \
  -T release-v2 \
  -n release-v2 \
  -f build/nce_fota_mender_demo/zephyr/zephyr.signed.bin \
  --compression none

📌 Replace values as needed for your device:

  • -t: Device type (CONFIG_MENDER_DEVICE_TYPE)
  • -n: Artifact name (CONFIG_ARTIFACT_NAME)
  • -T: Payload type (e.g. release-v2)
  • -f: Firmware binary file path (usually build/nce_fota_mender_demo/zephyr/zephyr.signed.bin)
  1. Upload the generated .mender file to the Releases section in the Mender dashboard.
Upload the new artifact to the Releases section.

Upload the new artifact to the Releases section.

5️⃣ Deployment Creation

Once your artifact is uploaded to the Mender Releases section, you're ready to deploy it to your device(s).

  1. Navigate to the Deployments tab in the Mender dashboard.
  2. Click Create Deployment and follow the wizard:
    • Select the target device or device group.
    • Choose the artifact you previously uploaded.
Create a deployment in the Mender dashboard.

Create a deployment in the Mender dashboard.


🚦 Deployment Status Flow

After creation, the deployment will appear in the list with an initial status of pending.
As your device contacts the Mender server, the status will progress automatically:

pending → downloading → rebooting → installing → success ✅ / failure ❌
Deployment status flow in Mender dashboard.

Deployment status flow in Mender dashboard.


⚙️ Configuration Options

The following configuration options are available for customizing the Mender FOTA demo:

🧩 General Options

Config OptionDescriptionDefault
CONFIG_APPLICATION_VERSIONApplication version reported to Mender1
CONFIG_ARTIFACT_NAMEMender artifact name (used in artifact creation)"release-v1"
CONFIG_MENDER_DEVICE_TYPEDevice type used for update compatibility"thingy"
CONFIG_MENDER_FW_UPDATE_CHECK_FREQUENCY_SECONDSFirmware update check interval (in seconds)30
CONFIG_MENDER_AUTH_CHECK_FREQUENCY_SECONDSAuth check interval (when unauthorized)30

🔐 Secure Communication

Config OptionDescriptionDefault
CONFIG_MENDER_URLMender backend URL"eu.hosted.mender.io"
CONFIG_NCE_MENDER_COAP_PROXY_HOSTCoAP proxy hostname provided by 1NCE"coap.proxy.os.1nce.com"
CONFIG_COAP_SERVER_PORTCoAP server port (5684 if DTLS is enabled, else 5683)Auto
CONFIG_NCE_MENDER_COAP_URI_PATHURI path for proxying CoAP requests to Mender"mender"

Unsecure CoAP Communication

By default, the demo uses 1NCE SDK to send a CoAP GET request to 1NCE OS Device Authenticator. The response is then processed by the SDK and the credentials are used to connect to 1NCE endpoint via CoAP with DTLS.

To test unsecure communication (plain CoAP), disable the device authenticator by adding the following flag to prj.conf

CONFIG_NCE_DEVICE_AUTHENTICATOR=n

📦 Ready-to-Flash Firmware for Thingy:91

For quick testing, we provide prebuilt firmware binaries that can be flashed directly to your Thingy:91 device — no build setup required.

Available prebuilt files:

VersionBinary (.bin)HEX (.hex)Mender Artifact (.mender)
release-v1release-v1.binrelease-v1.hexrelease-v1.mender
release-v2release-v2.binrelease-v2.hexrelease-v2.mender

👉 Flash directly using: release-v1.hex or release-v2.hex

Note: These builds enable all LTE bands, so the initial network registration may take several minutes while scanning.


1NCE Zephyr blueprint - 1NCE Memfault Demo

Overview

The 1NCE Memfault Demo enables Zephyr-based devices to send diagnostics and fault data via CoAP using the 1NCE CoAP Proxy. This is useful for tracking faults, crashes, and network issues in IoT devices. Communication can optionally be secured using DTLS.

On the Thingy:91 device, LED indicators show the following statuses:

  • 🔵 BLUE – Network connected
  • 🟢 GREEN – Memfault data sent successfully
  • 🔴 RED – Failed to send Memfault data

🔌 Memfault Integration

To use this demo, install and enable the Memfault Plugin for 1NCE OS.

📦 SDK Requirement: nRF Connect SDK v2.8.0


▶️ Running the Demo

1️⃣ Build & Flash

Build the project for either thingy91/nrf9160/ns or nrf9160dk/nrf9160/ns or nrf9151dk/nrf9151/ns.

  • Flash using VS Code for DKs or nRF Connect Programmer for Thingy:91.
  • Firmware path (Thingy:91):
    build/nce_debug_memfault_demo/zephyr/zephyr.signed.hex

⚠️

On Windows, avoid long folder paths to prevent build errors.

Use something like C:\dev\memfault_demo


2️⃣ Upload Symbol File to Memfault

To enable metric processing:

  • Go to Memfault Dashboard > Symbol Files
  • Upload:
    build/nce_debug_memfault_demo/zephyr/zephyr.elf

📘 Symbol File Guide

Upload the ELF symbol file to Memfault.

Upload the ELF symbol file to Memfault.

Memfault symbol file upload confirmation.

Memfault symbol file upload confirmation.


3️⃣ Authorize the Device

The device will register itself using the SIM’s ICCID as its serial number.
You’ll see it appear in the Devices view of Memfault.

Device listed in Memfault dashboard.

Device listed in Memfault dashboard.


4️⃣ Generate Events

On boot, two events are sent automatically:

  • heartbeat: Contains standard metrics
  • reboot: Reports cause of last reboot

Use the CLI to trigger more:

nce post_chunks     # Push buffered data now
nce divby0          # Trigger division-by-zero crash
nce sw1             # Increment switch_1_toggle_count
nce sw2             # Log switch_2_toggled event
nce disconnect      # Simulate disconnection and reconnection

The overview dashboard shows a summary of recent device issues:

Memfault dashboard overview of device issues.

Memfault dashboard overview of device issues.


🔘 Fault Injection via Buttons

Button / SwitchDescription
Button 1Stack overflow
Button 2Division by zero
Switch 1Custom metric: toggle count
Switch 2Event trace: switch toggled

💡 On Thingy:91, use nce CLI instead (only Button 1 available)


📶 Connectivity Metrics

Enabled by default with:

CONFIG_MEMFAULT_NCS_LTE_METRICS=y
CONFIG_NCE_MEMFAULT_DEMO_COAP_SYNC_METRICS=y
CONFIG_NCE_MEMFAULT_DEMO_CONNECTIVITY_METRICS=y

Standard LTE Metrics

  • ncs_lte_time_to_connect_ms
  • ncs_lte_connection_loss_count
  • ncs_lte_tx_kilobytes
  • ncs_lte_rx_kilobytes

Additional Metrics

  • ncs_lte_nce_operator
  • ncs_lte_nce_bands
  • ncs_lte_nce_current_band
  • ncs_lte_nce_apn
  • ncs_lte_nce_rsrp_dbm

Sample Connectivity dashboard configuration:

Sample Connectivity dashboard configuration

Sample Connectivity dashboard configuration

Sync Succes chart configuration:

Sync Success chart configuration

Sync Success chart configuration

To create a new metrics chart:

Create a new metrics chart

Create a new metrics chart

Signal quality chart configuration:

Signal quality chart configuration

Signal quality chart configuration

Sent KB chart configuration:

Sent KB chart configuration

Sent KB chart configuration


🔐 DTLS Configuration

To enable secure communication:

CONFIG_NCE_MEMFAULT_DEMO_ENABLE_DTLS=y
CONFIG_NCE_SDK_ENABLE_DTLS=y
CONFIG_NCE_DEVICE_AUTHENTICATOR=y
CONFIG_NCE_SDK_DTLS_SECURITY_TAG=<your_tag>
  • If onboarding is required, set <your_tag> to an empty tag and the demo will authenticate via 1NCE automatically.
  • On failure (3x), re-onboarding is triggered automatically.

⚙️ Configuration Options

General Options

Config OptionDescriptionDefault
CONFIG_NCE_MEMFAULT_DEMO_PERIODIC_UPDATEEnable periodic Memfault updatesy
CONFIG_NCE_MEMFAULT_DEMO_PERIODIC_UPDATE_FREQUENCY_SECONDSInterval between updates (seconds)30
MEMFAULT_METRICS_HEARTBEAT_INTERVAL_SECSHeartbeat interval (in header file) in config/memfault_platform_config.h30
CONFIG_NCE_MEMFAULT_DEMO_CONNECTIVITY_METRICSCollect Additional connectivity metricsy
CONFIG_NCE_MEMFAULT_DEMO_COAP_SYNC_METRICSTracks successful/failed syncsy
CONFIG_NCE_MEMFAULT_DEMO_PRINT_HEARTBEAT_METRICSPrint heartbeat metrics to serial logy
CONFIG_NCE_MEMFAULT_DEMO_DISCONNECT_DURATION_SECONDSSimulated disconnect duration20
CONFIG_NCE_MEMFAULT_DEMO_ENABLE_DTLSEnable secure CoAP over DTLSn

🆘 Need Help?

Open an issue on GitHub for:

  • ❗ Bug reports
  • 🚀 Feature requests
  • 📝 Documentation issues
  • ❓ General questions

👉 Create a new issue


Made with 💙 by the 1NCE Team.