Skip to main content
Visitor II
December 2, 2025
Question

STM32G031K8 consumes 100uA in Stop1 mode

  • December 2, 2025
  • 8 replies
  • 475 views

Hi,

I am currently working on the firmware of a PCB with an STM32G031K8T6 as the MCU, supplied by a 1.8V voltage.

When I enter Stop 1 mode, the consumption of the MCU drops to 100uA, instead of the 7uA stated in the datasheet.

The app_stop function is as follows :

void app_stop(void)
{
 timer_uninit();
 i2c_slave_uninit();
 i2c_master_uninit();
 gpio_stop_mode();
 HAL_SuspendTick();
 SystemClock_Config_StopMode();
 HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
}

void gpio_stop_mode(void)
{
 GPIO_InitTypeDef GPIO_InitStruct;

 GPIO_InitStruct.Pin = GPIO_PIN_All;
 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

 GPIO_InitStruct.Pin = GPIO_PIN_All;
 GPIO_InitStruct.Pin &= ~(GPIO_WAKEUP_PIN);
 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

 __HAL_RCC_GPIOB_CLK_DISABLE();
 __HAL_RCC_GPIOC_CLK_DISABLE();
}

uint8_t timer_uninit(void)
{
 timer_off();
 return HAL_TIM_Base_DeInit(&timer_handler);
}

uint8_t timer_off(void)
{
 if(timer_handler.Instance != 0)
 {
 int irq_status = (timer_handler.Instance->DIER & TIM_IT_UPDATE) ? 1 : 0;
 HAL_TIM_Base_Stop_IT(&timer_handler);
 return irq_status;
 }
 return 0;
}

uint8_t i2c_slave_uninit(void)
{
 return HAL_I2C_DeInit(&i2c_slave_handler);
}

uint8_t i2c_master_uninit(void)
{
 return HAL_I2C_DeInit(&i2c_master_handler);
}

void SystemClock_Config_StopMode(void)
{
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 //RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};

 /** Initializes the RCC Oscillators according to the specified parameters
 * in the RCC_OscInitTypeDef structure.
 */
 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
 RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;
 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_NONE;
 HAL_RCC_OscConfig(&RCC_OscInitStruct);
 /** Initializes the CPU, AHB and APB buses clocks
 */
 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
 | RCC_CLOCKTYPE_PCLK1;
 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_LSI;
 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);

 /** Configure the main internal regulator output voltage
 */
 HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2);
}

 I checked all the IO levels, non of them are drawing current through a pull resistor.The SWD probe is removed.

Could you please tell me what I am missing ?

 

