Typical set of ports in a modern laptop: power, HDMI, 2x USB and a 3.5mm jack.

What made USB so popular in embedded systems market?

       No matter if youíre an engineer or a rather average computer user, USBís logo is probably almost as familiar to you as that of Apple. USB communication has established a standard in the industry of PCs and embedded systems with billions of USB products shipped every year. Truth be told, at this point, its popularity alone is often enough to make it the best solution for many applications, but this is not everything that this communication technology has to offer. In this column, weíll ponder over what USB is and what in particular makes it so special, what are its shortcomings and finally when you should consider using USB in your embedded systems. To better understand how this technology became so ubiquitous in the tech industry it will be useful to look at how it came into existence.


How it was done back in the old days?

       Back in the 1980s and early 1990s, connecting devices was much more troublesome than it is now. Peripherals utilized a variety of interfacing methods, required manual installation of drivers and different cables and the control unit had to have the hardware or an expansion card prepared specifically for them. For example, set up of a device tree for IBM Personal Computer required a dedicated keyboard that would use a 5 pin DIN socket which was the only connection with a direct access to the motherboard. For all other peripherals, there were expansion cards that you had to plug into the special ISA slots on the motherboard: video card for a monitor, game control adapter for a joystick, IBM Asynchronous Adapter (serial port card) for various types of HIDs and a parallel port card. If that wasnít inconvenient enough, other manufacturers used different ports and coming across devices dedicated to being compatible with only one machine was not uncommon.


A brief history of USB

       Driven by the desire to simplify the process of interfacing devices with the host, in 1994, a group of 7 tech giants at the time: Compaq, IBM, Intel, NEC, Microsoft, Nortel, and Digital decided to collaborate on the creation of a new, universal, easy to use, fast and multifunctional connection interface. The development of what they named Universal Serial Bus took a little over a year of work and in January 1996 the USB 1.0 has left Intel Labs and was introduced to the world. As promised, the new communication protocol met all of the original requirements and included few additional perks that made it even easier to interface peripheral devices with the computer:

  • plug and play (automatic detection) allowed for an automatic configuration of the device without the need to install drivers manually
  • hot-swappable/ hot-pluggable feature enabled connecting the device to the host without turning off the power
  • one USB slot in the host system allowed for connection of 127 devices

       Introduction of USB technology has created a paradigm shift in terms of being user-friendly making connecting devices foolproof and effortless even for the most inexperienced users. It allowed for connecting virtually any type of device from printers and external hard drives to webcams and game controllers to keyboards, smartphones, and mice. Thatís how the troublesome and tedious process of setting up a device tree turned into plugging the cable into one of the USB ports in the host system. As a logical consequence of that, a lot of traditional solutions were fully or partially superseded letting USB establish as a standard in communication protocols.


R.I.P.:

