AnsweredAssumed Answered

LPM_ExitStopMode() Does not Execute after return from STOP

Question asked by TimeIt on Apr 12, 2016
We're using the STM32CubeExpansion_BLE1_V2.5.2 on a STM32L4-Nucleo + BlueNRG-Expansion. It comes with low power manager drivers. The STM32L4 switches between RUN and STOP mode every ~ 1 sec. It uses RTC wakeup timer interrupt to exit STOP state. We can't locate the entry point to toggle GPIO after return from STOP mode.
The following LPM_Enter_Mode() function seems to point to the LPM_ExitStopMode() as the logical place to do the GPIO toggle but the code never gets there:
void LPM_Enter_Mode(void)
{
    uint32_t uwPRIMASK_Bit;

    uwPRIMASK_Bit = __get_PRIMASK();    /**< backup PRIMASK bit */

    __disable_irq();            /**< Disable all interrupts by setting PRIMASK bit on Cortex*/
        
    if(uwRUN_Req == 0)
    {
        if(uwDeepSleep_Req)
        {
            /**
             * Enter Sleep Mode
             */
            HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
        }
        else if (uwPDDS_Req == 0) /* WARNING: This mode is not supported yet by any platform */
        {
            LPM_EnterStandbyMode();    /**< Call user Hook */

            /**
             * Clear Wakeup flag
             */
            __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

            /**
             * Enter Standby Mode
             */
            HAL_PWR_EnterSTANDBYMode();

            LPM_ExitStandbyMode();    /**< Call user Hook */
        }
        else
        {
            /**
             * Clear Wakeup flag
             */
            __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

            /**
             * Enter Stop Mode
             */
            if(uwLPSDSR_Req)
            {
                HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI);
            }
            else
            {
#ifdef USE_STM32L4XX_NUCLEO      
                                HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
#else
                                HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
#endif
            }

            LPM_ExitStopMode();    /**< Call user Hook */
        }
    }

    __set_PRIMASK(uwPRIMASK_Bit);    /**< Restore PRIMASK bit*/

    return;
}

Outcomes