Silicon ChipA Handy USB Breakout Box For Project Development - June 2011 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Let's forget aobut a carbon tax and concentrate on the environment instead
  4. Feature: The FutureWave Energy Saver by Ross Tester
  5. Feature: Rescuing Electronic Gear After The Flood by Robert Googe
  6. Project: 20A 12/24V DC Motor Speed Controller Mk.2 by John Clarke
  7. Project: USB Stereo Recording & Playback Interface by Jim Rowe
  8. Project: VersaTimer/Switch With Self-Latching Relay by John Clarke
  9. Review: Marantz CD6003 CD Player by Leo Simpson
  10. A Handy USB Breakout Box For Project Development by Jim Rowe
  11. Vintage Radio: Radio manufacturing in 1925: the Wells Gardner story by Kevin Poulter
  12. Book Store
  13. Advertising Index
  14. Outer Back Cover

This is only a preview of the June 2011 issue of Silicon Chip.

You can view 28 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "20A 12/24V DC Motor Speed Controller Mk.2":
  • 20A 12/24V DC Motor Speed Controller Mk2 PCB [11106111] (AUD $12.50)
  • 20A 12/24V DC Motor Speed Controller Mk2 PCB pattern (PDF download) [11106111] (Free)
Items relevant to "USB Stereo Recording & Playback Interface":
  • USB Stereo Record/Playback PCB [07106111] (AUD $15.00)
  • USB Stereo Recording & Playback Interface (PDF download) [07106111] (PCB Pattern, Free)
  • USB Stereo Recording & Playback Interface front panel artwork (PDF download) (Free)
