Implementation of Ethernet access system based on single chip computer and analysis of network performance

Implementation of Ethernet access system based on single chip computer and analysis of network performance

[Abstract] Introduce the Ethernet control chip RTL8019AS, and design the Ethernet access system embedded in TCP / IP protocol in the single-chip computer with limited storage space, and realize the RS-485 field bus device access Ethernet through embedded TCP / IP single-chip system , Complete the remote communication and control of PC and terminal equipment, and finally test and analyze the system performance, and achieved satisfactory results.
[Keywords] SCM; Ethernet; RTL8019AS chip; TCP / IP protocol; network performance analysis



1 Introduction The rapid development of interconnected network hardware and software has led to an exponential growth of network users. In the context of the increasingly networked electronic devices, more and more embedded applications need to support network functions. TCP / IP is a set of protocols that interconnect various systems on the Internet, and it has become one of the most commonly used network standards. While using computers for network interconnection, various home appliances, instrumentation, and data collection and control equipment in industrial production are gradually becoming networked, in order to share the huge information resources in the network. As long as the TCP / IP protocol is implemented on those devices and a network interface is added, it can be easily accessed into the existing network. Considering the low cost of the single chip microcomputer, the use of UDP (User Datagram Protocol), IP (Network Message Protocol), ARP (Address Resolution Protocol) and simple application layer protocol in the TCP / IP protocol, according to the needs of the application to make corresponding reduction In this article, we will introduce the design of embedded TCP / IP single-chip microcomputer system using AT90S8515 single-chip microcomputer and 10Mbps Ethernet controller chip RTL8019AS, and successfully implement the RS-485 field bus device to access Ethernet through the single-chip microcomputer system embedded in TCP / IP to complete the PC. Remote communication and control with terminal equipment, and finally analyze the system performance.
2 Introduction to Ethernet Controller RTL8019AS RTL8019AS is a 10 Mbps Ethernet controller chip based on ISA bus produced by Taiwan REALTEK Company. Due to its excellent performance and low price, it occupies a considerable share of the 10Mbps network card in the market.
Main performance:
(1) Comply with the standards of Ethernetâ…¡ and IEEE802.3 (10Base5, 10Base2, 10BaseT);
(2) Support full-duplex, and the transmission and reception can reach 10Mbps at the same time;
(3) 16KB on-chip SRAM, used to send and receive buffer, reduce the speed requirements of the main processor;
(4) Support 8 / 16-bit data bus and 8 interrupt request lines (6) Support jumper and non-jumper mode;
(7) Allows programmable output of 4 diagnostic LED pins;
(8) 100-pin PQFP package.
The chip is very powerful. It integrates the functions of the media access sublayer (MAC) and the physical layer. It has greatly improved the RTL8019, with stronger processing power and more flexible operation. However, when interfacing with a general single-chip microcomputer, only a part of it is needed to complete the network communication function, and the other pins are left floating.
3 Interface circuit with AT90S8515 single-chip system This article uses AT90S8515 single-chip microcomputer, compared with 8051 series single-chip microcomputer, it has programmable 8K FLASH in the system, internally integrates on-chip 512-byte EEPROM and 512-byte SRAM, uses simplified instruction set and writes programs Concise and convenient debugging procedures.
The system hardware connection is shown in Figure 3-1. The system provides an RJ45 interface to connect to the Ethernet network, and provides an RS-485 interface to connect with field devices to achieve data network transmission and remote control of the device.


The interface signal lines provided by AT90S8515 MCU are: 8-bit data bus D0 ~ D7 of PA port, 5 address lines A8 ~ A12, read signal line RD, write signal line WR, 2 control lines PB0, PB1. These signal lines are correspondingly connected to the signal lines of RTL8019AS. Among them, IOCS16B of RTL8019AS is connected to the pull-down resistor, so that the chip works in 8-bit bus mode, the reset is controlled by PB0, and the PB1 chip select address is enabled. The clock circuit is 8MHz for single chip and 20MHz for network chip. At the field control end, an RS-232 to RS-485 485 chip (WM485) is needed, and a network isolation filter (FM2146) is required at the network access end, so that the interface circuit design is completed, then the address space is calculated and allocated, and written Assembler. In this system, the address mapping space of the network chip in the single chip microcomputer is 80 ×× H-0x9F ×× H, and the internal I / O base address of the network chip is 300H.
A few notes on the design circuit, the JP pin of RTL8019AS is connected to a high level to make the chip work in the jumper mode; the address latch is not used, and the RTL8019AS data is directly read and written with the address data multiplexing port. The network chip only uses The 5-bit address line has no conflicts; the system uses the query mode of operation without connecting interrupt signal lines, simplifying the circuit design.
4 Software design
4.1 MCU assembly program embedded with TCP / IP protocol MCU access to Ethernet must be embedded with TCP / IP protocol so that the application program of the user terminal can use general network programming techniques, such as the use of Socket socket, established with MCU Connect to achieve data communication. The assembly flow chart is shown in Figure 4-1. The MCU first initializes the stack and serial port, and initializes the RTL8019AS network chip. The IP address of the system is stored in the on-chip EEPROM of the MCU. After resetting the MCU, these data are first read to initialize the network. Due to the limited resources of the MCU, the network protocol is tailored according to the needs of embedded applications. Some protocols such as ARP, RARP, IP, and UDP are used in the system to ensure that the MCU is connected to the Ethernet and the code size is sufficiently small. The single-chip computer mainly completes the unpacking of network data and the packaging of serial RS-485 data. When the Ethernet data arrives at the device, the MCU uses the query method to read the network data and analyze it. If it is an ARP (Physical Address Resolution Protocol) packet, it is transferred to the ARP processing program, and the RARP packet is sent to the IP address and The physical address is added to the local area network to establish the mapping. If it is a UDP data packet and the IP address and port number are correct, the data packet is received. After the data is unpacked, the data part is output through the serial port to control the RS-485 field device. Conversely, if the field sends data to the MCU through the serial port, the MCU packs the data according to the UDP protocol format, sends it to the RTL8019AS, and the RTL8019AS outputs the data to the local area network. If necessary, you can also complete the data pre-processing before receiving the serial data, and then send the processed data to the local area network.

