OpenWrt Forum Archive

Topic: pl2303 usb serial adapter problems with rts/dtr lines

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I'am running Openwrt (0.9) on a ASUS WL500gP and have some problems
with the pl2303 usb serial adapter. Normal serial port access works without
problems, but setting rts/dtr does not work.

rts/dtr setting is required to get access to a ws2300 weather station,
the weather station uses the rts/dtr level to generate high/low signals.
The same software runs without problems on my laptop with 2.6.15 with
the same pl2303 adapter.

The following code snippet includes the handling of the rts/dtr lines,
the dmesg output shows the debug output from the pl2303 kernel
module (loaded mit debug=1)

Do I have a problem with my cross compiling enviromnet
(but all other serial port access functions work) or is there
a bug in the pl2303 driver ?


      Micha


code snippet
========

// Set DTR low and RTS high and leave other ctrl lines untouched

ioctl(ws2300, TIOCMGET, &portstatus);   // get current port status
portstatus &= ~TIOCM_DTR;
portstatus |= TIOCM_RTS;
ioctl(ws2300, TIOCMSET, &portstatus);   // set current port status

dmesg
====

usbserial.c: USB Serial support registered for PL-2303
usbserial.c: PL-2303 converter detected
pl2303.c: device type: 2
usbserial.c: PL-2303 converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.11
pl2303.c: pl2303_open -  port 0
pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 2
pl2303.c: 0x40:0x1:0x404:0x0  0
pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 2
pl2303.c: 0xc0:0x1:0x8383:0x0  1 - 0
pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 2
pl2303.c: 0x40:0x1:0x404:0x1  0
pl2303.c: 0xc0:0x1:0x8484:0x0  1 - 2
pl2303.c: 0xc0:0x1:0x8383:0x0  1 - 0
pl2303.c: 0x40:0x1:0x0:0x1  0
pl2303.c: 0x40:0x1:0x1:0x0  0
pl2303.c: 0x40:0x1:0x2:0x44  0
pl2303.c: 0x40:0x1:0x8:0x0  0
pl2303.c: 0x40:0x1:0x9:0x0  0
pl2303.c: pl2303_set_termios -  port 0
pl2303.c: 0xa1:0x21:0:0  7 - 80 25 0 0 0 0 8
pl2303.c: pl2303_set_termios - data bits = 8
pl2303.c: pl2303_set_termios - baud = 9600
pl2303.c: pl2303_set_termios - stop bits = 1
pl2303.c: pl2303_set_termios - parity = none
pl2303.c: 0x21:0x20:0:0  7
pl2303.c: set_control_lines - value = 3, retval = 0
pl2303.c: 0xa1:0x21:0:0  7 - 80 25 0 0 0 0 8
pl2303.c: pl2303_open - submitting read urb
pl2303.c: pl2303_open - submitting interrupt urb
pl2303.c: pl2303_ioctl (0) cmd = 0x540e
pl2303.c: pl2303_ioctl not supported = 0x540e
pl2303.c: pl2303_set_termios -  port 0
pl2303.c: 0xa1:0x21:0:0  7 - 80 25 0 0 0 0 8
pl2303.c: pl2303_set_termios - data bits = 8
pl2303.c: pl2303_set_termios - baud = 2400
pl2303.c: pl2303_set_termios - stop bits = 1
pl2303.c: pl2303_set_termios - parity = none
pl2303.c: 0x21:0x20:0:0  7
pl2303.c: 0xa1:0x21:0:0  7 - 60 9 0 0 0 0 8
pl2303.c: pl2303_ioctl (0) cmd = 0x540d
pl2303.c: pl2303_ioctl not supported = 0x540d
pl2303.c: pl2303_ioctl (0) cmd = 0x5407
pl2303.c: pl2303_ioctl not supported = 0x5407
pl2303.c: pl2303_ioctl (0) cmd = 0x741d
pl2303.c: pl2303_ioctl not supported = 0x741d
pl2303.c: pl2303_ioctl (0) cmd = 0x741a
pl2303.c: pl2303_ioctl not supported = 0x741a
pl2303.c: pl2303_ioctl (0) cmd = 0x5407
pl2303.c: pl2303_ioctl not supported = 0x5407
pl2303.c: pl2303_write - port 0, 1 bytes
pl2303.c: pl2303_write - length = 1, data = 06
pl2303.c: pl2303_write_bulk_callback - port 0
pl2303.c: pl2303_ioctl (0) cmd = 0x5407
pl2303.c: pl2303_ioctl not supported = 0x5407
pl2303.c: pl2303_write - port 0, 1 bytes

