~aleteoryx/muditaos

9367647f6a6d113bc5372846e18e4ba8a188de44 — Lefucjusz 1 year, 10 months ago 4f63943
[BH-1921] Fix debug session disconnects on entering WFI

Fix of the issue that debug session would sometimes
disconnect when the CPU entered WFI mode due to
core clock being stopped.
1 files changed, 10 insertions(+), 0 deletions(-)

M module-bsp/board/rt1051/bellpx/bsp/lpm/WfiController.cpp
M module-bsp/board/rt1051/bellpx/bsp/lpm/WfiController.cpp => module-bsp/board/rt1051/bellpx/bsp/lpm/WfiController.cpp +10 -0
@@ 92,6 92,11 @@ namespace bsp
            return ((PMU->REG_2P5 & PMU_REG_2P5_BO_VDD2P5_MASK) != 0);
        }

        bool isDebugSessionActive()
        {
            return ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0);
        }

        void disableSystick()
        {
            SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;


@@ 127,6 132,11 @@ namespace bsp
            return 0;
        }
        timeSpentInWFI = 0;
        if (isDebugSessionActive()) {
            LOG_INFO("WFI disabled - active core debug session detected");
            blockEnteringWfiMode();
            return 0;
        }
        if (isTimerTaskScheduledSoon()) {
            blockEnteringWfiMode();
            return 0;