From 7239588534a3014ffd6d0335a7c5bf4f54afe7a4 Mon Sep 17 00:00:00 2001 From: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> Date: Fri, 10 Mar 2023 11:38:11 -0500 Subject: [PATCH] Reduce priority of factory reset task (#25598) Since the task priorities were adjusted for #24099 (and maybe even before?) the factory reset RPC would time out, breaking any test which relies on the RPC successfully completing. This is because the reset is happening immediately, before whatever is handling the RPC can complete. Reducing the FreeRTOS task priority just before the reset "fixes" it. (Maybe there's a better fix?) Tested on Mighty Gecko SiLabs board. --- src/platform/silabs/efr32/ConfigurationManagerImpl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platform/silabs/efr32/ConfigurationManagerImpl.cpp b/src/platform/silabs/efr32/ConfigurationManagerImpl.cpp index 168e3e1f38722f..886a304b2ead17 100644 --- a/src/platform/silabs/efr32/ConfigurationManagerImpl.cpp +++ b/src/platform/silabs/efr32/ConfigurationManagerImpl.cpp @@ -292,6 +292,13 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) // Restart the system. ChipLogProgress(DeviceLayer, "System restarting"); + + // When called from an RPC, the following reset occurs before the RPC can respond, + // which breaks tests (because it looks like the RPC hasn't successfully completed). + // One way to fix this is to reduce the priority of this task, to allow logging to + // complete before the reset occurs. + vTaskPrioritySet(NULL, 0); + NVIC_SystemReset(); }