cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L152RE + IDB05A1: Force the board in a low power mode and wake up as soon as a device wants to connect with the IDB05A1 (BLE)

Not applicable

Hello,

One specification of my system is the long live of my peripheral (Nucleo-L152RE+ IDB05A1). The most time, my peripheral is in advertising mode. I know that as soon as IDB05A1 advertising I can put µc in standby, the IDB05A1 will work autonomously and continue to advertise. If the IDB05A1 find a central it will wake up the microcontroller.

1. I tried to enter low power modes with following pre-built functions:

HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI );

HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFE );

HAL_PWR_EnterSTANDBYMode();

The Microcontroller reach the low power mode but the current is around 1mA which is far too much. In these modes I couldn't wake up the microcontroller.

2. On the web I found following function. With it I had a similar current consumption but the microcontroller is able to be wake up:

void EnterStandbyMode(void)

{

/* Wait that user release the User push-button */

/* Disable all used wakeup sources */

//LL_PWR_DisableWakeUpPin(LL_PWR_WAKEUP_PIN1);

CLEAR_BIT(PWR->CSR, PWR_CSR_EWUP1);

/* Clear all wake up Flag */

//LL_PWR_ClearFlag_WU();

SET_BIT(PWR->CR, PWR_CR_CWUF);

/* Enable wakeup pin */

//LL_PWR_EnableWakeUpPin(LL_PWR_WAKEUP_PIN1);

SET_BIT(PWR->CSR, PWR_CSR_EWUP1);

/* Enable ultra low power mode */

//LL_PWR_EnableUltraLowPower();

SET_BIT(PWR->CR, PWR_CR_ULP);

/** Request to enter STANDBY mode

    * Following procedure describe in STM32L1xx Reference Manual

    * See PWR part, section Low-power modes, Standby mode

    */

/* Set STANDBY mode when CPU enters deepsleep */

//LL_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);

MODIFY_REG(PWR->CR, PWR_CR_PDDS, PWR_CR_PDDS);

/* Set SLEEPDEEP bit of Cortex System Control Register */

//LL_LPM_EnableDeepSleep();

SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));

/* This option is used to ensure that store operations are completed */

#if defined ( __CC_ARM)

__force_stores();

#endif

/* Request Wait For Interrupt */

__WFI();

}

3. After the wake up the microcontroller restarts. I know which interrupt is incoming but it's incoming a lot of times so I can't find a fitting logic which secure that the microcontroller is not getting in low power mode again.

At the moment when a device want connect to my microcontroller it is in ... standby -> wake up -> standby -> wake up -> stanby...

By the way I work with STM32CubeMX and SW4STM32.

I hope you can help me with the current consumption problem and the logic. If you have any ideas about this issues, feel free to share your thoughts

Best regards,

Tobias

0 REPLIES 0