2021-10-05 09:55 PM
Dear Master,
I have problem dealing with STM32L4Q5CGT6, i just turn on the peripheral like SPI, I2C, UART and set the core clock to 400KHz.
in the datasheet and PCC says the current consumption (IDD) will be around 300uA.
but in actual i measure the idd drawn at 1.6mA.
i have set the DBGMCU->CR =0;
HAL_PWREx_EnableLowPowerRunMode();
here is the code:
void led1_off(void){
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
}
void led2_on(void){
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET);
}
void led2_off(void){
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
}
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_I2C1_Init();
MX_SPI1_Init();
MX_SPI2_Init();
MX_USART1_UART_Init();
MX_USART3_UART_Init();
/* USER CODE BEGIN 2 */
DBGMCU->CR=0;
HAL_PWREx_EnableLowPowerRunMode();
HAL_Delay(3000);
//HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
//HAL_GPIO_WritePin(ISO_EN_GPIO_Port, ISO_EN_Pin,GPIO_PIN_RESET);
// sensoring_power_en();
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
//led1_on();
//led2_off();
//HAL_Delay(100);
//led1_off();
led2_on();
HAL_Delay(10);
led1_off();
led2_off();
HAL_Delay(800);
}
/* USER CODE END 3 */
}
i have disconnect all GPIO from board, only VDD,VDDA,VDDUSB,VBAT and VSS connected to supply.
here is the schematic:
How to achive the current consumption like the datasheet about 300uA?
Thanks,
Regards,
Hendry
2021-10-06 02:47 AM
Hello,
Page 130, datasheet says:
"fHCLK = fMSI
all peripherals disable"
2021-10-08 08:28 AM
Hello @hendry putra rahadi,
Try to put all the unused GPIOs in analog state in order to reduce the power consumption.
Aymen
2021-10-08 09:00 AM
correct, if i disable all peripherals , idd = 300uA, but in PCC calculate the idd around 350uA when spi, uart, i2c enabled. just adding 50uA?
2021-10-08 09:05 AM
sure , i have checked box "put all unused gpio to analog".
i have try in several days, when enable only I2C1, UART3. idd still 200uA.
when i enable SPI1 SPI2 and USART1 , idd raised 400uA each. total around 1.2 - 1.4mA.
should i use bitbanged instead of dedicated peripheral?