Validating and debugging USB embedded systems using a mixed signal oscilloscope
USB is widely used in embedded devices of all kinds, providing simple interconnectivity and interoperability, making it important for designers to come up to speed on system level hardware and protocol test and debug. Fortunately, the use of a mixed signal oscilloscope (MSO) to validate performance designs makes this process much less onerous by allowing designers to trigger on specific packet content, decode an entire acquisition, and search for an event of interest.
The implementation of any generation USB is challenging. The simplicity of using USB for the end-user is made possible by its underlying complexity. To troubleshoot system-level interactions in these complex embedded systems, MSOs typically offer 16 digital channels in addition to two or four analog channels. Since the digital channels are fully integrated into the oscilloscope, the user can trigger across all input channels, automatically time correlating analog, digital, and serial signals. Support for high-speed acquisition on these channels is critical to capture fine signal detail around the trigger point for precision timing measurements for setup and hold, clock delay, signal skew, and glitch characterization.
In using an MSO to debug USB in an embedded system, the first step is to define the record length for an acquisition. The record length tells the scope how many sample points to acquire. The longer the record length, the longer the time window the scope will capture. Typically a record length of 100,000 points is a good starting point.
Modern MSO support an extensive range of serial buses ranging from old standbys such as RS-232 and I2C to FlexRay and Ethernet and many more. The choice of serial bus to decode is selectable from front panel menus. These menus in turn guide the user through the setup, and in the case of USB, of such variables as bus speed and type such as low speed, full speed and high speed and whether the signal is single-ended or differential. In addition, the logic thresholds for the bus signals must be defined. To simplify the setup, the user can choose a preset. For instance, if full speed is selected as the bus speed, the scope will apply the typical threshold value.
Once this is accomplished, the next step is to setup the MSO to trigger on specific packet content, which makes it possible to capture a specified event. Triggering is critical to the debug process because it provides the ability see what is occurring system wide before and after a suspected or known problem takes place. To facilitate this, MSOs can trigger on a variety of different packet and byte types including:
- End of Packet
- Token (or Address) Packet
- Data Packet
- Handshake Packet
- Special Packet
In this example, the MSO is set to trigger on a specific data packet, the ASCII character “!”. Telling the scope to acquire the waveform requires only a button press. As shown in Figure 1, zooming in around the trigger, you can see that the scope triggered on a data packet that contains an exclamation mark.
MSOs, such as the Tektronix MSO4000 used here, typically provide an easy to read, color-coded display of the decoded USB bus as shown in the screen captures. A green bar symbol represents the start of packet. Sync bytes are shown in purple boxes. Packet identifier bytes and address values are in yellow boxes. Data packets are shown in blue boxes. Errors in packets or bytes are shown in red. In this case, there were no errors. Finally, the red bar symbol represents the end of the packet. In this example, the data values are shown in ASCII. The values can be displayed in hexadecimal or binary if desired.
The next step is to look at the other times a data packet contained an exclamation mark. Given that the record length was set to 100,000 points, finding a specific event, like every time an exclamation mark is sent, by scrolling through screens of data looking for the event could be very time consuming.
A more efficient approach is to use the MSO’s search functionality that allows it to automatically search the entire waveform record for a specific event. For this example, this functionality was used to search for every occurrence of an exclamation mark in the data stream. There are a variety of search types available for USB, including the same packets and bytes available as triggers.
As shown in Figure 2, the instrument performed a search for every occurrence of an exclamation mark as indicated by the white triangular marks at the top of the display. Each one of these triangles marks a data packet that contains an exclamation mark. In this example, five events were identified. Arrow buttons are used to navigate between the different events to gain more insight into the design. It would of course to be possible to search for many other types of events within in the same acquisition.
While USB is frequently called for in embedded systems due to its ubiquity and convenience for the end user, there’s no getting around the additional complexity it represents. With a mixed signal oscilloscope, validating and troubleshooting a USB bus is straightforward. The ability to trigger on specific packet content, decode an entire acquisition, and search for events greatly reduces the time involved with isolating problems and identifying root causes.
About the author
Faride Akretch is a technical marketing manager for Tektronix. In nearly 20 years in the industry he has held a variety of positions, including application engineer, product marketing, and business and market development, in Germany, Japan, and the United States. He holds a master's degree in electrical engineering/electronics from the Technical University in Berlin, Germany.