Debug module

Important

The Asset Tracker v2 application is in maintenance mode. For new projects, it is recommended to use the Cellular: nRF Cloud multi-service sample instead.

The debug module intends to improve the overall debugging experience in the application. By default, it subscribes to all the events in the system and implements support for Memfault through the Memfault module integrated in nRF Connect SDK.

Note

To enable the debug module, you must include the ../overlay-debug.conf overlay configuration file when building the application.

Features

This section documents the various features implemented by the module.

Memfault

The debug module uses Memfault SDK to track nRF Connect SDK specific metrics such as LTE, location, Bluetooth, and stack metrics. The debug module also implements Memfault SDK software watchdog, which is designed to trigger an assert before an actual watchdog timeout. This enables the application to be able to collect coredump data before a reboot occurs.

To enable Memfault, you must include the ../overlay-memfault.conf when building the application. To get started with Memfault integration in nRF Connect SDK, see Memfault integration.

Custom transport

The data that is collected from the device can be routed through a custom transport to the Memfault cloud instead of using Memfault’s own HTTPS transport. To do this, enable the CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT Kconfig option. If this option is enabled, the debug module forwards the captured Memfault data through the DEBUG_EVT_MEMFAULT_DATA_READY event. If the CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT Kconfig option is disabled, the debug module uses the Memfault firmware SDK’s own internal HTTP transport. Transporting Memfault data through a pre-established transport can save overhead related to maintaining multiple connections at the same time. Currently, only the AWS IoT configuration supports this configuration.

Configuration options

CONFIG_DEBUG_MODULE_MEMFAULT_USE_EXTERNAL_TRANSPORT - Configuration for transfer of Memfault data

This option, if enabled, makes the debug module trigger events carrying Memfault data. This data can be routed through an external transport to Memfault cloud, for example, through AWS IoT, Azure IoT Hub, or nRF Cloud.

CONFIG_DEBUG_MODULE_MEMFAULT_HEARTBEAT_INTERVAL_SEC - Configuration for nRF Connect SDK Memfault metrics tracking interval

This option sets the time interval for tracking nRF Connect SDK Memfault metrics.

CONFIG_DEBUG_MODULE_MEMFAULT_CHUNK_SIZE_MAX - Configuration for maximum size of transmitted packets

This option sets the maximum size of packets transmitted over the configured custom transport.

Module configurations

To enable Memfault, you must set the following mandatory options:

To get more detailed stack traces in coredumps sent to Memfault, you can increase the values of the following options:

Coredumps are by default stored to non-initialized RAM. To enable storing to flash, configure the following options:

For extended documentation regarding nRF Connect SDK Memfault integration, see Memfault integration documentation.

Module states

This module has no internal states.

Module events

The asset_tracker_v2/src/events/debug_module_event.h header file contains a list of various events sent by the module.

Dependencies

This application uses the following nRF Connect SDK libraries and drivers:

API documentation

Header file: asset_tracker_v2/src/events/debug_module_event.h
Source files: asset_tracker_v2/src/events/debug_module_event.c
Debug module event