2020-11-11 01:22 AM
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)
{}
}
2020-11-11 06:39 AM
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
2020-11-12 04:14 AM
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.
2020-11-12 04:15 AM
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
but it barely made any difference. What am I doing wrong.
2020-11-12 05:09 AM
We'll have to look again and then get back to you with an update.
/Peter
2020-11-12 07:17 AM
@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:
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
2021-01-05 12:11 PM
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)...