Skip to content

Commit

Permalink
samples: matter: disable mpsl before preforming factory reset
Browse files Browse the repository at this point in the history
We can speed up flash operations while performing a factory reset
by disabling mpsl before that.

Thanks to that flash operations do not wait for mpsl
synchronization and all write operations take less time.

Signed-off-by: Arkadiusz Balys <[email protected]>
  • Loading branch information
ArekBalysNordic committed Jan 8, 2025
1 parent a30fb62 commit 9f07771
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ Gazell
Matter
------

|no_changes_yet_note|
* Disabled the :ref:`mpsl` before performing factory reset to speed up the process.
The :ref:`mpsl` is also disabled during the last fabric removal process and is re-enabled after the flash operations are completed.

Matter fork
+++++++++++
Expand Down
16 changes: 14 additions & 2 deletions samples/matter/common/src/app/fabric_table_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

#include "app/group_data_provider.h"

#ifdef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_MPSL
#include <mpsl/mpsl_lib.h>
#endif

#ifdef CONFIG_CHIP_WIFI
#include <platform/nrfconnect/wifi/WiFiManager.h>
#endif
Expand Down Expand Up @@ -57,10 +61,18 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate {
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
chip::DeviceLayer::ThreadStackMgr().ClearAllSrpHostAndServices();
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
/* Erase Matter data */
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();
/* Erase Network credentials and disconnect */
chip::DeviceLayer::ConnectivityMgr().ErasePersistentInfo();
#ifdef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_MPSL
/* Disable mpsl before start removing settings to improve the performance. */
mpsl_lib_uninit();
#endif
/* Erase Matter data */
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();
#ifdef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_MPSL
/* Re-enable mpsl after clearing persistent data. */
mpsl_lib_init();
#endif
#ifdef CONFIG_CHIP_WIFI
chip::DeviceLayer::WiFiManager::Instance().Disconnect();
chip::DeviceLayer::ConnectivityMgr().ClearWiFiStationProvision();
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ manifest:
- name: matter
repo-path: sdk-connectedhomeip
path: modules/lib/matter
revision: ad8ba68fd93b25f3fc0c0093bdaade96439b3987
revision: pull/527/head
west-commands: scripts/west/west-commands.yml
submodules:
- name: nlio
Expand Down

0 comments on commit 9f07771

Please sign in to comment.