cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 STOP2 mode current jumps from 1 µA to 50 µA when enabling GPIO wake-up

ts00882014
Associate

Hi,

 

I’m working on an STM32L431CBT6 project where I enter STOP2 mode and measure ~1 µA current, which is great. However, I need to use PA0 as a GPIO input to wake up the MCU from STOP2.

 

When I configure PA0 as an input (no pull, or pull-up/down), my STOP2 current jumps to about 50 µA.

 

Here’s the relevant setup:

 

  • MCU: STM32L431CBT6

  • Toolchain: CubeMX + HAL

  • STOP2 entry via HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI)

  • All unused GPIOs are set to analog mode

  • PA0 configured as GPIO_MODE_INPUT

  • Supply voltage: 3.3V

  • Current measured with multimeter

void Enter_Stop2_Mode(void)
{
	// Set all GPIOs to analog
	GPIO_InitTypeDef gpio = {0};
	gpio.Mode = GPIO_MODE_ANALOG;
	gpio.Pull = GPIO_NOPULL;
	gpio.Pin = GPIO_PIN_All;

	// Set all pins to analog mode
	HAL_GPIO_Init(GPIOA, &gpio);
	HAL_GPIO_Init(GPIOB, &gpio);
	HAL_GPIO_Init(GPIOC, &gpio);
	HAL_GPIO_Init(GPIOD, &gpio);
	HAL_GPIO_Init(GPIOE, &gpio);
	HAL_GPIO_Init(GPIOH, &gpio);

	gpio.Pin = V1_Pin;
	gpio.Mode = GPIO_MODE_INPUT;
	gpio.Pull = GPIO_PULLUP;  // or GPIO_PULLDOWN
	gpio.Pull = GPIO_NOPULL;
	HAL_GPIO_Init(GPIOA, &gpio);

	HAL_SuspendTick();
	HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
}


/* USER CODE END 0 */

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{

  /* USER CODE BEGIN 1 */

  /* USER CODE END 1 */

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

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART1_UART_Init();
  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
	  printf("entering stop mode\r\n");
	  Enter_Stop2_Mode();
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

 

Question:

Is this higher current expected when keeping a GPIO input active in STOP2? My power budget is around 10uA.

 

1 REPLY 1
ELABI.1
ST Employee

Hi @ts00882014,

To reduce power consumption in STOP2 mode, you need to configure the unused I/O pins as analog.

Thank you.

ELABI.1

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.