T30, WCE7 and C# - Bytes sent after closing COM port

I am currently testing a T30 with an Iris board, image 1.4 of CE7, using C# and your UART demo application slightly modified.

Everything works well until I close the port. If data was sent, sometimes there is an additionnal 8 bytes sent after closing the port.

I rooted down the problem to the DiscardOutBuffer() method. If I call it after sending data I get the problem.

comPort1 = new SerialPort();
opened_port = comPort1;
opened_port.Write(txtSend.Text.ToCharArray(), 0, txtSend.Text.Length);

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?

This issue is not shown so far. Currently a lot of the engineers are at busy at the embedded world. We will have a look on this as soon as possible.

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.