2024-08-13 12:32 AM
I'm currently testing low-power applications on the NUCLEO-U545RE-Q board, which involves using an SSD1306 OLED display and a BME280 MEMS atmospheric sensor, both interfaced via I2C1 and I2C3 at 1 MHz. The FCLK is configured to 160MHz. Clock source is internal resonators, HSI and LSI (RTC disabled). Internal SMPS is enabled. Additionally, I'm utilizing an integrated user button and LED on the Nucleo board.
The process starts by acquiring temperature, humidity, and pressure readings upon power-up. After 5 seconds, the system transitions to standby mode. To restart the process and view the necessary information while conserving battery life, the user can press the reset button. However, I've encountered an issue where the MCU, when in standby mode, consumes 25 mA—a significantly high draw for a small lithium battery. This current draw was measured by placing an ammeter in series with JP4, as specified in the UM3062 for MB1841.
Despite several attempts to reduce this consumption, I have not yet succeeded. Below is the main loop of my code in main.c. If you need to see more code snippets or my STM32CubeMX configurations, please let me know, and I will provide them.
/* USER CODE BEGIN WHILE */
while (1) {
HAL_GPIO_WritePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin, GPIO_PIN_SET);
BME280_Measure();
HAL_GPIO_WritePin(LED_GREEN_GPIO_Port, LED_GREEN_Pin, GPIO_PIN_RESET);
char BufferT[10], BufferP[10], BufferH[10];
sprintf(BufferT, "%.5f", Temperature);
HAL_UART_Transmit(&huart1, (uint8_t*)BufferT, strlen(BufferT), HAL_MAX_DELAY);
ssd1306_SetCursor(0, 1);
ssd1306_WriteString(BufferT, Font_11x18, White);
sprintf(BufferP, "%.1f", Pressure);
HAL_UART_Transmit(&huart1, (uint8_t*)BufferP, strlen(BufferP), HAL_MAX_DELAY);
ssd1306_SetCursor(0, 23);
ssd1306_WriteString(BufferP, Font_11x18, White);
sprintf(BufferH, "%.5f", Humidity);
HAL_UART_Transmit(&huart1, (uint8_t*)BufferH, strlen(BufferH), HAL_MAX_DELAY);
ssd1306_SetCursor(0, 45);
ssd1306_WriteString(BufferH, Font_11x18, White);
ssd1306_UpdateScreen(&hi2c1);
HAL_Delay(100);
HAL_SuspendTick();
HAL_PWR_EnterSTANDBYMode();
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */