[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. 

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值