|
| 1 | +# nRF-Connect Memfault Example |
| 2 | + |
| 3 | +This is a small example application showing a Memfault integration running on an |
| 4 | +nrf52840 development board, using the nRF Connect SDK. Any nRF board should also |
| 5 | +work. The example has been tested on: |
| 6 | + |
| 7 | +- nRF52840-DK |
| 8 | +- nRF5340-DK |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +Make sure you have the Zephyr / nRF-Connect tools installed first: |
| 13 | + |
| 14 | +<https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/nrf/gs_installing.html> |
| 15 | + |
| 16 | +To build and flash this example to an nRF52840-DK (PCA10056), run the following |
| 17 | +commands: |
| 18 | + |
| 19 | +```bash |
| 20 | +❯ west init --local memfault_demo_app |
| 21 | +❯ west update |
| 22 | +❯ west build --board nrf52840dk_nrf52840 memfault_demo_app |
| 23 | +❯ west flash |
| 24 | +``` |
| 25 | + |
| 26 | +Open a serial terminal to access the console: |
| 27 | + |
| 28 | +```bash |
| 29 | +# for example, pypserial-miniterm |
| 30 | +❯ pyserial-miniterm --raw /dev/ttyACM0 115200 |
| 31 | +``` |
| 32 | + |
| 33 | +The console has several Memfault test commands available: |
| 34 | + |
| 35 | +```bash |
| 36 | +uart:~$ mflt help |
| 37 | +mflt - Memfault Test Commands |
| 38 | +Subcommands: |
| 39 | + reboot :trigger a reboot and record it using memfault |
| 40 | + get_core :gets the core |
| 41 | + clear_core :clear the core |
| 42 | + crash :trigger a crash |
| 43 | + test_log :Writes test logs to log buffer |
| 44 | + trigger_logs :Trigger capture of current log buffer contents |
| 45 | + hang :trigger a hang to test watchdog functionality |
| 46 | + export :dump chunks collected by Memfault SDK using |
| 47 | + https://mflt.io/chunk-data-export |
| 48 | + trace :Capture an example trace event |
| 49 | + get_device_info :display device information |
| 50 | + post_chunks :Post Memfault data to cloud |
| 51 | + trigger_heartbeat :Trigger an immediate capture of all heartbeat metrics |
| 52 | + get_latest_release :checks to see if new ota payload is available |
| 53 | +``` |
| 54 | +
|
| 55 | +For example, to test the coredump functionality: |
| 56 | +
|
| 57 | +1. run `mflt crash` and wait for the board to reset |
| 58 | +2. run `mflt get_core` to confirm the coredump was saved |
| 59 | +3. run `mflt export` to print out the base-64 chunks: |
| 60 | +
|
| 61 | + ```plaintext |
| 62 | + uart:~$ mflt export |
| 63 | + <inf> <mflt>: MC:SE4DpwIEAwEKbW5yZjUyX2V4YW1wbGUJZTAuMC4xBmFhC0Z5RE1gF8EEhgFpSW5mbyBsb2chAmxXYXJuaW5nIGxvZyEDakVycm9yIGxvZyE=: |
| 64 | + <inf> <mflt>: MC:gE6A/A==: |
| 65 | + ``` |
| 66 | +
|
| 67 | +4. upload the chunks to Memfault. see here for details: |
| 68 | +
|
| 69 | + <https://mflt.io/chunks-debug> |
0 commit comments