解决:查看 FreeRTOSConfig.h 文件中配置的宏 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY ,即系统可管理最高中断优先级。查看你配置的串口中断优先级是否比该宏定义的优先级低,如果不是,则要修改。
- 例如
- 若此时我将串口1(或串口2)的抢占优先级更改为 2(1~4均可)都会产生如上警告。
// 文件 main.c
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4); // 中断组 4
// 文件 FreeRTOSConfig.h:
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 //RTOS系统可管理的最高中断优先级
// 文件 usart.c:
//Usart1 NVIC 配置
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority= 8;//抢占优先级8
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //子优先级0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
nvicInitStruct.NVIC_IRQChannel = USART2_IRQn;
nvicInitStruct.NVIC_IRQChannelCmd = ENABLE;
nvicInitStruct.NVIC_IRQChannelPreemptionPriority = 7; //抢占优先级7
nvicInitStruct.NVIC_IRQChannelSubPriority = 0; //子优先级0
NVIC_Init(&nvicInitStruct);
|