最近做新项目更新了一下STM32CubeMX到4.16.1,执行生成代码时提示:
WARNINGS:
- When FreeRTOS is used, it is strongly recommanded to use HAL timebase source other than the Systick.
然后按提示设置SYS部分的Timebase Source,除了SysTick可选的就是各个未占用的TIM。
按我之前的理解,SysTick就是为了RTOS准备的专用定时器,这会CubeMX让我选普通的TIM,有点晕了,不知道为什么。
SysTick与TIM做RTOS的timebase,孰优孰劣?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
摘一部分:
As mentioned is the UM1718 “STM32CubeM user manual:
“ By default, the STM32Cube HAL is built around a unique timebase source which is the ARM-Cortex system timer (SysTick).
However, HAL-timebase related functions are defined as weak so that they can be overloaded to use another hardware timebase source. This is strongly recommended when the application uses an RTOS, since this middleware has full control on the SysTick configuration (tick and priority) and most RTOSs force the SysTick priority to be the lowest.
Using the SysTick remains acceptable if the application respects the HAL programming model, that is, does not perform any call to HAL timebase services within an Interrupt Service Request context (no dead lock issue).
To change the HAL timebase source, go to the SYS peripheral in the IP tree pane and select a clock among the available clock sources: SysTick, TIM1, TIM2,...”
反正我TIM这块也不依赖HAL库,用systick无妨。
只是,既然已经有个专业的了,为何还要去挤其它功能。
没太理解原因。。。。
给讲一下?
一周热门 更多>