STM32L031 Ultra low power consumption
Hello. I have purchased STM32L031 nucleo development board and wanted to experiment with it. I plan to work on a LoRa project that sends sensor information. The device is battery powered hence ultra low power consumption is a top priority.
https://www.st.com/en/evaluation-tools/nucleo-l031k6.html
To test the power consumption I have also purchased Power Profiler Kit II from Nordic:
https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2
According to the STM32L031 User manual (https://www.st.com/resource/en/user_manual/um1956-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf), I have connected Power Profiler Kit to JP1 (IDD) to measure the current consumption.
The test code I am running:
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_USART2_UART_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
/* Check and handle 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);
}
/* Disable Wakeup Counter */
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
/* Clear all related wakeup flags */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
int counter = 0;
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
counter++;
HAL_Delay(1000);
printf("toggle LED \n");
if(counter >= 5){
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0xFFFF, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
HAL_PWR_EnterSTANDBYMode();
}
}
/* USER CODE END 3 */
}
I have run the Power Profiler for 5 minutes and the results are as following:

Sleep current consumption:

Active mode power consumption:

I can see that the power consumption in Standby mode is about 2uA. The power when the device wakes up is about 5mA.
My question:
Is it possible to optimize it further? Can I reduce the active mode current consumption? This is just testing code and it does not do anything except incrementing the counter, but my actual application will transmit the LoRa message and enter standby. The LoRa modules works with SPI interface so I must ensure SPI works in active mode.
Any suggestions on how to further optimize the power consumption is very much appreciated!
