SerialConnection and Linux

Hello, i’m working with Linux Mint / Windows10.
The following code works fine on Win:

SerialConnection1.Baud = SerialConnection.Baud57600
for i as integer = 0 to SerialDevice.LastIndex
Try
SerialConnection1.Device = SerialDevice.At(i)
SerialConnection1.Connect
MessageBox(“The serial connection is open.”)
Catch error As IOException
MessageBox(“The serial connection " + Str(i) + " could not be opened!”)
End Try
next i

On Linux i get 20 times the MessageBox “The serial connection is open.”
But i receive no data. According the docs it should work. What can i do?

Is there no way to use my program on Linux? I need the serial port in the future!

Hi Peter.
I would open a Feedback case for this. If one for this exists, add some points to it and comment with your specific code and issue.

I’m sorry I can’t be of more help, but it’s been quite some time since I needed Serial at all, let alone on Linux.
– Anthony

Ok, i installed the feedback system and found a lot of cases.
Result: it doesn’t work! No response, no workaround!

That’s absolutely frustrating. I wrote a program with serial communication. Now i have nothing.

If you open a serial port then don’t change the port to another:

SerialConnection1.Baud = SerialConnection.Baud57600
var isConnected As Boolean = false
for i as integer = 0 to SerialDevice.LastIndex
Try
SerialConnection1.Device = SerialDevice.At(i)
SerialConnection1.Connect
MessageBox(“The serial connection is open.”)
isConnected = true
Exit For // Stop connecting to other ports if we are connected
Catch error As IOException
MessageBox(“The serial connection " + Str(i) + " could not be opened!”)
End Try
next i
// Do something with the serial port here for example poll it once.
If isConnected Then
SerialConnection1.poll // You may or may not get a DataReceived event if there is data.
End If

i can say the serial port is working for me on linux, but it depends on the correct settings e.g. SerialConnection1.Baud etc…

1 Like

You may also want to try using API 1.0 lingo; API 1.0 has many more years of testing and use. Not sure what to tell you about the Feedback stuff, it seems more of a black hole specially if you are in Linux so I would heavily search the forum first.

@DerekJ
the ttyUSB0 is found as last device, it connects without error, but there is absolute no “DataReceived”.
The serial-parameters are the same like on Win10.

@LangueR
then i will need two connections? A SerialConnection (API2) and an old Serial from (API1)? Is that the solution?

What device is at the other end?

Only one connection. You must choose either one API or the other, but not both (meaning that you either define the serial control using the new API or old API but for the same control you can’t combine them).

An example of the old API (maybe not the best example, nor a new one) is here: https://www.dropbox.com/s/kz1wmzy63tr9vf0/forum%20serial%20monitor.rbp?dl=1