USB OTG Technology and Its Application in Storage Test

Publisher:skyhcgLatest update time:2009-12-07 Source: 邸超 张志杰Keywords:USB Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Storage testing is a dynamic testing technology that places a miniature data acquisition and storage tester on the object to be tested or at the test site, with no effect on the object to be tested or the effect is within the allowable range, to complete the rapid acquisition and memory of information on site in real time, and then recover and process and reproduce the test information by computer afterwards. The main technical feature of storage testing is to complete dynamic data acquisition and storage memory on site in real time, especially to complete dynamic parameter testing under various harsh environments and compact design conditions, and then recover and process and reproduce it. Traditional storage testers have the following shortcomings:

(1) The storage medium is placed inside the instrument, and the entire instrument must be collected to read back the data. Due to the complex test environment faced by storage testing, complex and bulky protective bodies are often installed or placed in shelters, which makes it difficult to disassemble and recycle the instrument. Outdoor readback and analysis of data are often difficult to continue due to limited conditions. (2) With the development of storage testing technology, the challenges and environments faced by storage testing are becoming increasingly complex, and the test time and required capacity are flexible and variable, and are gradually increasing. Due to the limitations of the design structure of traditional storage testers, different capacities mean that new instruments must be redesigned and produced.

(3) The current computer motherboards generally integrate USB interfaces, and the "large ports" that storage testers have always used, such as parallel ports and serial ports, have gradually been abandoned. Some newly launched motherboards even only integrate USB ports. The storage tester interface must adapt to this change and implement communication based on USB ports through certain measures. This design uses the CH375 of Nanjing Qinheng Company and the ATMEGA32 microcontroller of Atmel to effectively overcome the above shortcomings and achieve good results in practical applications. As a new type of mobile storage device, the U disk is highly favored for its small size, fast speed, vibration resistance and strong versatility. The system uses the microcontroller to read and write the U disk, and the collected data is directly stored in the U disk in the form of files, which can effectively improve the data storage speed and reliability. It is particularly suitable for occasions with long-term and large-capacity data collection, which facilitates data exchange with host computers such as PCs, thereby realizing on-site data collection and indoor data analysis. By replacing the U disk, the system capacity can be flexibly selected, which greatly improves the versatility of the storage tester and reduces the test cost.

2 USB OTG and Mass Storage Device Protocol

As a supplementary specification of USB 2.0, USB OTG (On The Go) has dual powerful functions to free USB devices from complete dependence on PCs. USB peripherals can be directly interconnected for communication without the participation of a PC host. USB communication is carried out in a layered manner, which can be generally divided into a functional layer, a USB device layer, and a bus interface layer. The USB flash drive belongs to the USB Mass Storage device in the USB family. It is a random storage device based on blocks/sectors. It communicates with the host in a "control/bulk/interrupt" (CBI) mode or a "bulk" (Bulk-Only) mode. The USB communication protocol specification is very complex. The USB mass storage protocol includes four independent sub-class specifications, namely CBI, Bulk-Only, ATA, and UFI. The first two sub-specifications define the transmission method of data/command/status on the USB bus, and the latter two sub-specifications define the operation commands of the storage medium. Among them, the ATA command specification is used for hard disks, and the UFI command specification is formulated for USB mobile storage. Before saving data, the USB flash drive must be formatted according to the regulations of a certain file system. Compared with computer hard disk, the storage capacity of USB flash disk is much smaller. Therefore, FAT16 file system can achieve relatively high comprehensive efficiency and good compatibility in USB flash disk, and is widely used in mobile storage devices such as USB flash disk. The structure of FAT16 file system is divided into 5 parts: MBR area, DBR area, FAT area, FDT area, and DATA area. Among them, MBR area is the master boot record area, DBR area is the operating system boot record area, FAT area stores file allocation table, FDT area stores file directory table, and DATA area is the real data storage area.

3 System Hardware Design

