Design of Buoy Network Communication System Based on TCP/IP

Publisher:boczsy2018Latest update time:2012-04-18 Source: 电子测量技术 Keywords:TCPIP Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

The basic research of underwater acoustic channel matching is an emerging research field based on underwater acoustics, ocean physical acoustics and modern signal processing technology. The local sea area underwater acoustic channel measurement platform (Figure 1) built to meet the research needs can realize the systematic collection and real-time transmission of environmental information and channel parameters, and test the feasibility of the channel tolerance matching method.

The buoy system plays an irreplaceable role in the study of underwater acoustic channels due to its flexibility, high efficiency, and low self-interference. Most existing buoy systems use direct sequence spread spectrum radios for direct surface communications, which often do not use network protocols or use custom network protocols. The use of wireless bridges for surface communications and TCP/IP as the network protocol will greatly enhance the networking of the buoy system. At the same time, since the TCP/IP protocol is one of the most mature network protocols at present, the stability and scalability of the buoy network have been improved, and it is even possible to directly control the buoy system through the Internet. Therefore, this paper designs and implements a buoy network communication system based on the TCP/IP network protocol.

1. Design of buoy network communication system

1.1 Buoy communication system based on TCP/IP network protocol

The buoy used in the basic research of underwater acoustic channel matching has an underwater sensor unit, a signal processing unit and a surface communication unit. The surface communication unit is responsible for the information exchange between the buoy and the shore-based control station, the survey ship and other buoys, and is required to have a network communication function.

The buoy network communication system consists of a wireless bridge, a TCP/IP protocol control unit and a microcontroller (MCU), as shown in Figure 2. The wireless bridge uses a relatively mature bridge product, such as the BreezeNET wireless bridge, which transmits TCP/IP data packets through a wireless network. The MCU is responsible for setting the TCP/IP protocol stack, writing the data to be sent and reading the received data.

The implementation of TCP/IP protocol stack is the core part of the buoy network communication system. It can be implemented by software, but this method generally requires an MCU with a higher processing speed and occupies a large amount of code space. At the same time, programming requires a thorough understanding of the mechanism and details of the entire TCP/IP protocol, which makes development difficult. The hardware implementation method frees the MCU from the heavy work of running the network protocol, thereby improving system efficiency.

Data or instructions are sent or received by the wireless bridge. It is connected to the 10Base-T general Ethernet interface controller RTL8201 through the RJ45 interface via a transformer. RTL8201 exchanges data with W3100A through the MII standard interface. RTL8201 receives Ethernet frames from W3100A and then performs Manchester encoding. When sending Ethernet frames, a frame start flag is added to the front of the frame. When an Ethernet frame is detected in the network, the RTL8201 receiving module first uses a phase-locked loop circuit to synchronize with the physical signal, then samples and receives the physical signal and sends it to the Manchester decoding function block, and finally obtains the "0" code that can be recognized by W3100A (the frame preamble has been separated), and sends it to the network interface layer module through the MII interface. When sending data, the data is written into the sending buffer of W3100A by the MCU data interface. By controlling the relevant control registers of each protocol layer, the data is added with various control flags in the TCP layer, and encapsulated into a TCP segment to achieve reliable connection-oriented transmission. The TCP segment is then handed over to the IP layer for packaging. An important function of the IP layer is to implement the fragmentation of the TCP segment so that the IP datagram can use the data area of ​​the Ethernet frame with maximum efficiency. The complete IP datagram continues to be passed to the network interface layer. The LLC sublayer uses the unreliable bit link provided by the physical layer to achieve reliable packet transmission services. The MAC sublayer adds the physical address of the destination node to the data packet, and MAC implements unreliable packet transmission. After passing through the network interface layer, it is finally encapsulated into a frame format, and then sent to RTL8201 through the MII interface, where Manchester encoding is performed and a leading signal is added. When RTL8201 detects that the physical link is idle, it immediately sends the data frame to the Ethernet through the RJ45 interface. When receiving data, the opposite operation is performed. The transceiver receives the physical signal on the Ethernet, separates the preamble and performs Manchester decoding, and transmits the result to the network interface layer. The MAC sublayer of the network interface layer checks whether the physical destination address of the frame is the same as its own to decide whether to hand it over to the LLC sublayer. The LLC uses the error detection bit to determine whether the packet is correct. The correct packet is sent to the IP layer, where errors are detected, the IP layer is decapsulated, and the fragments are reassembled before being sent to the TCP layer. The TCP layer implements connection-oriented reliable transmission, so the TCP layer will perform strict error control, then take out the data from the TCP segment, and then transmit it back to the MCU through the data interface. The physical frame is unpacked through each protocol layer and finally the data is transmitted back to the MCU. However, if the IP address or data is wrong during unpacking at each layer, the data packet will be discarded and retransmission is required. If the message being processed is ICMP, UDP or ARP, the general process is the same, and the difference between different messages will be indicated in the corresponding packet header for protocol identification.

1.2 TCP/IP protocol stack W3100A introduction

W3100A is a TCP/IP protocol stack chip, which includes Internet protocols such as TCP, IP Ver.4, UDP, ICMP, ARP, and DLC, MAC Ethernet protocols. Its functional block diagram is shown in Figure 3. The W3100A chip consists of 4 parts: microcontroller interface unit, network protocol engine, dual-port RAM and network physical layer media switch interface MII (Media Independent Interface) unit. W3100A supports full-duplex 20Mbps data communication and can support 4 independent network connections at the same time; provides 16KB data buffer dual-port SRAM; uses 0.35μm CMOS process, 64-pin LQFP package; uses 3.3V power supply voltage, and its I/O interface is compatible with 5V digital logic level, which can be easily connected to MCU and DSP interface.

