STM32与FreeRTOS学习备忘,xSemaphoreGiveFromISR
来源:互联网 发布:java编写信息管理系统 编辑:程序博客网 时间:2024/05/29 13:45
在学习FreeRTOS的时候,使用中断释放信号量时,出现了问题。
中断函数卡在xSemaphoreGiveFromISR();函数里了,具体是卡在portASSERT_IF_INTERRUPT_PRIORITY_INVALID();里。
根据注释查看http://www.freertos.org/RTOS-Cortex-M3-M4.html,里面有两点点出关键。
1.
Most systems default to the wanted configuration, with the noticeable exception of the STM32 driver library. If you are using an STM32 with the STM32 driver library then ensure all the priority bits are assigned to be preempt priority bits by calling NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); before the RTOS is started.
意味着选中断分组时只能选preempt为4bit,sub为0bit,即preemption范围0~15,sub priority范围为0
2.
Relevance when using the RTOS
FreeRTOS functions that end in "FromISR" are interrupt safe, but even these functions cannot be called from interrupts that have a logical priority above the priority defined by configMAX_SYSCALL_INTERRUPT_PRIORITY (configMAX_SYSCALL_INTERRUPT_PRIORITY is defined in the FreeRTOSConfig.h header file). Therefore, any interrupt service routine that uses an RTOS API function must have its priority manually set to a value that is numerically equal to or greater than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting. This ensures the interrupt's logical priority is equal to or less than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting.Cortex-M interrupts default to having a priority value of zero. Zero is the highest possible priority value. Therefore, never leave the priority of an interrupt that uses the interrupt safe RTOS API at its default value.
意味着不能让中断优先号分配不能小于configMAX_SYSCALL_INTERRUPT_PRIORITY!!!最好的分配方法当然是尾部15分配起,而不是从头部0开始分配。让GPIO的中断优先号大于configMAX_SYSCALL_INTERRUPT_PRIORITY,即中断优先号不优先于(logic above)你定义的最优中断优先号就行,xSemaphoreGiveFromISR();就可以用了。
- STM32与FreeRTOS学习备忘,xSemaphoreGiveFromISR
- STM32学习笔记(1)如何移植FreeRTOS
- STM32+freeRTOS学习笔记-1.使用cube MX创建一个freeRTOS的keil工程
- FreeRTOS STM32移植笔记
- STM32之FreeRTOS
- STM32之FreeRTOS
- FreeRTOS STM32移植笔记
- FreeRTOS移植到STM32
- FreeRTOS STM32移植笔记
- STM32 移植Freertos
- FreeRTOS STM32移植笔记
- STM32+freertos+lwip
- STM32上移植FreeRTOS
- STM32上移植FreeRTOS
- FreeRTOS STM32移植笔记
- STM32之FreeRTOS
- FreeRTOS STM32移植笔记
- FreeRTOS学习1--任务挂起与恢复
- 加强、提升SSL的密钥位数防止被黑客攻破
- 尊重原创,请保证您的文章为原创作品
- 朴素贝叶斯的应用
- 安卓学习笔记——关于流程控制
- Sql Server函数和存储过程
- STM32与FreeRTOS学习备忘,xSemaphoreGiveFromISR
- 【Git学习笔记】使用git status时刻关注仓库状态
- {转}——jquery serialize方法中文乱码及解决办法
- bitmap图像处理
- Adroid Intent Task的相关知识总结与归纳
- 快照实现技术浅析
- 平行宇宙中的一滴水
- App Store打包上传:Missing required icon file命名规则
- File not found: SYS\x86\DDK_HelloWorld.sys