文献出处:Vidojkovic M. The Design and Implement of TCP/IP Protocol Cluster on AVR Singlechip [J]. Biomedical Circuits and Systems, IEEE Transactions on, 2014, 5(6): 523-533.
The Design and Implement of TCP/IP Protocol Cluster on AVR Singlechip
Vidojkovic M
ABSTRACT
With the rapid development of the embedded technology, research and implement of the Internet of things will be a new technology revolution, yet the implement of the Internet of things is on the base of the communication between the things. For this reason, realizing the function of communication between singlechip is particularly important. Based on the characteristics of the embedded microcontroller, we analyzed the traditional PC TCP/IP protocol, and appropriately tailored TCP/IP protocol cluster on the basis of the characteristics of embedded singlechip. At last, we realized the reduced TCP/IP protocol cluster suitable for embedded singlechip, on AVR singlechip platform.
Keywords: The Internet of Things, Webit, Embedded System, TCP/IP Protocol, Ethernet 1. Introduction
The Internet of things means a kind of net that via infor-mation sense equipment such as FRID, infrared sensor, GPS, laser scanner and so on, in arranged protocol, join up between anything and the Internet to communicate information and realize intelligent identification, tracing, monitoring, and management. The concept of the Internet of things is suggested in the year of 1999. It is the \with things\It means two aspects: the first one is, the core and foundation of the Internet of things is still in the Internet, which based on, extending and expanding the Internet; the second one is, its client side extends and expands to anything, to make the in-formation exchanging and communication [1-3].
With the rapid development of computer and network technology, Internet has become an important means of information transmission, more and more embedded equipments are necessary to achieve the Internet's net-work [4-5]. Relative to the PC,
computing and storage resources of embedded systems are relatively limited; therefore to achieve all the TCP/IP protocol cluster in the embedded singlechip is quite unrealistic. So that, in order to save the system resources and ensure the reliability of the system, under the condition of improving the per-formance of embedded system, it's necessary to targeted modular simplify TCP/IP protocol. 2. Adoptive Equipment and Testing Platform
Webit is an overall solution that makes the equipments intelligent and networking. It is the new network equip-ment system structure with the elements of Internet and its basic idea is an independent, low-cost 3 W server embedded in equipment, to make the equipment has in-dependent network intelligence.
Webit is an embedded Internet product decided by Liaoning Provincial Key Laboratory of Embedded Technology by themselves. Webit 1.0 is successfully pass technical appraisal and the trademark registration in the year of 2000, and Webit 2.0 (Internet non-standard electrical equipment access server) passed the appraising meeting of scientific and technological achievements held by science and technology commission of Liaoning province in May 2001. Considering that webit is AVR 8 bit singlechip, its storage unit is very limited, therefore it's very important to design a kind of TCP/IP protocol cluster suitable for the products.
The performance of Webit 2.0 as follows: * Without depending on PC system structure; * Using Atmel AVR RISC processors; * User-defined Web pages;
* User-defined CGI programs used to control; * 14 bit I/O interface (TTL level); * TTL level UART supported 115200 bps; * 10 M Ethernet interface (RJ-45); * System programming (ISP);
Overview of Ethernet controller chip RTL8019AS in Webit:
RTL8019AS is a highly integrated Ethernet controller, it can simply answer plug and play NE2000 compatible adapter, which has two-fold and power decrease
charac-teristics. Through the three-level control characteristic, RTL8019AS is the best ideal choice for network equip-ment GREEN PC in all already known things. The two-fold function can simulate send and receive the spread between twisted-pair and all two-fold Ethernet switches. This not only can make bandwidth stronger from 10 Mbps to 20 Mbps, but also avoid read muliaccess agreement because of Ethernet channel fight character. Microsoft's plug and play function can alleviate user lower income and focus on the adapter resources, such as the input and output, IRQ, memory address, etc. How-ever, in special application without plug and play func-tion of compatibility, RTL8019AS support s JUMPER and JUMPERLESS options.
In order to provide complete plug and play solution, RTL8019AS integrated 10BASET transceiver, and auto-examination function between AUI and BNC interface. In addition, 8 IRQ BUS and 16 basic addresses BUS provide comfortable environment for large resources situation.
RTL8019AS supports 16 k, 32 k and 64 k bytes mem-ory BROM and the flash memory interface. It provides the page model function, which can only support 4 M bytes BROM under 16 k bytes of memory system space. BROM's useless commands are used to release BROM memory space. RTL8019AS designed the singlechip with the 16 k bytes SRAM, so that not only provides more friendly function, but also saves SRAM storage resources.
3. The design of Webit Reduced TCP/IP Protocol Stack
In the AVR singlechip, due to the relatively limited re-sources, the TCP/IP protocol cluster of complete function cannot be achieved. So according to the characteristics of AVR singlechip, we cutting the original TCP/IP protocol cluster obtains the reduced TCP/IP protocol cluster.
Meanwhile, based on the architecture of TCP/IP pro-tocol stack, we adapted the design method of network slice model. The architecture of TCP/IP protocol cluster after simplify contains the ARP, IP, ICMP, UDP, TCP protocol processing model, etc. [6-8]. Each layer of the architecture of TCP/IP protocol stack is designed as a module of independent function, handles their data. Dif-ferent modules can be invoked by function to turn over datum to upper or lower processing module [9]. Figure 1 shows
the simplified TCP/IP protocol architecture.
Known by Figure 1, when the AVR singlechip re-ceives data from network, data packet processing mod-ules will base on certain condition to choose the ARP module of link layer or the IP protocol module of net-work layer to process.
Likewise, when the data packets are processed by UDP and TCP protocol modules of transport layer, it will turn over processed packets to IP protocol processing module, and make encapsulation for IP first address, the first (such as the fields like address, type of agreement, etc.) by corresponding function calls. Then transfer the data-gram including IP first and TCP first to the lower layer by function call, until the data is sent smoothly. The TCP/IP protocol processing is shown in Figure 2.
4. The Design and Implement of Simplified Embedded TCP Protocol
First, in Webit, we format and size of the MAC and IP address, system address configuration, and size of the buffer were defined already. We make the address format of MAC, IP to become fixed value in system. The system configuration is used for setting specific value of the IP address, the port and MAC address. In this system, for the limited data needed the singlechip to process, so we don't set the buffer larger than normal.
4.1 The Implement of ARP Protocol
Because the embedded singlechip is normally in the ser-vice of the passive state. So while we design and imple-ment the ARP protocol, we don't implement the function of address mapping table, neither realize the function of querying any client mapped IP into the MAC address, only need to achieve when other client to query the local Mac address. Packet and get feedback of the relationship between own IP and MAC address, and send.
When the embedded singlechip receives ARP packets from Ethernet, we according to the type of operation codes of the packets decide type of ARP packet, if the ARP request packet, compare destination IP address field of ARPP packet with the local settings of IP address. If it's equal, local MAC address packaging to responded ARP reply packet, if not, don't do processing, discard it. The processing flow of ARP
packet is shown in Figure 3. 4.2 The Implement of IP Protocol
The IP protocol is the core of the TCP/IP protocol cluster. All the ICMP, UDP and TCP data transmit as IP datagram format. In the IP protocol processing modules, While implement the IP protocol module, we firstly received the IP date packet from the Ethernet and decide whether the destination IP address field values in the head of da-tagram equals local IP address, if not, discard; if consis-tent, check such field as the version number and check-sum of the IP datagram, etc.
After examination, confirm the packet is right, and then decide to choose ICMP protocol, UDP protocol or TCP to submit to upper processing, according to the type of IP data. In addition, another function of IP protocol module we designed and implemented is to make the message encapsulation delivered from upper into IP data, then turn over IP data encapsulation to link layer to make data frame encapsulation and sending. The processing flow of IP protocol is shown in Figure 4. 4.3 The Implement of ICMP Protocol
ICMP protocol is a kind of information transfer control protocol. We think about the embedded singlechip as a server is responded the client commonly, as a passive device, it does not need to initiatively send back the message. So we only implement the receiving and han-dling the Echo Request between singlechip and other devices in the ICMP protocol module, and also send the Echo Reply. The implementation of ICMP protocol is as follows: read type code of the first byte of ICMP data packets, and check the ICMP packet types. If the type code is 8, the type of packets will be modified to 0, fill each field of packets to make the encapsulation of Echo Reply packets needed to be sent back, finally calls Sen-dIP function, make ICMP data packets into IP datagram encapsulation to send. If the packets' type code isn't 8, discard the packet. The processing flow of ICMP proto-col is shown in Figure 5. 4.4 The Implement of UDP Protocol
UDP protocol provides reliable, connectionless commu-nication between applications, it transmits datum to the IP layer and sends out, but does not guarantee they can reach the destination.
When the UDP protocol modules receive packets, first locate the port fields of UDP packets, save the remote and purpose port of the UDP packets, then the compare the objective port of the packet with the port of local regulations, if not equal, discard it; if equal, call the cor-responding function. Finally, set the source port, objec-tive port, data length, checksum field in the header of UDP packet, add datum to be sent, make encapsulation and sending by IP layer. The processing flow of UDP protocol is shown in Figure 6.
4.5 The Implementation of TCP Protocol
Due to the limited resources of singlechip, and to handle TCP packet better, so while implementing the TCP pro-tocol module, we reduced the common TCP/IP protocol, and did not implement the sliding window protocol, flow control and congestion control mechanisms. Meanwhile, we set two TCP connection control block in the TCP protocol modules, and adopt the response mode with single window. When receiving TCP packets, first locate mark field of TCP packets, if the TCP packet is required to build a new connection, check whether still exist spare TCP connection control block in the system. If present, this spare control block will be used as the control block for this connection, and establish connections. Con-versely, if there is no spare TCP connection control block, and do nothing.
When the mark field of the TCP packets is another type, search whether exist TCP connection control block corresponding to the TCP packets. If present, judge ac-cording to the mark field of the value of SYN, FIN, ACK and so on, then choose corresponding function to process packets. If don't exist TCP connection control block cor-responding to the TCP packets, don't do anything. Construction and closing the connection of the TCP protocol are through the \\spe-cific wave\the specific approach. The proc-essing flow of TCP protocol is shown in Figure 7. 5. Testing
In order to test whether the TCP/IP protocol realized can achieve the desired objective, we carried on a series of tests.
The Ping command is the most frequently used in network. This command sends
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库单片机外文文献1在线全文阅读。
相关推荐: