2023-11-15 01:28 PM
Hi,
I'm using a NUCLEO-L452RE and wanted to check out current in different low power modes.
With only the basic pins configured, I can measure <7uA in Stop2. Not bad.
using:
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
Problem I have is if I configure the 4 UART ports, an I2C port, etc... then go to stop mode 2, my current is between 200 and 1000uA, depending on what I have configured in the IOC file.
Since I'm going to stop mode 2, most of these devices can't be used. Is it really necessary to disable all unused peripherals before I enter stop mode 2? I probably assumed wrong that I could leave them configured assuming they'd not be powered in this low power state.
I've run some tests where I call:
HAL_UART_MspDeInit(&huart1);
HAL_UART_MspDeInit(&huart2);
HAL_UART_MspDeInit(&huart3);
before going to stop2, and I see major current improvements. Do I need to do this for all peripherals that can't be used in stop mode 2, then re-enable them on wake-up?
I couldn't find a good example that specifically shows that this needs to be done, so I'm wondering if I'm missing something.
2023-11-20 06:32 AM
Hi Sarra,
Any further advise? Is the correct procedure to enter stop mode 2 to set all un-needed pins to analog input before sleep, then set them back to their respective functions on wake-up? Or is there a better method?
Thanks!
2023-11-24 08:41 AM
I don't have confirmation on the correct procedure to implement before and after stop 2 low power mode. I have found that if I don't disable the UART/I2C/QSPI peripherals before this low power mode, the current consumption is ~600uA vs ~2.6uA when I do disable them.
I'm looking to determine if this is the correct procedure using the HAL interface. Please confirm or correct as needed.
//stop mode 2
//disable unused peripherals
HAL_UART_MspDeInit(&huart1);
HAL_UART_MspDeInit(&huart2);
HAL_UART_MspDeInit(&huart3);
HAL_UART_MspDeInit(&hlpuart1);
HAL_I2C_MspDeInit(&hi2c1);
HAL_QSPI_MspDeInit(&hqspi);
//enter stop mode 2
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
//re-enable clocks
SystemClock_Config();
//re-enable peripherals
HAL_UART_MspInit(&huart1);
HAL_UART_MspInit(&huart2);
HAL_UART_MspInit(&huart3);
HAL_UART_MspInit(&hlpuart1);
HAL_I2C_MspInit(&hi2c1);
HAL_QSPI_MspInit(&hqspi);