Skip to main content
Visitor II
November 11, 2020
Question

I have received minimum 30µA current in the STM8L Halt Mode. How can I decrease this value to the below of 30µA.

  • November 11, 2020
  • 5 replies
  • 1394 views

Hello Guys,

I have a small problem in my STM8L device. My current remains in 30µA even in the halt mode (I would like to obtain 10-15µA). What are the ways to drop this value?

I have tried to put a serial resistor to increase the total resistance of the system and finally to obtain lower current. However, if I use a bigger resistor than the 500 Ohm, system will not work. Is it a good idea to connect a serial resistor to the microprocessor in order to decrease the current? Will it has an impact on a bad way?

I also tried to make some configuration changes in the code, like putting the halt mode or disabling the timers.

In the below, you can see my main code.

So, What do you suggest me to handle this problem?

#include "stm8l15x.h"
#include "stm8l15x_TIM2.h"
 
void main(void)
{
	TIM2_CtrlPWMOutputs(DISABLE);
	TIM2_Cmd(DISABLE);
	TIM3_Cmd(DISABLE);
	TIM4_Cmd(DISABLE);
	ADC_Cmd(ADC1,DISABLE);
	PWR_PVDCmd(DISABLE);
	PWR_UltraLowPowerCmd(ENABLE);
	enableInterrupts();
	
 while (1)
 {	
		halt();
	
 }
}
 
#ifdef USE_FULL_ASSERT
 
 
void assert_failed(uint8_t* file, uint32_t line)
{
 
 while (1)
 {}
}
 
 
 
 

    This topic has been closed for replies.

    5 replies

    Technical Moderator
    November 11, 2020

    Clocking any peripheral draws current, so before halt() you should disable the peripheral clocks via RCC_AHBPeriphClockCmd and also deactivate LSE during STOP, if LSE is used.

    Sorry, proposed a solution for the STM32, which cannot be used for STM8.

    /Peter

    Visitor II
    November 12, 2020

    Hello Peter, I have a similar problem but I am using stm8l05X_LD and my code is similar to one above. My stm8l is currently consuming 100 micro Amps, how do I reduce this figure. I tried turning off the peripheral clocks just like you suggested using

    1. CLK_PeripheralClockConfig(CLK_Peripheral_TIM1,DISABLE);
    2. CLK_PeripheralClockConfig(CLK_Peripheral_TIM2,DISABLE);
    3. CLK_PeripheralClockConfig(CLK_Peripheral_TIM3,DISABLE);
    4. CLK_PeripheralClockConfig(CLK_Peripheral_TIM4,DISABLE);

    but it barely made any difference. What am I doing wrong.

    Visitor II
    November 12, 2020

    Hello Peter, I have a similar problem but I am using stm8l05X_LD and my code is similar to one above. My stm8l is currently consuming 100 micro Amps, how do I reduce this figure. I tried turning off the peripheral clocks just like you suggested using

    CLK_PeripheralClockConfig(CLK_Peripheral_TIM1,DISABLE);
    CLK_PeripheralClockConfig(CLK_Peripheral_TIM2,DISABLE);
    CLK_PeripheralClockConfig(CLK_Peripheral_TIM3,DISABLE);
    CLK_PeripheralClockConfig(CLK_Peripheral_TIM4,DISABLE); 

    but it barely made any difference. What am I doing wrong.

    Technical Moderator
    November 12, 2020

    We'll have to look again and then get back to you with an update.

    /Peter

    Technical Moderator
    November 12, 2020

    @AIpek.1​ Adding a resistor in series to a microcontroller makes no sense (note that the voltage drop across the resistor depends on the current, so depending on the current status of the STM8, VCC would permanentely jumping up and down).

    Please also deactivate the following if you do not need them during HALT:

    • RTC Clock
    • LCD
    • LSE
    • LSI
    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);
     
    #ifdef USE_LSE
     CLK_LSEConfig(CLK_LSE_OFF);
     while ((CLK->ECKCR & 0x04) != 0x00);
    #else
     CLK_LSICmd(DISABLE);
     while ((CLK->ICKCR & 0x04) != 0x00);
    #endif

    Please let us know if it works for you.

    /Peter

    Visitor II
    January 5, 2021

    It has been some time, but if the problem(s) are still there, check for floating GPIO. I configure unused GPIO as input with a pullup. But don't do that for GPIO with resistive loads (to gnd)...