[STM32CubeIDE]使用freertos时Timebase Source为什么不能设定为SysTick

参考https://www.digikey.com/en/maker/projects/getting-started-with-stm32-introduction-to-freertos/ad275395687e4d85935351e16ec575b1

SysTick is a special timer in most ARM processors that’s generally reserved for operating system purposes. By default, SysTick in an STM32 will trigger an interrupt every 1 ms. If we’re using the STM32 HAL, by default, SysTick will be used for things like HAL_Delay() and HAL_GetTick(). As a result, the STM32 HAL framework gives SysTick a very high priority. However, FreeRTOS needs SysTick for its scheduler, and it requires SysTick to be a much lower priority.

We can fix this conflict in a few ways, but the easiest is to assign another, unused timer as the timebase source for HAL. Timers 6 and 7 in most STM32 microcontrollers are usually very basic, which makes them perfect as a timebase for HAL. Go to System Core > SYS and under Mode, change the Timebase Source to TIM6.

即 SysTick 被FreeRTOS用来生成1ms定时,用于任务调度,而且需要将该定时中断设为较低优先级。 而使用STM32 HAL的话, SysTick会被用来做定时且给预较高优先级。

解决方法就是使用一个系统中用不到的timer来做Timebase Source, 比如Timer 6 、Timer 7. 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页