TI的工程师,你们好
我使用了freertos,然后我期望串口中断的优先级是最高的,不会因为freertos而导致串口中断不被触发
我的做法是,
1、配置中断分组为3,也就是全部使用8个抢占优先级
2、配置串口中断为优先级0,也就是最高优先级
3、配置FREE RTOS最高可以使用的优先级为1,也就是0不属于FREE RTOS的管理范围,确保不会影响
但是在实际测试中发现,串口中断还是不能保证每次都触发,有时可以正常触发,但是经常性不能触发,有可能是什么原因呢?
代码片断如下
1、注册配置串口中断
UARTFIFODisable(UARTA0_BASE);
IntPrioritySet(INT_UARTA0 , INT_PRIORITY_LVL_0);
UARTIntStatus(UARTA0_BASE, false);
UARTIntClear(UARTA0_BASE,UART_INT_RX);
UARTIntRegister(UARTA0_BASE,uart_handle);
UARTIntEnable(UARTA0_BASE,UART_INT_RX);
2FREE RTOS配置
#ifdef __NVIC_PRIO_BITS
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3 /* 8 priority levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )