How to use Memfault

Asset Tracker Template

tags
Asset Tracker Template
  1. Provision the device:

    1. Follow the Getting Started guide to connect the device to your nRF Cloud instance.

    Once provisioned, the device automatically forwards coredumps and metrics to the Memfault project linked to your nRF Cloud account. Modem traces are also uploaded on crash when using the -debug-thingy91x release artifact or the modem-trace overlay described below.

  2. Open the Memfault dashboard from nRF Cloud:

    1. Log in to nRF Cloud.
    2. click the Memfault entry in the left sidebar to open the linked Memfault project.
  3. Upload the firmware symbol file:

  4. Upload the zephyr.elf file once per build, either from the Memfault UI (Symbol FilesUpload Symbol File → select build/app/zephyr/zephyr.elf) or from the command line using the Memfault CLI:

    memfault \
        --org-token <YOUR_ORG_TOKEN> \
        --org <YOUR_ORG_SLUG> \
        --project <YOUR_PROJECT_SLUG> \
        upload-mcu-symbols build/app/zephyr/zephyr.elf
    

    Memfault needs the build's zephyr.elf to decode crash addresses into function names, line numbers, and variable names.

  5. List your devices:

    1. In the Memfault UI, click Devices in the left toolbar to see all devices that have reported data.
    2. Select a device to explore its coredumps, metrics, and modem traces (CDRs).

    All standard builds include Memfault coredump capture and fleet metrics via nRF Cloud CoAP. To also upload modem traces on application crashes, either flash the pre-built -debug-thingy91x firmware from the release page, or include the overlay-upload-modem-traces-to-memfault.conf Kconfig overlay and the devicetree overlay overlay-upload-modem-traces-to-memfault.overlay in your west build command:

    west build -p -b <board> -- \
        -DEXTRA_CONF_FILE="overlay-upload-modem-traces-to-memfault.conf" \
        -DEXTRA_DTC_OVERLAY_FILE="overlay-upload-modem-traces-to-memfault.overlay"
    

Important

The modem trace upload feature can send upwards of 1 MB of modem trace data in case of application crashes. Consider this when planning your data usage and costs.

Example of a coredump received in Memfault:

Memfault UI