No More Wrong Ports: Implementing USB Devices In Your Hardware Design
I keep having what I like to call “Grouchy Old Man Thoughts” (GOMT). You know the type: “Why do I have to learn this new thing if what I have works for me?” or, “I wonder what it’d be like to have a conversation without them being on their phone half the time.” Well, my most recent GOMT has been that I think anyone born after the 90s is pretty lucky, technologically. They didn’t have to go through the painstaking phase before Universal Serial Busses were around. Anyone who remembers cursing at their non-responsive keyboard only to realize that the keyboard was connected to the mouse’s PS/2 socket, or struggling with securing printer connections on a huge printer port can appreciate the beauty of USBs.
With how USBs have become, and how embedded they are in almost any system, it’s important for a PCB to be able to know how they operate, and how to work with a USB interface in a hardware design. Especially as memory storage devices are becoming able to hold larger amounts of memory with less total space, the USB is only getting more valuable with time. Don’t settle for glam-rock and dial-up connections forever, learn how to make your devices plug and play too.
Basic Circuitry Of A USB Device.
At its core, a USB device is built with the consideration of being user-friendly; however, in my experience within electronics design, the more user-friendly a device, the more complicated its design is. When working with designing a USB device, the most difficult part lies in the firmware: getting the various descriptors right and ensuring the USB communication stack is functioning correctly can be a strenuous task.
A hardware engineer, on the other hand, will primarily be concerned by the circuitry of a USB device. The hardware usually involves a microcontroller with USB interface, USB receptacles, and passive components. The connections are usually minimal, with the primary USB connections being power (V+), signals (D+, D-) and ground (Gnd). Knowing the requirements will be able to help you tremendously in your efforts to hardware design a USB device and keep you from having another GOMT.
Your power requirements for a USB device can make or break your design; you’ll need to be sure that you do not spoil the host USB power supply circuits. A single USB 2.0 port on the computer has the ability to produce up to 500mA. But that does not mean it will supply 500mA when you plug your USB device in; instead, the USB device has to go through an enumeration process where it negotiates with the host to request the current capacity it needs.
The power budget calculations you make are vital to designing correctly. If your USB device requires high current capacity that cannot be provided by a single USB port, you may need to get it powered by two USB ports. Alternatively, a self-powered USB device will eliminate the dependency of the USB port for power supply. Keeping these power budget calculations close will keep yourself moving along steadily in your USB hardware design.
USB Speed Identification
Typically there are 3 types of speed a USB device can operate in under the USB 2.0 standards. Keyboards and mouse normally operate at low speed with a transfer rate of 1.5 Mbit/s; however, gaming mouse usually run as high speed at 12MBit/s. High-speed USB data transfer with maximums of 480 MBit/s is usually used by devices like external hard drives.
In order for a USB device to operate at the right speed, it has to identify itself to the host correctly. A low-speed USB device will have it’s D- signal connection connected to a pulled up resistor. On the other hand, a USB high-speed device will have its D+ signal pulled up. The high-speed USB device uses a different approach to speed identification. It initializes as a full speed USB Device before sending a series of transmission during the enumeration to identify itself as a high-speed device.
Ensuring Adequate Signal Protections
Ensuring signal safety is another vital feature to keep track of when designing your USB devices. USB devices are usually mobile with frequent interaction by users. This brings the hazard of Electrostatic Discharge (ESD) into concern. It is essential to place ESD protection components along the data signal to prevent device failure due to ESD. Besides that, some USB devices are powered over lengthy USB cable. This increases the chance of external electrical interference affecting the power connections. To address this, ferrite beads are usually placed on the V+ and GND connections.
And one of the final protections you need to take care of is when you are routing the data signals. Even for a low-speed USB device, the rate of 1.5 MBit/s is considerably high speed on the PCB. Basic design rules for high-speed signals need to be applied to ensure signal integrity.
As the D+ and D- are differential pairs, interactive differential routing tools in software like Altium can be pretty useful in parallel and matching length connections. For your PCB design software needs, Altium’s CircuitStudio® will be able to help you securely track the features you need to make your hardware designs succeed.
If you have more questions on USB device hardware design, consider talking to our experts at Altium now.