1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Add USB to any PIC project for less then $3

Discussion in 'Microcontrollers' started by Mike - K8LH, Feb 28, 2010.

  1. leftfield95

    leftfield95 Member

    Joined:
    Aug 5, 2008
    Messages:
    71
    Likes:
    2
    Location:
    lincs, UK
    Hi Mike,

    After I lost my old Nokia phone, I decided to convert a fake DKU-5 cable, it too used a Prolific 2303 chip. But it took quite a while to figure out how to make it work, of the five wires in the cable, I had to short all the wires together except the black-GND wire to make it act as a loopback in Hyper-terminal. After that I worked out which pairs had to be shorted to enable the chip so it would TX and RX.

    However even when it wasn’t working I don’t think the driver reported any errors. (Win XP SP3)

    I can try and find my notes if you want to let you know which pairs I shorted together.

    Leftfield95
     
  2. Blueteeth

    Blueteeth Well-Known Member

    Joined:
    Oct 15, 2003
    Messages:
    1,168
    Likes:
    34
    Location:
    Hertfordshire, UK
    Don't connect the tx and rx :) Even though it shouldn't matter, the cable has no series resistors on its I/O's. I would plug it into your PC, open the device in hyperterminal (or another terminal) *then* connect the Tx to Rx.

    A while ago I read through the datasheet to work out why it was crashing my machine (turns out I was drawing >200mA from the bus) and I thought I had blown the Tx pin by shorting it to ground. It wasn't the case. All the I/O pins are tristated until the device is opened by the host PC. That is to say, if you plug it into your PC, its asleep until you open the comm port it's been assigned to.

    Before then, all I/O pins are tristated, and it doesn't matter how much power you draw from the bus. As soon as you open the device, I 'think' it runs a quick check...which determines if everything is 'ok' then it opens successfully. I reckon linking the tx/rx pins for loopback before opening the device makes it poo itself :)

    The cable itself is basic, and nothing much can go wrong. But the Prolific chip can behave quite oddly in certain situations.... no where near as friendly as the FTDI chips. Any situation other than connected to a RS232 level shifter or a standard UART and it seems to misbehave.

    Out of interest, I'll try and recreate the error. I've had it before when I've opened the comm port whilst its been connected to certain circuits.

    Blueteeth

    Edit, I'm using XP SP2 (not SP3)
     
    Last edited: Mar 26, 2010
  3. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Thanks for the suggestions guys. I installed the driver on my wifes Vista-Home laptop and it does the same thing so I sent a message to Chinese Distributor asking for a replacement. Time will tell if they stand behind this relatively inexpensive product, or not.

    I tried with and without TX/RX connected together for 'loopback' and it doesn't make any difference. This particular clone CA-42 has four wires but only three are connected, WHT (Phone TX), GRN (Phone RX), and GND (BLK).

    More later, Mike...
     
    Last edited: Mar 26, 2010
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. leftfield95

    leftfield95 Member

    Joined:
    Aug 5, 2008
    Messages:
    71
    Likes:
    2
    Location:
    lincs, UK

    Hi Blueteeth,

    If IRC the tx/rx pins have some resistance on them, they definitely don’t draw 200ma plus when shorted. I think the cable version I have has some buffering on board, the moulded usb plug is way too big to contain just a prolific chip.

    According to the web the other two connections are power and aci. The power is for powering external circuits from the Nokia phone and the aci is some sort of signalling for accessories. The power seems to be used to supply the buffer, since if it has no power fed into it the rx pin doesn’t work, but I still get tx signals.

    I’m now curious to see what’s inside the moulded plug, I think I’ll sacrifice this one (I have more in a draw at work). I would specifically like to change it to run on 5v logic and supply power to the microcontroller circuit, like the homemade FTDI based one I have.

    Leftfield95
     
  6. Blueteeth

    Blueteeth Well-Known Member

    Joined:
    Oct 15, 2003
    Messages:
    1,168
    Likes:
    34
    Location:
    Hertfordshire, UK
    Ahh leftie, I meant I was drawing 200mA from the bus directly (to power an AVR, some LED's), the reason I thought I had blown the tx was because of my shoddy prototyping (tx line soldered to strip board...with shorts)....I should have made it clear those were two seperate 'mistakes'. My fault bro. lol yes, I'm sure if the tx pin can source/sink 200mA it would be only for a few us before somethign goes pop :)

    Also, note, the cable can be modded to allow up to 500mA drawn from the bus. A pin on the chip is read on startup to determine what power level is allowable (100mA limit, or 500mA) one may need to replace the cable coming out of the USB hood though, seems a bit 'thin' for 500mA.

    I would open up the plug, mine isn't moulded, just two pieces of plastic snapped together. Its a real basic cable, no eeprom, just the PL2303 (http://user.chollian.net/~mines/pl2303.pdf), a crystal, and some passives. It is possible yours has buffering, mine certianly doesn't. If I find my camera I'll get a pic of the one I have.

    Blueteeth
     
  7. leftfield95

    leftfield95 Member

    Joined:
    Aug 5, 2008
    Messages:
    71
    Likes:
    2
    Location:
    lincs, UK
    Hi Blueteeth/Mike,

    So I bit the bullet, and tore the case from the usb connector, the soft rubber outer came off quite easily, but underneath that, the entire board was coated in a soft moulded thermo plastic. It wasn’t too difficult to peel the plastic from the pcb, the results are shown, there is still plastic around the pins of the pl-2303.


    The pcb uses a PL-2303HX which is 3.3v max, but has a 5v tolerant RX input, the second ic is an em78p153sn which is a 14pin 8bit micro. The whole thing looks quite well made, and looking at the bottom of the pcb, is also used as a charger when the missing components are added. The microcontroller appears to monitor/control the charger circuit as well as some of the serial data lines.

    The rx data line has a 4.7k inline resistor and a 220k pullup at the pl-2303.
    The tx has a 100ohm inline resistor.

    Leftfield95
     

    Attached Files:

  8. Blueteeth

    Blueteeth Well-Known Member

    Joined:
    Oct 15, 2003
    Messages:
    1,168
    Likes:
    34
    Location:
    Hertfordshire, UK
    Some pics

    Oh nice! Looks more complicated than mine. I notice theres only one 'data' wire, perhaps thats the bidirectional line some mobiles use. Hopefully I'll post a pic of the guts of my CA-42 tonight.

    Update. Heres front and back of my CA-42 ($0.99 with free shipping from ebay). Stupidly basic,and pity they epoxied the chip eh?
     

    Attached Files:

    Last edited: Mar 30, 2010
  9. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    I received a replacement cable from the Chinese distributor and got the same "Cannot start. (Code 10)" error on the XP-SP3 laptop (PL-2303 v2.0.13.140 driver) and on the Vista laptop (PL-2303 v3.3.10.140 driver).

    Finally got it working on my XP-SP3 laptop last night by using an older v2.0.2.5 driver from here;

    http://www.usglobalsat.com/download/546/win_drivers.zip

    The Chinese source I used did not provide a driver CD so you might want to purchase $2.68 cables + CD from another Chinese source instead. Here's one that was recommended by one of the guru's over on the Arduino forum;

    Topvshonw CA-42 Cable + CD $2.68 including shipping



    The good news and the bad news

    It seems each new generation of CA-42 clones coming out of China is being manufactured cheaper and cheaper. The cables I received have four wires but only three are connected to the PL-2303 at the USB end of the cable (Tx, Rx, and Gnd).

    The cables are completely molded so there's no easy way to get at the PL-2303 circuit board but if you decide to cut through the blue plastic and then the black plastic potting underneath you'll find the circuit board shown in the pictures below with relatively easy access to solder pads for the 5v, 3.3v, and other serial signals, like DTR.

    In summary, it seems I can have a "pretty" molded $2.68 usb-to-serial cable with just Rx, Tx, and Gnd, wired to a 3.5mm Stereo type plug for my projects, or, I can have an "ugly" adapter without molded USB shell on one end but with access to 5v (<100-ma), 3.3v (<50-ma), and several other serial signals.

    More later. Regards, Mike
     

    Attached Files:

    Last edited: Apr 15, 2010
  10. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    Yeah, I'm geeked!

    [​IMG]
     

    Attached Files:

  11. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    My 16F88 Serial Bootloader now working as a USB serial bootloader... Oh yeah!!!

    [​IMG]
     

    Attached Files:

  12. Jon Chandler

    Jon Chandler Banned

    Joined:
    Feb 28, 2008
    Messages:
    130
    Likes:
    2
    Mike,

    I had a problem with Prolific drivers when I used a similar adapter. I found a note about revised drivers someplace and they solved my problems. There's a lonk to the drivers on my page here: Simple Signal Generator - 3 - ThrowAwayPIC

    I don't recall exactly what the problem was - I think VB couldn't open the com port. Not the same problem but the revised driver may help.

    There's also a couple other adapters listed on my page under "useful bits and pieces"...with shipping, they're about the same price and seem to be of decent construction.
     
  13. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    I found working drivers Jon (post #28) but thank you anyway... I did check out some of the other adapters you recommended but they were more expensive...
     
    Last edited: Dec 24, 2010
  14. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    I use these now... real simple to use and nice!
    MCP2200
     
  15. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,569
    Likes:
    128
    Location:
    Caribbean
    Got any examples of its use Atom? It's a USB 2.0 spec. So faster thruput.
    I'd like to see the circuit for it...also if u have any 16F ASM USART code I'd be grateful.


    Thanks,
    and Merry Christmas.
     
    Last edited: Dec 24, 2010
  16. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Last edited: Dec 24, 2010
  17. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,569
    Likes:
    128
    Location:
    Caribbean
    I love the board atom, would u share the eagle sch & brd file?
     
  18. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,637
    Likes:
    109
    Location:
    Michigan, USA
    You mentioned needing UART code in another thread. Have you never done 16F ASM USART code before?
     
  19. AtomSoft

    AtomSoft Well-Known Member

    Joined:
    Feb 7, 2008
    Messages:
    5,670
    Likes:
    41
    Location:
    Brooklyn, NY US
    Here is my eagle files...
     

    Attached Files:

  20. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,808
    Likes:
    135
    Location:
    morristown,tn
    Atom you no if you come up with something good and are using the mcp2200 Microchip will let you have a vendor id for like the first 1000 you sell. Which is cool. To get your own id cost big bucks. Just thinking you may want to sell them video viewers. Some day.

    Here a great pdf about serial ports stuff
     

    Attached Files:

    Last edited: Dec 24, 2010
  21. Jon Chandler

    Jon Chandler Banned

    Joined:
    Feb 28, 2008
    Messages:
    130
    Likes:
    2
    Prolific will also assign VID/PID numbers for products using their converter chips.
     

Share This Page