Skip to contentSkip to conversation

pl2303 linux driver does not work

DISCUSSION Batdelger.O 2 participants 5 messages Nov 5, 2014 – Nov 6, 2014 1 message not in the archive TTY layer and serial drivers

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Thank you for your quick response.
It's just simple python code. I'm not sure if flow control is correct. I also used gtkterm and tried by every option. I'm new at usbserial devices. How to know how should it be?

import time
import serial
import sys

ser = serial.Serial(

        port='/dev/ttyUSB0',
        baudrate=4800,
        parity=serial.PARITY_ODD,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        # timeout=0

)

# RTS 0 DTR 1. not sure it's correct one. I tried by reverse. ser.setRTS(False)
ser.setDTR(True)

print ser.isOpen()

ON="\x1B\x5D"
ser.write(ON)
ser.flushOutput()
print "after write"

   # read = ser.read()
   # sys.stdout.write("RECEIVED:" + read + "\n")
   ser.close()
Signature · 3 lines
Best regards,
Batdelger.O R&D engineer
Grapecity Mongolia LLC
Quoted 16 lines · Greg KH
Quoted 8 lines · Batdelger.O

Hello
Hope you guys are doing great.
I've got problem with pl2303 Linux driver. In a nutshell, my mission is to control magnetic card reader/writer with PL-2303 XA / HXA chip from the Linux. I'm using Ubuntu 14.04(kernel version: 3.13.0-39-generic). Everything is going fine. Giving no errors. Writing data via usb-serial seems to work. But the device is not receiving data. If that issue familiar with you, please give me advice.

How exactly are you "writing data"? And have you set up flow control properly?

thanks,

greg k-h

Signature · 3 lines
Best regards,
Batdelger.O R&D engineer
Grapecity Mongolia LLC
#2 lore raw
Quoted 6 lines · Batdelger.O

Thank you for your quick response.
It's just simple python code. I'm not sure if flow control is correct. I also used gtkterm and tried by every option. I'm new at usbserial devices. How to know how should it be?

Quoted 11 lines
   import time
   import serial
   import sys

   ser = serial.Serial(
        port='/dev/ttyUSB0',
        baudrate=4800,
        parity=serial.PARITY_ODD,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        # timeout=0

That's a slow baud rate, do you mean that slow?

Quoted 5 lines

)

# RTS 0 DTR 1. not sure it's correct one. I tried by reverse. ser.setRTS(False)
ser.setDTR(True)

Does your device support hardware flow control?

Quoted 11 lines

   print ser.isOpen()

   ON="\x1B\x5D"
   ser.write(ON)
   ser.flushOutput()
   print "after write"
   # read = ser.read()
   # sys.stdout.write("RECEIVED:" + read + "\n")
   ser.close()

Try using minicom to see if you can properly connect to your device first, before trying to write your own code from "scratch", to determine that the device works.

greg k-h

#3 lore raw
Quoted 11 lines · Batdelger.O
Quoted 9 lines

Thank you for your quick response.
It's just simple python code. I'm not sure if flow control is correct. I also used gtkterm and tried by every option. I'm new at usbserial devices. How to know how should it be?

import time
import serial
import sys

Quoted 8 lines
Quoted 7 lines
    ser = serial.Serial(
         port='/dev/ttyUSB0',
         baudrate=4800,
         parity=serial.PARITY_ODD,
         stopbits=serial.STOPBITS_ONE,
         bytesize=serial.EIGHTBITS,
         # timeout=0

That's a slow baud rate, do you mean that slow?

Actually, baud rate is 9600. 4800 was one of my attempts.

Quoted 19 lines
Quoted 5 lines

)

# RTS 0 DTR 1. not sure it's correct one. I tried by reverse. ser.setRTS(False)
ser.setDTR(True)

Does your device support hardware flow control?
I think so. The Features section of device doc contains line: "Automatic hardware flow control with CTS/RTS ". But I'm not sure. How to know exactly it does?.

Quoted 10 lines
    print ser.isOpen()

    ON="\x1B\x5D"
    ser.write(ON)
    ser.flushOutput()
    print "after write"
    # read = ser.read()
    # sys.stdout.write("RECEIVED:" + read + "\n")
    ser.close()
