Prolific PL2303 driver
Rick Murray (539) 13840 posts |
Does anybody have a driver for a USB to serial adaptor based upon the Prolific PL2303? |
Steve Pampling (1551) 8170 posts |
Windows drivers I presume? This stuff? ========== System Requirement: Supported device ID and product strings: |
Rick Murray (539) 13840 posts |
That would surely be a topic for Aldershot? I’m looking for a PL2303 driver for RISC OS. |
Steve Pampling (1551) 8170 posts |
Ah, just didn’t associate RO and hardware drivers |
Raik (463) 2061 posts |
I know only one for the FTDI chipset. |
Steve Pampling (1551) 8170 posts |
The source at: Might vaguely interest you, or not |
Rick Murray (539) 13840 posts |
Thanks Steve. I had a look at Thomas’ module, the pl2303 source you pointed to, and the associated FTDI code. The serial devices seem to be pretty similar, to the extent where I wonder if it would be possible to bodge Prolific support into the FTDI module. But, alas, I don’t feel like dealing with low level device drivers. I can’t say “pffft, I’ll just write something in VB” because my Pi eats 7W from the mains. The PC? About twenty times that. :-/ Hardly something I’d feel happy leaving always-on. So, I wussed out… Edit: picked up this one as well as it looks like it might support more pins and I think the device I want to use does something weird like holding some of the flow control lines (DTR and RTS, I think) at fixed state to define the serial high and low levels. |
Dave Higton (1515) 3526 posts |
I spent a rather frustrating time a couple or so years back trying to get a PL2303 to work. I developed a strong dislike of the device. However, this thread piqued my curiosity, so I went back to have another look. I had written a short BASIC experimental app. Its calls to start the PL2303 up were clearly inspired by the Linux driver. When I took out the other calls that I had added (which were almost certainly derived by reverse engineering what the Windows driver did), I was able to get basic transmission working at two baud rates. The limitation is that you can only run it once – subsequent runs stop it working until it’s unplugged and replugged. However, that wouldn’t be a problem in a module driver that opened it only once. So I’ve started a module driver in C. It occurred to me that serial devices are most commonly accessed in RISC OS via blockdrivers, and that it might be possible to have one USB serial blockdriver that would interface to any USB serial device driver module if we could standardise the module API. To make it easy to understand, it seems to me that the module’s API should follow that blockdriver’s API as closely as possible. Then when the blockdriver is initialised, it has to be given the SWI base of the particular module that it will call. Thoughts, anyone? Dunno how it would cope with multiple USB serial dongles of the same type, but I guess that’s a much rarer requirement. |
Rick Murray (539) 13840 posts |
If I remember correctly, the sp_dual blockdriver used a register to select which port was to be used, and the same blockdriver did both ports. The blockdriver spec will need to be updated to cater for events that were impossible in the late eighties – just as I am doing with the MIDI driver – namely the ability to add and remove devices on the fly, plus the wrinkle that a device when re inserted may or may not be the same device (if you have two serial leads, can you tell them apart in software when there’s no dedicated port?) but it’ll certainly have a different USB ID. Fun! :-) I think for now, just concentrate on getting one to work. Multiples can be a luxury for another time. I’m looking forward to trying this, though I can’t speak for the provenance of the cable, if it is real or a better quality clone… |
Rick Murray (539) 13840 posts |
By the way, how do you read from the control port? I have wondered if the MIDI dongle has a way of flagging that it’s buffer is full, but I haven’t had any success reading the control port. I was thinking that if I could get that working, to hammer it with data (not difficult :-/ ) and keep reading the control port to see if anything changes between slow data (under MIDI speed) and faster data (saturates and loses bytes). |
Colin (478) 2433 posts |
I have written a generic DeviceFS driver which handles CP210x and CH340 usb serial devices at the moment it works very well – 960k with handshaking on the cp210x – but I couldn’t find a way around handshaking causing the machine to lock up when you did something like echo test { > serialusb#rts: } and you don’t get the clear to send signal – a problem standard serial: devices also have. Devices are allocated serialusb I don’t have a devicefs/module allocation at the moment so haven’t released it. |
Rick Murray (539) 13840 posts | heyrick -one- -nine- -seven- -three- -at- yahoo -dot- co -dot- uk :-) |
Colin (478) 2433 posts |
Sent
I wouldn’t have thought Midi would have flow control because the data is time dependent. I can’t see that it would have much to control either isn’t the baud rate and word format fixed? |
Rick Murray (539) 13840 posts |
Thanks. Sadly it doesn’t recognise my device – a Prolific PL2303. It seems, by looking in the module, that it’s main support is for the Silicon Labs CP210x (as mentioned). If it is any use, my device is Vendor ID 067B and Product ID 2303, Device ID 0300. Address 8, config 1, class/subclass/protocol all zero. There is one interface with three endpoints.
Or, from the command line: Interface 0.0 class 255.0:0 ’’ If this in any way resembles the CH340 or CP210x, I’d be willing to give it a try if you can tweak the device recognition? Probably won’t work (as it is a different device), but hey, worth a try, no? ;-) Update: the clone, that I know is a clone, provides exactly the same information. |
Colin (478) 2433 posts |
Yes I knew the PL2303 wouldn’t work. Unlike USB Audio USB serial doesn’t have a standard interface so a driver has to be written for each device – it’s similar to USB Ethernet in that respect. As luck would have it I’ve just tried an old pic programmer I have and that is the same usb device as yours so I may be able to write a backend for that. I remember I had trouble with the device on windows. I had to use an old driver to get it to work, which windows kept updating. I think prolific is in a piracy battle and keep changing their chips so the drivers don’t work with pirated chips. |
Ronald May (387) 407 posts |
The PL2303 that I have is the one commonly sold for connecting PC’s (that have USB serial drivers) to the Pi. It has the flying leads for the Pi connection. |
Colin (478) 2433 posts |
I use snoopy on a PC. It turned out for the PL2303 device I have the only commands that worked were enabling the device and changing the baud rate. The Snoopy output showed commands to change word format but these didn’t actually do anything when I checked with an oscilloscope. |
Steffen Huber (91) 1953 posts |
This is exactly what Thomas Milius’ ComCentre does. Works fine with many USB “SurfSticks”. http://www.thomas-milius.privat.t-online.de/Download/Freeware/COMCentre.zip |
Rick Murray (539) 13840 posts |
Yup. I rolled back my driver and refused any subsequent updates. Thankfully they haven’t pulled an FTDI on us yet…
Might be worth looking at the Linux driver that Steve linked above to see if the commands the driver tries to send matches up with what you are seeing in Snoopy? We’re getting closer. I have a SerialUSB device now, but… Using 'SerialUSB#noblock;sleep;nohandshake;baud=115200;data=8;stop=1;noparity:' Cannot find a valid endpoint(23) * That’s with the known-clone1 looped back to the Pi’s UART; and also with the better built one (so unknown if it is real or a clone). 1 It claims to be a Prolific PL2303HX, but there’s a big Xtal between two pins that are marked “reserved” on the PL2303 datasheet. That ought to be a giveaway… ;-) |
Colin (478) 2433 posts |
I you run usbdescriptors with the device plugged in. Then search for 2303 you should find something like the output below. If you post your version I’ll see what I can do.
|
Rick Murray (539) 13840 posts |
Thanks. I’ll run that on both of the devices and post the results when I get back home. I’m waiting for a burger… |
Steve Pampling (1551) 8170 posts |
That’s stuff pointed at by the prolific web site among the support category. |
Rick Murray (539) 13840 posts |
The better quality serial lead (the one I specifically want to use): ============================================= Device USB19 ============================================= : 0 : 2 : total size of ServiceCall block : 91 : 2 : 2 : offset to descriptor list : 0x20 : 4 : 20 : name : USB19 : 24 : 1 : bus number : 1 : 25 : 1 : device address : 5 : 26 : 1 : host address : 3 : 27 : 1 : host port : 2 : 28 : 1 : speed : 2 full speed --------------------------------------------- Standard Device Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 12 : 18 : : 1 : 1 : bDescriptorType : 1 : 1 : : 2 : 2 : bcdUSB : 110 : 272 : : 4 : 1 : bDeviceClass : 0 : 0 : : 5 : 1 : bDeviceSubClass : 0 : 0 : : 6 : 1 : bDeviceProtocol : 0 : 0 : : 7 : 1 : bMaxPacketSize : 40 : 64 : : 8 : 2 : idVendor : 67b : 1659 : : 10 : 2 : idProduct : 2303 : 8963 : : 12 : 2 : bcdDevice : 300 : 768 : : 14 : 1 : iManufacturer : 1 : 1 : 'Prolific Technology Inc.' : 15 : 1 : iProduct : 2 : 2 : 'USB-Serial Controller' : 16 : 1 : iSerialNumber : 0 : 0 : '' : 17 : 1 : bNumConfigurations : 1 : 1 : +----+----+---------------------------+----------+------------+ Standard Configuration Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 9 : 9 : : 1 : 1 : bDescriptorType : 2 : 2 : : 2 : 2 : wTotalLength : 27 : 39 : : 4 : 1 : bNumInterfaces : 1 : 1 : : 5 : 1 : bConfigurationValue : 1 : 1 : : 6 : 1 : iConfiguration : 0 : 0 : '' : 7 : 1 : bmAttributes : 80 : 128 : (bit7) USB 1.0 bus powered (bit6) Bus powered, (bit5) No remote wakeup : 8 : 1 : bMaxPower : 32 : 50 : 100mA +----+----+---------------------------+----------+------------+ Standard Interface Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 9 : 9 : : 1 : 1 : bDescriptorType : 4 : 4 : : 2 : 1 : bInterfaceNumber : 0 : 0 : : 3 : 1 : bAlternateSetting : 0 : 0 : : 4 : 1 : bNumEndpoints : 3 : 3 : : 5 : 1 : bInterfaceClass : ff : 255 : Vendor Specific : 6 : 1 : bInterfaceSubClass : 0 : 0 : : 7 : 1 : bInterfaceProtocol : 0 : 0 : : 8 : 1 : iInterface : 0 : 0 : '' +----+----+---------------------------+----------+------------+ Standard Endpoint Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 7 : 7 : : 1 : 1 : bDescriptorType : 5 : 5 : : 2 : 1 : bEndpointAddress : 81 : 129 : Endpoint 1 - IN : 3 : 1 : bmAttributes : 3 : 3 : Interrupt : 4 : 2 : wMaxPacketSize : a : 10 : 1 x 10 byte max packets : 6 : 1 : bInterval : 1 : 1 : +----+----+---------------------------+----------+------------+ Standard Endpoint Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 7 : 7 : : 1 : 1 : bDescriptorType : 5 : 5 : : 2 : 1 : bEndpointAddress : 2 : 2 : Endpoint 2 - OUT : 3 : 1 : bmAttributes : 2 : 2 : Bulk : 4 : 2 : wMaxPacketSize : 40 : 64 : 1 x 64 byte max packets : 6 : 1 : bInterval : 0 : 0 : +----+----+---------------------------+----------+------------+ Standard Endpoint Descriptor +----+----+---------------------------+----------+------------+ :Off :Sz :Name :Value hex :Value dec : +----+----+---------------------------+----------+------------+ : 0 : 1 : bLength : 7 : 7 : : 1 : 1 : bDescriptorType : 5 : 5 : : 2 : 1 : bEndpointAddress : 83 : 131 : Endpoint 3 - IN : 3 : 1 : bmAttributes : 2 : 2 : Bulk : 4 : 2 : wMaxPacketSize : 40 : 64 : 1 x 64 byte max packets : 6 : 1 : bInterval : 0 : 0 : +----+----+---------------------------+----------+------------+ Just checked the clone device. The response is the same. BTW, what’s Snoopy? Will it run on XP? |
Colin (478) 2433 posts |
The descriptors look identical so it’s odd that is doesn’t find the endpoint. Are you using an old os version? An old USB driver may be the problem.
SnoopyPro. Its from 2002 so I’d expect it to work on XP. |
Rick Murray (539) 13840 posts |
Yup. It works on the latest version of RISC OS. I wasn’t aware that my one was that out of date. Dammit. I’m going to have to unpack and mod my own… such a pain… ;-) |