Abstract: A design method that uses the LPC2364 chip as the processor and uses the TCP protocol in the Ethernet to design a serial port to network port module to implement data transmission mode conversion. The software in this method adopts FreerRtos real-time multi-task embedded system and uIP protocol stack to realize two tasks of serial port data communication and network port data communication. The system block diagram and main program flowchart are also given in the article.
Keywords: TCP / IP protocol; LPC2364; uIP; FreeRTOS; serial port to network port
O Introduction The serial port to network port module is a device networking server that allows serial devices to immediately have networking capabilities. It has a selectable interface serial port and a TCP / IP network interface, allowing serial devices to connect to the network immediately. In order to achieve fully automated network management of industrial equipment. The small size of the module makes it easy to integrate into a system or device, and it can be adapted to complex networks. To this end, this paper gives the hardware and software implementation method of using LPC2364, DP83848C, SP3485 and H2019 to form a serial port to network port module.
1 uIP Introduction uIP is a software protocol stack developed by Adam Dunkels of the Swedish Institute of Computer Science (Network Embedded Systems Group). The source code of the protocol stack is written in C language and is completely open. The uIP protocol stack removes the uncommon functions in the complete TCP / IP, simplifies the communication process, but retains the protocols that must be used for network communication. It puts the design focus on the network layer and transport layer protocols such as IP / TCP / ICMP / UDP / ARP, so it can guarantee the universality of the code and the stability of the structure.
Because the uIP protocol stack is specially designed for embedded systems. Therefore, uIP also has the following superior functions:
â—‡ There is very little code, and its protocol stack code is less than 6K, which is very convenient to read and transplant.
â—‡ The amount of memory occupied is very small, and the RAM occupies only a few hundred bytes.
â—‡ The hardware processing layer, protocol stack layer and application layer share a global buffer area, and there is no copy of data. Both sending and receiving rely on this buffer area, so it can greatly save space and time.
â—‡ Support multiple concurrent active and passive connections.
â—‡ Example programs provided in the source code include web server, web client, email sending program (SMTP client), Telnet server, DNS host name resolution program, etc. Moreover, it has strong versatility and can be passed without modification after transplantation.
â—‡ A round-robin mechanism is used for data processing, without the support of the operating system.
Because uIP requires less resources and it is easy to transplant, most microcontrollers with small RAM can use the uIP protocol stack.
2 Introduction of FreeRTOS FreeRTOS is a portable real-time kernel with open source code. A migration package can be provided for many different processor architectures and development tools. Each official porting package contains a configured application example that can be used to demonstrate the core features and speed up the learning process.
FreeRTOS is a scalable real-time kernel designed for small embedded systems. The highlight is that its design follows the principle of small size, simplicity, and ease of use, while supporting tasks and co-routines, as well as queues, binary semaphores, counting semaphores, recursive semaphores, and mutexes, etc. It can be used for communication and synchronization between tasks, tasks and interrupts.
3 Serial port to network port module hardware implementation The serial port to network port module uses LPC2364, DP83848C, SP3485 and H2019. The hardware circuit diagram of its system is shown in Figure 1.
4 Serial port to network port module software implementation The serial port to network port module software needs to establish two tasks, one is initialization and the other is task scheduling. The initialization includes clock initialization, protocol stack initialization, IP address initialization, gateway address initialization, subnet mask initialization, and network port initialization. Serial port initialization, etc. The main function code is as follows:
Figure 2 shows the flow chart of its main function. In the main function, uIP protocol stack initialization and serial port initialization can be initialized and set. At the same time, two communication tasks are established through the operating system initialization, and then the task scheduling of the operating system can be started. Figure 3 shows the serial port task control flow in the system.
5 Communication test of protocol conversion card The protocol conversion card in this paper is not a protocol conversion card in the general sense, but a conversion card based on a specific serial communication protocol. The card in the prescribed protocol, the data received by the network port can be divided into two types, one is the control command, the other is the query command. In the software, the serial port task and the network port task have two shared data buffers. The buffer can be checked through the serial port task. If there is data in the buffer, it is determined whether the data is the correct command according to the communication protocol. If it is correct Command, it is judged whether it is a query command or a control command. If it is a control command, the control command is sent out and the buffer is cleared; if it is a query command, the network port task will take out the data in another buffer and use the protocol stack to This data is sent out and the buffer is cleared at the same time. Through debugging with the TCP communication client detection tool and serial debugging assistant, you can find that if the TCP communication client sends a query command, the network port task automatically takes the data to the predetermined buffer and sends it out. At the same time, the TCP communication client Displayed on the screen; if the TCP communication client sends a control command, wait for the data returned by the serial debugging assistant. If there is a return, it will be displayed on the TCP communication client; if the serial assistant does not return, the software control will always send control commands until the correct reply is received.
6 Concluding remarks The conversion card of serial port to network port designed in this paper is a conversion card with serial communication protocol. The protocol card will analyze and judge the received data, and then determine the data transmission method, so as to realize the combination of the FreeRTOS operating system and the uIP protocol stack. In addition, since the FreeRTOS operating system and the uIP protocol stack are transparent to users, the module can easily modify the serial port communication rate, serial port communication format, IP address, gateway, subnet mask and other functions at any time. And make full use of the stability and reliability of the FreeRTOS operating system and good real-time characteristics, and at the same time can take advantage of the high efficiency of Ethernet communication to facilitate the implementation of data conversion.
Radiation XLPO insulated Control Cable is not cross-linked by normal chemical cross-linking material under high temperature and high pressure, but cross-linked by high energy electron accelerator or rays. That is why radiation XLPO insulated control cables get higher electrical property, excellent flame retardant property, Stronger mechanical property, they are also with better resistant to heat-aging, scratching, abrasion, oil, melting, and environmental stress crack. The most common material used for radiation cross-link cables are PVC, XLPE.
Long-term temperature: Up to 125â„ƒ
Conductor: OFC copper
Heat-resistant level: 90â„ƒ,105â„ƒ,125â„ƒ
Rated voltage: Up to 0.6/1kV
This cable is used in control system, electrical equipments and instruments, especially suitable for high temperature and fire retardant condition.
Q: Are you a factory or trading company?
A: We are a manufacturer. We are professional in developing and producing electrical wires and cables since 2001.
Q: Can I visit your factory?
A:Yes! You are welcome to visit our factory for further detail check.
Our factory is located in Minqing,Fujian.You could choose to fly to Xiamen/Fuzhou International airport. And tell us your flight No. We will arrange to pick you up if you like.
Q: May I buy samples from you?
A: Yes! You are welcome to place sample order to test our superior quality and services.
Q: Can you put my brand name (logo) on these products?
A: Yes! Our factory accepts to print your logo on the products.
Q: May I know the status of my order?
A: Yes .The order information and photos at different production stage of your order will be sent to you and the information will be updated in time.
To receive a quote, further information or advice, Leen Cable invites you to contact us.We believe we will become your best partner in electrical cables and wires services.
Radiation XLPO Insulated Control Cable,Copper Screened Control Cables,Armoured Shielded Control Cables, Shielding XLPE Control Cable
Smartell Technology Co.,Ltd , http://www.liencable.com