legacy connectors superceded by USB (
Figure 1: Legacy connectors superceded by USB
source: Wikipedia

USB basics

Male connectors of type A and B
Figure 2: Male connectors of type A and B
source: Wikipedia

Hardware

       USB, like most other cables, has two ends. Type A (on the left), is designed for host devices and for increased compatibility almost always takes on the form shown in the diagram. Type B (on the right) is usually used for control of the peripherals and the shape and size of connectors can vary depending on the needs of a particular device. Inside of a traditional USB 2.0 cable, there are 4 shielded wires. Two of them are power (1) and ground (4) that allow the device to be powered by the host through the USB connection, eliminating the need for an additional power supply. The other two wires, the data upstream (3) and data downstream (2) are responsible for the transmission of the data, which is streamed in a form of a differential signal. Typically for this type of signaling, they are wired to form a twisted pair for reduced electromagnetic radiation and crosstalk between neighboring pairs.

USB Architecture and Data Transmission

       In USB architecture, there will always be a host and a device connected to it. Their model of communication is often referred to as a master-slave relationship. The PC or the primary embedded system is the master and it controls all of the communications on the bus. Since USB is a serial type connection it can communicate with one device at a time and one of the masterís tasks is to tell slaves when it is their turn to exchange the data with him. USB specification allows for up to 127 devices to be connected to one host port in a tiered, star topology with a limit of up to 7 tiers (host + 5 hubs + device). Implementing this type of topology where the hub acts as a middleman that provides an additional power source ensures enough power supply for every connected device.

       Data transmission in USB connection doesnít have an external clock line (asynchronous), which enables it to send information at different speeds. Because the host communicates with only one device at a time and devices send the data at different rates, hubs also play an important role in data transmission. They can help with data trafficking on the bus by retransmitting the data from slower devices at the highest speed, freeing the bandwidth for other connections.


Additional features

       When you see that your device utilizes a USB connector, you already know that you donít have to know a single thing more about the host or a device to connect them properly. Thatís because USB has a plug and play feature which enables the host to access basic information about the device, assign it with a unique address and load one of the appropriate drivers stored in hostís OS onto it. In the case when the devices are using custom drivers that are not included in the standard OS package, they can be found online (accesio.com > Drivers & Downloads) or in installation packets that come with the device.

       There is also no need to turn off the host system (which is how it used to be) before plugging in the USB device because the connection is hot-pluggable. In desktop PCs, this could make little of a difference, but sure enough, it is convenient. However, when it comes to heavy-duty machinery, medical apparatus, or military equipment, where shutting down the system can be expensive or even life-threatening this feature really shows its potential. It allows broken components to be replaced with little to no effect on the whole system, minimalizing the mean time to repair. Before USB, connecting a device while the system was running could damage the device, the host or in some cases both. Thatís the reason why most of the old connectors had to have safety measures like screws preventing peripherals to be unintentionally detached.

       Another important feature of USB is the support of full backward compatibility, meaning that all USB devices, no matter what generation of this technology the host or the peripheral uses, will work just fine with one another. You can essentially plug your USB 1.1 I/O device from 1998 into the 3.2 port in your new computer and it will run the same software apps without the need for any modifications. This means that while this technology is constantly being developed, there is no need to worry about the lifespan USB may have.


Why is it so popular to use USB in embedded systems and how is it advantageous with respect to other types of interfaces/ in which cases should we consider using this connection?

       USB was originally designed to interface peripheral devices to desktop PCs and for a few reasons, it wasnít suitable for use in an industrial environment which is why initially it didnít seem to be an attractive alternative to other buses used in the Data Acquisition and Control market. After addressing these issues, however, advantages of USB became clearer and it started slowly earning its place and recognition in the world of embedded systems. Below is an overview of advantages and limitations for a typical USB connection and a brief discussion of solutions to the most common problems with this technology in embedded systems applications.

PROS

  • Backward compatibility eliminates any concern about the USB getting outdated - no unnecessary upgrades.
  • Hot-plugging / Hot-swapping allows for replacing broken devices without the need for shutting down the system, minimizing the mean time to repair and significantly decreasing maintenance costs.
  • Plug and play makes the system set up easier and faster and therefore less expensive. It reduces time to connect devices to host systems.
  • Ubiquitous - itís supported by the latest versions of most operating systems, there is a large support base and a variety of USB devices to choose from.
  • Versatile - USB has a huge set of software and protocol standards
  • Ability to power devices over the cable eliminates the need for an additional power supply reducing clutter, costs of cabling and making USB systems more portable
  • 1 slot, 127 devices allows the primary embedded system to manage up to 127 devices (including hubs). However, getting any close to this number significantly reduces the functionality of the connection due to USBs serial nature.
  • Fast - more than adequate for most tasks in terms of data transfer

USB maximum data rates

USB 1.0

1.5Mb/s LowSpeed

 

12 Mb/s FullSpeed

USB 2.0

480 Mb/s HighSpeed

USB 3.0

5 Gb/s SuperSpeed

USB 3.1

10 Gb/s SuperSpeed+

USB 3.2

20 Gb/s SuperSpeed+

Table 1: Improvement in maximum theoretical bandwidth of USB across generations

CONS

  • High in latency (time delay between calling the software function and updating the actual hardware of the I/O), USB is inherently high in latency, 0.25ms vs 100ns for PCI Express and low in determinism, meaning that the latency is not very consistent.

In general, USB is considered not ideal for closed-loop control applications, however, when the closed loop output is for example to flip the switch (~ 5ms) the latency of 0.25ms doesn’t make any noticeable difference. This limitation of USB is more visible when the closed loop works with higher frequencies like in audio noise canceling or laser intensity adjustment. Internal buses like PCI Express or Mini PCI Express are generally better for these types of applications.

  • Short cables - USB cable length is limited to 5m for USB 2.0 and to 3m for USB 3.0, however, you can extend it with active (repeater) cables up to 30m or up to hundreds of meters with an optical fiber active cables (that also happens to conveniently serve the purpose of an isolator in case of differences in ground potential).
  • Unprepared for industrial use which is what initially prevented it from succeeding in DAQ market. A typical USB connection is still a desktop-sitting, pretty-looking, cheap, consumer-oriented product. This is why ACCES I/O who has been with DAQ since the early days of the industry, long before the introduction of USB, created USB/104 - a new line of USB Data Acquisition and Control boards produced in the PC/104 form-factor, optimized for embedded systems. This line offers a holistic approach to adapting USB to industrial purposes:
    • Loose and sloppy connection, which is said to be the most common complaint with USB in industrial applications, was replaced with isolated, high retention or latching connectors
    • Delicate and uniquely sized enclosures were replaced with powder coated (less resistant, doesn’t chip off, standard in robust industries) steel enclosures (EMI/RFI resistant) produced in PC/104 form-factor.
    • OEM board-only option with mounting holes matching the PC/104 form factor fits inside hundreds of enclosures and is compatible with a variety of mounting systems (including the DIN-rail mounting which is another standard in the industry) and countless cable systems and standoffs
    • For ensured quality, the boards are individually tested
    • Mean Time Before Failure is monitored for better performance assessment and maintenance scheduling. Boards are also made in a form of line replaceable unit.
    • The devices are equipped with isolated cards for increased reliability
    • They can use higher currents for digital output enabling the communication with more TTL devices or driving longer cables without signal repeaters

       USB has quickly won hearts of users of desktop PCs and small consumer devices, but there is a lot of ways in which this technology had to be adapted before it earned its spot in the DAQ market. USB is notoriously cheap and delicate but when it’s made in the right way, it becomes a very reliable bus.


Why do we still use USB 2.0 and what exactly changed in USB 3.0/ 3.1/ 3.2

       In Data Acquisition and Control market, most customers donít need a bandwidth higher than 20 Mbs so the constantly improving transfer speeds of new USB buses are irrelevant for the majority of applications. The more important transaction rate, on the other hand, stays virtually the same for new generations which doesnít give too much incentive for DAQ industry to upgrade to higher versions. Additionally, the full backward compatibility of USB ensures that the devices wonít get outdated and left incompatible. With that forward proofing, even though the bandwidth is getting better, USB 3 is more expensive while still having similar frequency, rendering it excessive for a low bandwidth market.


Marcin Kierebinski by Marcin Kierebinski, Mechanical and Elecrical Engineering intern at ACCES I/O.

Marcin Kierebinski is our awesome Mechanical and Electrical Engineering intern that currently studies at University of California, San Diego. His project experience in Embedded Systems involves utilizing inertial measurement units (IMUs) for portable motion capture applications.

Acquisition, Control, Communication: Engineering and Systems

olark('api.rules.defineRule', { id: 'delayed_response', description: 'Will send a response to the visitor after an operator doesn't respond.', condition: function(pass) { olark('api.visitor.getDetails', function(details) { var delay = 60 / details.messageCountForThisVisit; if (details.isConversing && details.secondsSinceLastMessageToOperator >= delay && !details.secondsSinceLastMessageToVisitor) { pass(); } }); }, action: function() { olark('api.chat.sendMessageToVisitor', { body: 'Sorry about the delay. We'll get back with you as soon as possible ... but it might be via e-mail, especially if it is currently 2am Pacific.' }); olark('api.chat.sendNotificationToOperator', { body: 'Automated delay message has been sent to visitor.' }); }, perVisitor: true });