RS-232 APP

Try opening/running the sample file (shipped with xojo) named “Serial Port Bar Code Reader Example”, and see if your device, named “ttyUSB-Anybus” appears in the drop-down menu.

If it appears in the drop-down then it’s on to the next step, if not then we go back to examining the .rule file…

:: here’s where the template is on my drive, in case you need some breadcrumbs ::
/Applications/Xojo 2018 Release 1/Example Projects/Communication/Serial/Serial Port Bar Code Reader Example.xojo_binary_project

Sorry if I wasn’t clear, but “ttyUSB-Anybus” does appear in the drop-down menu in my code, the same as in code you suggested. With nothing connected to the USB ports, the pull down options are:
/dev/ttyAMA0
/dev/ttyS0
With the FDTI converter attached two additional options appear:
/dev/ttyUSB-Anybus
/dev/USB0
None show the expected incoming data on the Pi, but the same programs do show it arriving on Comm1 when code is run on PC.

Look in the /dev/serial/by-path/ folder to see the paths to your available serial devices.

-Wes

Hi David,

What happens when you call the .Open method against that port (sample code below), does it return true?

[code]Public Function autoConnectUSBPort() as Boolean

Dim i, count As Integer
count = System.SerialPortCount

For i = 0 To count - 1

if System.SerialPort( i ).Name = "/dev/ttyUSB-Anybus" then
  
  AnyBusRS232.ABSerialPort.SerialPort = System.SerialPort(i)
  
  if Not AnyBusRS232.ABSerialPort.Open then
    
    Return False
    
  end if 
  
  Return True
  
end if 

Next
End Function[/code]

I just realized I had not modified Xojo’s example which was waiting for specific characters before displaying incoming data. I had removed that restriction to compile on my PC, but had not uploaded the corresponding build to the Pi. When I did so, the Pi did start receiving the serial data. Now I need to figure out why code crashes when I select the port. I don’t expect that will be too hard to figure out. Thanks for your help, I’ve been quite lost until now!

This serial port is really wearing me out! My first Pi was working for a while, but eventually stopped, and it took a while to figure out that it was not reacting to baud rate changes, it was stuck 57k baud, and I needed 9600. A new Pi worked right away, but within a few minutes stopped. The Pi itself seems to be working fine, but I can no longer get the serial port to send anything, despite it opening fine. The scale I am trying to communicate with is continuously sending readings toggling between 0 and 12V, connected to the Pi via a FDTI serial-USB converter. Could this voltage be a problem for the Pi?

Never use any higher voltage than 5V over USB.
RS232 = 12v but USB/Serial is NOT.

It wasn’t a voltage problem, the USB-serial converter is taking care of the voltages. I was setting baud with serial1.baud=9600 instead of serial1.baud=8. What threw me off was that the first setting worked under Windows, and only very occasionally under Linux, so I thought the problem was with the Pi.