Use Memfault

Asset Tracker Template

tags
Asset Tracker Template

To set up remote debugging with Memfault, complete the following steps:

  1. Provision the device.

    Follow Getting started to connect the device to your nRF Cloud instance.

    Once provisioned, the device forwards coredumps and metrics automatically to the Memfault project linked to your nRF Cloud account. The device also uploads modem traces on a crash when you use the -debug-thingy91x release artifact or the modem trace overlay.

  2. Open the Memfault dashboard.

    1. Log in at nRF Cloud. You land in the new Memfault-integrated nRF Cloud experience, which is the Memfault dashboard for your linked project.
    2. Onboard the device in the new UI, under Fleet > Devices > Add devices, as described in Connecting. The other device-management UI steps in these guides, such as the shadow configuration, still use the legacy nRF Cloud portal. Open it using the link in the bottom left corner of the new UI.
  3. Upload the firmware symbol file.

    Upload the zephyr.elf file once per build, either from the Memfault UI, under Symbol Files > Upload Symbol File, where you 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 the crash addresses into function names, line numbers, and variable names.

  4. List your devices.

    1. In the Memfault UI, select 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, which are custom data recordings (CDRs).

    All standard builds include Memfault coredump capture and fleet metrics through 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 both the overlay-upload-modem-traces-to-memfault.conf Kconfig overlay and the overlay-upload-modem-traces-to-memfault.overlay devicetree 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"
    

Note

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.

You can also decrypt the traces uploaded to Memfault, so you can inspect the nRF Cloud CoAP exchange leading up to a crash. For more information, see Decrypted traces uploaded to Memfault.

The following image shows an example of a coredump received in Memfault:

Memfault user interface showing the decoded stack trace of a device coredump