No announcement yet.

Reading data from Linux

  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading data from Linux

    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:

    ser = serial.Serial(
    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:

    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?

  • #2
    Figured it out

    Turns out that you don't always need to pass arguments to usbserial as I have above. I thought you did since usbserial was being used by another device on this machine and that one did need the extra arguments. Providing them in this case seems to just have broken it :-(

    To make it work, all I had to do was make sure that no related modules were loaded and then run:
    modprobe pl2303
    . That loaded usbserial and everything Just Worked.