Best regards,

    This topic has been closed for replies.

    8 replies

    Technical Moderator
    December 3, 2025

    hello @levantg 
    For now, I suspect that the issue is related to the PCB design. I tested the stop mode with an STM32G031K8 Nucleo board, and it provided consumption values that align with the datasheet.
    Can you double-check your hardware?
    I attached the project if you want to test it on your PCB.

    Hope that helps!
    Gyessine

    levantgAuthor
    Visitor II
    December 3, 2025

    Hi @Gyessine ,

    Thank you for your answer. I do not see the project in attachement of your message, could you please re-attach it ?

     

    Best regards,

    Technical Moderator
    December 3, 2025

    hello @levantg 

    Sorry for this inconvenience.
    Here it is
    Gyessine

    levantgAuthor
    Visitor II
    December 5, 2025

    Hi Gyessine,

    The virus scan is continuously in progress on your file, which prevents me to download it. Is there another way you can send it to me ?

     

    Best regards

    Technical Moderator
    December 5, 2025

    Hello @levantg ,

    Unfortunately this is an issue that has occurred the last two days and the team is working on it. 

    See this thread: Attachments stuck on "virus scan in progress..."

    Technical Moderator
    December 3, 2025

    Hello @levantg ,

    Ensure no external circuitry is causing leakage or additional current consumption.

    Technical Moderator
    December 5, 2025

    hello @levantg 
    First, sorry about the virus scan in progress issue. We are aware of it, and I assure you that we are actively working on resolving it.

    As an alternative solution, could you please create another project that includes only the stop mode function without any other peripherals? I noticed that you are using timers and I2C, this will help ensure that we are testing your hardware accurately.

    I ran this test with our Nucleo product and observed a consumption of less than 10 µs. You can use the function explained in this wiki for reference.

     while (1)
     {
     /* USER CODE END WHILE */
    
     /* USER CODE BEGIN 3 */
    	 HAL_Delay(2000);
    	 HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
     }
     /* USER CODE END 3 */

    Hope that helps
    Gyessine

    levantgAuthor
    Visitor II
    December 9, 2025

    Hi Gyessine,

    Sorry for my late reply.

    I made a new projects with the following code in main.c, the consumption of the STM32 remains the same (~97uA).

    int main(void)
    {
     // Reset of all peripherals, initializes flash interface and systicks
     HAL_Init();
    
     // Configure the system clock to 48 MHz
     SystemClock_Config();
    
     /* Infinite loop */
     while(1)
     {
     HAL_Delay(1000);
     HAL_SuspendTick();
     SystemClock_Config_StopMode();
     HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
     HAL_ResumeTick();
     }
    }

    The System_Clock_Config_StopMode function is as follows :

    void SystemClock_Config_StopMode(void)
    {
     RCC_OscInitTypeDef RCC_OscInitStruct = {0};
     RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
     //RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
    
     /** Initializes the RCC Oscillators according to the specified parameters
     * in the RCC_OscInitTypeDef structure.
     */
     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
     RCC_OscInitStruct.HSIState = RCC_HSI_OFF;
     RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;
     RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_NONE;
     HAL_RCC_OscConfig(&RCC_OscInitStruct);
     /** Initializes the CPU, AHB and APB buses clocks
     */
     RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
     | RCC_CLOCKTYPE_PCLK1;
     RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_LSI;
     RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
     RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
     HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
    
     /** Configure the main internal regulator output voltage
     */
     HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2);
    }

     So I guess it seems to be HW related ?

    Best regards,

    Graduate II
    December 5, 2025

    SWD probe removing is irelevant if you leave design powered after flash (with activation debug in low power mode).

    For current measure always remove complete power and do clean start.

    ST Employee
    December 9, 2025

    how about the other low power modes like the standby?

    you can get the example code of standby and stop in STM32CubeG0/Projects/NUCLEO-G031K8/Examples_LL/PWR at master · STMicroelectronics/STM32CubeG0 · GitHub

    if the standby mode also not align with the datasheet, there maybe the PCB issue

     

    levantgAuthor
    Visitor II
    December 9, 2025

    Hi Shirley,

    I tried the Standby mode, which gives the same current consumption (97uA), here is my main function :

    int main(void)
    {
     // Reset of all peripherals, initializes flash interface and systicks
     HAL_Init();
    
     // Configure the system clock to 48 MHz
     SystemClock_Config();
    
     /* Infinite loop */
     while(1)
     {
     HAL_Delay(1000);
     HAL_SuspendTick();
     SystemClock_Config_StopMode();
     HAL_PWR_EnterSTANDBYMode();
     HAL_ResumeTick();
     }
    }
    Technical Moderator
    December 9, 2025

    hello @levantg 
    well, in that case, it really looks like a hardware related issue
    just to be safe, verify that no interrupts are preventing the STM32 from entering low-power modes.
    Double-check the NVIC configuration. If no issues are found, proceed to inspect the hardware.
    We hope this analysis helped you identify the root cause of your issue.
    Gyessine

    Graduate II
    December 9, 2025

    From where you have info you need 

    SystemClock_Config_StopMode();

    Mode is name STOP because system clock is stopped = no require any change from HSI !. 

    STM32CubeG0/Projects/NUCLEO-G031K8/Examples_LL/PWR/PWR_EnterStopMode/Src/main.c at master · STMicroelectronics/STM32CubeG0 · GitHub

    levantgAuthor
    Visitor II
    December 9, 2025

    I just tried it to make sure the problem did not come from a clock issue. But even when I don't use this functions the consumption does not decrease.

    Technical Moderator
    December 11, 2025

    hello @levantg 
    Can you test the consumption of the boards in normal mode and then in various other low-power modes, such as:

    • Sleep mode
    • Low-power run mode
    • Low-power sleep mode
    • Stop 0, Stop 1, Stop 2 modes

    I am particularly interested in understanding if there even a decrease in consumption from normal mode to low-power modes, and between different low-power modes, especially the lightest ones like low-power run and sleep modes.

    If all tests result in the same 100 µA consumption, and since you mentioned that the LED does not toggle, this strongly suggests verifying the measurement method. How are you measuring the consumption?

    Here is a hardware implementation example of an IDD jumper from U083 (jumper 5).


    Gyessine_0-1765441365728.png

     


    Gyessine