cancel
Showing results for 
Search instead for 
Did you mean: 

Halt mode and Current consumption

YannDiPadova
Associate

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;
		}
	}
}​

 

0 REPLIES 0