EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

How to erase LPC2129 -UART FIFO

Started by rk November 30, 2006
Hi
The code  written for rx data in LPC2129-uartO

     U0LCR = 0x83;
     U0DLL = 39;              // baud rate  = 9615      @ pclk = 6mhz

     U0FCR = 0x07;             //FIFO enable
     U0LCR = 0x03;            //Rx data as 8 bits, no Parity, 1 Stop
bit

while(!(U0LSR & 0x01));	   //executed untill U0RSR full
while(U0LSR & 0x01)
       {
        ch3[x] = U0RBR;
        x++;
       }

Transmitter sending stream of data among which only first 16 bytes of
data were stored in FIFO remaining were lost.Give me solution or modify
the above code such that FIFO can be erased when it fulls without the
loss of data stream

with thanks 
Rk

"rk" <sradha1984@gmail.com> wrote in message 
news:1164869849.298720.323560@80g2000cwy.googlegroups.com...
> Hi > The code written for rx data in LPC2129-uartO > > U0LCR = 0x83; > U0DLL = 39; // baud rate = 9615 @ pclk = 6mhz > > U0FCR = 0x07; //FIFO enable > U0LCR = 0x03; //Rx data as 8 bits, no Parity, 1 Stop > bit > > while(!(U0LSR & 0x01)); //executed untill U0RSR full > while(U0LSR & 0x01) > { > ch3[x] = U0RBR; > x++; > } > > Transmitter sending stream of data among which only first 16 bytes of > data were stored in FIFO remaining were lost.Give me solution or > modify > the above code such that FIFO can be erased when it fulls without the > loss of data stream > > with thanks > Rk
The LPC2129 only has a 16 byte FIFO I believe so once the FIFO is full then it won't take any more data. Also if bit 0 of the LSR is the FIFO full flag then that will clear as soon as you read the first word from the FIFO and you'll only go round your loop once. Better to check for the FIFO full flag and then loop until the FIFO empty flag sets. Better still use an interrupt method to trigger at levels before the FIFO is full so you don't miss messages while you are reading the FIFO.

The 2024 Embedded Online Conference