cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4A6 consuming 2 mA system current in Stop 2 mode configuration

Nikhil D&K
Associate II

Hello developers,

We are currently developing a low power metering product using STM32L4A6 controller. It is clocked by HSE (16 MHz) and LSE (32 KHz) for RTC and LCD.  It has a magnetic and optical sensor which will be always active and generating interrupts if read value is greater than set threshold. It also incoprates glass LCD for displaying stats, NFC (ST25DV), LoRa module (RAK3172) for communication and an gas gauge IC (STC315) for battery gauging.  

 

Devices that are currently triggered off in my product are NFC, LoRa, Gas Gauge. Before entering STOP2 mode i am also de-intializing the LCD drivers. Still the current consumption measured on entering STOP 2 mode is  approximately:

MCU : 300 uA

System Measurement: 2.5 mA 

 

So can anyone please guide me why my system current is consuming arounf 2.5 mA even when all the components are triggered off. And all the uncessesary peripherals are de-initalzed. 

 

 

 

 

 

 

 

 

    

 

8 REPLIES 8
Piranha
Chief II
Ced
ST Employee

Hello @Nikhil D&K 

Can you check if the debug MCU STOP mode is not enabled. (Bit DBG_STOP inside the DBGMCU_CR register).

In Debug Stop mode, the FCLK and HCLK are provided by the internal RC oscillator which remains active in STOP mode.

Best Regards,

Ced

 

 

Hello @Ced ,

As per your suggestion, i have checked if DBG_STOP bit is set or not using the below code :

 

 

// Assuming DBGMCU_CR is a 32-bit register and DBG_STOP is bit 1 (bit index starts from 0)

// Read the value of the DBGMCU_CR register
uint32_t dbgmcu_cr_value = DBGMCU->CR; // Replace 'DBGMCU' with the correct register base address for your microcontroller.

// Extract the DBG_STOP bit
uint32_t dbg_stop_bit = (dbgmcu_cr_value >> 1) & 0x1;

// Check the value of the DBG_STOP bit
if (dbg_stop_bit == 1) {
    // DBG_STOP is enabled
    // Your code here...
} else {
    // DBG_STOP is disabled
    // Your code here...
}

 

Using above code it shows that the dbg_stop_bit is set. But  on power on reset it is disabled. 

 

 

 

 

I am sill getting around 150 uA in STOP 2 mode measured for MCU current consumption even when on power reset.   

Your code improved and simplified:

 

if (DBGMCU->CR & DBGMCU_CR_DBG_STOP) {
	// DBG_STOP is enabled
} else {
	// DBG_STOP is disabled
}

 

I gave you two links, which show and explain many low-power mode related issues and solutions. Have you fixed all of those? The bugs will not go away just because you pretend they are not there...

@Ced , maybe ST should also start acting like adults and fixing those issues exposed by the two links I gave. The HAL, examples, even Knowledge Base and Wiki articles - all of them present broken code. Or will ST continue playing this "let's pretend the flaws doesn't exist" game forever?

Hello @Piranha @Ced the first link you mentioned is broken. Just to give more information i am using HSE to clock my device at 16MHz via PLL. I have configured clock settings using clock configuration section of Cube MX. 

Now to enter in STOP 2 mode i just wrote the following code : 

 

 

	HAL_SuspendTick();
	HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

 

Still the current consumption measured on IDD pin is around 200 uA measured using power profiler. I have also check by power reseting it, but still getting approximately the same current consumption. 

 

So can you please guide me how to get current consumption below 10 uA ? Looking for guidance. 

 

 

Also @Ced on power reset, the debug MCU STOP mode is not enabled. So i don't think thats the issue here. 

 

 

 

Fixed the broken link. Though, searching that title in Google (what an unorthodox idea!), immediately returns the correct link as the first result. And you didn't even read the second link...

Hey @Piranha ,

Thanks for the links.

I have reffred the code for Shutdown and Standby mode. When i put my STM32L4A6VGT6 in Shutdown mode using below code snippet, with no peripherals initialized, i still get around 150-200 uA current consumption on power profiler.  

 

 

void Power_Off(void)
{
	// Configure wake-up features
	// WKUP1(PA0) - active high, WKUP4(PA2) - active low, pull-up
	PWR->PUCRA = PWR_PUCRA_PA2; // Set pull-ups for standby modes
	PWR->CR4 = PWR_CR4_WP4; // Set wakeup pins' polarity to low level
	PWR->CR3 = PWR_CR3_APC | PWR_CR3_EWUP4 | PWR_CR3_EWUP1; // Enable pin pull configurations and wakeup pins
	PWR->SCR = PWR_SCR_CWUF; // Clear wakeup flags

	// Configure MCU low-power mode for CPU deep sleep mode
	PWR->CR1 |= PWR_CR1_LPMS_SHUTDOWN; // PWR_CR1_LPMS_SHUTDOWN
	(void)PWR->CR1; // Ensure that the previous PWR register operations have been completed

	// Configure CPU core
	SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Enable CPU deep sleep mode
	DBGMCU->CR = 0; // Disable debug, trace and IWDG in low-power modes

	// Enter low-power mode
	for (;;) {
		__DSB();
		__WFI();
	}
}

 

What could be the possible issue here ?