Skip to main content
Visitor II
July 29, 2024
Question

Halt mode and Current consumption

  • July 29, 2024
  • 1 reply
  • 926 views

Hi,

 

I have a STM8S001J3. I want to put my uC in halt mode because I'm on battery. The problem is that halt mode consume around 1mA when the interrupts are enabled. I need interrupts to wake up from halt mode with my GPIO pin so I can't disable it.

I tried without the interrupts and the current consumption is around 4uA.

I can't imagine that interrupts consume so much and that this issue is mentionned nowhere in the documentations.

 

I join here a copy of my main function:

 

main()
{
	GPIO_Init (LED, GPIO_MODE_OUT_PP_LOW_SLOW);
	GPIO_Init (BT, 	GPIO_MODE_IN_PU_IT); 
	
	GPIO_Init (GPIOA, GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_SLOW);
	GPIO_Init (GPIOD, GPIO_PIN_6, GPIO_MODE_OUT_PP_LOW_SLOW);
	GPIO_WriteLow(GPIOA, GPIO_PIN_3);
	GPIO_WriteLow(GPIOD, GPIO_PIN_6);

	EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOB, EXTI_SENSITIVITY_RISE_ONLY);
	
	enableInterrupts();
	
	while (1)
	{
		
		if (bouton() && oneTime) //if button pressed
		{
			oneTime = 0;
			if(sleep)
			{
				sleep = 0;
			}
			else
			{
				ledOff();
				sleep = 1;
				halt();
			}
		}
		else if(!bouton() && !oneTime)
		{
			oneTime = 1;
		}
	}
}​

 

    This topic has been closed for replies.

    1 reply

    Visitor II
    November 29, 2024

    Hello,

    Make sure all IOs are in some defined state. i.e. do not leave any IOs floating. either set them to output, add pull up/down external resistor or enable the internal pull up resistor.

    The analog front end of the gpio will consume power when a floating voltage wiggles about.

    If I recall correctly only the stm8l* parts have ultra low power mode that achieves < 1 uA in the most extreme halt mode... just in case that is what you are trying to achieve.

    see https://community.st.com/t5/stm8-mcus/cannot-enter-low-power-mode-stm8l052c6/td-p/356194

    the stm8s001j3 datasheet shows 4.5uA typical @ 3.3v in HALT mode.