Skip to main content
Graduate
November 23, 2023
Question

Low power on STM32L4 series using RTOS

  • November 23, 2023
  • 3 replies
  • 2699 views

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? 

    This topic has been closed for replies.

    3 replies

    ST Employee
    November 23, 2023

    Hello @Ans

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

    AnsAuthor
    Graduate
    November 24, 2023

    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. 

     

    ST Employee
    November 27, 2023

    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

    AnsAuthor
    Graduate
    November 28, 2023

    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. 

    ST Employee
    November 29, 2023

    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;
    }