Quoted 3 lines

Try using minicom to see if you can properly connect to your device first, before trying to write your own code from "scratch", to determine that the device works.

Device is working fine on windows 7. My simple python scripts is
working fine without setting any options except port name (on win7).

Quoted 3 lines

greg k-h

Signature · 3 lines
Best regards,
Batdelger.O R&D engineer
Grapecity Mongolia LLC
#4 lore raw
Quoted 20 lines · Batdelger.O
Quoted 11 lines · Batdelger.O
Quoted 9 lines

Thank you for your quick response.
It's just simple python code. I'm not sure if flow control is correct. I also used gtkterm and tried by every option. I'm new at usbserial devices. How to know how should it be?

import time
import serial
import sys

Quoted 8 lines
Quoted 7 lines
   ser = serial.Serial(
        port='/dev/ttyUSB0',
        baudrate=4800,
        parity=serial.PARITY_ODD,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        # timeout=0

That's a slow baud rate, do you mean that slow?

Actually, baud rate is 9600. 4800 was one of my attempts.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

)

# RTS 0 DTR 1. not sure it's correct one. I tried by reverse. ser.setRTS(False)
ser.setDTR(True)

Does your device support hardware flow control?

I think so. The Features section of device doc contains line: "Automatic hardware flow control with CTS/RTS ". But I'm not sure. How to know exactly it does?.

You usually need to set this up on the device itself. The manual for the device should say how to do this.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
   print ser.isOpen()

   ON="\x1B\x5D"
   ser.write(ON)
   ser.flushOutput()
   print "after write"
   # read = ser.read()
   # sys.stdout.write("RECEIVED:" + read + "\n")
   ser.close()
Quoted 5 lines
Quoted 3 lines

Try using minicom to see if you can properly connect to your device first, before trying to write your own code from "scratch", to determine that the device works.

Device is working fine on windows 7. My simple python scripts is working
fine without setting any options except port name (on win7).

Again, please try running minicom on Linux which sets up the line settings in a "known manner" before blaming the kernel driver :)

thanks,

greg k-h

#5 lore raw

I'm sorry. E-mail subject was wrong. I just wanted to find good direction. Ok, I'll try by minicom.

Signature · 4 lines
Best regards,

Batdelger.O R&D engineer
Grapecity Mongolia

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, November 6, 2014 11:36 AM
To: Batdelger.O
Cc: [email protected]
Subject: Re: Fwd: Fwd: Re: pl2303 linux driver does not work

Quoted 5 lines · Batdelger.O
Quoted 5 lines · Batdelger.O
Quoted 3 lines

Thank you for your quick response.
It's just simple python code. I'm not sure if flow control is correct. I also used gtkterm and tried by every option. I'm new at

usbserial devices.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines

How to know how should it be?

import time
import serial
import sys

Quoted 8 lines
Quoted 7 lines
   ser = serial.Serial(
        port='/dev/ttyUSB0',
        baudrate=4800,
        parity=serial.PARITY_ODD,
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS,
        # timeout=0

That's a slow baud rate, do you mean that slow?

Actually, baud rate is 9600. 4800 was one of my attempts.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

)

# RTS 0 DTR 1. not sure it's correct one. I tried by reverse. ser.setRTS(False)
ser.setDTR(True)

Does your device support hardware flow control?

I think so. The Features section of device doc contains line:
"Automatic hardware flow control with CTS/RTS ". But I'm not sure. How to

know exactly it does?.

You usually need to set this up on the device itself. The manual for the device should say how to do this.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
   print ser.isOpen()

   ON="\x1B\x5D"
   ser.write(ON)
   ser.flushOutput()
   print "after write"
   # read = ser.read()
   # sys.stdout.write("RECEIVED:" + read + "\n")
   ser.close()
Quoted 5 lines
Quoted 3 lines

Try using minicom to see if you can properly connect to your device first, before trying to write your own code from "scratch", to determine that the device works.

Device is working fine on windows 7. My simple python scripts is
working fine without setting any options except port name (on win7).

Again, please try running minicom on Linux which sets up the line settings in a "known manner" before blaming the kernel driver :)

thanks,

greg k-h