Since I have setup the uart2 to generate an Rx interrupt above kernel priority, it happens randomly that the OS gets in a continues loop within the:
static portTASK_FUNCTION( prvIdleTask, pvParameters )
It just keeps running that function over and over again. And no other task will get executed anymore.
It usually happens when the Rx buffer has overflowed. However, in the same interrupt, before i get the data, I check if an overflow has occurred. And if it does, i just discard the the data and clear the overflow stat bit.
The most of the UART code is based on the example supplied in the demo. I do not set/read any variable during the interrupt. I only send a queue using the correct interrupt routine provided for it.
I notice that the error occurs much less when i remove the following function:
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
Does anyone knows what this could be?