The system uses the powerful single-chip AT-mega32 from the AVR high-end machine series as the central processing chip, and the CH375 from Nanjing Qinheng Electronics Company as the USB host control chip. The working principle block diagram of the hardware system is shown in Figure 1:

Block diagram of the working principle of the hardware system

ATMEGA32 is a low-power 8-bit microcontroller based on AVR RISC structure. The performance of an external 16 MHz crystal oscillator can reach 16 MI/S. AT-mega32 contains 32 kB of in-system programmable FLASH, 1kBE2PROM, 2kB SRAM, 32 general I/O ports, 32 general working registers, an 8-channel 10-bit A/D converter with selectable gain differential input , and supports multiple interface modes. The rich on-chip memory space greatly improves the work efficiency when operating the USB disk, the diverse peripheral interfaces facilitate the expansion of the system, and the efficient CPU instruction set enables the system to obtain a relatively high sampling rate. CH375 has an 8-bit data bus and read, write, chip select control lines and interrupt outputs, and supports 5 V and 3.3 V power supply voltages at the same time, following the USB 1.1 specification. Therefore, CH375 is used as a full-speed USB Host. When the host interface is connected, only an external crystal oscillator and capacitor are required, and it can be easily connected to the system bus of controllers such as microcontrollers/DSPs/MCUs/MPUs. Since reading and writing USB flash drives or mobile hard disks are generally performed in sector mode, in order to further improve execution efficiency, the disk data buffer and file data buffer can be appropriately increased (both are integer multiples of 512 B), and the larger the buffer, the higher the execution efficiency, so 32 kB of RAM 62256 is expanded. The sensor signal is quantized into a digital signal by the A/D converter MAX 153 after being conditioned by the analog circuit, and is stored in 62256 in a loop under the control of the single-chip microcomputer ATMEGA32. After the trigger signal arrives, the data of 62256 and the subsequent signals are all stored in the external USB flash drive through CH375 according to the negative delay points preset by the program, until the newly created file in the USB flash drive is filled and closed. At the same time, the status light set by the system indicates that the work has been completed.

The schematic diagram of the interface between ATMEGA32 and CH375 in the actual design is shown in Figure 2:

Schematic diagram of the interface between ATMEGA32 and CH375 [page]

4 System Software Design

The software structure diagram of USB mass storage device is shown in 3:

USB mass storage device software structure diagram

Generally, the MCU or embedded system needs to implement several layers on the left side of Figure 3 to process the file system of USB storage devices, and the right side is the internal structure layer of the USB storage device. Since CH375 is not only a general USB-HOST hardware interface chip, but also has built-in related firmware programs, it simplifies external programming. The built-in firmware includes the UFI command layer on the left side of the above figure, the USB basic transmission command layer and the Bulk-Only protocol layer, so the actual MCU program only needs to process the FAT file system layer, and even this layer can be implemented by the CH 375 U disk file-level subroutine library. CH375 provides a C language subroutine library. The file-level interface of the USB storage device, these application layer interface APIs include commonly used file-level operations, which can be transplanted and embedded into various commonly used MCU programs.

Here, ICC AVR software is used to write the ATMEGA32 program, and the AVRU disk file-level subroutine library CH375HFB. A provided by CH375 is called. After the program is run and initialized, the system enters the waiting trigger state. After the trigger signal is detected, a new file is created through CH375FileCreate, and the data collected by AD is written to the U disk through CH375FileWrite. After the file is full, CH375FileClose is called to close the file. After the acquisition is completed, the external U disk can be directly removed and taken back for indoor analysis. Due to the use of the file management mode, the required operation is very simple, just like reading files in the U disk.

5 Conclusion

