1 Hardware system composition
1.1 Introduction to USB wireless network card
Wireless network card is an important part of wireless local area network (WLAN). The physical layer and MAC layer of WLAN are completed by the hardware and software of wireless network card, while all layers above LLC layer are realized by computer software. WLAN includes network interface card (referred to as wireless network card) and access point/bridge (AP/bridge) for communication. Among them, wireless network card provides the interface between end-user equipment (handheld device) and access point/bridge. At present, wireless network card is widely used in the form of PCMCIA and CompactFlash (CF) card. Most of the available wireless network cards are based on Intersil Prism or Lucent Hermes chipset, among which wireless network cards for USB devices are supported by Ateml chipset. This system uses D-Link's WLG-122 wireless network card, with Prism2 chipset, which is connected through USB host port.
1.2 System composition
The main controller uses Atmel 9261, with an operating frequency of 180 MHz, 16 KB data cache and 16 KB instruction cache, external 64 MBNAND FLASH and 64 MB SDRAM, and the peripheral interface consists of 10/100 Mb/s adaptive Ethernet card, 3 USB 2.0 interfaces, 2 universal asynchronous receivers and transmitters (UART), LCD interface and serial peripheral interface (SPI), which can be easily connected to external working devices. The operating system uses Linux 2.6.15; the bootloader uses U-boot; the root file system uses ramdisk. After the system starts, the yaffs file system is mounted. The system uses Atmel 9261 development board of Ateml company. The peripheral interface includes 2 USB host interfaces, one of which is connected to an external USB wireless network card. The wireless router uses Cisco-Linksys's WRTl60N, which supports 802.11g standard, TCP protocol and TFTP protocol, as shown in Figure 1.
Figure 1 Hardware structure
2 USB wireless network card driver
2.1 Linux USB driver module structure
For the USB wireless network card in the access system, from the perspective of the CPU, the first thing you see is the USB bus, and then the network card chip, so the USB driver must be implemented before the network card driver. The USB device interface is divided into the host side and the device side, so the USB driver is also divided into the USB host side driver and the USB device side driver. In terms of the host control machine, there are mainly two specifications: UHCI and OHCI.
The upper application software accesses the system's USB devices in the form of a file system. Each USB device connected to the system bus can correspond to one or more drivers at the same time, that is, each USB device can set one or more nodes on the Linux system for application use.
Since the USB interface is a master-slave mode and a tree-like network structure with multiple devices connected, the USB host must have the function of configuring and managing all different types of USB devices connected to the bus. The Linux USB host driver can support multiple USB bus functions at the same time, and each USB bus works independently. The USB host driver consists of three parts: the USB host controller driver (HCD), the USB driver (USBD), and different USB device type drivers. Figure 2 describes the structure of the Linux USB driver. Linux defines a universal request block (URB) to transfer data between the USB device class driver and USBD, and between USBD and HCD.
2.2 LinUX Network Driver Structure
All Linux network drivers follow a common interface. Object-oriented methods are used in design, that is, a device is an object (net device structure), which has its own data and methods. The most basic methods of a network device are initialization, sending and receiving. The structure of the Linux network driver can be divided into four layers: network protocol interface, network device interface, device driver function and network media. The main task of the network driver is to complete the device driver layer function to meet the required functions. [page]
Figure 2 LinUX network driver structure
2.2.1 Access and control of USB wireless network card driver devices
Unlike PCI, ISA and other devices, new generation buses such as USB and 1394 do not have IO/MEM mapping, interrupt and DMA hardware resources. Instead, they are replaced by abstract hardware resource concepts. For USB devices, resources mainly include configuration, interface and endpoint. Among these resources, endpoints are of the most important significance to USB devices. The actual data transmission is achieved through the reading and writing of endpoints. The driver obtains these resources through descriptors. During initialization, the USB driver reads the descriptor from the device endpoint 0, and saves the properties of these resources after parsing to prepare for data transmission.
2.2.2 USB network device driver design
The USB wireless network card driver first registers itself with the USB subsystem, and then uses the vendor id and device id to determine whether the hardware device has been inserted into the bus. The camera driver needs to create a
When the wireless network card is inserted into the USB bus, the USB core will call the Probe method to detect the information passed in to determine whether the wireless network card device matches the driver, and fill in the struct net_device to complete the initialization of the network device. When the wireless network card is unplugged, the USB core will call the Disconnect method to complete the cleanup. The driver initializes a module by calling module_init through the initialization and elimination functions of the display module, and calls the module_exit function when uninstalling. [page]
Among them, the open function mainly completes the initialization of the pAd data structure describing the network card hardware, including the urb packet receiving function, the interface configuration function, the initialization of the send and receive data structure and the MAC address copy function, and finally the net_dev data send and receive function. The RTMPSend-Packets function is responsible for sending the packaged network data packets. The communication between the wireless network card driver and the USB core is transmitted through interrupt/batch mode.
3 Compilation and testing
3.1 Compiling the wireless network card driver
The Linux kernel version of this system is 2.6.15. Configure the kernel on the host machine, remove unnecessary functions in the kernel through "make menuconfig", and add support for WLAN. Click Device Driver→Network device support→Wireless LAN (non-hamradio)→Select Wireless Lan driners (non-hamradio) & Wireless Extensions; then enter the source code of the general USB-WLAN driver, modify the makefile, relocate the kernel folder option to the Linux kernel just compiled, and compile and generate the rt73.ko driver module in this folder through "make".
There are many ways to transfer files in ARM embedded Linux development, such as TFTP service and NFS file system. Here we download the rt73.ko driver module to the development board. Since Linux supports dynamic loading of modules, it is very convenient to load the module into the kernel using "insmod". The loaded module can be checked through "lstood". After that, the rt73 module has been successfully loaded.
Add wireless management applications, iwconfig, iwapy, iwlist, etc. to the development board file system to configure frequency, network, ID, ES-SID, reception sensitivity, access mode, wireless network standard, and encryption switch.
Finally, write the wireless network startup and self-configuration program to realize automatic configuration of IP address and wireless network card. At this point, the entire wireless network card driver has been compiled.
3.2 Test results and analysis
Start the wireless network and write a bandwidth test program. The test program adopts the C/S design mode. The client runs on the ARM development board and the server runs on a Linux PC in the local area network. The workflow of the test program is as follows: the client sends byte streams of different sizes, and the server processes and calculates the corresponding bandwidth to obtain a broadband curve, and then obtains the maximum bandwidth that the network can actually achieve. After repeated tests, the wireless network card can work stably. The bandwidth is 6 Mb/s within a radius of 50 m from the AP, which is still a certain distance from the theoretical value of 54 Mb/s. The specific reason is being analyzed. The test results are shown in Figure 3.
Figure 3 Wireless network broadband test results
4 Conclusion
Linux is the operating system with the highest proportion of embedded systems in the market today. Its driver mode supports module stacking technology, and kernel developers have provided some common modules. Starting from engineering applications, we have studied and transplanted the device driver of USB wireless network card under Linux. Based on this, we can build embedded wireless LAN, and it can also be used in places where wired network cannot be extended or difficult to install, and where there are requirements for flexible mobility and temporary use, such as adding cameras and image processing chips. It can also be used for remote wireless video monitoring in industrial sites.
Previous article:Data communication design scheme between ARM and DSP in embedded machine vision system
Next article:Design of fingerprint recognition access control system based on ARM
Recommended ReadingLatest update time:2024-11-16 15:00
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Learning ARM-LINUX embedded system based on LS_BBB development board Part 1: Platform Overview
- What is loop response?
- GD32E231 DIY Competition (3) GD32E231C driving OLED (128X32)
- Looking for domestic brushless motor control chip?
- A serial screen product with analog video signal usage sharing
- Useful information | Four major development skills for microcontrollers!
- 【TI mmWave Radar Review】+Configuration File Test (I)
- AC/DC voltage and current signal ADC acquisition
- EEWORLD University Hall----Microelectronic Devices and IC Design (Huazhong University of Science and Technology)
- Looking for QFN32/LQFP128 package PCB parts library