Items relevant to "VersaTimer/Switch With Self-Latching Relay":
  • VersaTimer/Switch PCB [19106111] (AUD $10.00)
  • PIC16F88-I/P programmed for the VersaTimer/Switch [1910611A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (ASM and HEX) files for the Versatimer/Switch [1910611A] (Software, Free)
  • Versatimer/Switch PCB pattern (PDF download) [19106111] (Free)
  • Versatimer/Switch front panel design (PDF download) (Panel Artwork, Free)
Items relevant to "A Handy USB Breakout Box For Project Development":
  • USB Breakout Box PCB [04106111] (AUD $5.00)
  • USB Breakout Box PCB pattern (PDF download) [04106111] (Free)

Purchase a printed copy of this issue for $10.00.

By JIM ROWE A Handy USB Breakout Box You can build it in 10 minutes and for less than $15 USB is a great interface but it is isn’t foolproof. The good thing is that you can troubleshoot it with this simple USB “breakout box”. It connects into virtually any USB 1.1 or USB 2.0 cable and lets you examine D+ and D- signal line activity with your scope – as well as letting you check the USB power line voltage (Vbus) and even the current being drawn from the bus. R ECENTLY, I’VE BEEN working on the development of a USB device, ie, a device designed to hook up to a PC via a USB cable and become a “bus powered peripheral”. Along the way, I realised that I was going to have to measure the current drawn by the device, to make sure it conformed to the USB specification. Since I also struck trouble getting the device to “enumerate” properly when it was first hooked up to a PC, it was also going to be handy to be able to check the voltage levels on the two USB signal lines with my scope, to see if the voltage levels were within specification. Now since the device’s USB connector was mounted directly on its PCB, the only way to measure the current drawn from the host via the USB bus would be to cut the pin 1 track on the board, so I could connect in a milliammeter. But I didn’t want to cut a track on the board just for this test, because it would need to be bridged again with a short length of wire afterwards. It also turned out to be a bit tricky connecting my scope’s probes to the two USB signal lines, because my 80  Silicon Chip board was fairly small, with a high component density near the USB socket. In fact, this is always the way with USB interfaces – they’re hard to get at. What I really needed was a small “breakout box” which could be connected in series with the USB cable between the PC and the device. This would make any of the bus lines available for testing. So I knocked one up using a small piece of PCB cut from an old prototype board. The latter already had a USB type-A socket mounted on it, so all I had to do was add a type-B socket and a handful of other parts. It looked a bit untidy (as you can see from the above photo) but it worked well and let me do the testing in short order. When I mentioned that I had built up this handy little USB testing jig to SILICON CHIP’s esteemed publisher Leo Simpson, his response was as quick as a shot: “If it’s that handy why don’t you take a quick picture of it and draw up the circuit, so we can publish the details in the magazine and give other people the chance to build one?” In the end, as well as taking a few photos and drawing up the circuit, I also designed a PCB pattern for it. So when you build one, it will look better than my prototype. What’s more, it will take take just 10 minutes or less to put together. Circuit details Fig.1 shows the circuit and there really is very little to it. All four USB lines basically pass “straight through” between the type B input socket and the type A output socket, so normal operation can continue. The Vbus line has a 1Ω 1% resistor connected in series with it but this is normally shorted out by a jumper shunt (JP1). When you want to measure the current being drawn from the host PC by the USB device, you simply remove the jumper shunt and connect a DMM between the two ends of the resistor. The resistor then acts as a current shunt, converting milliamps into millivolts. So by switching your DMM to its lowest DC voltage range (say 0-2V), you’ll be able to measure the device current in milliamps very easily. If you want to measure the bus siliconchip.com.au CON1 (USB TYPE B SOCKET) + + – – FROM PC 3 SCREEN 4 2 D– 2011 1 2 D+ TO USB DEVICE 3 4 GND GND D– D+ GND Silicon Chip Binders REAL VALUE AT $14.95 PLUS P & MONITOR D+ MONITOR D– SC  CON2 (USB TYPE A SOCKET) 1  1% Vbus 1 MEASURE Ibus* JP1 SCREEN MEASURE Vbus P * WHEN JUMPER SHUNT IS REMOVED (1mV = 1mA) USB BREAKOUT BOX Fig.1: with jumper JP1 in place, all four USB lines basically connect straight through. The current is measured by removing JP1 and monitoring the voltage across the 1Ω resistor (1mV = 1mA). Fig.2: the PCB will only take about 10 minutes to assemble. Don’t forget to solder the earth lugs on the sides of the USB sockets. The board can be fitted with rubber feet at the corners, or you can cut out the corners and fit the board into the base of a UB-5 zippy box. X O B TU OKAER B BSU 1102 © 11160140 GND D– USB IN CON1 3 2 4 1 USB OUT CON2 D+ GND 4 3 2 1  1% + – Vbus + 1 JP1 – Ibus (1mV = 1mA) WITH SHUNT REMOVED These binders will protect your copies of S ILICON CHIP. They feature heavy-board covers & are made from a dis­ tinctive 2-tone green vinyl. They hold 12 issues & will look great on your bookshelf. H 80mm internal width H SILICON CHIP logo printed in gold-coloured lettering on spine & cover H Buy five and get them postage free! voltage as well, this is easily done by connecting your DMM (set to the next higher DC voltage range) to the two pins of the other SIL pin strip (Vbus) on the top left of the circuit. In most cases, you should get a reading of +5V, unless there’s a problem. The two SIL pin strips near the bottom of the circuit are provided so you can easily monitor the D+ and D- signal line waveforms with an oscilloscope. As you can see from the scope grabs (Fig.3, Fig.4 & Fig.5), these signals take the form of bursts or “packets” of data at 1ms intervals. The data is encoded using a differential NZRI (non-returnto-zero inverted) format, with the D+ and D- lines pulsing in synchronism but with reversed polarity. To conform to the USB specification, both data line signals should have a peak-to-peak amplitude of between 3.0V and 3.7V. Note that while the outer screens of CON1 and CON2 are connected together, to preserve the continuity of the USB cable screen, they are not connected to the USB cable ground (ie, pin 4) inside the breakout box. This is necessary to make sure that the box doesn’t disturb the operation of the siliconchip.com.au Parts List 1 PCB, code 04106111, 76 x 45mm 1 PC-mount USB type B socket (CON1) (Jaycar PS-0920 or Altronics P1304) 1 PC-mount USB type A socket (CON2) (Jaycar PS-0916 or Altronics P1300) 1 1Ω 1% 0.25W resistor 1 SIL 8-way pin header strip 1 jumper shunt 4 self-adhesive rubber feet Price: $A14.95 plus $A10.00 p&p per order. Available only in Aust. Silicon Chip Publications PO Box 139 Collaroy Beach 2097 Or call (02) 9939 3295; or fax (02) 9939 2648 & quote your credit card number. Use this handy form Enclosed is my cheque/money order for $________ or please debit my screen in USB 2.0 cables. I should note here that the main information you’ll be able to get from the D+ and D- waveforms is their peakto-peak amplitude, whether they are switching in the correct differential fashion and whether they’re both fairly constant in amplitude rather than varying sporadically or cyclically – either of which are indications of problems. It’s not easy to get much more information than this because of the differential NZRI encoding.  Visa    Mastercard Card No: _________________________________ Card Expiry Date ____/____ Signature ________________________ Name ____________________________ Address__________________________ __________________ P/code_______ June 2011  81 Fig.2 shows the assembly details. It’s just a matter of installing the parts as shown, not forgetting the wire link. The four 2-way pin headers are snapped off an 8-way header. The corners of the board can be fitted with rubber feet or it can be mounted in the base of a standard UB-5 zippy box. In use, jumper shunt JP1 is removed if you want to measure the voltage across the 1Ω resistor, to determine the current drawn by the attached USB device. Protocol analyser Fig.3: a single USB control packet showing the differential NZRI encoding (D+ in yellow and the D- in blue). The frequency reading is not relevant but note how the two waveforms have approximately equal P-P amplitudes. Fig.4: another capture of the D+ and D- signal waveforms, at a slower time­ base rate. Here we see a control packet, followed by a much longer data packet. Again the frequency reading is not relevant. Fig.5: this third capture of USB signal waveforms is at a much slower rate again, and shows the way the D+/D- data packets are sent at intervals of 1ms. Again, the frequency reading is not relevant. 82  Silicon Chip Like most tools, the breakout box is handy for what it does but inevitably has its limitations. For examining USB bus operation in more detail once you’ve checked the basics, you really need a USB protocol analyser which can look at all of the control and data packets flying back and forth along the bus, identify those coming from the host and those returning from the device. This will let you see what’s happening (or not happening, when it’s supposed to). There are a few software USB protocol analysers currently available, which can be very handy for this “deeper” level of troubleshooting. As the name suggests, these are basically software programs which run on the PC and “keep an eye” on the activity at any designated USB port, so that they can either display it in “real time” or save all of the information in a log file which you can open later and examine in detail. One of these software USB protocol analysers I can recommend is USBTrace, developed and marketed by a firm called SysNucleus. A free 15-day evaluation copy of USBTrace can be downloaded from their website at www.sysnucleus. com and although it’s a bit restricted in terms of the data it can save during a single session, it’s still quite handy. If you want the full version, this can be purchased online for US$195.00. Also available for free downloading are software decoders for the various USB device classes, so USBTrace can be more informative about their operation. There’s also a Microsoft “USB Device Viewer” software tool called UVCview.exe which can be quite handy when you’re troubleshooting USB device operation. It’s part of Microsoft’s Windows Driver Kit (WDK), which can be downloaded for free from www.microsoft.com/downloads/ The latest version at the time of writing is V7.1.0, which comes as a 618MB ISO file. This must be burnt to a CD-R before SC UVCview can be installed. siliconchip.com.au