After testing, the system achieved the expected effect in actual use and overcame some shortcomings of previous storage testers. In particular, it achieved good results for the acquisition of slow-changing large-capacity signals. Since CH375 only supports USB1.1 protocol and uses a single-chip microcomputer as a controller to manage the operation of the entire system, it is bound to affect the sampling rate of the instrument. Therefore, the selection of OTG devices that support USB 2.0 protocol and the use of better-performing controllers such as DSP, CPLD, etc. can greatly improve the sampling rate of the instrument to meet higher requirements.

Keywords:USB Reference address:USB OTG Technology and Its Application in Storage Test

Previous article:Gas detection method and implementation in mobile cabin based on telemetry
Next article:Design of a high-precision infrared temperature measurement system based on SOC

Recommended ReadingLatest update time:2024-11-17 00:42

They are all C-port Thunderbolt 3/Thunderbolt 4/USB 3.0/USB 4. What are the differences? One picture to understand
       There has been a lot of news recently about Apple switching to the USB-C interface for the iPhone next year. It seems that the convenience of traveling around the world with just one cable is just around the corner.   However, are you wondering, although they are all USB-C interfaces, they can actually correspo
[Mobile phone portable]
They are all C-port Thunderbolt 3/Thunderbolt 4/USB 3.0/USB 4. What are the differences? One picture to understand
What is the principle of making USB-RS232 converter with CP2101 (2102)?
Cp2101(2102) chip introduction: CP2101 (CP2102) is a product of Silicon America. It is a dedicated chip that highly integrates USB to UART functions and provides a simple solution with minimal PCB space. CP2101 includes a USB2.0 full-speed controller, USB transceiver, clock, EEPROM and asynchronous s
[Analog Electronics]
What is the principle of making USB-RS232 converter with CP2101 (2102)?
USB-Powered 5.8 GHz RF LNA Receiver with Output Power Protection
USB Powered 5.8 GHz RF LNA Receiver with Output Power Protection USB-Powered 5.8 GHz RF LNA Receiver with Output Power Protection Evaluation and Design Support ►Circuit Evaluation Board ► CN0534 circuit evaluation board (EVAL-CN0534-EBZ) ► Desi
[Analog Electronics]
USB-Powered 5.8 GHz RF LNA Receiver with Output Power Protection
Design of lower computer for temperature measurement system based on AVR USB interface
0 Introduction In recent years, with the continuous development of integrated circuits and chip manufacturing technology, different USB communication chips have emerged. At present, typical USB communication chips include CH375, PDIUSBD12, etc. These devices are characterized by powerful functions, but high prices,
[Test Measurement]
Design of lower computer for temperature measurement system based on AVR USB interface
Design solution based on MCU and USB device controller IP core
1 Introduction Serial ports (such as RS232) and parallel ports are often used to connect peripheral devices in traditional computer systems. However, both serial ports and parallel ports have insurmountable disadvantages such as slow communication speed and interface monopoly that is not conducive to expansion. The Un
[Power Management]
Design solution based on MCU and USB device controller IP core
USB device driver transplantation development board as USB disk
The TQ2440 development board has two USB ports. You need to set the second USB port (the one for burning) as a USB device. 1. Modify the source code First, use the development board as a slave device, that is, the USB port uses the USB Device function, and modify the "arch/arm/mach-s3c2440/mach-smdk2440.c" file in t
[Microcontroller]
USB device driver transplantation development board as USB disk
Bus communication equipment based on single chip microcomputer design
In the integrated avionics system, fast and effective data transmission has a great impact on the performance of the entire avionics system, so the data bus is called the "skeleton" of the modern avionics system. ARINC429 is one of the most commonly used communication buses between avionics systems. To realize ARINC429
[Microcontroller]
Bus communication equipment based on single chip microcomputer design
Charging the battery via USB
The Universal Serial Bus (USB) port is a bidirectional data port with power and ground. USB can connect all types of peripherals, including external drives, storage devices, keyboards, mice, wireless interfaces, video and still cameras, MP3 players, and countless other electronic devices. Many of these devices are b
[Power Management]
Charging the battery via USB
Latest Test Measurement 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号