Discussion group dedicated to the Philips LPC2000 family of ARM MCUs
high performance UART FIFO usage - naderus2000 - Mar 8 5:26:13 2007
I want to uart0 for tx long string with FIFO mode enable.
what is the best performance wat to do that?I want the min time I
must wait in this function.
here is a simple function for that:
void UART0_String(char * str)
{
char i = 0;
while(!(U0LSR &0x20));// see in FIFO is full free from last
access
while(*str != '\0')
{
U0THR = *str++;
i++;
if(i == 16) // FIFO is full
{
while(!(U0LSR &0x20)); // wait until the FIFO free
i =0;
}
}
}
if my string is 18 char when 16 char is fill in the FIFO
I must wait the 16 char is sent (about 16*70us @ 115200)
but if i can detect when two char is send i only want
2*70us that's more effient.
Is there any way for better usage of FIFO with interrupt?

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Re: high performance UART FIFO usage - Danish Ali - Mar 8 8:46:52 2007
I don't think the UART can tell you if there is space in the FIFO
(except to say it is completely empty).
This is a limitation of the 16550 UART that the lpc family emulates.
I can think of two approaches:
1) Provide your own software FIFO - as big as you want
subject to available memory.
2) Use a spare hardware timer to predict how the UART FIFO will empty.
I strongly recommend approach 1.
If the software FIFO is big enough your call will not block.
And while you're at it, add a software FIFO for characters coming in.
Regards,
Danish
--- In l...@yahoogroups.com, "naderus2000"
wrote:
>
> I want to uart0 for tx long string with FIFO mode enable.
> what is the best performance wat to do that?I want the min time I
> must wait in this function.
> here is a simple function for that:
>
> void UART0_String(char * str)
> {
> char i = 0;
>
> while(!(U0LSR &0x20));// see in FIFO is full free from last
> access
>
> while(*str != '\0')
> {
> U0THR = *str++;
> i++;
> if(i == 16) // FIFO is full
> {
> while(!(U0LSR &0x20)); // wait until the FIFO free
> i =0;
> }
> }
> }
>
> if my string is 18 char when 16 char is fill in the FIFO
> I must wait the 16 char is sent (about 16*70us @ 115200)
> but if i can detect when two char is send i only want
> 2*70us that's more effient.
> Is there any way for better usage of FIFO with interrupt?
>

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )