cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L power (current) consumption problem

jisoon
Associate II
Posted on August 23, 2011 at 06:42

 I'm developing some applications with STM8L152R8 and STM8L152M8 MCU now, and both applications are 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 low power run mode, active halt mode, and halt mode but our current indicator displayed mA order current consumption, from 1mA to 5mA. Of course I have stoped HSI, LSI, all timers and disabled all interrupts. GPIOs are also retested as push-pull low-slow output mode. I was confused, thus I decided to take out the STM8L discovery board and verify with that evaluation board.

 First, I just delivered power into the discovery board with USB cable. Through toggling the power mode, the LCD of discovery board have shown fine current consumption. About 1mA in run mode, and about 7uA in low-power mode, and below 1uA in halt mode ... it seemed fine.

 However, the result changed with my verification method changing. I switched the IDD jumper to 'OFF' mode, and started verification again. With IDD jumper switch off, the current-measuring circuit should be powerless and the MCU will solely consume the power, I expected so. I connected the precise current measuring multimeter (Agilent 34401A) serially in power supply line (3.3V), and started current consumption measuremnt by ourselves. And the multimeter have shown 30mA of current consumption. Unbelievable, but that's what I've seen. Regardless of MCU power mode, the current consumption was 30mA.

 This is my current situation. Now I cannot be certain of our current consumption method neither the firmware code we've written for MCU low power mode. I want to run our device in active-halt mode with RTC, and the power consumption matter is very important. 

 Little help here, please?

#stm8s-discovery-power-consumption #low-power #stm8l #stm8l-low-power-halt #high-current #high-current
10 REPLIES 10
komarek.milan
ST Employee
Posted on August 23, 2011 at 14:06

Hello,

Where did you connect the amp meter exactly? It should be connected between JP1 header pin 1 and 2 of the STM32L Discovery otherwise you are measuring something else than the microcontroller current consumption.

jisoon
Associate II

Posted on August 24, 2011 at 02:21

Thank you eM Ko, You pointed out well ... I guess I measured current from wrong pins. I measured current between +3V3 and GND pin, which are supplying power into ST-LINK as well. Measuring between JP1 pin 1 and 2, the measured current consumption was fine.

Now my remaining problem is about setting my own target application MCU into low power consumption mode. The code below is my source code which intended to make MCU go into active halt mode. Anybody please point out what's wrong here?

