cancel
Showing results for 
Search instead for 
Did you mean: 

Workaround to reduce consumption in sleep mode after previous wake up from stand by mode

bogusz
Associate II
Posted on November 09, 2017 at 15:51

I'm using STM32L100R8-A and i struggled with higher consumption in sleep mode. Finally I found workaround which works for me. It would be fine if someone else can confirm this beahvior.

My circuit is powered from 3V Lithium battery and I have to detect when battery is removed - there is 1mF backup capacitor to hold the power. I Have configured EXTI IRQ when battery is removed and I go into Stand by mode in this interrupt. I also enable wakeup pin (same pin) to wake up from stand by mode when battery is connected again.

When I connect the battery for the first time when even backup capacitor is drained, the consumption in run mode, sleep mode and stand-by mode is according to datasheet.

Problem appears when I enter stand-by mode and then wake up by rising edge at WAKEUP_PIN2.

After such wakeup consumption in sleep mode is higher around 130uA @ 3V!

Workaround 1.

We can reduce consumption about 106uA if we disable, after wakeup reset in init phase, wakeup pin 2 by command:

HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN2);

 

 

Workaround 2.

We can reduce consumption about another 24uA if we clear, after wakeup reset in init phase, wakeup flag WUF by command:

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

 

 

These two workarounds work for me pretty fine, but i didn't notice I have to do this in datahseet or any app. note. So if you can confirm this strange behavior at your STM32Lxx and if thhese workaround works for you?

Here is my IRQ routine where I enter stand by mde and configure wake up event:

void EXTI15_10_IRQHandler(void)

{    

  HAL_GPIO_EXTI_IRQHandler(PTB_DEF_BATT_PRESENT_PIN); // PC13    

    HAL_RTCEx_DeactivateWakeUpTimer(&T_hrtc); // in case if stop mode preceded

    V_HW_SystemClock_Config();

    HAL_IWDG_Refresh(&T_hiwdg);    

    

    __HAL_RCC_CLEAR_RESET_FLAGS();    

    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

    HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN2); // Batt insertion detection

            

    HAL_SuspendTick(); // deactivate Systick IRQ

    

    __HAL_RCC_PWR_CLK_ENABLE(); // this is better it has also necessary delay

    SCB->SCR |= SCB_SCR_SLEEPDEEP; // enter deepsleep mode

    PWR->CR |= PWR_CR_PDDS; // enter standby in deepsleep

    PWR->CR |= PWR_CR_CWUF; // clear wakeup flag

    __DSB();

    __ISB();

    __WFI(); // seems its ok to call this inside IRQ..

    __DSB();

    __ISB();

}

#current-consumption #stand-by #wake-up-from-standby-mode #sleep-mode
0 REPLIES 0