From 8e5a36dfd51ff3444a357ffbf6b0ebddeaeea460 Mon Sep 17 00:00:00 2001 From: Gillian Minnehan Date: Thu, 5 Sep 2024 10:44:15 -0400 Subject: [PATCH] fix(ble): set device ID after BLE init when using MAC address ### Summary The device ID when using the MAC address was Unknown after the system booted because the device has not been given a MAC address yet at the time the device ID is set (system init). This change removes the option for using a MAC address as the device id for BLE devices, and sets a static device id for the BLE sample app. ### Test Plan - Tested on a nRF52840 DK with the peripheral_mds sample app ``` uart:~$ *** Booting nRF Connect SDK v3.5.99-ncs1-4965-g3733e7097909 *** Starting Bluetooth Memfault example Bluetooth initialized Advertising successfully started uart:~$ mflt get_device_info [00:00:03.995,544] mflt: S/N: nrf-ble-testdevice [00:00:03.995,605] mflt: SW type: nrf-ble-fw [00:00:03.995,666] mflt: SW version: 0.0.1+688c47 [00:00:03.995,727] mflt: HW version: nrf52840dk_nrf52840 ``` --- modules/memfault-firmware-sdk/Kconfig | 1 + samples/bluetooth/peripheral_mds/README.rst | 2 +- samples/bluetooth/peripheral_mds/prj.conf | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/memfault-firmware-sdk/Kconfig b/modules/memfault-firmware-sdk/Kconfig index 7056b99bfe43..ea61dc77857c 100644 --- a/modules/memfault-firmware-sdk/Kconfig +++ b/modules/memfault-firmware-sdk/Kconfig @@ -44,6 +44,7 @@ config MEMFAULT_NCS_DEVICE_ID_IMEI config MEMFAULT_NCS_DEVICE_ID_NET_MAC bool "Use network interface MAC address as device ID" select HW_ID_LIBRARY + depends on !BT help Use the device's network interface MAC address as Memfault device ID diff --git a/samples/bluetooth/peripheral_mds/README.rst b/samples/bluetooth/peripheral_mds/README.rst index f0739d5c40c3..b139cc266060 100644 --- a/samples/bluetooth/peripheral_mds/README.rst +++ b/samples/bluetooth/peripheral_mds/README.rst @@ -133,7 +133,7 @@ See `Memfault SDK`_ for more information. To send data to the Memfault cloud through a Bluetooth gateway, you must configure a project key using the :kconfig:option:`CONFIG_MEMFAULT_NCS_PROJECT_KEY` Kconfig option. You can find your project key in the project settings at `Memfault Dashboards`_. -You also need to set the :kconfig:option:`CONFIG_MEMFAULT_NCS_DEVICE_ID` static Kconfig option for this sample +Use the :kconfig:option:`CONFIG_MEMFAULT_NCS_DEVICE_ID`, to set the static device ID. For this sample, it is ``ncs-ble-testdevice`` by default. Building and running ******************** diff --git a/samples/bluetooth/peripheral_mds/prj.conf b/samples/bluetooth/peripheral_mds/prj.conf index e4cbed98f614..ce52790ab850 100644 --- a/samples/bluetooth/peripheral_mds/prj.conf +++ b/samples/bluetooth/peripheral_mds/prj.conf @@ -37,9 +37,11 @@ CONFIG_HEAP_MEM_POOL_SIZE=256 CONFIG_MEMFAULT=y CONFIG_MEMFAULT_SHELL=y +CONFIG_MEMFAULT_LOGGING_ENABLE=y +CONFIG_MEMFAULT_LOG_LEVEL_INF=y CONFIG_MEMFAULT_NCS_PROJECT_KEY="" -CONFIG_MEMFAULT_NCS_DEVICE_ID="" +CONFIG_MEMFAULT_NCS_DEVICE_ID="nrf-ble-testdevice" CONFIG_MEMFAULT_NCS_BT_METRICS=y