cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L1 STOP MODE

ali ergin gursoy
Associate II
Posted on May 30, 2013 at 16:21

Hi,

Stm32l1 consumes much current than I expected. In standby mode, I measure 6uA consumption for my board but when I put it in stop mode it consumes 480uA. It should be around 10uA.

The configuration is;

USART_ITConfig(USART2, USART_IT_RXNE, DISABLE);

USART_Cmd(USART2, DISABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, DISABLE);

USART_ITConfig(USART3, USART_IT_RXNE, DISABLE);

USART_Cmd(USART3, DISABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, DISABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, DISABLE);

ADC_Cmd(ADC1, DISABLE);

DAC_Cmd(DAC_Channel_1,DISABLE);

DAC_Cmd(DAC_Channel_2,DISABLE);

/* Disable PVD */

PWR_PVDCmd(DISABLE);

    /* Enable Ultra low power mode */

    PWR_UltraLowPowerCmd(ENABLE);

    RCC->AHBENR = 0x05;

    RCC->AHBLPENR = 0x05;

    RCC->APB1ENR = RCC_APB1ENR_PWREN;

    RCC->APB2ENR = 0;

    /* To stop the sys tick for avoid IT */

    SysTick->CTRL = 0;

    SysTick->CTRL  &= ~SysTick_CTRL_TICKINT_Msk;        // systick IRQ off

    PWR_ClearFlag(PWR_FLAG_WU);

    /* RCC system reset */

    RCC_DeInit();

    /* Flash no latency*/

    FLASH_SetLatency(FLASH_Latency_0);

    /* Disable Prefetch Buffer */

    FLASH_PrefetchBufferCmd(DISABLE);

    /* Disable 64-bit access */

    FLASH_ReadAccess64Cmd(DISABLE);

    /* Disable FLASH during SLeep  */

    FLASH_SLEEPPowerDownCmd(ENABLE);

    /* Enable the PWR APB1 Clock */

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

    /* Select the Voltage Range 3 (1.2V) */

    PWR_VoltageScalingConfig(PWR_VoltageScaling_Range3);

    /* Wait Until the Voltage Regulator is ready */

    while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET);

    /* Configure the MSI frequency */

    RCC_MSIRangeConfig(RCC_ICSCR_MSIRANGE_0);

    /* Select MSI as system clock source */

    RCC_SYSCLKConfig(RCC_SYSCLKSource_MSI);

    /* Wait until MSI is used as system clock source */

    while (RCC_GetSYSCLKSource() != 0x00);

    /* Disable HSI clock */

    RCC_HSICmd(DISABLE);

    /* Disable HSE clock */

    RCC_HSEConfig(RCC_HSE_OFF);

    /* Disable LSI clock */

    RCC_LSICmd(DISABLE);

    /* 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_400KHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;

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(GPIOG, &GPIO_InitStructure);

GPIO_Init(GPIOF, &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);

/* Enter Stop Mode */

PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

It does not matter waking up from stop mode, I just want to decrease my current consumption to 10uA. What is wrong with my code? Any suggestion?

#stm32-stm32l151
3 REPLIES 3
Posted on May 30, 2013 at 16:47

What is wrong with my code? Any suggestion?

May be it's not the code, but rather what you have attached to the chip, or elsewhere on the board?

Are you measuring the current just to the chip? Or the board as a whole? Did you provide a simple provision to separate that supply from everything else, and measure it independently?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ali ergin gursoy
Associate II
Posted on May 31, 2013 at 08:12

I am measuring the current for entire board. Unfortunately, I can not separate the supply, however I do not understand how it helps my problem. In standby mode my entire board consumes 6uA, so I assume that if I use stop mode appropriate it should be 10uA more or less.

ali ergin gursoy
Associate II
Posted on May 31, 2013 at 10:06

I solved the problem. It is a little bit stupidity. I am using STM32L151B and it does not have F&G I/O. I removed the irrelevant code and my board consumed 47uA. Then, I reilazed that if I use LSI instead of LSE, it would be better so I  closed the LSE; RCC_LSEConfig(RCC_LSE_OFF) and enabledthe LSI;  RCC_LSICmd(ENABLE). Now, the current consumption on my board is around 5uA.

Thanks for your interest.