USB host function in embedded applications

Publisher:Xingfu6666Latest update time:2012-04-16 Keywords:Embedded Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

USB has become the standard way for devices to communicate with PCs, from general-purpose devices (such as flash memory devices and mice) to specialized devices, and the standard has almost completely replaced other serial communication protocols.


USB peripherals cannot communicate with each other, they can only communicate with a USB host device that has control over the bus. Until recently, only PCs had host capabilities. But now, many microcontrollers also have embedded USB host capabilities, which allows embedded applications to connect to a wider range of USB peripherals.


USB flash drives are a widely used USB peripheral device that has become an inexpensive medium for transferring or storing large amounts of data. Many data logging devices have been developed thanks to them. For long-term data logging in remote locations, data can be collected and stored in a flash drive, then brought back to a convenient location for analysis and processing.

Figure 1: PIC24FJ256GB1 microcontroller with embedded USB host function


Flash drives can also be used to transfer high-speed time-correlated data to a PC. PCs are excellent data analysis tools, but their real-time capabilities are limited. Conversely, embedded applications are well suited for real-time data acquisition, but data analysis capabilities are often weak. An embedded real-time data logger can store data on a flash drive and then transfer the data to a PC for analysis, thus giving full play to the advantages of both.

Embedded USB Host Applications
One of the first tasks when starting an embedded design is to select a microcontroller. In order to use a flash drive, the microcontroller must have the ability to be an embedded USB host. If the microcontroller has USB OTG (On-The-Go) or USB Dual Role functions, such as Microchip's PIC24FJ256GB1 microcontroller, as shown in Figure 1, it can also support embedded USB host functions. USB peripherals, sometimes also called USB device mode, can only be used as a flash drive, etc., and cannot communicate with other USB peripherals.


Second, the designer should make sure that a complete set of development tools is available. At a minimum, a device programmer is needed (a debugger is best) and a C compiler, because embedded USB hosts and programs running on microcontrollers are often written in C rather than assembly language.


Finally, designers should also understand what software libraries are available, because the handshake operation when the embedded device discovers the flash drive requires support for the USB device class, FAT32 file system, and other libraries. Designing support for embedded USB host devices from scratch can take months, while a solution consisting of a certified protocol stack can save considerable time.


In order to use the flash drive, the embedded device also needs a USB Mass Storage Class device terminal driver, a hardware command line interface, and a file system interface. Typically, flash drives with 2Gb or less of storage space use the FAT16 file system, while larger capacity flash drives will use the FAT32 file system.

Design Requirements
● If the embedded host needs to support the USB device class, it must be able to provide 500mA of current to power the peripherals.
● If the embedded host needs to support any device that consumes more than 100mA, it must also be able to provide 500mA of current.
● If the embedded host needs to support devices that consume 100mA or less, the VBUS voltage limit can be reduced to 4.4V. However, if the embedded host needs to support devices that consume more than 100mA, the VBUS voltage limit is 4.75V, just like a full-featured host.
● The overcurrent protection mechanism must be redesigned to reset without user intervention.
● The transmission delay from the USB connector to the transceiver must be within 8ns.
● The capacitance on VBUS of the embedded USB host must be greater than 120μF, and the capacitance on VBUS of the USB OTG device must be 1.0~6.8μF.
In addition to the above rules, the user interface of the embedded USB host application must also be carefully considered. USB peripherals are usually used on PCs, and detailed error information can be provided in case of errors. If the LED indicator flashes, the user can know that the connection has failed. The USB specification also makes mandatory provisions that certified USB embedded host devices must provide error information. In other words, all error information must be clearly notified to the application layer, that is, to the user.

