cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L010RB_NUCLEO_PWR_STANDBY

Nonotiboy
Associate II

Hello,

 

I have tested the kit discovery  NUCLEO-L010RB and the program PWR STANDBY(mcu STM32L010RB), this work fine. I would like do exactly the same test with the mcu STM32L010K8 (so the same family like STM32L010RB), but I have a problem, the program run well but the current consumption is always at about 2mA instead 1.8uA in standby mode.

I use the KEIL for the development. Nothing else is connected in the STM32L010KB, just VDD, VSS and VDDA like the picture in attachment.

 

Have you an example with KEIL to test the STM32L010KB in standby mode please?

 

Below my current program.

 

 

 

int main(void)
{
  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */
  

  /* MCU Configuration--------------------------------------------------------*/

  HAL_Init();

  /* Configure the system clock to 2 MHz */
  SystemClock_Config();

  /* Configure LED2 */
//  BSP_LED_Init(LED2);


	
  /* Enable Power Control clock */
  __HAL_RCC_PWR_CLK_ENABLE();

  /* Check if the system was resumed from Standby mode */
  if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
  {
    /* Clear Standby flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);


    /* Wait that user release the User push-button */
//    BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
//    while(BSP_PB_GetState(BUTTON_KEY) == GPIO_PIN_RESET){}
  }

  /* Insert 5 seconds delay */
  HAL_Delay(5000);

  /* The Following Wakeup sequence is highly recommended prior to each Standby mode entry
     mainly when using more than one wakeup source this is to not miss any wakeup event.
     - Disable all used wakeup sources,
     - Clear all related wakeup flags,
     - Re-enable all used wakeup sources,
     - Enter the Standby mode.
  */

  /* Disable all used wakeup sources: PWR_WAKEUP_PIN1 */
  HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);

  /* Clear all related wakeup flags*/
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

  /* Enable WakeUp Pin PWR_WAKEUP_PIN1 connected to PA.00 */
  //HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

  /* Enter the Standby mode */
  HAL_PWR_EnterSTANDBYMode();

  /* This code will never be reached! */
  while (1)
  {
  }
  /* USER CODE END 3 */
}


/**
  * @brief System Clock Configuration
  * @retval None
  */
void SystemClock_Config(void)
{
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};

  /* Enable MSI Oscillator */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
  RCC_OscInitStruct.MSIState = RCC_MSI_ON;
  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
  RCC_OscInitStruct.MSICalibrationValue=0x00;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK)
  {
    /* Initialization Error */
    while(1);
  }



  /* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2
     clocks dividers */
  RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0)!= HAL_OK)
  {
    /* Initialization Error */
    while(1);
  }
  /* Enable Power Control clock */
  __HAL_RCC_PWR_CLK_ENABLE();

  /* The voltage scaling allows optimizing the power consumption when the device is
     clocked below the maximum system frequency, to update the voltage scaling value
     regarding system frequency refer to product datasheet.  */
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

}

 

 

 

Thanks

 

 

6 REPLIES 6

Welcome to the forum.

Please study the Posting Tips: How to write your question to maximize your chances to find a solution.

In particular, note how to post source code - not as a screenshot.

 


@Nonotiboy wrote:

I would like do exactly the same with the mcu STM32L010KB, but this doesn't work.


"doesn't work" tells us next to nothing - please give full details.

  • What hardware are you using? Show schematics.
  • What were you expecting to observe?
  • What did you actually observe, and how did you observe it?
  • What debugging have you done to find what's wrong?

 

Imen.D
ST Employee

Hello @Nonotiboy ,

The PWR example with NUCLEO-L010RB board can be tailored to any other supported device without issue.

Do you use the debugger ? Try disconnecting the debugger physically.

The Debug MCU configuration register allows to configure the low-power modes when the MCU is under
debug and may impact values in STANDBY mode as DBG_STANDBY bit may keep some clock powered.

Please have a look at the RM0377, in "Debug support for low-power modes" section.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Nonotiboy
Associate II

Thanks for your response.

The result is the same when I remove physically the debugger, always about 2mA.

 

I remark something strange, In the kit NUCLEO-L010RB, this bit DBG_STANDBY is reset, but in my program the DBG STANDBY is always set, I cannot clear DBG_STANDBY (I have added the code below) !

Please see the picture in attachment.
This but could be the problem?

 

 

	 HAL_Delay(500);
	HAL_DBGMCU_DisableDBGStopMode();
	HAL_DBGMCU_DisableDBGSleepMode();
	HAL_DBGMCU_DisableDBGStandbyMode();

 

 

 


@Nonotiboy wrote:

I remark something strange, In the kit NUCLEO-L010RB, this bit DBG_STANDBY is reset, but in my program the DBG STANDBY is always set, I cannot clear DBG_STANDBY (I have added the code below) !


It needs a power-cycle to clear it.

https://community.st.com/t5/stm32cubeide-mcus/dbgmcu-cr-dbg-stop-setting-ignored/td-p/616278

https://community.st.com/t5/stm32-mcus-boards-and-hardware/stm32f030-disable-debug-in-stopmode-from-firmware-registers-edit/m-p/696293 

Thanks for your response, but why the Kit NUCLEO-L010RB doesn't need this power_cycle and the DBG_STANDBY bit are reset by default and not for the STM32L010KB? 

 

 

Nonotiboy
Associate II

Maybe it is posssble to have the same exmple like STM32Cube_FW_L0_V1.12.0\Projects\NUCLEO-L010RB\Examples\PWR\PWR_STANDBY but with code for STM32L010K8 inside instead STM32L010RB please ?

 

There is surely a small difference between the 2 which makes that the program does not consume normally in standby mode in the STM32L010K8.