pl2303.c: pl2303_read_int_callback - usb_submit_urb failed with result -19

I am planning to do the same thing, and would like to know if there are any news on this subject. Micha, have you found a workaround?

Peter

If you google for this error message - you will see other posts (either this forum or elsewhere on the Internet) which document some problems using the PL2303 with linux 2.4.x.   
Apparently driver problems have been fixed in  linux 2.6.x. 
If Kamikaze 2.6 works for you (no wilreless on WL 500G P) then you can upgrade to Kamikaze.

See ticket # 779 at https://dev.openwrt.org/ticket/779 for the history here.

Otherwise I remember seeing a post about someone backporting the 2.6.x PL2303 driver back to 2.4.x and I think that worked. So you can try to google for that.

I personally did not need RTS/DTR lines so I could live with the buggy PL2303 driver.

You may want to try FTDI based converters. I have one which did not give any error msgs but I don't know about RTS/DTR.

They should cost less than US$20

Problem is that I need wireless, so I cannot use 2.6.x. (WL500gx). Also the ticket referenced above mentions that FTDI converters gives the same error?
So my only rescuse at the moment is a backported 2.6.x driver, but the only one I could find would not load in openwrt. (Made for unslung).
If anyone is aware of a backported 2.6.x to 2.4.x pl2303 (pl2303X) driver that works please let me  know.

Peter

If you have found the backported driver source - just recompile it using Buildroot-ng. It is a fair amount of work but if you are intending to develop apps  with openwrt you will probably have to get over that hump that at some time.

Alternatively you can see if others have had issues with keyspan or belkin converters, and if all looks good go with those.

I do agree the lack of wireless support in 2.6.x for the Broadcom wireless card is a real pain for users of the Asus wl500g. It's a really neat box otherwise.  Hopefully the  openwrt gurus will address that at soon.

Problem is solved. I created a Kamikaze build environment on my Ubuntu system, and did a build of kamikaze 2.4.34. I then copied usbserial.o and pl2303.o from the created build to my 2.4.30 openwrt (after renaming the old modules), did an insmod of the new modules, and comms to my WS2300 weather station was finally working ok.
If anyone else needs the compiled modules drop me a note.

Peter

Great.
Did you use the backported 2.6.x driver for pl2303.c  and usbserial.c ?
Or is this a linux 2.4.34 version driver ?
If it is a 2.4.34 driver - could you do a diff on the 2.4.34 and 2.4.30 versions and post the difference.
And is there a website that you can put the compiled modules on ?

Thanks

Yes to both of your questions. The kamikaze linux 2.4.34 driver is a backported 2.6.x driver. I do not have the 2.4.30 source readily available, so I cannot do a diff. I have placed the 2.4.34 modules on http://pfugl.dk/downloads/pl2303.zip.

Peter

Thanks.
I have reopended the ticket #779 and posted a link to this thread as the resolution  - to help others who are searching for a solution.
Since White Russian development has ceased, I don't know what the developers will do to close the ticket.

The new pl2303.o and usbserial.o  did not work for me (Asus wl500gP) - in the sense that no data was sent over the RS-232.

I'll put it in debug mode and post the dmesg results

