If I send the string “testing 1-2-3” and monitor the output on a PC using Tera Term, I get “testing 1-2-33-2-3-2-”. If I send “1234567” I get “123456756745674”. However if I send a multiple of 8 bytes everything is OK.
It looks like a bug since DiscardOutBuffer() should silently flush the buffer and not output 8 bytes from the sent buffer, which should alredy been flushed after sending the data…
This occurs on all UART, baud rate and parity setting. Any idea?
Looks as if you have found a bug in the Tegra 3. We tracked this down and found that this actually happens when the reset register of the UART A (COM 1) is written. We will check if we find anything in the Erata of the Tegra chip and eventually will provide a solution for this.
As soon as it is confirmed this issue will be listed as Issue 16114 on the Tegra Roadmap.
The description of the problem is not completely correct:
Description: When you call PurgeCom
(or DiscardOutBuffer in .NET), some
data which already have been sent out
is sent again.
Workaround: Do not use
these functions for now.
The fact is that DiscadOutBuffer is automatically called by .NET when closing a port, which is also done automatically when exiting an application. The workaround in this case would be to never exit the application… This can become a problem if the garbage data gets interpreted as a valid command by the receiver.