cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with STM8S001J3 power consumption in halt mode

PSchü.1
Associate

Hello Community,

I just bought a few of STM8S001J3 for testing.

I want to use the halt-mode to get the lowest power consumption.

The problem is that setting the Processor in halt, current is still at about 240uA (too much).

I was testing about ten of those processors and always getting same results.

(I also tried several GPIO and clock settings as well as active halt with giving example in Stdperlib and AWU functions.)

In datasheet the maximum current is about 6uA in halt mode.

Maybe the processor does not fit the datasheet?

Anybody got an idea what goes wrong?

Thank you for help.

setup:

3.3V on VDD

GND on VSS

0.1uF on VCAP - VSS

0.33uF VDD – VSS

PD6 as interrupt

unused Pins in PP

tested Code:

#include "stm8s.h"        // using StdperLib

void Delay(uint32_t nCount);

void Halt_Init(void);

void clock_setup(void);

void main(void)

                              Delay(100000);

                              GPIO_Init(GPIOD, GPIO_PIN_6, GPIO_MODE_IN_FL_IT);

                              GPIO_Init(GPIOC, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_SLOW);

                              GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_PP_LOW_FAST);

                              GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_PP_LOW_FAST);

                              GPIO_Init(GPIOD, GPIO_PIN_5, GPIO_MODE_OUT_PP_LOW_FAST);

                              clock_setup();

                              

                             EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOD, EXTI_SENSITIVITY_RISE_ONLY);

                             EXTI_SetTLISensitivity(EXTI_SENSITIVITY_RISE_ONLY);

                              

                             enableInterrupts();

 while (1)

               {

                              Halt_Init();

                              halt();

Delay(100000);

               }

}

void Delay(uint32_t nCount)

{       while (nCount != 0)

       {

           nCount--;

       }

}

void Halt_Init(void)

{

               // tried several IN and Output as well as disabling SWIM and playing around with clock-settings

}

void clock_setup(void) // also tried without clock-setup

{

               CLK_DeInit();

               

               CLK_HSECmd(DISABLE);

               CLK_LSICmd(DISABLE);

               CLK_HSICmd(ENABLE);

               while(CLK_GetFlagStatus(CLK_FLAG_HSIRDY) == FALSE);

               

               CLK_ClockSwitchCmd(ENABLE);

               CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);

               CLK_SYSCLKConfig(CLK_PRESCALER_CPUDIV1);

               

               CLK_ClockSwitchConfig(CLK_SWITCHMODE_AUTO, CLK_SOURCE_HSI,

               DISABLE, CLK_CURRENTCLOCKSTATE_ENABLE);

               

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_I2C, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_ADC, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_AWU, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_UART1, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER1, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER2, DISABLE);

               CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER4, DISABLE);

}

0 REPLIES 0