I'm interfacing GPS module with LPC2378. The GPS module is sending data continuously and the packet size is more than 100 bytes. The receiver buffer's(RBR) size is 16 bytes. As soon as GPS module is connected to LPC's UART, the first 16 bytes are placed in RBR and the remaining bytes of GPS module is lost. The LSR(Line Status Register) shows overrun error. I tried using interrupts whenever ready data is available in RX line. But even in this case, LSR shows overrun error. How to receive all the bytes from GPS module in LPC2378 without overrun error?
GPS module is communicating at 9600 baud rate. Hence, UART1 is used with baud rate of 9600. The RBR is read continuously in an infinite loop. Still there is overrun error. Can you please let me know if there is any flaw in this logic? If yes, how do I resolve this? Below is the code
#include <lpc23xx.h> #include <stdint.h> char ch; int main() { PINSEL0 |= 0x40000000; /* Enable TxD1 pin */ PINSEL1 |= 0x00000001; /* Enable RxD1 pin */ U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U1DLM = 0x00; U1DLL = 78; /* 9600 Baud Rate @ 12MHz Clock */ U1LCR = 0x03; /* DLAB = 0 */ U1FCR = 0x07; /*Enable FIFO */ while(1) { if (U1LSR & 0x01) /* Check if data is ready in RBR */ { ch=U1RBR; /*Read receiver buffer*/ } } }
Where are you detecting an overrun error? That code just sits in an infinite loop waiting for a character to arrive, and when it does it gets removed.
What do you want to do with the character received? it's just discarded.
You're not stopping the code in the debugger and then manually checking registers, are you?
You need to check the chip documentation, but the UART probably continues to receive characters - then, if the debugger's stopped the code, you obviously will get an overrun error!