[En-Nut-Discussion] UART Buffer Flush Problem
Michael Baverso
mbaverso at elcontech.com
Sun Jan 5 23:25:16 CET 2003
Have you tried:
NutDeviceWrite(uart, 0, 0);
----- Original Message -----
From: "Pat Shueh" <ptlinux at optushome.com.au>
To: <en-nut-discussion at egnite.de>
Sent: Sunday, January 05, 2003 7:17 AM
Subject: [En-Nut-Discussion] UART Buffer Flush Problem
> I have got a similar problem as described in JasonG's earlier post.
>
> Basically, I couldnt seem to flush the output buffer of my UART device if
> the buffer is not full. My process will just hang unless i type something
to
> UART to trigger output. My ethernut application basically send and
receieve
> data from a device connected to the UART. I couldnt seem to get the last
bit
> of data if the buffer is not full. the part of my code is included below,
> can someone give me a hand here?!
>
> I have used UartAvrFlush(uart).. but not sure if i have used it correctly.
>
> u_char inbuf[256];
>
> int i;
> while(connected)
> {
> i=NutDeviceGetLine(uart, inbuf, sizeof(inbuf));
>
> NutPrintFormat(sostream, "buffer size=%d\r\n", i);
>
> //NutPrintFormat(sostream, "%s\r\n", inbuf);
> NutPrintFlush(sostream);
>
> if (i != sizeof(inbuf))
> {
> UartAvrFlush(uart);
> }
> NutThreadYield();
> }
>
> my output looks like this.
>
> buffer size = 256
> buffer size = 256
> buffer size = 256
> buffer size = 256
> buffer size = 256
> buffer size = 256
> <--------------------hang there...
> after i send a \r to uart..
> buffer size = 236 got printed..
>
>
> Thanks
>
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list