4

I want to bitbang a Prolific PL-2303HX. There is the library libftdi which enables bitbanging on the FT232 chip. Can I make it work with PL-2303? When I try using libftdi it gives in the error "Can't open device".

Anyone knows how to make this work?

When I try to open the device with the example code in libftdi (changing the vendor and device id to

f = ftdi_usb_open(&ftdic, 0x067b, 0x2303);

I get the following output

rick2047@ubuntu:~/work/libftdi$ sudo ./a.out 
[sudo] password for rick2047: 
unable to open ftdi device: -6 (ftdi_usb_reset failed)
Kortuk
  • 13,412
  • 8
  • 62
  • 85
Rick_2047
  • 3,917
  • 5
  • 48
  • 68

3 Answers3

3

It's not gonna happen. The chips are /pin/ compatible (the pins do the same things) but the internal behavour is very different. The FTDI chips are built with bit-bang mode as a design goal, the Prolific chip is not.

Christopher Biggs
  • 1,506
  • 7
  • 7
2

I have no idea how to do bitbanging with the prolific chips, but the error you're seeing is a result of the vendor identifier (VID) and product identifier (PID) of the Prolific chip being different from FTDI's default

This sample code shows an example of where this kind of an error might be thrown:

if ((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0)
{
    fprintf(stderr, "unable to open ftdi device: %d (%s)\n", 
            ret, ftdi_get_error_string(&ftdic));
    return EXIT_FAILURE;
}

ftdi_usb_open() is an alias for the function:

ftdi_usb_open_desc_index(
    struct ftdi_context * ftdi,
    int                   vendor,
    int                   product,
    const char *          description,
    const char *          serial,
    unsigned int          index  
)   

that just substitutes a null pointer for the description and serial, and '0' for the index.

The source for this function can be found on line 623 of ftdi.c, or it's online here.

Note that every interaction that the FDTI drivers do in this function and beyond assumes that you've got an FTDI chip on the other end. Fixing this problem is almost certain to lead to further problems, and fixing those problems will get you another. There will be a light at the end of the tunnel, but it may be a long way getting there.

Adding Prolific support to libftdi (or porting libftdi's API to a new library, call it libprolific) would be pretty neat. However, you're almost certainly better off using Prolific's drivers: http://www.prolific.com.tw/eng/downloads.asp?id=31

Kevin Vermeer
  • 20,067
  • 8
  • 57
  • 102
  • I am on ubuntu so I do not require a driver for the chip. I was just hoping that I could make these drivers work with libftdi as both are pin compatible. Maybe I will get it to work someday. – Rick_2047 Mar 10 '11 at 04:53
2

They are two totally different chips inside.

Here is the FTDI Linux driver: http://lxr.linux.no/linux+v2.6.37.3/drivers/usb/serial/ftdi_sio.c

And here is the PL230x Linux driver: http://lxr.linux.no/linux+v2.6.37.3/drivers/usb/serial/pl2303.c

Notice they are not the same.

The datasheet does not mention the PL2303 supporting any bitbang modes.

You can always use RS232 lines for bitbang: DTR and RTS for output, RI+DCD+DSR+CTS for input.

markrages
  • 20,015
  • 7
  • 60
  • 97