In the 4-layer model of TCP / IP protocol, the link layer is partially completed by RTL8019AS, the network layer and the transmission layer are processed by the single-chip microcomputer, and the application layer can be completed within the single-chip microcomputer as needed, or can be transferred to the user or terminal device by the single-chip microcomputer. .
In the program processing of the single-chip microcomputer, there are mainly complete ARP, RARP protocol modules, UDP protocol modules, other protocols are selected according to the needs, to complete the system requirements, the initialization of the network chip is necessary, the correct configuration of the RTL8019AS registers can make the hardware normal work.
4.2 User terminal program design In order to realize the control of the MCU communication system device embedded in TCP / IP, the author uses VC ++ 6.0 to write a data transmission application program on the user terminal PC. Usually Winsock programming is used, first create a socket, bind the IP address and port number, use UDP datagram, establish a connection with the socket embedded in the TCP / IP microcontroller system, and when network data arrives, VC ++ responds to Receive ( ) Message, read data and process; when the user needs to control the embedded device, call the Send () function to send control commands or data.
In the debugging test, the Sniffer software was used on the PC to monitor (or intercept) the TCP / IP protocol packet data flow between the PC and the MCU. The performance of the system was tested and satisfactory results were obtained.
5 System performance analysis The subjective evaluation of network performance can be reflected by the following indicators: capacity, utilization, optimal utilization, throughput, available load, accuracy, efficiency, delay, delay variation, response time, etc. The final manifestation of network performance is the subjective evaluation of the end user during use.
The following mainly analyzes the impact of each network layer on system performance:
(1) Physical layer and data link layer performance. From the perspective of the system hardware, the functions of these two layers are mainly completed by RTL8019AS. The maximum transmission packet of each frame is 1K bytes, but the reading and writing of data are done by the single-chip computer, so the bandwidth of the entire system is limited by the speed of the single-chip computer. The theoretical maximum bandwidth of the design system is 8Mbps, and the optimal utilization rate is 3 ~ 4Mbps.
(2) Network layer performance. Here we mainly consider the choice of transmission protocol. For the TCP protocol with retransmission mechanism, it means that there are a large number of datagram retransmissions under the bad network environment, which reduces the network utilization rate and has a large delay. In the specific application of the system, the UDP protocol is used to meet the real-time requirements of data collection. For packet loss, the necessary control strategies can be taken at the application layer to improve.
(3) Application layer performance. Host, server, and application protocol constitute the three elements of network application layer performance. The host and server are the two ends of the network connection, and the application protocol is a contract in the data transmission process at both ends of the network connection. The program uses a socket program running in the Ethernet embedded system as a server, and uses RS-485 communication protocol to control and collect data from remote devices. In this process, the performance problems of the network server have the greatest impact: the load of the server, the request queue is too long, the protocol parameter settings are improper, and so on.
6 Conclusion Ethernet's low cost, openness, extensive development and application software, and hardware support make this single-chip microcomputer data communication system embedded with TCP / IP protocol low cost, less hardware, stable and reliable operation, and fast transmission speed. , Short development cycle and other advantages, has a wide range of application prospects, especially in the field of remote monitoring such as data collection and data transmission, and the network informatization of smart appliances. At present, the system has been successfully applied in substation monitoring systems and remote data acquisition systems.

60Hz Diesel Generator

60Hz Diesel Generator Set,Diesel Generator,Diesel Genset,Diesel Generator Set

Shanghai Kosta Electric Co., Ltd. , https://www.ksdpower.com

This entry was posted in on