EMX debug while serial port active issue

Hi Folks,

want to start with development of my apps command shell.

Use an EMX DevSys (for the moment), connected to my PC (Win7 Pro) via USB for deployment and debugging, so business as usual.

I also connect a USB to Serial adapter to the RS232 interface of the EMX DevSys (COM2) and want to use it as my console IO.

But I run into troubles to echo characters, reading chars or sending chars, Looks very mystic.

Than I tried to drill down systematically, here the facit:

Loading a program, writing the string ‘Hallo’ to the COM2, receiving via TeraTerm but NOT run VS2012 works for about 40 minutes, than I stopped it, cause I think this is stable.

Loading the same program, but now have VS2012 running and debugger attached, no breakpoints, this fails after one or two minutes. The software can be halted with a breakpoint and seems to be running after this moment, but no output at TeraTerm.

After this ‘crash’ I tried to disconnect the USB/Serial adapter and reconnect after some secondes, but this time I get the message ‘USB device not recognised’. I have to reboot my PC to get this solved.

I tried this with two different adapters, one Aten and one using the Prolific chip set, exact the same behavior.

Before bashing GHI, has anybody seen something like this? For me it is clear, that using both EMX and serial adapter makes the problem, but how can I efficiently debug an app with commandline interface, if that fails ???

Any ideas? Reduce baude rate, use a special adapter with a special chipset (FTDI) using two PCs …

Thanks for helping.

With best regards


I have a devsys, what do I need to do to see the issue? Please provide the steps and the code.

Hi Gus,

SDK 4.2
USB/Serial Adapter
2 USB cable

Connect for development via USB
Connect USB/Serial Adapter to the DB9 of the DevSys

run this code:

Option Explicit On
Option Strict On

Imports System
Imports System.Text
Imports System.Threading
Imports System.IO.Ports
Imports Microsoft.SPOT

Namespace TestSerialLine
Public Class Program
Public Shared Sub Main()
’ EMX Development Board: COM1, use UEXT socket near DC input
’ EMX Development Board: COM2, use the DB9 labeld ‘RS232’
’ EMX Development Board: COM3, use 40p plug, search for COM3 pins
Dim UART As New SerialPort(“COM2”, 115200)

        Dim read_count As Integer = 0
        Dim tx_data() As Byte = Encoding.UTF8.GetBytes("Hallo")
        Dim rx_data(25) As Byte

        UART.ReadTimeout = 0

        ' send some data
        UART.Write(tx_data, 0, tx_data.Length)

            read_count = UART.Read(rx_data, 0, rx_data.Length)
            'If read_count > 0 Then UART.Write(rx_data, 0, read_count)
            UART.Write(tx_data, 0, tx_data.Length)

    End Sub

End Class

End Namespace

((Code is after some helpless try outs, so just to test))

Without debugging, works, with debugging fails after some short time.

OS: Win 7 Pro 64 Bit.

Adapters: Aten and Prolific, both the same behavior. Maybe you can try another type of adaper?

Godd luck.

With best regards


… have TeraTerm 4.53 but current is 4.79, will update.

Hi Gus,

running more than an hour without problems.

Change the code (you already have) echoing the characters, Picture of the test fixture attached. NOT in debug mode, just deployed to the board and press reset button. Hope you can read something on the screen.

Works fine.

Now I think about to use my netbook as a terminal or should I take my VT100 from my Computer Museum to be more autentic? (www.compuseum.at)

But it still turns out, both the same time crashes the USB connection from board to PC (not other direction).

With best regards


If you decrease the amount of time the thread sleeps for, does the error happen sooner when the debugger is attached?

will test John.
First Version was without that delay and doesnt work.

Now I use two PCs, Hihi.

Hi Gus,

using two PCs ‘fix’ that, hihi.

With best regards


Hi John,

yes, seems that 10ms delay make it more likely to hang.

Normally I get about half the screen of the terminal, now it hangs after short time, see attachment.

With best regards


And it hangs on both computers? Do you have any FTDI cables you can try it with?

Hi John,

it hangs only if I use ONE computer to run VS2012 (debug mode) and the terminal program.

It is very funny that it works when I dont debug or when I use TWO computers one for debugging and one as a plain terminal …

Sorry, no FTDI cable here. If there is enough order volume I will buy some FTDI modules from Mouser to equip my G400HDR for console application use …

With best regards


Try to connect the TX and RX pins of COM2 together. See if what you write out over TX you receive over RX under the same conditions that caused a failure earlier.

Morning John,

after the hangup yesterday I totally lost USB connectivity, the Prolific port tells me, that the driver is missing and the EMX port also. After restarting the PC it works.

The loop back is running now, will see how long, but it runs definitely longer than the ‘Debug and terminal on one PC’ configuration, which was over after less than one minute.

Best regards


PS: For me it is an USB Driver or Win issue …

Hi John,

Loop back is running about 30 minutes now without any problems. So it turned out (for me) that it is an issue at the PC side.

With best regards



any news?

Just bump in again. Tried to use a serial port over USB of a totally other project, Fails. I am very upset and didn’t understand whats going on in the first moment, but as I realized that VS2012 still running in debugging mode it was clear.

Stop debugging, restart the computer and everything works as expected.

So, in the moment you use EMX debug interface (or G400D debug interface) every other virtual serial ports crash immediately. You have to stop debugging and restart the machine to solve that.
And debugging and using a virtual serial port for what reason ever is mutual exclusive.

With best regards


Did you have the loopback running with the debugger attached?

Hi John,

no, have another program running on EMX with debugger attached. This software uses a telnet connection via ethernet to have a console line to work. This manner, I didnt need a virtual com port, cause this doesn’t work out.

But when I start using a virtual com port with a totally other app it crashes immediately. Same app running fine with the same com port, but I have to restart and the EMX can’t be in debugger mode.

With best regards


Hi John,

Looks like the EMX/G400D debugging device, which is startet/created on the Win7 Pro PC do something strange and kicks out all other USB devices on that machine which representing a virtual com port.

As I use a different machine for the two links, it works.
As I use Telnet instead of a virtual com port on the same machine (or on others), it works.

I know, sound a Little strange, but it is a fact here.

With best regards


So you have a few USB devices on the computer that act as a virtual COM port and when you start to debug the EMX, those devices go away?


connecting the EMX/G400D is nice.
I see the devices with their correct names, all happy.

When I start a debug session, I see still all devices, but everything but the EMX/G400D stucks. It depends on the software whats exactly happens, error messages, just no transmit/receive possible any more …

It looks, as something on a very high level in Windows went wrong.

I only find out, that I have to restart my machine (now I am really happy to bought this damm fast SSDs) to get the other things running again.

So virtual com ports, used for what reason ever and debugging EMX/G400D boards is mutual exclusive.

Sorry, there is no other story here.

With best regards