Why isn't my custom USB data cable working?


29 posts   Page 1 of 2   1, 2
by doveman » Tue Dec 18, 2012 7:50 pm
I bought some USB connectors and wired pins 2 & 3 up to connect the data lines to my hub but it's not working. I tested by plugging my RF remote receiver directly into the Pi and the light on that comes on shortly after powerup but not when I plug it into the hub.

I've taken some pictures to show what I've done. The first shows the USB plug with the white wire on pin 2 (data -) and the yellow wire on pin 3 (data +).

Image

This then goes to a 5-pin DIN as shown in this second picture, with the Yellow (data +) wire on the outside pin and the white wire on the inside pin.

Image

This third picture shows an overall view

Image

As you can probably see, the power from the UBEC is wired to two pins on the other side of the 5-pin DIN (the fuse is just in line with the RPi GPIO). The plug going into the DIN socket (not shown here) carries the power over 26 AWG (same as used from the fuse to the GPIO) and the USB data over a mini-USB cable that I cut the USB end off, with the green wire connected to the yellow wire on the socket and the white wire connected to the white wire on the socket.

I've buzzed out the cable (using a small piece of wire to poke into the mini-USB plug) and pin 2/white definitely goes to pin 2 on the miniUSB and pin3/yellow goes to pin 3 on the microUSB. I've buzzed out between the pins on the USB plug and the underside of the board as well, just to check the plug was making proper contact.

The power is getting to the hub OK as it has two blue leds on top which come on.

So I'm rather baffled/frustrated now and would appreciate any advice.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by pluggy » Tue Dec 18, 2012 8:02 pm
The GND connector in the USB is also needed for data - it forms a return path for the signals on the data connections.
Don't judge Linux by the Pi.......
User avatar
Posts: 2078
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by doveman » Tue Dec 18, 2012 8:11 pm
Ah, nice one. I'll go and wire that up and try again :)
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Tue Dec 18, 2012 11:03 pm
Dammit, still doesn't work after doing that.

