Hello, I encountered a problem with RXRDY interrupt of uart in LPC824. I lost first bytes of packet sometimes.
One processor send packet of bytes (13 bytes) every 2 seconds. Another should receive that packet via interrupt. Receiver correctly accept in example 5 packets and the 6'th packets first two bytes was lost (interrupt not generated) and from third byte residual packet was received ok. Then again all ok wiht next packets, but after some time first bytes missing and so on.
Strange thing that if I use pooling method in main loop(if(( LPC_USART1->STAT & 0x01)==1)), then all bytes received correctly, none bytes are lost. So I think interrupt not always generated?
LPC824 main clock is 60mhz, systemcoreclock 30mhz., uart baudrate 115200 (but with others baudrates situaciot the same).
const uint32_t UARTCLKDIV=1;
/* Reset FRG */
LPC_SYSCON->PRESETCTRL &= ~ (1<<2);
LPC_SYSCON->PRESETCTRL |= (1<<2);
clk = SystemCoreClock*2/UARTCLKDIV;
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<15);
//enable pin switch
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<7);F
LPC_SWM->PINASSIGN1 = 0xFF1706FFUL;
LPC_USART1->CFG |= (1 << 2);
LPC_USART1->BRG = clk / 16 / baudrate - 1;
LPC_SYSCON->UARTFRGMULT = (((clk / 16) * (LPC_SYSCON->UARTFRGDIV + 1)) /
(baudrate * (LPC_USART1->BRG + 1))) - (LPC_SYSCON->UARTFRGDIV + 1);
LPC_USART1->INTENSET = 1; // Enable UART interrupt rx
while ( LPC_USART1->STAT & 0x01)
regVal = LPC_USART1->RXDAT; // Dump data from RX FIFO
LPC_USART1->CFG |= (1 << 0);
It seemed you take the bare-bones way, Have you tried the NXP-examples? Although not perfect, they help from time to time to get things done. May be you should try them so you can isolate the error source (if any).