Hi at all,

im using an wl500-gP with an usb serial adaptor

And i want to connect an ws 2300 weather station.
Just like this: http://pfugl.dk/index.php?option=com_co … ;Itemid=58

but i get an error while sending/reading data from usb.
I'm using Olegs firmware, but i hope you can help me, please.

Can you send me the pl2303.zip ??
Should this work for me?

I noticed the link for  http://pfugl.dk/downloads/pl2303.zip is broken

If I can find that zip file on my laptop I will email it to hoogla.  Meanwhile you could contact pfugl directly to get that zip file

As per my last post, that driver did not work for me. I stopped trying to debug it because I got a FTDI based serial to USB converter and that has worked much better with no error messages at all.

Hi,

@snoyowlster:  Are you using an wl500gp and a ws2300 weather station?

Which firmware are you running? Does everything work?

Which converter do you use?  Where can I get it?

Sorry for my poor english.

Thanks in advance

I haven't used the weatherstation.
In the past, I used PL203 and FTDI based USB to serial converters for some other projects where I was controlling boards with serial ports.  The PL2303 converters are available from newegg and many other sites.
For FTDI  based converters, you can go to FTDI's website  or you can google for that.

Again I am not sure if the problem you are having will go away with FTDI or not.  So best to buy a cable from a store which will allow you to return it.

Regards

Hm, ok.

Can somebody compile the driver like "hoogla" described at the beginning?

What must I do to do that?
Can I do it by myself?

britnet - have you tried my drivers as snowyowlster mentions above? There is a txt file describing how to get the drivers loaded, but it is for openwrt - not Olegs's firmware. They are compiled for 2.4.34, but works fine with 2.4.30 - not sure what Oleg uses.
You really should consider switching to openwrt :-)
I am using an WL500G deluxe with PL2303 device connected to a WS2305 weather station, and it's been runnning stable for about 3 months now.
Regards - Peter

Code:
// Set DTR low and RTS high and leave other ctrl lines untouched
locator web newsitemapsitemap
ioctl(ws2300, TIOCMGET, &portstatus);   // get current port status
portstatus &= ~TIOCM_DTR;
portstatus |= TIOCM_RTS;
home michaelparkart net home
ioctl(ws2300, TIOCMSET, &portstatus);   // set current port status
Many thanks.....Site correct!
Marwell.

(Last edited by Marwell on 22 May 2008, 19:18)

pfugl wrote:

britnet - have you tried my drivers as snowyowlster mentions above? There is a txt file describing how to get the drivers loaded, but it is for openwrt - not Olegs's firmware. They are compiled for 2.4.34, but works fine with 2.4.30 - not sure what Oleg uses.
You really should consider switching to openwrt :-)
I am using an WL500G deluxe with PL2303 device connected to a WS2305 weather station, and it's been runnning stable for about 3 months now.
Regards - Peter

Hi,
i tried the drivers snoqyowlster mentions, but they didnt work, there was an error at loading them.

Switching to openwrt isnt an alternative at the moment, sorry :-(

Do You have an Website where i can see the weather values of you station?

Marwell wrote:

Code:
// Set DTR low and RTS high and leave other ctrl lines untouched
ioctl(ws2300, TIOCMGET, &portstatus);   // get current port status
portstatus &= ~TIOCM_DTR;
portstatus |= TIOCM_RTS;
ioctl(ws2300, TIOCMSET, &portstatus);   // set current port status
Many thanks.....Site correct!
Marwell.

Thank you for posting the code, but is ioctl available in oleg firmware?

Please stop asking about drivers for Oleg's firmware. This place is for discussing OpenWrt related stuff...

Earlier I used same Prolific based USb to serial adapter cable, got almost same error. Then I got a USB to Serial adapter with a FTDI based chipset, which supposely should be better than the Prolific chipset; and believe it or not, it worked right away!

The discussion might have continued from here.