There is some posibility that UART get an overrun flag due to big data flows in my project.Sometimes an RX interrupt is executing,I have also checked overrun flag in the s_uart_Isr(UART0, s_uartHandle[0]) and overrun flag isn't set.But at the end of the IRQ handler,the overrun flag is set.So no another interrupt will be generated.I have to add two lines of code as below,how can I avoid this?Enable the interrupt nesting?(I'm using FreeRTOS)
void UART0_DriverIQRHanlder(void)
{
s_uart_Isr(UART0, s_uartHandle[0]);
/* I have to add two lines as below to clear overrun */
if(UART_GetStatusFlags(UART0) & kUART_RxOverrunFlag)
UART_ClearStatusFlags(UART0, kUART_RxOverrunFlag);
SDK_ISR_EXIT_BARRIER;
}
已解决! 转到解答。
"I wonder why the interrupt nesting should be disabled?"
As the levels get deeper it becomes harder to reason where the race conditions will appear.
This also generally indicates that the system is overloaded if it becomes necessary.
If there is no other choice do nothing other than increment a value, never set a flag because clearing it becomes a race condition, or deal with the hardware event that must be dealt with to meet the timing constraints of the system design.
The the variable that gets incremented is compared to a past value at a higher level where things can be dealt with.
"Enable the interrupt nesting?"
The answer to that question is almost always an emphatic 'No'.
If the ISR takes longer to run than the rate the data is coming in at would certainly cause this.
We really can't say more, without seeing more of the code.
"I wonder why the interrupt nesting should be disabled?"
As the levels get deeper it becomes harder to reason where the race conditions will appear.
This also generally indicates that the system is overloaded if it becomes necessary.
If there is no other choice do nothing other than increment a value, never set a flag because clearing it becomes a race condition, or deal with the hardware event that must be dealt with to meet the timing constraints of the system design.
The the variable that gets incremented is compared to a past value at a higher level where things can be dealt with.