AnsweredAssumed Answered

STM32L1 STOP MODE

Question asked by Gursoy.Ali_Ergin on May 30, 2013
Latest reply on May 31, 2013 by Gursoy.Ali_Ergin
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?

Outcomes