Hi, I am using the below function to enter low power mode in STM32L152, but yet the current consumption of MCU is about 4 mA. is there other configurations?
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE); PWR_EnterLowPowerRunMode(ENABLE);
Dear John, Indeed I did what you said I used an LED in series with 1K using GPIO_ToggleBits command in a while loop to see its frequency which gives me a view about operation of the MCU and its frequency. when I set the MCU frequency on 32Khz the led toggled in about 2Khz which verifies 32Khz clock. The current consumption is about 5mA. when LED is off the consumption decreases about 1.5mA. when clock is set to 16Mhz the led toggled about 1Mhz and current consumption is about 11mA when led is on and 10mA when LED is off.
upto this point there is a problem not solved for me. why MCU consumes this much current in 32kHz. I configured all pins as analog input too but no change in current.
I added a step with 100 seconds, disabled all peripherals and clock adjusted to 32kHz after downloading the project output to flash the MCU power consumption was about 8mA
when I set the MCU frequency on 32Khz when LED is off the consumption decreases about 1.5mA.
From 8mA to 1.5mA, I believe you have already found something important.
No I mean 1.5 mA less than previous condition. I have not yet achieved less than 4 mA. Did you use the code generated by Cube32 without any changing to have a consumption in range of micro amperes?
To me, this smells like a GPIO pin that is not clamped and energizes its transistors. Did you sure you disabled your GPIO block power supply?
The definitive guide to Cortex M0 end of chapter 17, suggests that on some processors if you have a debugger hooked up extra power will be required to provide the debugger the power it needs. it also says that just unplugging the debugger will not lower the current in some processors. What is required is to power the part down and power back up without the debugger connected on some processors.
I achieved the low power modes of MCU to about 3uA. The following commands set the MCU to low power sleep mode:
RCC_Configuration(); PWR_VoltageScalingConfig(PWR_VoltageScaling_Range1); /* Wait Until the Voltage Regulator is ready */ while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET) ; /* Init I/O ports */ Init_GPIOs(); GPIO_LowPower_Config(); Config_RCC(&SavRCC); ExtInt_configuration(); SysTick->CTRL = 0; SetHSICLKToMSI(RCC_MSIRange_0,DIV2,NoRTC); SystemCoreClockUpdate(); enableInterrupts(); //TIM4_configuration(); PWR_EnterSleepMode(PWR_Regulator_LowPower,PWR_SLEEPEntry_WFI);
My problem yet is that after switching between modes(RUN,LPR,LPS,..)the MCU does not enter to low power mode!