Virtual Serial port on Win - no data appears, sends OK (but CoolTerm works?)


I am stumped. Xojo SerialController connects OK to my device’s virtual serial port on windows (its a microcontroller that uses mbed USBSerial to establish a virtual serial port)

It also sends data ok to the device

The device both sends and receives correctly on PuTTY and CoolTerm (which I understand was made with Xojo)

But no matter what I try (XON, DTR on off, RTS on off, polling SerialPort.poll with a timer, DataAvailable etc etc) the BytesAvailable coming IN to the Xojo app refuses to go above zero. DataAvailable event is never firing - and this project is a copy of the Serial barcode reader, so by all rights it should.

I am totally stumped why this thing does not work. If I saw the source code of CoolTerm, I could probably figure it out, but since the source is not available, well…

Please give some ideas why a virtual serial port is not firing the data available on a Xojo program. I have tried everything and am at a total loss why it won’t work. Any ideas appreciated.

I used Eltima Virtual serial port to create 2 COM ports and a null modem cable. The other end I put into the Xojo application and the other end to PuTTY

And it works. So the Xojo code is somewhat OK as well.

I have programmed tens of different serial implementations, both hw and software.

But Xojo has me beat. There is no way to diagnose how it reads the virtual serial port. How is available data detected? Beats me.

Do you have the port opened and lasterror = 0?

Mystery of mysteries.

If I close the serial, and reopen it (exactly same way) … it starts working.

It can be repeated over and over. Start program, open connection, data goes only from xojo to device.

Close connection, reopen = data now goes both ways.


In the Xojo provided Examples/BarcodeSerial, the list of serial ports is a popup list

The index of that popup list is uninitialized, having a value of -234234234…

SerialController.Open gives a true regardless of the fact that there is no element -2123423423 on the pop up list

When connection is closed, and subsequently reopened, the index value is now correct

So, bug in the example program.

EDIT, nope

Still requires me to disconnect and reconnect to work


Ok so now I have pinpointed what exactly happens to make it work.

i need to start with XON, DTS and CTR off

AFTER first connect, I turn

SerialController.RequestToSend = True SerialController.DataTerminalReady = True

Close connection, reopen and works

If RTS and DTR are high when connection is opened first time, again it does not work

Finally, solution

I don’t know about other users of virtual serial ports (CDC driver for an MCU in this case), but here was my solution:

  1. start with XON, DTS and CTR off
  2. then, AFTER first connect:

SerialController.RequestToSend = True SerialController.DataTerminalReady = True SerialController.Reset

I’ve never had something like this happen, but then I normally don’t use hardware handshake. Glad you got it working.