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 implemented 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 the wireless network card of USB device is 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 (UARTs), 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.
2 USB Wireless Network Card Driver
2.1 Linux USB Driver Module Structure
For the USB wireless network card connected to the 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 driver and the USB device driver. In terms of the host control machine, there are mainly two specifications: UHCI and OHCI.
The upper-level 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 device connections, 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) for data transmission between USB device class drivers and USBD, and between USBD and HCD.
2.2 LinUX network driver structure
All Linux network drivers follow a common interface. The object-oriented approach is 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 most important task in the network driver is to complete the device driver layer function to meet the required functions.
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, but 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 importance to USB devices. 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 device endpoint 0, and saves the properties of these resources after parsing in preparation for data transmission.
2.2.2 Design of USB network device driver
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 registers and unregisters the module by calling module_init to initialize a module through the initialization and elimination functions of the display module, and calls the module_exit function when uninstalling.
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 Compilation of 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, the rt73.ko driver module is downloaded to the development board. Since Linux supports dynamic loading of modules, it is very convenient to load the module into the kernel with "insmod". Check the loaded module through "lstood", and then 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, receiving sensitivity, access mode, wireless network standard, and encryption switch.
Finally, write the wireless network startup and self-configuration program to automatically configure the 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 test bandwidth 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 reasons are being analyzed. The test results are shown in Figure 3.
4 Conclusion
Linux is the operating system with the highest usage rate in embedded systems in the market today. Its driver mode supports module stacking technology, and kernel developers have provided some general 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:Hardware system structure and software flow of Bluetooth access point based on ARM7
Next article:FPGA driver development for ARM920T based on Linux platform
Recommended ReadingLatest update time:2024-11-17 00: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
- [Mil MYC-J1028X development board trial] Build a DLNA streaming media server
- Share a video explanation by a senior hardware engineer - 3C certification surge and voltage drop test standards - the key is free
- [Qinheng Trial] CH559EVT Trial 3: Flowing Water Light
- ST MEMS Device Resource Library - State Machine (FSM) and Machine Learning (MLC) Functions [LSM6DSOX]
- Today's live broadcast: Typical applications of ADI switch/multiplexer series products
- [Analog Electronics Course Selection Test] + Basic Knowledge of Operational Amplifiers
- ARM9 programming STM32F030 microcontroller problem
- [Repost] Useful information: One article teaches you how to understand inductors
- Research and Design of SDTVHDTV Conversion Based on FPGA
- What does this addition and subtraction circuit do here?