cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L052R8 power (current) consumption problem

HLu
Associate

STM8L power (current) consumption problem

Posted on August 23, 2011 at 06:42

 I'm developing an application with STM8L052R8 MCU now, and this application is battery-used product. The problem is that, I cannot make the MCU consume micro-ampere order current.

I used every methods described in the reference guide manual, including active halt mode, and halt mode, but the least current indicator displayed 250uA. Of course I have stoped HSI, LSI, all timers and disabled all interrupts,disconnected other devices. GPIOs are also retested as push-pull low-slow output mode. I'm confusing.

 /**

 * @brief Config clock.

 * @retval None

 */

static void CLK_Config(void)

{

 /* Enables the Internal High Speed oscillator */

 CLK_HSICmd(ENABLE);

 /* Configures the system clock as HSI(16 MHz) */

 CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_HSI);

 /* High speed external clock prescaler: 1, then 16Mhz */

 CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);

 /* Wait for clock stability */

 while (CLK_GetSYSCLKSource() != CLK_SYSCLKSource_HSI)

 {

 }

}

/**

 * @brief Config GPIO.

 * @retval None

 */

static void GPIO_Config(void)

{

 GPIO_Init(GPIOA, 0xFF, GPIO_Mode_Out_PP_Low_Slow); 

  

 GPIO_Init(GPIOB, 0xFF, GPIO_Mode_Out_PP_Low_Slow);

 GPIO_Init(GPIOC, 0xFF, GPIO_Mode_Out_PP_Low_Slow);

 GPIO_Init(GPIOD, 0xFF, GPIO_Mode_Out_PP_Low_Slow);

 GPIO_Init(GPIOE, 0xFF, GPIO_Mode_Out_PP_Low_Slow);

  

 GPIO_Init(GPIOF, 0xFF, GPIO_Mode_Out_PP_Low_Slow);

  

 GPIO_Init(GPIOG, 0xFF, GPIO_Mode_Out_PP_Low_Slow); 

}

/**

 * @brief Config Low Power Mode.

 * @retval None

 */

static void LowPower_Config(void)

{

 /* Configures clock during active halt modes */

 CLK_HaltConfig(CLK_Halt_FastWakeup, ENABLE);

   

 /* Enables the Fast WakeUp from Ultra Low Power mode */

 PWR_FastWakeUpCmd(ENABLE);  

   

 /* Enables the Ultra Low Power mode */

 PWR_UltraLowPowerCmd(ENABLE);

}

/**

 * @brief Initializes the board, services, drivers, application and other modules.

 * @retval None

 */

void SYS_Initialize(void)

{

 /* Configures clock */

 CLK_Config();  

   

 /* Configures GPIO */

 GPIO_Config();

   

 /* Configures Low Power mode */

 LowPower_Config();

  

 /* Disable system general interrupts */  

 disableInterrupts();

 return;

}

/**

 * @brief Run application tasks.

 * @retval None

 */

void SYS_Tasks(void)

{

 halt();

  

 return;

}

/**

 * @brief Main program.

 * @param None

 * @retval None

 */

void main(void)

{

 SYS_Initialize();

 while (1)

 {

  SYS_Tasks();

 }

}

0690X000006CXd9QAG.png

0 REPLIES 0