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);
Might want to review STM32L1_Discovery_Firmware_Pack_V1.0.3\Projects\AN3413-Current_consumption_touch_sensing
It's also important to remember to keep an eye on every I/O pin - if there are pull-up/pull-down etc that might affect the power consumption.
Hi, If anyone has experience with configuration of STM32L152VD in Low power mode please help me. I followed instructions in manuals and notations in forums to configure but I am not successful. I started to do step by step first I changed the system clock to MSI=65Khz using excel file from ST website, Configured all GPIO as analog to reduce current consumption. MCU works with 65Khz. But,the first problem is the flash download error "cannot access target". each time I needed to press boot button and reset MCU. second problem is that MCU consumes about 4mA current in 3.3V. Why MCU consumes lots of power in 65Khz clock?
If you can't download, then it's probably because you are too early going into low-power mode.
Boot the processor in normal mode and check a GPIO pin or similar to make the decision if you should stay in normal mode or enter low-power mode. This allows you to keep the processor in normal mode while you play with the JTAG interface.
Next thing - make sure you experiment with a development board that doesn't have other electronics around the processor, so you know if you measure the current consumption of the processor or the current consumed by some other electronics.
The clock settings is as follows:
*============================================================================= * System Clock Configuration *============================================================================= * System Clock source | MSI(Range0) *----------------------------------------------------------------------------- * SYSCLK | 65000 Hz *----------------------------------------------------------------------------- * HCLK | 65000 Hz *----------------------------------------------------------------------------- * AHB Prescaler | 1 *----------------------------------------------------------------------------- * APB1 Prescaler | 1 *----------------------------------------------------------------------------- * APB2 Prescaler | 1 *----------------------------------------------------------------------------- * HSE Frequency | 8000000 Hz *----------------------------------------------------------------------------- * PLL DIV | Not Used *----------------------------------------------------------------------------- * PLL MUL | Not Used *----------------------------------------------------------------------------- * VDD | 3.3 V *----------------------------------------------------------------------------- * Vcore | 1.2 V (Range 3) *----------------------------------------------------------------------------- * Flash Latency | 0 WS *----------------------------------------------------------------------------- * Require 48MHz for USB clock | Disabled *----------------------------------------------------------------------------- *=============================================================================
and in main.c :
int main(void) { SystemInit(); SystemCoreClockUpdate(); /* Configure all GPIO as analog to reduce current consumption on non used IOs */ /* Enable GPIOs clock */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC | RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH | RCC_AHBPeriph_GPIOF | RCC_AHBPeriph_GPIOG, ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_Init(GPIOE, &GPIO_InitStructure); GPIO_Init(GPIOH, &GPIO_InitStructure); GPIO_Init(GPIOF, &GPIO_InitStructure); GPIO_Init(GPIOG, &GPIO_InitStructure); GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_Init(GPIOB, &GPIO_InitStructure); /* Disable GPIOs clock */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC | RCC_AHBPeriph_GPIOD | RCC_AHBPeriph_GPIOE | RCC_AHBPeriph_GPIOH | RCC_AHBPeriph_GPIOF | RCC_AHBPeriph_GPIOG, DISABLE); PWR_EnterLowPowerRunMode(ENABLE); /* Wait until the system enters RUN LP and the Regulator is in LP mode */ while(PWR_GetFlagStatus(PWR_FLAG_REGLP) == RESET) { } while(1) { }
Thanks for your points. Indeed to measure the current of MCU I have not soldered any other parts on my board. As you said I could not use Discovery board because its consumption is about 60mA with all parts on it. it seems any change in MSI frequency does not affect the power consumption of my board. Any Idea t go step by step to make power consumption low?
View all questions in Keil forum