Are serial port or Serial.Write working differently on Mac and Windows?

818 views Asked by At

I am trying to write a Xojo app to communicate with a device (a ZVT-ECash Terminal) that is connected to my Mac through a USB/Serial adapter.

I am testing my app on OS X and on Windows 7 (running under Parallels). In both cases I'm sending a string (always the same one) through Serial.Write somehow like that:

command = chrb(&h10) + chrb(&h02) + chrb(&h06) + chrb(&h00) +chrb(4)...
Serial1.Write(command)

Serial1 is an instance of the Serial control.

This string is acknowledged by the device as a valid command when I run my app on Windows and is not acknowledged on OS X (the device answers with a NAK).

On OS X I have also tried to send the same string manually with CoolTerm and it was not acknowledged either.

What am I doing wrong? Is it some problem with the Serial control in Xojo, and/or is there some general difference in how the serial port works under Win and OS X?

1

There are 1 answers

1
Thomas Tempelmann On BEST ANSWER

I have run into similar problems myself just recently. Turned out it had nothing to do with Xojo (even though CoolTerm is written in Xojo as well).

The problem was with the OS X driver for the adapter that is using the "2303" Prolific chip. I found that both the driver by Prolific and the open source version (osx.pl2303) had issues: The former did not always set the baud rate correctly whereas the latter did not handle the hardware handshake properly. My solution was to purchase the driver from https://www.mac-usb-serial.com - it was the only one that worked for me on OS X with two different 2303-based adapters.