re-read my postings #23 and #25 in this thread. And DO ensure that interrups are NOT enabled at the time vTaskStartScheduler() is called (the HAL or other drivers may decide to globally enable interrupts during initialization). There may still be other issues, but until we have excluded early interrupts, there isn’t a point in looking at other possible causes.
我有疑问,为什么在开启调度器时触发了同优先级的中断就有可能对FreeRTOS产生影响,而且是在调度器开启后,在中断回调里调用FreeRTOS API函数才会触发硬件故障。如果有影响,不应该连简单的GPIO翻转都运行不了吗?(目前把中断回调的API函数注释掉,在触发中断后,就不会死机),由于是黑箱,文档又没有提醒移植需要注意什么,什么操作会有什么影响。
Have you ensured that interrupts are not enabled before the scheduler is started and your problem nevertheless persists? If yes, we can go look for other potential issues. If not, DO and stop arguing before there are things to argue about. One potential issue is that since you appear to have a custom sys tick interrupt handler, it firing before the scheduler is started may mean that the scheduler crashes when trying to schedule something before there is anything to schedule. This is not about priorities, again.
And again, do yourself a favor and check the return values of ALL calls to FreeRTOS API functions. You may be having a problem somewhere completly different which may be obvious to see of, say, a call to xTaskCreate fails.
我自定义的定时器TIM6是只执行Hal库的时基,不参与systick,systick由FreeRTOS时基独占,尝试移植最开始把他俩放一起,程序就出现使用外部时钟HSE初始化失败,改为使用HSI就可以完成初始化,所以为了使用外部晶振,就把两个独立开。
然后我也在启动调度器前,把TIM6中断使能取消了,清除了中断标志,然而问题依旧。
如果TIM6要在启动调度器前不能触发任何一次,那不行,不然程序要大改。
所以依旧是那个问题,为什么在中断回调函数里调用API函数会导致prvCheckTasksWaitingTermination和listCURRENT_LIST_LENGTH无限循环,然后硬件故障。
就是因为找不到这个问题的根本原因,我也一直向你们熟悉FreeRTOS的各位求助。
使用STM32CubeMX生成的FreeRTOS框架,加上自己的程序,不会因为在中断回调里调用API函数而死机,然后它初始化流程我也看了,它在启动调度器前,并没有关中断。
我就想以HAL库为基础,移植最新的FreeRTOS进行学习,结果就是出现这个问题。
然后你说的检查API函数的返回值,我之后回去一个一个检查。
You mention that the FreeRTOS generated by CubeMX works. What changes have you made to this? How did you create your project?
就是代码框架由STM32CubeMX生成,然后我在自己HAL+FreeRTOS移植工程里把自己的功能实现的代码复制进去,就能正常使用。框架没有做修改,然后CubeMX生成的FreeRTOS版本是V1.6版本的
When did everything stop working then? Is it possible for you to share both working and non-working version? Are you using a dev board or your custom hardware?