////////////////////////////////////////////////////////
LCD_Cmd(DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_LCD, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_USART1, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_USART2, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_TIM3, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_TIM4, DISABLE);
CLK_PeripheralClockConfig(CLK_Peripheral_TIM5, DISABLE);
TIM1_Cmd(DISABLE);
TIM2_Cmd(DISABLE);
TIM3_Cmd(DISABLE);
TIM4_Cmd(DISABLE);
TIM5_Cmd(DISABLE);
ITC_DeInit();
CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSI);
CLK_SYSCLKSourceSwitchCmd(ENABLE);
while (((CLK->SWCR)& 0x01)==0x01);
CLK_HSICmd(DISABLE);
CLK->ICKCR |= 0x10; CLK->ICKCR &= ~0x20; CLK->ICKCR &= ~0x40; CLK->ICKCR |= 0x04; CLK->ICKCR &= ~0x01;
CLK_MainRegulatorCmd(DISABLE);
PWR_UltraLowPowerCmd(ENABLE);
GPIO_Init(GPIOA, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOB, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOC, GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOC, GPIO_Pin_0|GPIO_Pin_1, GPIO_Mode_Out_OD_Low_Slow);
GPIO_Init(GPIOD, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOE, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOF, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOG, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
GPIO_Init(GPIOI, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3, GPIO_Mode_Out_PP_Low_Slow);
sim();
halt();
jfelix
Associate II
Posted on September 28, 2011 at 10:36

Hello lim.jisoon,

I have the exact same problem, I wrote a similar function as yours to enter active halt mode but current consumption is still nearly the same. Did you succeded to get very low current consumption?

Viktor POHORELY
ST Employee
Posted on September 29, 2011 at 16:48

Try this one... it's for 152C6, so some adjustments to your sales type could be needed.

________________

Attachments :

Active_HALT.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzNk&d=%2Fa%2F0X0000000bKs%2Ffo7zkjPo3exxd75hJi86lUD8pwql0WsZDs0cljZUelk&asPdf=false
jisoon
Associate II
Posted on October 05, 2011 at 03:22

 Hello felix,

 My problem turned out to be voltage supply dependent one. 

 The current consumption of STM8L is very sensitive to the level of voltage supply. The specification of STM8L current consumption is all measured in 3V Vcc. If you increase the Vcc to 3.3V, the current consumption increases dramatically. 

 Try to add a 3.0V LDO in front of your MCU voltage supply line and measure the current consumption of your STM8L MCU. This is how I solved this problem. 

 Good luck!

elil
Associate III
Posted on October 11, 2011 at 18:31

Very strange, as IMHO, STM8L should not be sensitive to  Vcc since it has internal voltage regulator.

kkarasti
Associate II

Posted on February 03, 2012 at 16:49

Here's what I'm doing for the STM8L151 and it drops current to 0.5uA. This is full halt, but if you want to keep RTC active, just comment out those lines. One thing, you have to clear the wakeup INT before halt. Here, I'm using EXTI pin7 for wakeup.

Halt_Init();
EXTI_ClearITPendingBit(EXTI_IT_Pin7);
halt();

void Halt_Init(void)
{
  TIM1_Cmd(DISABLE);
  TIM2_CtrlPWMOutputs(DISABLE);
  TIM2_Cmd(DISABLE);
  TIM3_Cmd(DISABLE);
  TIM4_Cmd(DISABLE);
  ADC_Cmd(ADC1, DISABLE);
  PWR_PVDCmd(DISABLE);
  /* Switch to LSI as system clock source */
  /* system clock prescaler: 1*/
  CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1);
  CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSI);
  CLK_SYSCLKSourceSwitchCmd(ENABLE);
  while (CLK_GetFlagStatus(CLK_FLAG_LSIRDY) == 0);
  CLK_HSICmd(DISABLE);
  CLK_HSEConfig(CLK_HSE_OFF);
  /* Set STM8 in low power */
  PWR_UltraLowPowerCmd(ENABLE);

  /* Set GPIO in low power*/
  GPIO_LowPower_Config();

  /* Stop RTC Source clock */
  CLK_RTCClockConfig(CLK_RTCCLKSource_Off, CLK_RTCCLKDiv_1);

  /* Stop clock RTC and LCD */
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, DISABLE);
  CLK_PeripheralClockConfig(CLK_Peripheral_LCD, DISABLE);
}

void GPIO_LowPower_Config(void)
{
  /* Configure unused pins as output push-pull 0 to enter low power */
  /* Port A */
  GPIO_Init(GPIOA, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Slow);
  /* Port B not AIN */
  GPIO_Init(GPIOB, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);
  /* Port B LEDs, so they don't flash at power on */
  GPIO_Init(GPIOB, GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5, GPIO_Mode_Out_PP_High_Slow);
  /* Port C not wakeup pin!! */
  GPIO_Init(GPIOC, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6, GPIO_Mode_Out_PP_Low_Slow);
  /* Port D */
  GPIO_Init(GPIOD, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Slow);
  /* Port E */
  GPIO_Init(GPIOE, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Slow);
  /* Port F */
  GPIO_Init(GPIOF, GPIO_Pin_All, GPIO_Mode_Out_PP_Low_Slow);
}
ivgenikucherov
Associate
Posted on December 11, 2013 at 13:48

Hi,

I am using stm8L051F3 micro controller.

In my system, 3.7V voltage is implied on VDD.

What is the minimal current consumption that I should measure in halt mode ?

According to datasheet, the typical is 350nA while maximum is 2microA on 1.8V to 3.6V voltage.

Thanks,

Ivgeni.

Posted on June 11, 2018 at 09:34

thank you very much for the example code attached, it is really helpful. but, I am new to this brand of low power MCUs and currently I have a research on the low power MCUs. I faced a problem on how to make the stm8l

152C6 

MCU wake up again from the halt period of let's say 10 seconds. I.e. the mentioned MCU will halt for 10 seconds and then wake up to flash the LEDs and then go to halt again.  

Thank you pretty much.