Embedded systems are widely used in many fields such as industrial measurement and control, intelligent instruments, and smart homes. With the continuous expansion of the application scope of embedded systems and the increasing popularity of network applications, more and more embedded systems require network functions. Samsung's S3C2440A is one of the most widely used embedded microprocessors in China. In the S3C2440A application system, it currently only supports 10/100M network interface, which has great practical value. It can not only expand the application field of S3C2440A, but also provide a simple and easy reference for other embedded systems to access the network at high speed.
Design
This system is mainly composed of S3C2440A, memory, AX88180, Gigabit PHY chip 88E1111, embedded Linux, network driver, etc. (see Figure 1). The embedded Linux kernel is responsible for the management of system tasks and integrates TCP/IP protocol to facilitate the control of network functions. S3C2440A is responsible for the control of the entire system. It is connected to AX88180 in bus mode and is the main body of communication control. S3C2440A programs the internal registers of AX88180 through the network driver to realize the sending and receiving of Ethernet data, thereby completing the data transmission between the network and the system. AX88180 and 88E1111 are interconnected by RGMII interface, which is responsible for the implementation of the underlying protocol for data transmission.
Here is a brief introduction to the S3C2440A and AX88180 devices, which are the main bodies of communication control.
S3C2440A is a 16/32-bit RISC microprocessor based on ARM920T core, running at a frequency of up to 500MHz. It is mainly aimed at handheld devices and cost-effective, low-power applications. It is suitable for the development of various high-end handheld, small terminals and network application products. It has very rich on-chip resources, such as LCD, SDRAM, NAND FLASH, DMA, AD, PWM controllers, as well as UART, USB, camera, touch screen, IIC, IIS, SPI, SD, MMC, AC97 and other interfaces.
AX88180 is a Non-PCI Gigabit Ethernet control chip launched by AsiaInfo Corporation of Taiwan. It has a built-in 1000Mbps Ethernet media access controller (MAC); a 40KBytes SRAM network packet buffer; and hardware support for IP/TCP/UDP checksum offloads. It can be easily connected to a general 16/32-bit microprocessor and can be accessed like SRAM. It complies with IEEE 802.3/lEEE 802.3u/IEEE 802.3ab protocols and is suitable for streaming media, multimedia networks, high-bandwidth transmission, and other fields, such as digital media, home gateways, and IP TV.
Hardware Design
Since the hardware circuit is relatively complex, only the core circuit connection is given here, as shown in Figure 2. The S3C2440A and AX88180 are connected in bus mode. The address bus A2-A15, data bus D0-D31, read and write signals, etc. can be directly connected. The 40M~100M clock signal of AX88180 is provided by S3C2440A. The AX88180 interrupt signal is connected to S3C2440A EINT11. The entire interface circuit does not require an external circuit; the simplified Gigabit Media Independent Interface RGMII interface is used between AX88180 and the PHY chip, and the signals can be directly connected one by one.
Software Design
From an overall perspective, the Linux network system can be divided into the hardware layer, device driver layer, network protocol layer and application layer. The S3C2440A system has embedded Linux, integrated TCP/IP and other protocol stacks. The application layer program can be written by yourself or transplanted. Here we mainly analyze the implementation of the device driver.
In embedded Linux, the entire network driver framework can be divided into four layers, namely protocol interface layer, network device interface layer, device driver function layer, network device and network media layer. This framework has been built in the kernel network module. When designing the driver, the main work to be done is to complete the device driver function according to the device structure defined by the upper network device interface layer and the specific hardware characteristics of the bottom layer. The driver mainly consists of initialization, opening, closing, data receiving and sending functions.
Initialization function
The initialization function completes the initialization of the network device and is called by the init function pointer in the data structure device. After loading the AX88180 driver module, the initialization process will be called. This first detects the existence of the network physical device by detecting the hardware characteristics of the physical device, and then configures the resources required by the device, such as interrupts. After these processes are completed, the device data structure is constructed, and its related variables are initialized with the detected data. Finally, the device is registered with the Linux kernel and memory space is requested.
Open Function
The open function in the network device driver is called when the network device status changes from down to up, that is, when it is activated. A lot of AX88180 and 88E1111 initialization work can be done here. When the driver is loaded as a module, the open function also prevents the device from being in the open state when the module is unloaded. [page]
Close Function
The close function does the opposite of the open function and is called when the device status changes from up to down. It is used to release resources to reduce the system burden. When the driver is loaded as a module, the close function also reduces the number of times the device is referenced in order to uninstall the driver.
Send Function
The send function is one of the key processes of the network driver. It is connected to dev->hard_start_xmit and is called when the kernel sends data out through the device. The system allocates a 64K address space to AX88180, with 8000H-FBFFH as the send buffer address. When the system calls the driver's xmit, the sent data is placed in a sk_buff structure, sent to the data buffer address, and then sent to the network by AX88180. If the transmission is successful, hard_start_xmit releases sk_buff and returns 0; if the device cannot process it temporarily, it returns 1. The hardware generates an interrupt after the transmission is completed.
Interrupt and receive functions
The interrupt and receive function is also one of the key processes of the driver. If data is received, AX88180 will generate an interrupt notification system. In the interrupt handler, the driver applies for a sk_buff(), reads data from AX88180 and places it in the receive buffer address 0000H~7000H, and then fills some information in sk_buff. The protocol type of the received frame is determined by skb->dev=dev, and skb->protocol is filled in. Then the pointer skb->mac.raw points to the hardware data, and then the frame header is discarded. After that, skb->pkt_type must be set to indicate the link layer data type, and finally netif_rX() is called to transmit the data to the protocol layer.
The following is part of the sending function code:
Conclusion
The application scheme of the Gigabit network interface introduced in this article has been realized in the S3C2440A system. In the 1000 Full-duplex mode, the data transmission rate can reach 200Mbp. When using FTP to download data, the speed can reach more than 4Mbps, which is 5 to 6 times that of using a 100M network interface. If other higher-speed microprocessors are used, the speed of the network interface will be even higher.
Previous article:Design of Industrial Ultrasonic Flaw Detector Based on S3C2440 Microprocessor
Next article:Design of Data Acquisition System Based on AD7762 and FPGA
Recommended ReadingLatest update time:2024-11-16 21:01
- Popular Resources
- Popular amplifiers
- Machine Learning and Embedded Computing in Advanced Driver Assistance Systems (ADAS)
- Embedded Systems with RISC-V and ESP32-C3 - A practical introduction to architecture, peripherals and
- Multiplexed Networks for Embedded Systems: CAN, LIN, FlexRay, Safe-by-Wire
- Principles and Applications of Single Chip Microcomputers and Embedded Systems
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
- Lead Angle/Conduction Angle of Brushless DC Motor
- [Bluesun AB32VG1 RISC-V board "meets" RTT] + unpacking and environmental installation
- [Evaluation of EVAL-M3-TS6-665PN development board] Hardware introduction and features
- Renesas RL78 D1A has an error when assigning an unsigned short type variable to a floating point number
- Source code of FFT transform IP core.zip
- Competition Sharing 3: RSL10 Bluetooth SoC BMM150 Geomagnetic Sensor Data Collection
- Understanding TMS320C6000 gel files
- NASA is going to build Wi-Fi on the moon? What do you think?
- I have a question, STM32 drives a three-phase DC brushless controller to drive a DC brushless motor with Hall
- An employee was dissatisfied with being fired and used a "crawler" to delete company data