I've still got the USB end and the mini USB end from two cables I cut, so I'll have to splice them back together and test with that.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Tue Dec 18, 2012 11:36 pm
No, still doesn't work with the cables spliced except the red wire. Something very weird going on here. I guess I'll have to try splicing in the red wire as well and see if that makes any difference, although I can't see why it should as the hub has power so doesn't need it from the Pi.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by aTao » Tue Dec 18, 2012 11:40 pm
Please excuse me if this is something you know but....
Are you connecting USB type A to USB type A? ie client to client rather than client to server?
Or put another way, does it work with uncut cables?
>)))'><'(((<
User avatar
Posts: 430
Joined: Wed Dec 12, 2012 10:41 am
Location: Swine Town UK
by doveman » Wed Dec 19, 2012 12:05 am
It's USB type A from the Pi to USB mini-B on the hub. Yep, it worked when I was testing a few days ago with uncut cable. Unfortunately I've cut them all now so don't have any uncut to re-test with!
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Wed Dec 19, 2012 12:30 am
Well even with all four wires connected it doesn't work. The lights don't come on the hub with just the microUSB cable connected, so it doesn't appear to be getting any power from the Pi. As I've buzzed out the cable and confirmed that the pins on the microUSB plug are connected, I can only guess that something's wrong with the plug so that the pins are making contact on the hub socket. Seems unlikely though :?

I have another identical hub so I tested with that and also tried connecting the hub to my PC instead of the Pi (these two tests were done with only three wires connected and using the hub's PSU) and no joy.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Wed Dec 19, 2012 12:41 am
OK, I managed to find a short USB to miniUSB lead in my stash and with that it works. Without power from the UBEC, just the Pi, the remote receiver flashes at boot but then doesn't work but with the UBEC power it works fine.

So why on earth doesn't my custom cable or indeed the spliced cable work?
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by drgeoff » Wed Dec 19, 2012 1:05 am
doveman wrote:OK, I managed to find a short USB to miniUSB lead in my stash and with that it works. Without power from the UBEC, just the Pi, the remote receiver flashes at boot but then doesn't work but with the UBEC power it works fine.

So why on earth doesn't my custom cable or indeed the spliced cable work?

One or more of the following:
1. An open circuit
2. A short circuit
3. Crossed wires

Have a rest and come back to it. When you find the reason you will kick yourself. :)
Posts: 2041
Joined: Wed Jan 25, 2012 6:39 pm
by doveman » Wed Dec 19, 2012 1:23 am
Yeah, good idea to take a break. Well from that particular issue anyway, now I've got it running with the cable I found I can at least try and configure Raspbmc ;)
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Wed Dec 19, 2012 10:59 pm
OK, I've just tested with the spliced-back-together cable again. I checked the +5 and GND in the middle and that was reading OK so I plugged it into the hub and the lights came on. Don't know why it wasn't working yesterday but anyway. Haven't tested the data yet but will do in a bit.

I also tested my bare USB plug on my custom cable. Touching my meters positive probe to pin 1 causes the leds on the UBEC and Pi to dim, which doesn't happen testing the spliced cable at the midpoint, so I suspect I may have the pinout back to front. However, looking at this image of the plugs, it seems clear that pin 1/+5v is on the right, so with the Pi's composite and audio ports facing me and the USB ports on the left of the board, plugging this in would put pin 1 furthest away from me. I looked at a couple of other sources and they all seem to confirm this. However the fact that the leds dimmed when probing the furthest pin from me, yet didn't when probing the red wire in the middle of the spliced cable makes me suspect that red wire isn't connected to the furthest pin.

Testing both the exposed plug and the spliced cable, they weren't connected to anything (the exposed plug/custom cable has pins 2-4 wired to the DIN socket, the spliced cable just goes to the microUSB plug).
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Thu Dec 20, 2012 2:39 am
OK, the spliced cable is working for both power and data now (all four pins wired, braid not joined). I checked the braid on the two parts of the spliced cable and it's not connected to the GND or the metal body of the plugs at either end.

Still not sure what to do with my custom cable. It makes me nervous that the LEDs dim when probing the +5v pin on my plug (with no lead attached) but buzzing out the working spliced cable, the +5v definitely seems to be coming from that pin (the furthest away from me).
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by Burngate » Thu Dec 20, 2012 11:53 am
That would be making me nervous too. If your meter is set to voltage, it should be a high impedance and not put a load on anything!

The pin nearest the RJ45 ethernet socket is definitely the 5v pin
User avatar
Posts: 2328
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by doveman » Thu Dec 20, 2012 3:23 pm
Yeah, I was pretty sure it was that pin but the strange results when probing it made me doubt myself.

As I say, there's no lead attached to that pin and I've buzzed them all out to make sure none of the pins are shorting on the plug.

I'll try testing it again later. As the spliced cable is working now when it wasn't before, maybe I'll have more luck with the plug today as well!
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Fri Dec 21, 2012 12:11 am
Ah, turns out that was me shorting +5v to the body of the plug :o Luckily it hasn't damaged anything.

So anyway, I unsoldered the lead from the DIN socket, took the mini-USB half of the respliced cable I was using that worked and joined just the D+ and D- wires. The hubs still getting power directly from the UBEC. No good, the light comes on and stays on my remote receiver and it doesn't respond in XBMC. I tried connecting the GND wire as well but that didn't help.

So I swap to the unmodified cable I found and that works fine. The light comes on the remote receiver briefly and flashes, then goes off and only flickers when receiving commands.

Now as far as I can see, there's no way I've got the D+ and D- wires crossed (pin 2/D-/2nd nearest the RJ45 is connected to white on the microUSB end and pin 3/D+ is connected to green). Having said that, could I do any harm by swapping them over, just as a test?
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by Lob0426 » Fri Dec 21, 2012 12:36 am
Swapping the data lines will not hurt anything. If that does not work. Do a thorough test of your connectors. Maybe one of them has a bad pin.
Back-powered 256MB as WordPress Server
Motorola Lapdock with 512MB
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!
User avatar
Posts: 1868
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
by doveman » Fri Dec 21, 2012 2:39 am
Well I tried swapping the wires and nothing happened on the hub at all then. So I swapped them back and now still nothing like that either.

I know the microUSB part of the cable is fine as that worked when joined to the matching USB part of it's original cable. I can also buzz from the solder pins on the USB plug to the cable join points and they're OK too. Perhaps there is a fault with the plug so that it's not making contact, although I did buzz that to test previously as well. I've got some spares so I might try one but it's looking like I might have to give up on my plan to have everything nice and tidy and just find a way to make do, or my brother won't be getting his Christmas present (or at least he won't get to take it home with him as I'll have to work on it after Christmas and post it to him, which will be a shame for him and cost me in postage!)

Not to mention it cost me £16 to get the USB plugs (£6 P&P and I bought some micro and mini USB plugs as well, although I can't use those at all) and £6 for the DIN plug and socket, so it'd be a shame not to use any of them.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by dknute » Fri Dec 21, 2012 1:23 pm
£6? Wow, nasty prices. There's the shipping cost to consider but in general these things should be about 10 times cheaper (if not more but that's for big orders).

Anyway, are you trying to create USB data link with "some wire"? You do realize that this is a low voltage, high speed differential transmission that requires a properly matched cable to work? Just like twisted pair for Ethernet - while you might get some results with good enough quality cable on short distances, it just won't work otherwise. Also, having DIN type socket and plug in the middle is not going to help :)

I'm not sure what exactly are you trying to here but I'd suggest you stick to ready-made USB cables, and the shorter the better. You can buy some 3m or 5m long cables but many of these are cheap Chinese ones with little copper in them (and cheap is not what's on the price tag) so even those will give you trouble. There are USB extension cords out there and while the spec does not recommend those I got a few to work quite reliably. This would be much better idea for mating USB cables than DIN socket.
Posts: 56
Joined: Thu Nov 08, 2012 9:05 pm
by doveman » Fri Dec 21, 2012 1:47 pm
Yeah, I've got a short USB->microUSB cable and it looks like I'll just have to use that and sacrifice the ability to easily separate the two compartments (the RPi is in the bottom one, with the hub in the top). It's still possible, it just means I have to open the top compartment and disconnect the cables from the hub and the cables will be hanging out the side of both compartments.

The plan was to have the DIN socket on the bottom compartment and then the cables could be left plugged into the hub and the DIN plug disconnected to separate the two compartments.

I'm sure I've got some of these USB brackets somewhere and I could have unscrewed one of the sockets, screwed that to my case and then plugged the USB->microUSB cable going to the top compartment into that but of course I can't find them now I want to ;) Doing that, I'd still need to fit a barrell connector as well for the power.

You might be right that I'm just using completely unsuitable cable though. I was using this http://www.maplin.co.uk/4-core-overall- ... screen-137 as I planned to use two cores for USB and two for power and I thought the screen would help. It was only about 20cm from the USB plug to the DIN though, with the rest of the run to the hub using the proper microUSB cable.

I should try just using some 26 AWG I've got instead if I've got time.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by dknute » Fri Dec 21, 2012 4:02 pm
Hm, well if it's just the DIN socket and plug you need in between then maybe there is a way to make it work - but as I said before, you'll need some luck to get it working and not dropping the link every few minutes.

Anyway, stick to USB cables for data and whatever you have for the power. That means you will need to route two cables to the DIN rather than trying to fit power and data on one. Like this:

For data link take USB->USB cable, cut it and connect the wires to DIN on the socket (first piece) and the plug (second piece). You only need the two data wires and the ground one. Pick 3 contact points close to each other for that and do try to keep the wire leads as short as possible.
For power take another cable, and if you're using the pin header rather than microUSB to power Pi then it can be any cable, or even two separate wires. Connect those to DIN but try to pick contacts on the opposite side to data link.

This is how I would do it if I really had to keep everything in one plug. Might just work.

EDIT: Oh I forgot, a proper USB 2.0 cable will also have a shield. Might be a copper braid or a foil with a single wire. Connect that too to both sides of the DIN connection for the data link.
Posts: 56
Joined: Thu Nov 08, 2012 9:05 pm
by Maxion » Fri Dec 21, 2012 4:27 pm
dknute wrote:EDIT: Oh I forgot, a proper USB 2.0 cable will also have a shield. Might be a copper braid or a foil with a single wire. Connect that too to both sides of the DIN connection for the data link.


I guess USB can be finnicky.

I put my RPi in a small box and router the RJ 45 port to the edge of the case. I also mounted a USB hub at the edge of the case.

To do this, I butchered an RJ45 cable as well as a mini-USB cable for the hub. To get the cables to fit in the box I had to cut away the insulation and shielding so only the internal wires are left.

Oddly both my ethernet and USB cable work fine.
Posts: 138
Joined: Mon Dec 03, 2012 2:22 pm
by doveman » Fri Dec 21, 2012 5:16 pm
dknute wrote:Hm, well if it's just the DIN socket and plug you need in between then maybe there is a way to make it work - but as I said before, you'll need some luck to get it working and not dropping the link every few minutes.

Anyway, stick to USB cables for data and whatever you have for the power. That means you will need to route two cables to the DIN rather than trying to fit power and data on one. Like this:

For data link take USB->USB cable, cut it and connect the wires to DIN on the socket (first piece) and the plug (second piece). You only need the two data wires and the ground one. Pick 3 contact points close to each other for that and do try to keep the wire leads as short as possible.
For power take another cable, and if you're using the pin header rather than microUSB to power Pi then it can be any cable, or even two separate wires. Connect those to DIN but try to pick contacts on the opposite side to data link.

This is how I would do it if I really had to keep everything in one plug. Might just work.

EDIT: Oh I forgot, a proper USB 2.0 cable will also have a shield. Might be a copper braid or a foil with a single wire. Connect that too to both sides of the DIN connection for the data link.


Thanks. I've actually been running a separate cable (two wire lead to PC speaker, about 26 AWG) to the DIN for power but hopefully if I use a different cable, like 24 AWG from a CAT5, I might be able to get it working.

Someone else mentioned the braid to me, so I buzzed out the cable I cut in the middle and the braid isn't connected to the plug at all at either end! That cable works when the four USB wires are re-joined so the braid doesn't appear to be that important.
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by doveman » Fri Dec 21, 2012 5:24 pm
Maxion wrote:
dknute wrote:EDIT: Oh I forgot, a proper USB 2.0 cable will also have a shield. Might be a copper braid or a foil with a single wire. Connect that too to both sides of the DIN connection for the data link.


I guess USB can be finnicky.

I put my RPi in a small box and router the RJ 45 port to the edge of the case. I also mounted a USB hub at the edge of the case.

To do this, I butchered an RJ45 cable as well as a mini-USB cable for the hub. To get the cables to fit in the box I had to cut away the insulation and shielding so only the internal wires are left.

Oddly both my ethernet and USB cable work fine.


Heh, I cut a piece of PCB containing an RJ45 out of an old Access point and soldered the end of a RJ45 cable to it and plugged that into the RPi. That works fine, with just the four Transmit and Receive wires connected and it's quite a bit longer than my USB cable, so I'm hopefuly using the same sort of cable might get that working. I'm planning to cut the network cable very short though, as the socket will only be an inch or so from the RPi when mounted. I intend to put a couple of screws through the PCB either side to hold it to the base of my case, as I don't think hotglueing it in place is a good idea considering it will be pushed and pulled when inserting/removing cables.

Mind you, I'm running out of time to do all this, so I might just cut a notch in the case so that the user can open the lid, plug the network cable directly into the RPi and close the lid. Not as nice but there's one less extension/connection that could fail in future ;)
Posts: 163
Joined: Wed Dec 07, 2011 11:52 am
by Mortimer » Fri Dec 21, 2012 5:30 pm
Sending USB over lengths of Cat-5 cable works quite well. Keep the length down to 5m or less though.
Screen isn't important, that the signal line pair is twisted together IS important.
User avatar
Posts: 685
Joined: Sun Jun 10, 2012 3:57 pm