2019-11-18 10:21 PM
Hi,
I am using the STM32L433 and want to place this into very low power mode. I am thinking STOP1 as the wake up is from one of several interrupts. The setup works fine the system wakes up when it gets an interrupt, but the power consumed is way too high. Around 2.6mA
I disable the peripherals not being used then the following
// stop 1
PWR->CR1&=~(PWR_CR1_LPMS_STOP2|PWR_CR1_LPMS_STOP1);
PWR->CR1|=(PWR_CR1_LPMS_STOP0);
// enable low power regulator
PWR->CR1|=PWR_CR1_LPR;
// suspend systick interrupt
SysTick->CTRL&=~SysTick_CTRL_TICKINT_Msk;
// now wait for int then return
__WFI();
// enable systick interrupt
SysTick->CTRL|=SysTick_CTRL_TICKINT_Msk;
// turn off low power regulator
PWR->CR1&=~PWR_CR1_LPR;
Any comments would help
Mark
2019-12-12 02:51 AM
Hello,
In order to reduce the power consumption you need to put all GPIO in analog state like this :
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = GPIO_PIN_All;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOD_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
and this the code to enter STOP1 mode :
// suspend systick interrupt
SysTick->CTRL&=~SysTick_CTRL_TICKINT_Msk;
/* Stop 1 mode with Low-Power Regulator */
MODIFY_REG(PWR->CR1, PWR_CR1_LPMS, PWR_CR1_LPMS_STOP1);
/* Set SLEEPDEEP bit of Cortex System Control Register */
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
__WFI();
Best Regards,
Mohamed Aymen.