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. To get started with Memfault integration in nRF Connect SDK, see Memfault integration.
Memfault SDK is an SDK for embedded devices to make use of services that Memfault offers on their platform. For official documentation for Memfault SDK and the Memfault platform in general, see Memfault Docs.
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.
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
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
If you just want to do a quick test with a sample, disable the
CONFIG_MEMFAULT_USER_CONFIG_ENABLE option in the
prj.conf file 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 Memfault sample as a reference.
To have these configuration files in the include path, add the following in the
Following are some of the configuration options that Memfault SDK define:
You can find more details on each option using
guiconfig, and in the Kconfig sources in
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,
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:
- 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
- int memfault_ncs_device_id_set(const char *device_id, size_t len)