Serial can't write on macOS

Hi guys, I have a problem with a serial class. I’m trying to connect to a serial device and I want to send 2 commands to this serial device. i wrote the following code:

if serialInterface.Open Then
MsgBox("Can't connect")
end if

This code works as expected on Windows, but on Mac commands seems to be not sended to my serial device.
If I write to the serial device from the terminal with:

echo -ne 'my_strings_here' > /dev/cu.usbserial

then my serial device gets the data it need and does what it need to does.

It’s not a configuration problem because on Windows it works.

Is there an additional configuration to be done on Mac to make that code works? Thank you for anyone that can help me!

Did you check for

Or even ?

Hi, thank you for your reply. Yes, I’ve checked for them.
I’ve checked the last error code after each write and after the flush, but the result is always NoError.
Events aren’t called.
I’ve tried with xmitWait before the writes call, but the code won’t stop either.

Any other suggestions?

Hello, this code based in yours in a button works:

Note i used cheap chinese usb to serial first and it didn’t worked. Later tried with other that worked.

[code]Dim serialInterface As new Serial

TextArea1.Text=TextArea1.Text+EndOfLine+"Going to use Serial Port 2 that is: "+_



if serialInterface.Open Then
TextArea1.Text=TextArea1.Text+" Writing Hello to serial"+EndOfLine
TextArea1.Text=TextArea1.Text+" Writing Xojo to serial"+EndOfLine

TextArea1.Text=TextArea1.Text+" Last error code: “+ _
TextArea1.Text=TextArea1.Text+” Bytes remaining: "+ _

MsgBox(“Can’t connect”)
end if[/code]

It’s been a few years (and macOS releases) but I know at one point to do serial on the Mac you had to turn off SIP (System Integrity Protection). I don’t think it’s still an issue in Sierra and High Sierra but might be worth looking into. Years before that I know I had major issues with the cheap Prolific USB to Serial converters that didn’t work without finding updated drivers (macOS and Windows Vista). So there are many different things that could affect your serial comms.

I’ve bought a new USB to serial cable and I confirm that was it. The same code, with this new cable, now works.

Thank you all for the replies.