AnsweredAssumed Answered

STM32F0 sleep or standby mode excessive consumption

Question asked by Mancini.Michele on Sep 27, 2012
Latest reply on Sep 29, 2012 by fm
Hi,
I use the STM32F0 Discovery. I disconnect jump JP2 and connect ammeter. I build a simple program in IAR:


int main()
{
  DWORD i;
  UINT16 j;
 
  SystemInit();
  SystemCoreClockUpdate();

  init_hardware();
    for(j=0;j<10;j++){
    GPIO_SetBits(GPIOC,GPIO_Pin_8);
    for(i=0;i<200000;i++);
    GPIO_ResetBits(GPIOC,GPIO_Pin_8);
    for(i=0;i<200000;i++);
  }
 
  PWR_EnterSTANDBYMode();
 
  while(1){
    GPIO_SetBits(GPIOC,GPIO_Pin_9);
    for(i=0;i<200000;i++);
    GPIO_ResetBits(GPIOC,GPIO_Pin_9);
    for(i=0;i<200000;i++);
    }//while
}



I set the clock :


 

*=============================================================================
  *=============================================================================
  *        System Clock source                    | HSI
  *-----------------------------------------------------------------------------
  *        SYSCLK(Hz)                             | 8000000
  *-----------------------------------------------------------------------------
  *        HCLK(Hz)                               | 8000000
  *-----------------------------------------------------------------------------
  *        AHB Prescaler                          | 1
  *-----------------------------------------------------------------------------
  *        APB Prescaler                          | 1
  *-----------------------------------------------------------------------------
  *        HSE Frequency(Hz)                      | NA
  *----------------------------------------------------------------------------
  *        PLLMUL                                 | NA
  *-----------------------------------------------------------------------------
  *        PREDIV                                 | NA
  *-----------------------------------------------------------------------------
  *        Flash Latency(WS)                      | 0
  *-----------------------------------------------------------------------------
  *        Prefetch Buffer                        | ON
  *-----------------------------------------------------------------------------

I compile and download code in the flash , The first part of code flashes a led blue 10 times and after it goes to sleep.
The sleep mode works, in fact the rest of code (after the sleep condition) doesn't run.
After the sleep command, the STM32F0 consumes 5mA; in stand by mode, it consumes 2mA, instead of uA!!!.


Outcomes