美文网首页
2020-04-11STM32 CubeMX tickless

2020-04-11STM32 CubeMX tickless

作者: yango3 | 来源:发表于2020-04-12 14:52 被阅读0次

    It has been some time since I try to bring FreeRTOS + Stop mode on STM32L072 board. It's good to have the powerful os API and low current consumption at the same time. But ST seems not providing a complete and ready solution in CubeMX. So it do take me several days to peek through the code , fortunately with google articles, finally got a solution.

    Steps

    CubeMX code generation

    The default low power mode is Sleep Mode. We will customize CubeMX settings.

    "Pinout & Configuration"

    RCC      - Enable HSE & LSE
    SYS       -  Enable Debug Serial Wire
                   - TimeBase source [ TIM2 ]
    LPTIM1 - Mode [counts internal clock events]
                  - Enable NVIC 
    RTC       - Activate Clock Source
    Middleware - FreeRTOS enable
    

    "Clock Configuration"

    LPTIMCLK  -  Select LSE
    

    Codes to add

    __weak void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ){
    
    }
    
    
    

    Cube_FW_L0_V1.11.2 reference source code

    NUCLEO-L053R8/Applications/FreeRTOS/FreeRTOS_LowPower_LPTIM

    Here we will use LPTIM as tick timer clock source during STOP mode , as TIM2 will stop functioning then.

    Test Environment

    VCC : 3 V

    Without low power mode

    current consumption = 8.3 mA

    With low power sleep mode

    current consumption =

    相关文章

      网友评论

          本文标题:2020-04-11STM32 CubeMX tickless

          本文链接:https://www.haomeiwen.com/subject/bbupmhtx.html