I'm attempting to enable the Stop mode on the STM32L4R5ZIP, but it appears to significantly deviate from the specifications outlined in the datasheet, exhibiting a higher current consumption ranging from 7 to 9 mA in both sleep and stop modes.
Even after setting all free pins to default mode, deactivating all GPIOs, the power consumption remains consistent. I have experimented with both FreeRTOS and a non-FreeRTOS project, yet I consistently observe a 7mA current consumption in STOP Low-Power modes.
In the FreeRTOS project, I implemented tickless mode with the following code snippet:
void PreSleepProcessing(uint32_t ulExpectedIdleTime)
{
/* Called by the kernel before it places the MCU into a sleep mode because
configPRE_SLEEP_PROCESSING() is #defined to PreSleepProcessing().
NOTE: Additional actions can be taken here to get the power consumption
even lower. For example, peripherals can be turned off here, and then back
on again in the post sleep processing function. For maximum power saving
ensure all unused pins are in their lowest power state. */
HAL_SuspendTick();
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x801, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
__disable_irq();
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOF_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOG_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
HAL_PWREx_DisableVddIO2();
//STOP2 MODE
HAL_PWREx_EnterSTOP2Mode(PWR_SLEEPENTRY_WFI); /
}
void PostSleepProcessing(uint32_t ulExpectedIdleTime)
{
/* Called by the kernel when the MCU exits a sleep mode because
configPOST_SLEEP_PROCESSING is #defined to PostSleepProcessing(). */
/* WAKE UP WITH RTC */
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_RCC_DeInit();
__enable_irq();
/* resume systicks */
HAL_ResumeTick();
SystemClock_Config();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
}
I would highly appreciate any insights or suggestions to minimize the current consumption in this scenario.