[page]

2. Circuit design

The main circuit of the system is composed of microcontroller MSP430F169, network protocol stack W3100A, Ethernet interface controller RTL8201 and network interface. The connection between W3100A and MSP430F169 can adopt I2C interface mode or direct bus mode. The advantage of using I2C interface mode is that the circuit is simple and occupies less port resources. However, the transmission speed of I2C interface will be subject to certain restrictions, so when higher transmission speed is required, direct bus interface mode can be used, as shown in Figure 4. W3100A provides MII interface connected to RTL8201, where pins RX_CLK, RXDV, RXD[0:3] and COL are used for data reception, while TX_CLK, TXE, TXD[0:3] are used for data transmission.

In the implementation of the interface, the Ethernet transformer is indispensable. On the differential transmission pin (TX+/TX-), a pulse transformer dedicated to 10BASE-T operation is required to send the data to the network. The data from the network also passes through the transformer and is received by the differential receiving pin (RX+/RX-). The main function of the Ethernet transformer is to separate the external line from the RTL8201 to prevent interference and burnout of components, and to achieve live plug-in and pull-out functions. This design uses the PULES J0011 transformer, and its internal structure is shown in Figure 5. The transformer integrates the RJ-45 connector, which simplifies the wiring while also improving the reliability of high-frequency signal transmission.

At the same time, when designing the reset circuit, it should be noted that since the reset pin of W3100A is valid at a high level, while the reset pins of MSP430F169 and RTL8021 are valid at a low level, it is required to generate both high and low reset signals when designing the reset circuit, as shown in Figure 6.

3. Software Design

3.1 MSP430 bus reading and writing

W3100A has a dedicated microcontroller interface connected to the MCU, and its bus operation is similar to the MCU's reading and writing of external memory. However, the MSP430 microcontroller does not have a dedicated external expansion bus interface, so a general port is used here to simulate the external expansion bus port. The access to W3100A must be performed according to its read and write timing, as shown in Figures 7 and 8. The read and write program can be called as a function in the main program.

The following lists some of the bus read procedures:

The process of writing bus is similar to that of reading bus, except that P4 port is set to output state and write is enabled (/WE). It should be noted that the rising edge when /WE returns to high level triggers data writing.

[page]

3.2 Network transmission control

The Socket API function specially provided by Wiznet for W3100A can make the software design of network communication more convenient. First, initialize the network settings of W3100A, that is, set the default gateway, subnet mask, local physical address and IP address in the corresponding registers, and then establish a Socket connection to achieve communication. The whole process is very similar to Windows Socket programming.

The process of establishing a TCP connection is shown in Figure 9. First, complete the TCP/IP initialization of the chip, set the protocol selection register C0_SPOR of the corresponding channel, such as channel 0, to 0X01; select the TCP protocol, execute the sock_init command bit in the channel 0 command register C0_CR, and set C0_TW_PR, C0_TR_PR and C0_TA_PR to the same value; then execute the connect and listen command bits of C0_CR, and the TCP connection is established.

The 16KB dual-port RAM inside W3100A is used as data sending and receiving buffer. The address space of 0x4000~0x5FFF is the sending data buffer, and the address space of 0x6000~0x7FFF is the receiving data buffer. The MCU program writes the data to be sent into the sending buffer and reads the received data from the receiving buffer. When sending data in batches, it is necessary to query the sending data pointer once to calculate the size of the available sending buffer. Figure 10 shows the program flow of TCP data sending. The process of data receiving is similar to the sending process, so it will not be repeated here.

4. Testing and analysis

The key to functional testing is to test the availability and stability of the system. To this end, a simplified communication network was established, using a PC as one terminal of the communication network and a buoy as the other terminal. The system function was tested by testing the communication between the two.

First, test the network connection. As a necessary IP experiment, the PC sends a PING command to the buoy, and the PC displays the result as shown in Figure 11.

When the LAN is unobstructed, theoretically the average response time for a 0-byte PING request is 1ms. The experimental results verify the normal network connection.

The stability of the system is tested by forwarding a large amount of data. The PC sends data to the buoy, and the buoy forwards the data directly back to the PC. The PC compares the sent data with the received data to determine the bit error. Under room temperature conditions, the communication distance is 100 meters, and three groups of sending and receiving experiments are carried out, each lasting 10 hours. There is no packet loss, and the bit error rate is <10-9, which meets the design requirements. It should be pointed out that due to different sea conditions and communication distances, the transmission bit error rate of the system will be different, but in most cases the system is completely reliable as a channel for sending and receiving commands.

5. Conclusion

The application of TCP/IP protocol in the buoy system greatly enhances the stability and scalability of the buoy network. This design uses the MSP430 microcontroller and the network protocol stack W3100A to well implement the low-power network communication system of the buoy system, providing an ideal network communication guarantee for the basic research of underwater acoustic channel matching. At the same time, this design can also be embedded in other devices, such as field measurement instruments, vehicle-mounted systems, etc., to provide network services for more embedded systems, and has a very broad due prospect.

Keywords:TCPIP Reference address:Design of Buoy Network Communication System Based on TCP/IP

Previous article:Design of Embedded Network Interface Based on ENC28J60
Next article:Optimizing Solar Systems with Microinverters

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号