AnsweredAssumed Answered

STM32L151 stop mode problem!

Question asked by Mancini.Michele on Jul 10, 2013
Latest reply on Jul 10, 2013 by Mancini.Michele
Hi,
I want to try to send stm32l1 in stop mode (in my experiment I want it never wakes up).
My code works but the current is not equal to datasheet!!
In the datasheet the uC in stop mode is around ~2uA
In my experiment I have ~15uA!!
This my code:

int main()
  SystemInit();
  SystemCoreClockUpdate();
 
  PWR_VoltageScalingConfig(PWR_VoltageScaling_Range3);
  while (PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET) ;
  RTC_ITConfig(RTC_IT_WUT, DISABLE);
  LCD_Cmd(DISABLE);
  while (LCD_GetFlagStatus(LCD_FLAG_ENS) == SET); 
 
//********************************************       GPIO IN LOW MODE ********************************************
  GPIO_InitTypeDef GPIO_InitStructure;
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC,ENABLE);
   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD,ENABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOH,ENABLE);
   
  /* Configure all GPIO port pins in Analog input mode (trigger OFF) */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_400KHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
 
  GPIOA->MODER   = 0xFFFFFFFF;
  GPIOB->MODER   = 0xFFFFFFFF; 
  GPIOC->MODER   = 0xFFFFFFFF;
  GPIOD->MODER   = 0xFFFFFFFF;
  GPIOE->MODER   = 0xFFFFFFFF;
  GPIOH->MODER   = 0xFFFFFFFF;
   
  /* all GPIOA */
  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_All;
  GPIO_Init(GPIOA, &GPIO_InitStructure); 
   
   /* All GPIOC except PC13 which is used for mesurement */
  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_All;
  GPIO_Init(GPIOC, &GPIO_InitStructure); 
 
   /* all GPIOB except PB6 and PB7 used for LED*/
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ; 
  GPIO_Init(GPIOB, &GPIO_InitStructure);

 
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ; 
  GPIO_Init(GPIOD, &GPIO_InitStructure);
  
 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All ; 
  GPIO_Init(GPIOH, &GPIO_InitStructure);
   
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,DISABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,DISABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC,DISABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD,DISABLE);
  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOH,DISABLE); 
 
  PWR_PVDCmd(DISABLE);
 
//********************************************       RUN 4 Mhz in low power ********************************************
  PWR_FastWakeUpCmd(DISABLE);
  SetHSICLKToMSI(RCC_MSIRange_6,NoDIV2,WITHRTC) ;    
  SysTick->CTRL = 0;    
  RCC->APB1ENR = 0;
  PWR_UltraLowPowerCmd(ENABLE); 
 
 
 while(1){
      /* Enter Stop Mode permanently !!!!*/
    PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
  }



Outcomes