cancel
Showing results for 
Search instead for 
Did you mean: 

STM8L051F3 Halt Mode 300-400nA

Omkar Teli
Associate II
Posted on January 24, 2018 at 12:10

Hi,

   I looking to achieve lowest power consumption in halt mode.

Datasheet says we can achieve 350nA in halt

mode. I am able to achieve

195 uA(micro Amp) at 1.8V

.. I have written simple test code. FYI i am adding my code below which is written in STVD IDE and attached project folder also.

How can i achieve 350nA? Plz help me

Code:main.c

/* Includes ------------------------------------------------------------------*/

&sharpinclude 'stm8l15x.h'

/* Private macro -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

/* Private function prototypes -----------------------------------------------*/

void Delay (uint16_t nCount);

/* Private functions ---------------------------------------------------------*/

void GPIO_LowPower_Config(void)

{

/* Port A in output push-pull 0 */

  GPIO_Init(GPIOA, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3 ,GPIO_Mode_Out_PP_Low_Slow);

    

/* Port B in output push-pull 0 */

  GPIO_Init(GPIOB, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);

/* Port C in output push-pull 0 except Button pins */

  GPIO_Init(GPIOC, GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6, GPIO_Mode_Out_PP_Low_Slow);

/* Port D in output push-pull 0 */

  GPIO_Init(GPIOD, GPIO_Pin_0, GPIO_Mode_Out_PP_Low_Slow);

}

void Halt_Init(void)

{

/* Set STM8 in low power */

  PWR->CSR2 = 0x2;

    

/* Stop RTC Source clock */

  CLK_RTCClockConfig(CLK_RTCCLKSource_Off, CLK_RTCCLKDiv_1);

 

/* Stop clock RTC and LCD */     

  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, DISABLE);

}

void main(void)

{

    GPIO_LowPower_Config();/* Set GPIO in low power*/    

  while (1)

  {

      Halt_Init();

        sim();

        Delay(10);

        halt();

  }

}

void Delay(__IO uint16_t nCount)

{

  /* Decrement nCount value */

  while (nCount != 0)

  {

    nCount--;

  }

}

&sharpifdef  USE_FULL_ASSERT

/**

  * @brief  Reports the name of the source file and the source line number

  *   where the assert_param error has occurred.

  * @param  file: pointer to the source file name

  * @param  line: assert_param error line source number

  * @retval None

  */

void assert_failed(uint8_t* file, uint32_t line)

{

  /* User can add his own implementation to report the file name and line number,

     ex: printf('Wrong parameters value: file %s on line %d\r\n', file, line) */

  /* Infinite loop */

  while (1)

  {}

}

&sharpendif

#stm8l051f3-350na-halt-mode
0 REPLIES 0