How can I increase the interrupt priority of UART1 of the LPC2364? Due to heavy load on timer interrupts, I'm missing receiving characters every 5 - 10 seconds.
The initialization of UART1 is as follow:
void enableUART1(void) { VICVectAddr7 = (unsigned long) UART1_IRQHandler; // Set Interrupt Vector VICVectCntl7 = 17; //15; // use it for UART1 Interrupt VICIntEnable |= (1<<7); // Enable UART1 Interrupt }
// Enable RS485 P2.7 Initialisiert auf Out high PINSEL4 = PINSEL4|P2_00TXD1|P2_01RXD1; U1LCR = bits|parity|stops|_DLABON; U1DLL = (U8)baud; U1DLM = (U8)(baud>>8); U1LCR = bits|parity|stops|_DLABOFF; uart[_UART1].openChar1 =uart[_UART1].openChar2 =uart[_UART1].openChar3 =uart[_UART1].openChar4 =0; uart[_UART1].closeChar1=uart[_UART1].closeChar2=uart[_UART1].closeChar3=uart[_UART1].closeChar4=0; uart[_UART1].closeTimeout=timeout; flushBufferUART1( ); U1IER =(1<<0); // Enable Rx Interrupt uart[_UART1].initialized=1;
Many thanks for any input. Peter
How can I increase the interrupt priority of UART1 of the LPC2364?
Are you sure that this will solve your problem ? Instead of missing UART events, your system might start missing (or reacting too late to) timer events.
Have you looked into other ways to solve the problem ? According to the datasheet, the UART on your device has 16 byte transmit and receive FIFOs. If you use them, and your timer interrupts still need more time than the UART needs to receive 16 bytes (for usual baudrates, that's a small eternity for a uC), then are you sure you followed the KISS (Keep ISRs short and simple) strategy for your timer ISRs ?
And if the FIFO is not large enough, there is still the possibility of using DMA to handle the UART transfers, which will basically give you a buffer size equal to any RAM you can spare.
Hi Frank That's what I'm thinking about now. But, I don't understand this with the FIFO exactly: If I set
U1FCR = 0x01;
then FIFO is enabled and will interrupt on every character. But if I set
U1FCR = 0xC1;
then it will only interrupt on every 14th character. But what happens if I receive a string of only 11 characters?
But what happens if I receive a string of only 11 characters?<p>
If you want to receive every single character, set the UART to raise an interrupt as soon as there is one character in the FIFO. The beauty about the FIFO is that even if the UART has received additional characters by the time the uC starts the ISR, these additional character are not "lost", but stored in the FIFO, and you can read them from there.
View all questions in Keil forum