Hi there, I've been commissioned to write an embedded Linux component of a larger, more complicated machine and I'm having real trouble reading data from an Automation Direct "Click" PLC.
The PLC was programmed by someone-not-me to send an ASCII string over a serial connection every time a button was pushed. My code would then read said data from the serial connection and do a bunch of interesting stuff.
The PLC is doing its job, because if I connect a Windows laptop to the serial-to-usb cable and connect to it with Putty, I see the aforementioned output.
The trouble comes when I try this with Linux. Using the very same settings are were used on the Windows machine, I only *sometimes* see the output. I'm at the end of my rope here and I'm coming up empty.
I've tried using minicom, which insists that I'm always "Offline", and I've written a simple Python script to use the same settings with the same results. The settings I'm using are:
Code:
ser = serial.Serial(
"/dev/ttyUSB0",
baudrate=38400,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
rtscts=0,
xonxoff=1,
timeout=None
)
Or in other words 38400 801. I *believe* that I have the rtscts and xonxoff settings right but I really can't be sure.
In terms of modules, I've made sure that there are no modules loaded, and then I run the following:
Code:
modprobe usbserial vendor=0x067b product=0x2303
modprobe pl2303
I got the vendor and product codes from dmesg when the PLC was connected via USB the first time.
So, that's all I have... please tell me that someone out there understands what I'm doing wrong?