The Memfault module provides an integration of Memfault SDK into nRF Connect SDK and expands the functionality of the SDK with some options that are specific to nRF Connect SDK.


Memfault SDK is an SDK for embedded devices to make use of services that Memfault offers on their platform.

The SDK provides a functionality to collect debug information from devices in the form of coredumps, error traces, metrics, logs and more. Information that is collected from the device can be sent to Memfault’s cloud solution for further analysis. Communication with the Memfault Cloud is handled by APIs available in Memfault SDK, while the integration code of the SDK in nRF Connect SDK provides some additional functionality.

For official documentation for Memfault SDK and the Memfault platform in general, see Memfault Docs.

See the following examples of Memfault implementation in nRF Connect SDK:

Using Memfault SDK

The SDK is part of the West manifest in nRF Connect SDK and is automatically downloaded when running west update. By default, it is downloaded to <nRF Connect SDK path>/modules/lib/memfault-firmware-sdk/.

To include Memfault in your build, enable the Kconfig option CONFIG_MEMFAULT. The APIs in Memfault SDK can then be linked into your application.

In addition, you must configure a Memfault project key using CONFIG_MEMFAULT_NCS_PROJECT_KEY. CONFIG_MEMFAULT_NCS_PROJECT_KEY is located in ../overlay-memfault.conf.

To get access to all the benefits, like up to 100 free devices connected, register at the Memfault registration page.


When building applications with Trusted Firmware-M (TF-M), the faults resulting from memory access in secure regions are not caught by Memfault’s fault handler. Instead, they are handled by TF-M. This means that those faults are not reported to the Memfault platform. You can configure your application to use the Secure Partition Manager instead of TF-M if you prefer all such faults to be reported to the Memfault platform.


In general, configuration of Memfault SDK in nRF Connect SDK is done using Kconfig options. Kconfig options are defined both in Memfault SDK and in the integration layer, which integrates the SDK into nRF Connect SDK. Kconfig options of the integration layer are located in modules/memfault/Kconfig. These Kconfig options are differentiated by two distinct prefixes:

  • CONFIG_MEMFAULT_ - Prefix for options defined in Memfault SDK

  • CONFIG_MEMFAULT_NCS_ - Prefix for options defined in nRF Connect SDK

Additionally, nRF Connect SDK has an implementation of the Memfault Diagnostic Service (MDS). Use the CONFIG_BT_MDS option to enable it. The MDS cannot be used concurrently with HTTP transport.

Configuration files

If you just want to do a quick test with a sample, disable the CONFIG_MEMFAULT_USER_CONFIG_ENABLE option in the prj.conf to avoid adding the user configuration files. Otherwise, follow the instructions below.

Memfault SDK requires three files in the include path during the build process. Add a new folder into your project called config and add the following three files:

  • memfault_platform_config.h - Sets Memfault SDK configurations that are not covered by Kconfig options

  • memfault_metrics_heartbeat_config.def - Defines application-specific metrics

  • memfault_trace_reason_user_config.def - Defines application-specific trace reasons

For more information, you can see Memfault nRF Connect SDK integration guide. You can use the files in the nRF9160: Memfault sample as a reference. To have these configuration files in the include path, add the following in the CMakeLists.txt file:


Configuration options in Memfault SDK

Following are some of the configuration options that Memfault SDK define:

You can find more details on each option using menuconfig, guiconfig, and in the Kconfig sources in modules/lib/memfault-firmware-sdk/ports/zephyr/Kconfig.


The Memfault shell is enabled by default, using the UART interface. If AT Host library and the memfault module are enabled simultaneously, both will not behave as expected, as they both require the UART same interface. Therefore, it is recommended to only enable one of these at the same time. To disable the Memfault shell, you need to disable the two configurations, CONFIG_MEMFAULT_SHELL and CONFIG_MEMFAULT_NRF_SHELL.

Configuration options in nRF Connect SDK

The Kconfig options for Memfault that are defined in nRF Connect SDK provide some additional features compared to the options that are already implemented in Memfault SDK:

The nRF Connect SDK integration of Memfault SDK provides default values for some metadata that are required to identify the firmware when it is sent to Memfault cloud. These defaults can be controlled by using the configuration options below:

The Kconfig options for CONFIG_BT_MDS are the following:

API documentation

Header file: include/memfault_ncs.h
Source files: modules/memfault/
group memfault_ncs

Convenience functions for using Memfault firmware SDK with nRF Connect SDK.


int memfault_ncs_device_id_set(const char *device_id, size_t len)

Set the Memfault device ID.


In order to use this API successfully, CONFIG_MEMFAULT_NCS_DEVICE_ID_RUNTIME must be enabled.

  • device_id – Pointer to device ID buffer

  • len – Length of device ID. Cannot exceed CONFIG_MEMFAULT_NCS_DEVICE_ID_MAX_LEN.


0 on success, otherwise a negative error code