2021-03-24 10:10 AM
Hi,
I have a custom board with STM32L010. I used STM32 cubeMX to initialize the GPIO,I2C,SPI,ADC,USART,LPTIM2,CRC,DMA and RTC. Then I de-initialize everything except GPIO and put the controller in sleep mode. The current consumption still is 250 uA after it enters sleep mode even though the datasheet says that it should be around 2uA. I use the following code to enter sleep mode,
SCB->SCR &= ~( SCB_SCR_SLEEPDEEP_Msk ); // low-power mode = sleep mode
SCB->SCR |= SCB_SCR_SLEEPONEXIT_Msk; // reenter low-power mode after ISR
/* Ensure Flash memory stays on */
FLASH->ACR &= ~FLASH_ACR_SLEEP_PD;
__WFI(); // enter low-power mode
Is there something needs to be added or done to get 2uA current draw?
Thank you in advance for help.
2021-03-24 11:15 AM
Hi,
I am experiencing a similar problem. I am using a STM32L071CB on a custom board and cannot get the Stop mode current below 130 uA.
I'm not sure about your code. According to all the examples and the documentation you shouldn't need to change anything about the Flash.
Have you tried using the HAL? I can use
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
To enter low-power mode and get the 130 uA result. An inlined version that gets the same 130 uA result is:
/* Store the new value */
PWR->CR &= ~(PWR_CR_PDDS);
PWR->CR |= PWR_CR_ULP | PWR_CR_LPSDSR;
/* Set SLEEPDEEP bit of Cortex-M0+ System Control Register */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Request Wait For Interrupt */
__WFI();
Looking forward if you are able to get the 2 uA current draw.
2021-03-24 11:38 AM
Some hints:
Good luck!
/Peter
2021-03-24 11:56 AM
Thanks Peter for the quick reply.
Just to confirm, I should be able to set up SYSCLK/HCLK as 32 MHz, Vcore range 1 (1.8 V)? I understand that this setting should have no effect on Stop mode current consumption because the CPU clock is disabled -- it's just a matter of hunting down the peripheral that is still turned on.
2021-03-24 12:10 PM
@ricehornet Yes, essentially correct.
2021-03-24 12:11 PM
Thanks Peter and ricehornet , will try your suggestions and let you know how it goes.
2021-03-30 08:15 AM
Hi Peter,
Thank you for the help. I was able to get it down below 100 uA and I think its mostly due to other components on the custom board.
I am trying to start LPTIM before entering STOP mode , but as soon as I start the STOP mode the LPTIM stops working and the code does not enter the LPTIM ISR. I use HAL_LPTIM_TimeOut_Start_IT to start the timer and LSE is connected as input to the low power timer. Is there something that needs to be done to get the ISR for LPTIM working in STOP mode. I checked the datasheet and it says it shouldnt be an issue but I am still unable to make it work.
Thank you,
Ashish
2021-04-02 03:14 PM
Ashish,
If you haven't already, I would suggest trying the examples in the STM32Cube github repo: https://github.com/STMicroelectronics/STM32CubeL0/tree/master/Projects/NUCLEO-L073RZ/Examples/LPTIM
I used these and a Nucleo board to get a working Stop mode configuration and then ported that to my custom board/firmware. Good luck!
Eric
2021-04-02 04:20 PM
DBG->CR = 0; // Disable debug in low-power modes
Do this before entering low-power mode and physically disconnect the debugger.