Skip to main content

Quickstart Nordic nRF52/53/54

This quickstart gets you up and running with Memfault observability and OTA updates on Nordic nRF52, nRF53, and nRF54 devices using the nRF Connect SDK (NCS).

info

On an nRF51 and/or using the nRF5 SDK? Reach out to us!

Create your account on nrfcloud.com

Register for an account at nRFCloud.com and select the nRF52/nRF53/nRF54 configuration when prompted:

Set up the SDK

Follow the Zephyr Getting Started Guide to configure a Zephyr development environment. Then, create a workspace and install NCS 3.1.0 with:

# Create a workspace directory
mkdir ~/ncs-v3.1.0
cd ~/ncs-v3.1.0

# Initialize west
west init -m https://github.com/nrfconnect/sdk-nrf --mr v3.1.0

# Update all modules
west update

# Install Python requirements
pip3 install -r zephyr/scripts/requirements.txt
pip3 install -r nrf/scripts/requirements.txt
pip3 install -r bootloader/mcuboot/scripts/requirements.txt
tip

We recommend following along this tutorial with the peripheral_mds example, which you will find in nrf/samples/bluetooth/peripheral_mds.

This tutorial uses the nRF5340-DK for the example commands. Adjust to your own board specifier if you are using a different development kit.

1. Configure Your Project

info

To take advantage of nRF Cloud Services, this configuration enables four important services:

  • SMP: for remote management and updating your device over bluetooth
  • MCUBoot: to install a bootloader and allow your system to install the new image after reboot
  • Memfault: to capture crashes and metrics from your firmware
  • DIS Service: to share with the mobile app some information on the device (software version, serial number, etc)

Add or update the following options in your project's prj.conf (find your Memfault Project Key here):

nrf/samples/bluetooth/peripheral_mds/prj.conf
# Essential Memfault configuration
CONFIG_MEMFAULT=y
CONFIG_BT_MDS=y

# ⚠️ Make sure to update this line with YOUR Project Key from https://mflt.io/project-key!
CONFIG_MEMFAULT_NCS_PROJECT_KEY="YOUR_PROJECT_KEY"

# SMP is a must
CONFIG_BT_SMP=y

# Enable OTA updates
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

# Device Information Service (required for OTA)
CONFIG_BT_DIS=y
CONFIG_BT_DIS_SERIAL_NUMBER=y
CONFIG_BT_DIS_SERIAL_NUMBER_STR="mfltqs1"
CONFIG_BT_DIS_HW_REV=y
CONFIG_BT_DIS_HW_REV_STR="nrf5340dk" # Change for your board
CONFIG_BT_DIS_SW_REV=y
CONFIG_BT_DIS_SW_REV_STR="main"
CONFIG_BT_DIS_FW_REV=y
CONFIG_BT_DIS_FW_REV_STR="0.0.1"

# Memfault firmware identification
CONFIG_MEMFAULT_NCS_FW_TYPE="main"
CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y
CONFIG_MEMFAULT_NCS_FW_VERSION="0.0.1"
CONFIG_MEMFAULT_NCS_DEVICE_ID="mfltqs1"

# Testing shell (optional)
CONFIG_SHELL=y

And separately, add a sysbuild.conf file with the following line to enable the MCUBoot bootloader:

nrf/samples/bluetooth/peripheral_mds/sysbuild.conf
SB_CONFIG_BOOTLOADER_MCUBOOT=y

2. Build and Flash

Build and flash your firmware:

west build --sysbuild --pristine=always --board nrf5340dk/nrf5340/cpuapp nrf/samples/bluetooth/peripheral_mds
west flash --erase

Verify the device is advertising:

Bluetooth initialized
Advertising successfully started

3. Connect and Send Data

Upload Symbol File

Upload your build/peripheral_mds/zephyr/zephyr.elf file to Software → Symbol Files so Memfault can decode your data.

Upload Symbol File button

Install nRF Connect Device Manager

Download the mobile app:

Connect Your Device

  1. Open the app and scan for devices
  2. Select your device from the list
  3. Send a friendly "Hello" to your device to initiate a connection
  4. (fulfill any pairing requests -- PIN may appear in UART console of attached device)
  5. Tap the "Logs and Stats" tab - data will automatically start uploading via MDS

Connected device showing data upload

Verify Data Reception

Check the Processing Log to confirm data is flowing:

Processing Log showing received data

4. Test OTA Update

Now for the exciting part: let's roll out a firmware update over the air!

Create New Firmware Version

Update your software version in prj.conf:

prj.conf
CONFIG_BT_DIS_SW_REV_STR="0.0.2"  # Increment version
CONFIG_MEMFAULT_NCS_FW_VERSION="0.0.2" # Keep in sync

Rebuild and upload the new version:

west build --sysbuild

Upload the OTA payload and symbols to Memfault using the Memfault CLI:

# Upload OTA payload
memfault --project YOUR_PROJECT --org YOUR_ORG_SLUG \
--org-token YOUR_ORG_TOKEN upload-ota-payload \
--hardware-version nrf5340dk --software-version 0.0.2 \
--software-type main build/dfu_application.zip

# Upload symbols
memfault --project YOUR_PROJECT --org YOUR_ORG_SLUG \
--org-token YOUR_ORG_TOKEN upload-symbols \
--software-type main --software-version 0.0.2 \
build/peripheral_mds/zephyr/zephyr.elf
tip

The Memfault CLI requires installation and authentication. See the CLI installation guide for setup instructions, including the use of an Organization Auth Token.

Activate the Release

  1. Go to Software → Releases in Memfault
  2. Find your new release and click Activate
  3. Deploy to your default cohort

Activating OTA release

Install Update

In the nRF Device Manager app:

  1. Navigate to the "Image" tab view
  2. Tap "Check for Updates"
  3. Install the available update
  4. Watch your device update through the wonder that is Bluetooth Low Energy!

Checking for firmware updates

Next Steps

Your device is now sending metrics automatically every hour. Let's explore what Memfault collects:

View Device Timeline

Go to Fleet → Devices and click on your device to see:

  • Software version and update history
  • Reboot events and reasons
  • Metrics like battery, connectivity, performance
  • Traces including any crashes

Device timeline showing metrics and events

Test Crash Reporting

Use the Memfault UART shell extension to trigger a crash to see Memfault's debugging capabilities:

uart:~$ mflt test assert

The device will crash, reboot, and automatically upload the coredump. Use the nRF Device Manager app to forward the new diagnostic data to nRF Cloud! Check Issues to see the symbolicated crash with full stack trace.

Crash details with symbolicated stack trace

Congratulations! You now have:

  • Observability - Device metrics, crashes, and reboots
  • OTA Updates - Remote firmware deployment
  • Fleet Management - Centralized device monitoring

Production Considerations

  • Device Serial Numbers: Use unique serials from manufacturing
  • Cohort Management: Organize devices for staged rollouts
  • Custom Metrics: Track application-specific KPIs
  • Advanced Configuration: Security, logging, and optimization

Advanced Guides

Troubleshooting

  • Pairing Issues: Use west flash --erase to clear BLE bonds
  • No Data Flow: Verify project key and MDS service is enabled
  • Build Errors: Check compatibility requirements

Need help? contact us