Application of MCU Ethernet-CAN Gateway Based on "Network Communication"

Publisher:DreamySunsetLatest update time:2011-12-05 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Overview

In large-scale enterprise automation systems such as factories, substations, and intelligent buildings, as shown in Figure 1(a), Ethernet and PCs are used in the upper enterprise management and production monitoring layers, while fieldbuses (such as RS-485, CAN, lonWorks, Foundation, etc.) and single-chip microcomputer measurement and control equipment are used in the lower workshops and fields. The communication between the upper and lower layers is usually achieved by using an industrial control computer plus an Ethernet card, plus an interface card on the PC slot or an EPP interface card for the parallel printer port. This connection method is costly and has a long development cycle. The interface card becomes the communication bottleneck between the upper and lower layers of the system. Once a fault occurs, the connection between the upper and lower layers is interrupted. To this end, as shown in Figure 1(b), we use the cheap "Network Communication" to form an Ethernet-CAN gateway based on a single-chip microcomputer to replace the expensive industrial control computer plus an interface card, and successfully realize the direct connection between Ethernet and the existing CAN bus network, and realize the connection between the management and monitoring layer (Ethernet) and the production measurement and control layer (CAN bus network). The upper and lower layer data can be easily communicated.


Figure 1 Comparison of two distributed automatic control systems

More importantly, the mature, stable and cheap Ethernet has been popularized and penetrated into factories, workshops, buildings and other grassroots. In large-scale enterprise automation systems, there is no need to use fieldbus and two-level structure. You can directly use the cheap Ethernet interface module "Network Communication" to directly connect various measurement and control equipment to Ethernet to form a modern network control system.

2 Composition Principle of Ethernet-CAN Gateway

In the network control system, we use "Network Communication" to form an Ethernet-CAN gateway based on a single-chip microcomputer. The structure is shown in Figure 2. "Network Communication" consists of an Ethernet interface A and a microprocessor. On this basis, adding a CAN interface B forms an Ethernet-CAN gateway.


Figure 2 Ethernet-CAN gateway based on "Network Communication"

(1) Ethernet interface A

Ethernet interface A can use 10Base-T universal interface chips that comply with IEEE802.3 protocol, such as UM9003, RTL8019, etc., to complete the connection with Ethernet at the physical layer and data link layer. Using the RJ-45 socket, it can be directly connected to the Ethernet.

(2) Microprocessor

The microprocessor is responsible for controlling the Ethernet interface A chip and the CAN interface B chip. The microprocessor has TCP/IP communication protocol and CAN protocol installed inside, which completes the conversion between Ethernet protocol and CAN bus protocol, and realizes the transparent transmission of communication data between interface A and interface B. [page]

Since the amount of data transmitted by the CAN bus is not large and the data transmission rate is not high, which is much lower than the data transmission rate of Ethernet, the data transmission bottleneck in the Ethernet-CAN interface module is the CAN interface B. In the field of measurement and control, the amount of data transmitted is usually not large and the data transmission rate requirement is not high. Therefore, the microprocessor in this module can be a common single-chip microcomputer such as 8031.

(3) CAN interface B

CAN interface B uses Philips' CAN physical layer and link layer interface chip SJA1000 and PCA82C250. The microprocessor directly controls the AD0~AD7, ALE, RST and pins of SJA1000. The MODEL pin of SJA1000 is connected to a high level and works in Intel mode; the chip select pin is grounded and is always in the strobe state, as shown in Figure 3. The microprocessor's operation on SJA1000 is mainly the operation of registers: on the one hand, the mode register (MOD), command register (CMR), status register (SR), interrupt register (IR), interrupt enable register (IEP), bus timing register (BTR0, BTR1), output control register (OCR), and clock divider counter (CDR) of SJA1000 are set and tested; on the other hand, the transceiver buffer is read and written to exchange data with the CAN device.


Figure 3 Ethernet-CAN interface schematic diagram

Figure 4 is a flowchart of the microprocessor initializing, reading and writing to SJA1000. The microprocessor writes the command sent from Ethernet to SJA1000 to transmit it to the CAN measurement and control device; conversely, it reads the measurement value or status of the CAN measurement and control device from SJA1000 and sends it out through Ethernet.


Figure 4 Schematic diagram of microprocessor CAN interface

[page]

3 Main features of Ethernet-CAN gateway

Network distributed control requires an open, digital, multi-point communication control network, and the widespread use of fieldbus-based network distributed control systems in automation systems illustrates this point. Using Ethernet to replace fieldbus networks not only meets these requirements, but also has many advantages.

① There is no need to lay a special CAN communication network to transmit information between devices, but to use the widely available, cheap, and standard Ethernet to transmit information. The establishment of such a measurement and control network is very fast, the number of nodes is theoretically unlimited, the networking cost is low, and maintenance is easy.

② In data transmission, the address of each measurement and control device actually consists of two parts: the IP address of the "Network Communication" and the CAN interface address. In Ethernet, the CAN address and data of the CAN interface measurement and control device are transmitted together as the data of the IP packet in the "Network Communication" communication.

③ It has the characteristics of high communication capacity with multiple masters and multiple slaves; each frame has hardware CRC check and high reliability; the communication message can be large or small and the efficiency is very high; the communication protocol TCP/IP is a global unified standard and can be easily connected into a large control network without geographical restrictions.

④ The human-machine interface of the WWW (Word Wide Web) browser is user-friendly and easy to use. The device management server uses the browser to detect and control different devices on the Ethernet, and uses the WWW publishing method to provide dynamic interactive web browsing to network clients. It is easy to implement a scheduling production management system or an office automation information system.

⑤ Since the communication data packets conform to the TCP/IP standard, they can pass through switches or routers on the Internet. Remote Internet users can easily query the status of each smart device and remotely control each smart device in real time using a WWW browser.

4 Application of Ethernet-CAN Gateway Interface Module in Automatic Measurement and Control System

In an enterprise automatic control system designed and modified by us, the method shown in Figure 5 was adopted. All the original CAN measurement and control equipment were directly connected to the enterprise Ethernet through the Ethernet-CAN interface module, and some were still connected to the Ethernet through the CAN bus network; while the newly added equipment was directly connected to the Ethernet using the Ethernet interface module, and there was no need to lay a special CAN communication network for information transmission between devices.


Figure 5 Block diagram of distributed control application system based on Ethernet

On Ethernet, all CAN measurement and control nodes form a virtual network segment. The CAN device management server is any control node in the enterprise Ethernet. The WIN NT server connected to the Ethernet is installed with special network management software to allow legitimate engineering and technical personnel to remotely manage CAN devices and communicate data with CAN devices through Ethernet. In this way, Ethernet can completely replace the original CAN bus network. At the same time, the server uses WEB publishing to provide dynamic interactive web browsing to network clients.

Conclusion

With the development of industrial automation and office automation, in some cases, the network of distributed control systems is becoming larger and larger, and fieldbus is increasingly restricted by geography, laying costs, and load capacity. On the other hand, with the rapid development of flexible, convenient, secure, and reliable Ethernet and the popularization of the Internet, broadband networks have penetrated into homes, offices, hotels, factories, and workshops, allowing people to exchange information through the Internet in all places of life and work. In this case, using cheap "network communication" and the Internet to replace fieldbus, the original fieldbus distributed control system can be easily converted into an Ethernet-based distributed control system, which will be more and more widely used.

Reference address:Application of MCU Ethernet-CAN Gateway Based on "Network Communication"

Previous article:Combined application of DM9000A and baseband signal processing platform
Next article:Design of communication system between single chip microcomputer and digital signal processor based on CAN bus

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号