ARCHIVED
NOTE: this repo is no longer maintained- it has been migrated to the Memfault Firmware SDK Examples folder here:
https://github.com/memfault/memfault-firmware-sdk/tree/master/examples/nrf-connect-sdk/nrf5
This is a small example application showing a Memfault integration running on an nrf52840 development board, using the nrf-connect SDK.
Make sure you have the Zephyr / nRF-Connect tools installed first:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/gs_installing.html
To build and flash this example to an nRF52840-DK (PCA10056), run the following commands:
❯ west init -l memfault_demo_app
❯ west update
❯ west build -b nrf52840dk_nrf52840 memfault_demo_app
❯ west flash
Open a serial terminal to access the console:
# for example, pypserial-miniterm
❯ pyserial-miniterm --raw /dev/ttyACM0 115200
The console has several Memfault test commands available:
uart:~$ mflt help
mflt - Memfault Test Commands
Subcommands:
reboot :trigger a reboot and record it using memfault
get_core :gets the core
clear_core :clear the core
crash :trigger a crash
test_log :Writes test logs to log buffer
trigger_logs :Trigger capture of current log buffer contents
hang :trigger a hang to test watchdog functionality
export :dump chunks collected by Memfault SDK using
https://mflt.io/chunk-data-export
trace :Capture an example trace event
get_device_info :display device information
post_chunks :Post Memfault data to cloud
trigger_heartbeat :Trigger an immediate capture of all heartbeat metrics
get_latest_release :checks to see if new ota payload is available
For example, to test the coredump functionality:
-
run
mflt crash
and wait for the board to reset -
run
mflt get_core
to confirm the coredump was saved -
run
mflt export
to print out the base-64 chunks:uart:~$ mflt export <inf> <mflt>: MC:SE4DpwIEAwEKbW5yZjUyX2V4YW1wbGUJZTAuMC4xBmFhC0Z5RE1gF8EEhgFpSW5mbyBsb2chAmxXYXJuaW5nIGxvZyEDakVycm9yIGxvZyE=: <inf> <mflt>: MC:gE6A/A==:
-
upload the chunks to Memfault. see here for details: https://docs.memfault.com/docs/mcu/self-serve/#post-chunks-to-memfault