[En-Nut-Discussion] Problems with UART.c and _read()

Jason Walton walton.jason at gmail.com
Tue Sep 12 22:12:57 CEST 2006


Discussion,

I'm attempting to run the uart.c sample code provided on the website and am
experiencing odd behavior.

The first few output lines operate as expected; the output is as follows

-----------------------------------------------
Nut/OS UART Sample
Press any key...
-----------------------------------------------

At this point, a key is pressed, and for() loop that runs the remainder of
the code flies off the handle.  The following is an example of the text that
follows after a key is pressed.

-----------------------------------------------
Enter your name:
Hello lÀ¨cÿÿÿ!

Enter your name:
Hello stranger!

Enter your name:
Hello !

Enter your name:
Hello lÀ¨cÿÿÿ!

Enter your name:
Hello stranger!

Enter your name:
Hello !

Enter your name:
Hello lÀ¨cÿÿÿ!

Enter your name:
Hello stranger!
-----------------------------------------------

It appears to me that ln 102 fgets(inbuf, sizeof(inbuf), uart); claims to
have received data when no data has been entered.  I can only assume that
the data from the previous entry at the "Press Any Key" prompt has failed to
clear something.

Any ideas?


Hardware Version : Ethernut 1.3G
Nut/OS Version : 4.0.3

Thanks,

Jason



More information about the En-Nut-Discussion mailing list