cancel
Showing results for 
Search instead for 
Did you mean: 

Low power on STM32L4 series using RTOS

Ans
Associate III

I've been trying to implement low power modes on an STM32 L496 (Nucleo board) while using RTOS. I've tried with both freeRTOS and ThreadX. I followed official ST articles/tutorials and the lowest I got so far has been ~250 uA. 

So, has anyone been able to achieve current as low as they've mentioned in the articles/tutorials i.e. <10uA on Nucleo board? 

5 REPLIES 5
Sarra.S
ST Employee

Hello @Ans

Could you detail what peripherals are used? which mode? code snippet maybe? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Ans
Associate III

I followed this guide:

https://community.st.com/t5/stm32-mcus/how-to-use-stm32u5-with-freertos-in-tickless-mode/ta-p/568431

I've attached main.c and freertos.c files. 

 

Sarra.S
ST Employee

Hello @Ans

This tutorial uses an STM32U5, there are several differences to consider 

Please try to modify this code (add USB, LPUART,..) 

STM32Cube_FW_L4_V1.18.0\Projects\NUCLEO-L496ZG\Applications\FreeRTOS\FreeRTOS_LowPower

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Ans
Associate III

I did modify the code according to my board. You can check the files attached. Secondly, I've already tried this example (freeRTOS low power) for stm32l496 and it didn't produce the expected results. 

Sarra.S
ST Employee

Hello @Ans

I checked your code and it looks ok, to make sure FreeRTOS has already temporarily suspended its tick interrupt, 

in Freertos.c, in PreSleepProcessing macro: add  SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk as following 

 

void PreSleepProcessing(uint32_t ulExpectedIdleTime) 
{
/* place for user code */
	HAL_SuspendTick();
	printf("Entering in STOP2 Mode...\r\n");
    SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk;
    HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
}

 

 and in PostSleepProcessing, add SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;

 

void PostSleepProcessing(uint32_t ulExpectedIdleTime)
{
/* place for user code */
	/* Enable SysTick Interrupt */

    SystemClock_Config();
    printf("\nExit from STOP2 Mode\r\n");
    HAL_ResumeTick();
    SysTick->CTRL  |= SysTick_CTRL_TICKINT_Msk;
}

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.