USB Device Certification
USB certification is mainly used to ensure that USB devices comply with the requirements of the USB specification. Certification can be carried out by various independent testing agencies. Once a product passes the certification, the manufacturer is allowed to use the USB logo, but also needs to comply with additional license restrictions (refer to the USB Implementers Forum: http://www.usb.org/developers/logo_license).


Products can also be manufactured and sold directly without USB certification. Without USB certification, manufacturers can declare that their products support USB, but they cannot use the USB logo anywhere on the device or packaging. Generally, it is not difficult to obtain USB embedded host device certification.

Communicating over USB
One of the biggest challenges in implementing a USB embedded host is communicating with the wide variety of USB peripherals. Although not all flash drive products are certified, users will not be happy if one flash drive works fine in an embedded device, but another does not work for no apparent reason.


It's OK if the flash drive needs to power up twice or half as long as the maximum allowed, or because the flash drive locks up when the host polls at the maximum allowed rate, or because the flash drive requires a different sequence of SCSI commands to establish communication, etc. But users will criticize the host if such a flash drive doesn't work on the host but works fine on the PC. So make sure to do extensive testing to communicate with a variety of non-certified USB peripherals, even if it's just a thumb-sized flash drive or a cable.


Although embedded USB host devices can provide USB class-level support, restrictions on support for special USB peripherals should also be considered during design and testing, and the product can be used normally in the designed application field by identifying the VID (Vendor ID) and PID (Product ID). This ID list refers to the Target Peripheral List (TPL) published by the USB Implementers Forum, which is a list of inspection items that must be followed in order to obtain embedded host certification. Complete OTG certification actually only requires interoperability with products marked with the VID/PID in the TPL list.

Keywords:Embedded Reference address:USB host function in embedded applications

Previous article:Classification and working principle of printers
Next article:Software Design of X-ray Energy Spectrum Analyzer Based on Fieldbus

Recommended ReadingLatest update time:2024-11-16 15:33

How to download programs using the STM32 serial port (USB serial port)
1. Steps for STM32 serial port download program  1) Install "CH340 driver (USB serial port driver)_XP_WIN7 common"  2) Open the serial port download software "STM32F4 serial port download software (FLYMCU)"  3) Connect the USB interface of the development board to the USB port of the computer and power the development
[Microcontroller]
MCU USB Device Registration Editor
    In the previous chapters, users have learned how to see the types and formats of all connected USB devices in the device manager. Of course, users also know that when these devices are unplugged and reconnected, there is no need to reinstall their drivers. So how does the PC host know that they have been installed
[Microcontroller]
MCU USB Device Registration Editor
Design of wire rope flaw detection alarm system based on USB mobile storage
1 Introduction  In the wire rope flaw detection, it is necessary to realize the data exchange from the detection sensor to the memory. USB mobile memory has the advantages of easy portability, fast operation and low cost. With the development of its technology and its wide application, how to use single-chip microco
[Microcontroller]
Design of wire rope flaw detection alarm system based on USB mobile storage
Using USB UART bridge to realize MCU online programming
Introduction : Universal Serial Bus (USB) is a new type of serial interface that supports plug-and-play, making the connection of peripherals to computers more efficient and convenient. This interface is suitable for a variety of devices. It is not only fast, plug-and-play, and hot-swappable, but also ca
[Microcontroller]
Using USB UART bridge to realize MCU online programming
Data acquisition and control system design based on USB interface
1 System Structure The block diagram of the data acquisition and control system composed of ADuC845 single-chip data acquisition device and CH341 USB interface device is shown in Figure 1. ADuC845 completes analog data acquisition, switch input and output, control voltage and PWM control signal output, and
[Test Measurement]
Data acquisition and control system design based on USB interface
USB Battery Charging Circuit
  One of the features of the USB standard is that the host can provide power to plugged-in USB peripherals. This advancement from the serial and parallel ports of the past to USB has greatly increased the number of devices that can be connected to a PC.   In addition to directly powering USB devices, a more useful fun
[Power Management]
USB Battery Charging Circuit
iPhone 15 Pro latest appearance rendering: USB-C port, protruding back, hard to describe
Now, foreign media 9to5 Mac has given a set of appearance pictures of the iPhone 15 Pro. Although they are renderings, they are compiled based on reliable information about the current rumors of the new phone. With the launch of the iPhone 15 lineup, all iPhone 15 models will switch to USB-C to replace the Lightning
[Mobile phone portable]
Design and implementation of high-speed data acquisition card with USB interface
Modern industrial production and scientific research have increasing requirements for data acquisition. In some high-speed and high-precision measurements such as transient signal measurement and image processing, high-speed data acquisition is required. Currently, the common high-speed data acquisition cards are ge
[Microcontroller]
Design and implementation of high-speed data acquisition card with USB interface
Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号