Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf toup] Disable mpsl before performing factory data #527

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ config NVS_LOOKUP_CACHE_SIZE
config ZMS_LOOKUP_CACHE_SIZE
default 512 if ZMS

# Enable Dynamic interrupts to have a possibility to reconfigure it for devices that use MPSL
# on the application core and needs synchronization between MPSL and FLASH driver.
if MPSL

config DYNAMIC_INTERRUPTS
default y

config DYNAMIC_DIRECT_INTERRUPTS
default y

config MPSL_DYNAMIC_INTERRUPTS
default y

endif # MPSL

# ==============================================================================
# Zephyr networking configuration
# ==============================================================================
Expand Down
14 changes: 12 additions & 2 deletions src/platform/Zephyr/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#include <platform/ThreadStackManager.h>
#endif

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

namespace chip {
namespace DeviceLayer {

Expand Down Expand Up @@ -220,14 +224,20 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
}
#else

ConnectivityMgr().ErasePersistentInfo();

// We should disable MPSL before performing multiple operations on flash to speed up this process.
// It is required only when synchronization between flash and MPSL is enabled.
#ifdef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_MPSL
mpsl_lib_uninit();
#endif // CONFIG_SOC_FLASH_NRF_RADIO_SYNC_MPSL

const CHIP_ERROR err = PersistedStorage::KeyValueStoreMgrImpl().DoFactoryReset();

if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "Factory reset failed: %" CHIP_ERROR_FORMAT, err.Format());
}

ConnectivityMgr().ErasePersistentInfo();
#endif // CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS

PlatformMgr().Shutdown();
Expand Down
Loading