<div dir="ltr">Hi, I have a simple loopback program in my board (bsp lpc_176x), It reads information from a tty and returns it through the same tty (using POSIX functions), I tested it sending characters with a PC's terminal and I saw the ECHO on the terminal, I found an unusual behavior with some bsp configurations, sometimes the first character that I send is returned dirty (some extra bytes are sent), after this first dirty character the program works well.<div>
Example:</div><div><br></div><div>-------------------------------------------------------------------------------------------<br></div><div><div><font face="courier new, monospace">void configureUart(const int fd)</font></div>
<div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">       </span>struct termios options;</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">   </span>tcgetattr(fd, &options);</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>//Set raw mode</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">    </span>cfmakeraw(&options);</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>tcsetattr(fd, TCSANOW, &options);</font></div><div><font face="courier new, monospace">}</font></div><div><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace">rtems_task Init(</font></div><div><font face="courier new, monospace">  rtems_task_argument ignored</font></div><div><font face="courier new, monospace">)</font></div>
<div><font face="courier new, monospace">{</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">       </span>const int fd = open(TTYSO, O_RDWR);</font></div><div><span class="" style="white-space:pre"><font face="courier new, monospace">       </font></span></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if (fd >= 0)</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">   </span>{</font></div><div>
<font face="courier new, monospace"><span class="" style="white-space:pre">           </span>configureUart(fd);</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>char buffer[1u];</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>while (true)</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">              </span>{</font></div><div>
<font face="courier new, monospace"><span class="" style="white-space:pre">                   </span>if (read(fd, buffer, 1u) == 1u)</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                   </span>{</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                                </span>write(fd, buffer, 1u);</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">                    </span>}</font></div>
<div><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>}</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">         </span>close(fd);</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div>
<div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">      </span>while(1);</font></div><div><font face="courier new, monospace">}</font></div>
<div>
<font face="courier new, monospace"><br></font><div><div><font face="courier new, monospace">#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER</font></div><div><font face="courier new, monospace">#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER</font></div>
<div><font face="courier new, monospace">#define CONFIGURE_MAXIMUM_TASKS            1</font></div><div><font face="courier new, monospace">#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2</font></div><div><font face="courier new, monospace">#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM</font></div>
<div><font face="courier new, monospace">#define CONFIGURE_MAXIMUM_DEVICES 5</font></div><div><font face="courier new, monospace">#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4</font></div><div><font face="courier new, monospace">#define CONFIGURE_RTEMS_INIT_TASKS_TABLE</font></div>
<div><font face="courier new, monospace">#define CONFIGURE_INIT</font></div><div><font face="courier new, monospace">#define CONFIGURE_STACK_CHECKER_ENABLED</font></div><div><font face="courier new, monospace">#include <rtems/confdefs.h></font></div>
<div>-------------------------------------------------------------------------------------------<br clear="all"><div><br></div><div>In this example, when i press 0123456789 the output looks like: </div><div><div>]�\     B�\^0123456789</div>
</div><div><br></div><div>I said "with some configurations" because I found that if I define maximum devices to 4 (<span style="font-family:'courier new',monospace">#define CONFIGURE_MAXIMUM_DEVICES 4)</span> it works well, but with <span style="font-family:'courier new',monospace">#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4</span> and if I remove <span style="font-family:'courier new',monospace">#define CONFIGURE_STACK_CHECKER_ENABLED</span>  the problem appears again. </div>
<div><br></div><div>I don't know if I'm doing something bad or if it is a bug, Can someone help me with that?</div><div><br></div><div>Thanks,</div><div><br></div><div> </div>-- <br><div dir="ltr"><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">
<span style="font-size:16px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><img src="http://www.tallertechnologies.com/templates/tallertechnologies/images/signature.png" width="200" height="78"><br>

</span></p><br><span style="font-size:16px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">

<span style="font-size:16px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><font size="4"><span style="font-family:verdana,sans-serif">Gabriel Alejandro Ibarra</span></font><br>

</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><font><span style="font-family:verdana,sans-serif;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Software Engineer</span></font><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:italic;font-variant:normal;text-decoration:none;vertical-align:baseline"></span></p>

<br><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"></span><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">

<font size="1"><span style="font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">San Lorenzo 47, 3rd Floor, Office 5</span></font></p>

<p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><font size="1"><span style="font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Córdoba, Argentina </span></font></p>

<font size="1"><br><span style="font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"></span></font><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt">

<font size="1"><span style="font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:bold;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Phone:</span><span style="font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"> +54 351 4217888<br>

</span></font></p></div>
</div></div></div></div></div>