Tm4c nested uart interrupts- does each com finishes it’s run before the next one executed

armcortex-m4interruptsuart

Board: Tiva™ C Series TM4C1294

EK-TM4C1294XL

My program is listening to 2 UART ports (UART 3 and 7)

I've encounter a problem that I'm losing some bytes received and I'm suspecting that this issue relate to the UART's interrupts.

I understand that UARTs have nested interrupts but does both of them are serial?

For example: I'm inside UART 3 interrupt function and then while UART 3 didn't finish the interrupt (just copy their bytes to buffer) UART 7 interrupts arrives, does the system moves to UART 7 or it will first finish UART 3 and then moves to the UART 7?

Currently I'm suffering from error bytes something like 45-400 bytes for file that his size in 12 Mbytes.

I'm suspecting the above issue cause this issues.

p.s if only 1 UART is sending data I have binary same files on both host and PC.

Best Answer

Your problem will be solved if you give priority levels to your interrupts, so first won't bother second.

Here is one example:

NVIC_SetPriority(UART3_IRQn, 0);
NVIC_SetPriority(UART7_IRQn, 1);

While one interrupt is being serviced, second arrived is in pending state.