Embedded USB interface design based on ARM

Publisher:WhisperingSongLatest update time:2016-09-05 Source: eepwKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
With the widespread application of embedded systems, various small terminals need to develop USB interfaces to connect with the outside world. At present, there are two commonly used technologies. The USB interface based on single-chip microcomputers is characterized by the need for external chips, complex circuits, and few CPU resources left; the USB interface based on ARM is characterized by rich resources, but there are many ARM series products. If the selection is not appropriate, more peripheral circuits need to be connected, and the CPU performance cannot be well exerted. 
USB (Universal Serial Bus) is the abbreviation of universal serial bus. It has become the mainstream interface of computers because of its convenience, dynamic bandwidth allocation, excellent fault tolerance and high cost performance. 
This design uses Samsung's ARM9 core S3C2440A chip as the CPU, because the chip integrates all the components for controlling USB, and the peripheral circuit is simple and easy to implement. 
1 Features of S3C2440A 
The CPU part of S3C2440A mainly integrates power module, reset and clock module, touch screen and keypad module, program memory and data memory module. At the same time, it provides the following rich peripheral interfaces: synchronous memory (SDRAM) and NAND FLASH control interface, which can be expanded to 1 GB of storage space; 4 DMA channels and 24 interrupt ports; can control STN LCD and TFT LCD display, support touch screen function; USB interface type A and type B each; 3 serial ports, I2C, SPI, I2S and other interfaces; with AC97 audio interface; with SD card, digital camera interface and network interface. 
 
S3C2440A also has multiple working modes, the pins are distributed in a 17×17 square shape, numbered from left 1 to right 17 horizontally, and numbered from bottom A to top U vertically, classified as A1~A17, B1~B17, C1~C17 and so on to U1~U17. The functions corresponding to these pins are not unique. Usually, as long as the enable changes, S3C2440A can achieve different control functions. The pins of S3C2440A involved in this design are divided into 3 categories as shown in Table 1. 
 
2.2 Serial port 
circuit The role of the serial port in this design is to load the USB driver through the computer, and the principle is shown in Figure 2. 
 
2.3 Power supply circuit 
Since the pins of the S3C2440A chip have different requirements for voltage, it is necessary to complete the power supply transformation, and its principle is shown in Figure 3. 
 
3 Research on driver 
According to the USB interface, its device structure can be divided into USB Host (host) and USB Device (external device). The USB host controls the USB device to communicate, while the host and the host, or the USB device and the USB device cannot communicate. 
3.1 USB host 
The functions of the USB host usually include the following parts: verify whether the USB device is inserted or removed; control the data flow between the USB host and the device; return the displayed status of the USB host. The 
USB system software consists of the following three parts: host controller driver (HCD), USB driver (USBD), and host software (Host Software). The functions of the host controller are shown in Table 2. HCD and USBD contain software interfaces based on different abstraction levels. The two work together in a certain way to complete tasks to realize the functions of the USB system. There is no specific definition of the difference in their tasks, but one of the functions that HCD must have is that it must support a variety of different host controller chips. In some operating systems, when the system must implement certain basic functions, it can be implemented by the host software. 
 
3.2 USB transfer types 
USB defines four types of transfers: control transfer, synchronous transfer, interrupt transfer, and batch transfer. Among them, control transfer refers to reliable, non-periodic, bursty communication initiated by the host client software, mainly used for the transmission of control commands and status information; synchronous transfer refers to periodic and continuous communication between the host and the device, generally used to transmit real-time information. This type retains the ability to include the concept of time in the data, but the transmission is not necessarily urgent; interrupt transfer refers to the transmission of a small amount of data, low speed, and periodic; batch transfer refers to non-periodic, large, and reliable transmission, and its typical application is to transmit data that can utilize bandwidth. 
3.3 USB device request 
USB devices should respond to request commands from the host through the default control pipe (Default Control Pipe). These requests are completed by using control transfers. The request and the request parameters are sent to the device through the Setup packet, and the host is responsible for setting the value of each field in the Setup packet. There are three types of requests included in USB device requests: standard, manufacturer, and device class. Standard requests are used to complete the device enumeration process; manufacturer requests are used to complete user-defined requests; device class requests refer to requests transmitted by certain specific USB device classes, such as printer classes. Device request requirements have strict definitions, including type, device request, value, index, and length. 
3.4 USB driver structure 
The S3C2440A chip supports USB1.1 protocol and USB 2.0 protocol. This design is for USB Host (host, type A) and is written based on USB 1.1 protocol. The program structure and data transmission flow are shown in Figure 4. 
 
The writing of the driver is mainly divided into the following parts: hardware abstraction layer, interrupt service program, standard device request and main loop. The hardware abstraction layer implements the direct read and write operations of S3C2440A on the I/O port; the interrupt service program handles various interrupts, including requests on the bus task; the standard device request completes various standard requests sent by the host, which is used to complete various enumeration requests; and the main loop is responsible for completing the data collection and other tasks of the foreground. After all tasks are completed, they must return to the main loop. 
4 Conclusion 
This design uses Samsung's ARM9 S3C2440A chip as the CPU. Compared with the original single-chip microcomputer-based model, the peripheral circuit is simpler and it is easy to reliably implement the USB interface function of the embedded terminal. In debugging, the embedded development board GEC2440A kit used also provides a serial port tool DNW. This tool can be used to detect whether the driver is correct or not. For example, if the program is written correctly, the DNW serial port will prompt "USB IS CONNECT". Since the S3C2440A chip has rich functions, such as the processor can improve the computing speed, the LCD can interact with the human-computer, and the network port can connect to the Internet, the developed embedded terminal can not only improve the overall performance, but also lay the foundation for future applications.
Keywords:ARM Reference address:Embedded USB interface design based on ARM

Previous article:Detailed explanation of uboot transplantation
Next article:Hardware Design of Embedded USB Host

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号