CN104219121A - Serial bus communication online reconstruction method based on FPGA (field programmable gate array) - Google Patents
Serial bus communication online reconstruction method based on FPGA (field programmable gate array) Download PDFInfo
- Publication number
- CN104219121A CN104219121A CN201410471276.8A CN201410471276A CN104219121A CN 104219121 A CN104219121 A CN 104219121A CN 201410471276 A CN201410471276 A CN 201410471276A CN 104219121 A CN104219121 A CN 104219121A
- Authority
- CN
- China
- Prior art keywords
- communication
- control module
- reconstruction
- serial bus
- reconfiguration
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000006854 communication Effects 0.000 title claims abstract description 203
- 238000004891 communication Methods 0.000 title claims abstract description 201
- 238000000034 method Methods 0.000 title claims abstract description 58
- 230000003068 static effect Effects 0.000 claims abstract description 14
- 238000002360 preparation method Methods 0.000 claims abstract description 11
- 230000008569 process Effects 0.000 claims description 20
- 230000006870 function Effects 0.000 claims description 16
- 238000001514 detection method Methods 0.000 claims description 14
- 230000009471 action Effects 0.000 claims description 2
- 230000008521 reorganization Effects 0.000 claims 11
- 230000004913 activation Effects 0.000 claims 2
- 230000005540 biological transmission Effects 0.000 description 14
- 238000010586 diagram Methods 0.000 description 11
- 238000005516 engineering process Methods 0.000 description 4
- 238000012795 verification Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 238000005070 sampling Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Landscapes
- Communication Control (AREA)
Abstract
本发明提供了基于FPGA的串行总线通信在线重构方法,包括如下步骤:(1)对从站设备中的FPGA进行区域划分,划分为静态区域和通信重构区域,(2)从站设备识别串行总线的通信协议类型,当通信协议类型不一致时,激活重构控制模块,(3)从站设备中重构控制模块向重构主控模块发送重构请求,重构主控模块发出准备完成信号给重构控制模块,重构控制模块收到准备完成信号后对通信重构区域进行在线动态重新配置,使得重构区域中的通信协议类型与串行总线的通信协议类型一致。本发明使得基于FPGA的串行总线通信设备具备在线自动适应网络协议变化的能力,增强网络通信设备的灵活性和互换性,对多种网络通信协议并存的工业控制领域具有重大意义。
The invention provides an FPGA-based serial bus communication online reconfiguration method, comprising the following steps: (1) dividing the FPGA in the slave station device into a static region and a communication reconfiguration region, (2) the slave station device Identify the communication protocol type of the serial bus. When the communication protocol type is inconsistent, activate the reconstruction control module. (3) The reconstruction control module in the slave station device sends a reconstruction request to the reconstruction main control module, and the reconstruction main control module sends a reconfiguration request. The preparation completion signal is sent to the reconstruction control module, and the reconstruction control module performs online dynamic reconfiguration of the communication reconstruction area after receiving the preparation completion signal, so that the communication protocol type in the reconstruction area is consistent with the communication protocol type of the serial bus. The invention enables FPGA-based serial bus communication equipment to have the ability to automatically adapt to network protocol changes online, enhances the flexibility and interchangeability of network communication equipment, and is of great significance to the industrial control field where multiple network communication protocols coexist.
Description
技术领域technical field
本发明涉及工业控制领域,尤其涉及工业控制系统的基于FPGA的串行总线通信在线重构方法。The invention relates to the field of industrial control, in particular to an FPGA-based serial bus communication online reconfiguration method of an industrial control system.
背景技术Background technique
随着工业控制的网络化、信息化的程度不断提高,要求对现场设备集中监视、统一管理。然而,目前国际上网络通信协议就多达200余种,其中满足国际标准IEC61158的也有20余种。系统设计者根据不同的应用需求,往往需要多个仪表厂商提供不同的传感器、变送器、控制器、执行机构等。然而每个仪表生产厂商可能使用不同标准的网络通信协议,如ModbusRTU、Modbus ASCII、Profibus-DP,CC-Link等。多种网络通信的并存使得工业设备的开发者和使用者都面临着严峻的考验,亟需一种具有动态适应网络通信变化的能力,而且只消耗最小的软硬件资源。在实际工业网络控制系统中,由于功能或临时更换等需求,同样采用串行总线(比如RS-485总线、CAN总线等)为物理传输的通信设备可能同时存在于同一网络,则需要网络通信设备站具有自动识别链路通信协议,然后将本站的通信模式切换到当前通信协议,实现网络控制系统的通信自适应。针对该问题目前解决方案有以下两种:硬件全局重构和软件冗余方法。硬件全局重构技术是近年来基于FPGA发展起来的配置技术。网络控制系统的全局重构则是通过检测当前网络的通信协议类型,更改的负责网络通信部分,然后将该配置文件整体烧写至FPGA。然而,硬件全局重构需要对整个FPGA资源重新配置,该重构方法是对器件的整体进行更新写入,不需要改变的非通信部分也进行了更新写入,从而导致系统进行重新初始化,甚至引起系统崩溃,所以该技术尚未被广泛应用于工业现场控制过程中。With the continuous improvement of the network and informatization of industrial control, centralized monitoring and unified management of field devices are required. However, there are currently more than 200 types of network communication protocols in the world, and more than 20 of them meet the international standard IEC61158. According to different application requirements, system designers often require multiple instrument manufacturers to provide different sensors, transmitters, controllers, actuators, etc. However, each instrument manufacturer may use different standard network communication protocols, such as ModbusRTU, Modbus ASCII, Profibus-DP, CC-Link, etc. The coexistence of various network communications makes the developers and users of industrial equipment face a severe test. There is an urgent need for a device that has the ability to dynamically adapt to changes in network communications and consumes only the smallest hardware and software resources. In an actual industrial network control system, due to functional or temporary replacement requirements, communication devices that also use serial buses (such as RS-485 bus, CAN bus, etc.) as physical transmission may exist on the same network at the same time, and network communication devices are required The station can automatically identify the link communication protocol, and then switch the communication mode of the station to the current communication protocol to realize the communication self-adaptation of the network control system. There are currently two solutions to this problem: hardware global reconfiguration and software redundancy. Hardware global reconfiguration technology is a configuration technology developed based on FPGA in recent years. The overall reconstruction of the network control system is to detect the communication protocol type of the current network, change the part responsible for network communication, and then burn the entire configuration file to the FPGA. However, global reconfiguration of hardware requires reconfiguration of the entire FPGA resource. This reconfiguration method is to update and write the entire device, and also update and write the non-communication parts that do not need to be changed, which will cause the system to be re-initialized, or even Cause system crash, so this technology has not been widely used in industrial field control process.
软件冗余方法是通过将实现不同通信协议的功能块同时集中在设备站中,通过检测链路通信协议,然后通过函数调用或功能切换使得当前通信模式为链路通信模式,保证网络控制系统正常通信。然而,由于该方法同时将所有通信协议集中一起,使得系统消耗的硬件资源和软件资源将随着服务的通信协议种类数量成倍的上升,造成大量资源浪费。The software redundancy method is to concentrate the function blocks that realize different communication protocols in the equipment station at the same time, by detecting the link communication protocol, and then make the current communication mode be the link communication mode through function calling or function switching, so as to ensure the normal operation of the network control system communication. However, since this method centralizes all communication protocols at the same time, the hardware resources and software resources consumed by the system will increase exponentially with the number of types of communication protocols served, resulting in a large waste of resources.
发明内容Contents of the invention
为解决现有技术存在的问题和缺陷,本发明提供一种基于FPGA的串行总线网络通信在线重构方法,通过对网络通信重构区域采用部分硬件重构的方式,在线动态配置网络通信重构区域,使得基于FPGA的串行总线网络通信设备具备在线自动适应网络协议变化的能力,增强网络通信设备的灵活性和互换性。In order to solve the problems and defects existing in the prior art, the present invention provides an FPGA-based serial bus network communication online reconfiguration method, by adopting a partial hardware reconfiguration method for the network communication reconfiguration area, online dynamic configuration network communication reconfiguration method The structure area enables FPGA-based serial bus network communication equipment to have the ability to automatically adapt to network protocol changes online, and enhances the flexibility and interchangeability of network communication equipment.
本发明的技术方案是:Technical scheme of the present invention is:
1.基于FPGA的串行总线通信在线重构方法,其特征在于,所述网络通信过程涉及主站设备和从站设备,具体包括如下步骤:1. the serial bus communication online reconfiguration method based on FPGA, it is characterized in that, described network communication process relates to master station equipment and slave station equipment, specifically comprises the steps:
步骤一,对从站设备中的FPGA进行区域划分,并划分为静态区域和通信重构区域,所述静态区域包括重构控制模块和重构主控模块;Step 1, dividing the FPGA in the slave device into a static area and a communication reconstruction area, the static area includes a reconfiguration control module and a reconfiguration master control module;
步骤二,从站设备识别串行总线的通信协议类型,当串行总线的通信协议类型与所述通信重构区域中的通信协议类型不一致时,激活所述重构控制模块;Step 2, the slave station device identifies the communication protocol type of the serial bus, and activates the reconfiguration control module when the communication protocol type of the serial bus is inconsistent with the communication protocol type in the communication reconfiguration area;
步骤三,从站设备中所述重构控制模块向所述重构主控模块发送重构请求,所述重构主控模块收到所述重构请求后进行重构准备,并在确认完成重构准备后发出准备完成信号给所述重构控制模块,所述重构控制模块收到所述准备完成信号后对所述通信重构区域进行在线动态重新配置,使得所述重构区域中的通信协议类型与所述串行总线的通信协议类型一致。Step 3, the reconfiguration control module in the slave station device sends a reconfiguration request to the reconfiguration main control module, and the reconfiguration main control module prepares for reconfiguration after receiving the reconfiguration request, and confirms the completion Sending a preparation completion signal to the reconfiguration control module after the reconfiguration preparation, the reconfiguration control module performs online dynamic reconfiguration of the communication reconfiguration area after receiving the preparation completion signal, so that in the reconfiguration area The communication protocol type is consistent with the communication protocol type of the serial bus.
2.从站设备的所述通信重构区域包含串行链路通信协议所包括的物理层,数据链路层和应用层,所述网络通信协议的在线动态重新配置是指:①若从站设备的物理层没有设置可与FPGA芯片相匹配对接的对外接口,则网络通信重构区域包含数据链路层和应用层,②若从站设备的物理层设置有可与FPGA芯片匹配对接的对外接口,则网络通信重构区域包含对物理层,数据链路层和应用层进行通信重构的过程,实现基于FPGA的串行总线的网络通信在线重构,应用层和物理层的通信重构过程与数据链路层的通信重构过程方法相同。2. The communication reconstruction area of the slave station equipment includes the physical layer, the data link layer and the application layer included in the serial link communication protocol, and the online dynamic reconfiguration of the network communication protocol refers to: ① if the slave station If the physical layer of the device does not have an external interface that can be matched with the FPGA chip, the network communication reconstruction area includes the data link layer and the application layer. Interface, the network communication reconstruction area includes the process of communication reconstruction of the physical layer, data link layer and application layer, and realizes the online reconstruction of network communication based on the FPGA serial bus, and the communication reconstruction of the application layer and the physical layer The process is the same as the communication reconstruction process method of the data link layer.
3.对网络通信重构区域进行重构之前,将整个静态区域和通信重构区域完全重新配置一次,确定所述通信重构区域的默认通信类型。3. Before reconfiguring the network communication reconfiguration area, completely reconfigure the entire static area and the communication reconfiguration area once, and determine the default communication type of the communication reconfiguration area.
4.所述步骤二中,在激活重构控制模块之前,先通过从站设备中的存储器控制模块测试并建立所述重构控制模块与从站设备的外置存储器之间的数据连接,为网络通信重构准备配置文件,所述配置文件的位置由当前串行总线的通信协议的类型决定。4. In the step 2, before activating the reconfiguration control module, test and establish the data connection between the reconfiguration control module and the external memory of the slave device through the memory control module in the slave device, for A configuration file is prepared for network communication reconstruction, and the location of the configuration file is determined by the type of the communication protocol of the current serial bus.
5.所述步骤二中,所述重构控制模块被激活后,重构控制模块冻结所述通信重构区域的所有输入信号,包括所述重构控制模块向所述重构主控模块输出的用于将通信重构区域复位的局部复位信号。5. In the second step, after the reconfiguration control module is activated, the reconfiguration control module freezes all input signals in the communication reconfiguration area, including the output of the reconfiguration control module to the reconfiguration main control module A local reset signal for resetting the communication reconfiguration area.
6.所述步骤三中,所述重构控制模块向重构主控模块发送重构请求的同时,所述重构控制模块向所述重构主控模块发送重构时钟,所述重构请求信号在整个重构过程中贯穿整个重构过程,直到出现重构成功或者重构错误。6. In step 3, while the reconfiguration control module sends a reconfiguration request to the reconfiguration main control module, the reconfiguration control module sends a reconfiguration clock to the reconfiguration main control module, and the reconfiguration The request signal runs through the entire refactoring process until a refactoring succeeds or a refactoring error occurs.
7.所述重构控制模块接收到重构主控模块的准备完成信号后,等待四个重构时钟周期,并在第四个重构时钟周期结束前存储控制模块从存储器中读取第一个16bit的数据;7. After the reconstruction control module receives the preparation completion signal of the reconstruction main control module, it waits for four reconstruction clock cycles, and before the end of the fourth reconstruction clock cycle, the storage control module reads the first A 16bit data;
当第四个重构时钟周期结束时,即第四个重构周期的下降沿,存储控制模块将读取的第一个16bit的数据传输至重构主控模块的数据总线上,第一次等待四个时钟周期以后,在下一个下降沿到达之前读取第二个16bit的数据;When the fourth reconfiguration clock cycle ends, that is, the falling edge of the fourth reconfiguration cycle, the storage control module transmits the first 16-bit data read to the data bus of the reconfiguration main control module. After waiting for four clock cycles, read the second 16bit data before the arrival of the next falling edge;
重复上述动作直到存储器中的配置文件读取完成且重构主控模块输出重构成功信号到所述重构控制模块。The above actions are repeated until the reading of the configuration file in the memory is completed and the reconstruction main control module outputs a reconstruction success signal to the reconstruction control module.
8.所述重构控制模块接收到重构成功信号后在8个重构时钟周期内解除重构请求信号。8. The reconfiguration control module releases the reconfiguration request signal within 8 reconfiguration clock cycles after receiving the reconfiguration success signal.
9.所述重构请求信号解除后,需要等待通信重构区域的冻结信号成功解除后,所述重构请求信号才能通过重构区域的复位信号进行复位。9. After the reconfiguration request signal is released, the reconfiguration request signal can be reset through the reset signal of the reconfiguration area after the freeze signal of the communication reconfiguration area is successfully released.
10.所述静态区域还包括链路通信检测模块,链路通信检测模块根据串行总线的报文信息识别当前网络的通信协议类型,若识别的当前通信协议类型与重构区域中的通信协议类型不一致,链路通信检测模块激活重构控制模块。10. The static area also includes a link communication detection module, and the link communication detection module identifies the communication protocol type of the current network according to the message information of the serial bus, if the identified current communication protocol type is consistent with the communication protocol in the reconstruction area The types are inconsistent, and the link communication detection module activates the reconstruction control module.
本发明的技术效果:Technical effect of the present invention:
1.本发明提供一种基于FPGA的串行总线通信在线重构方法,从站进行完全配置以后,当其检测到网络通信链路通信协议与网络通信重构区域的协议不一致时,激活重构控制块。通过对网络通信重构区域采用部分硬件重构的方式,在线动态配置网络通信重构区域,使得基于FPGA的串行总线网络通信设备具备在线自动适应网络协议变化的能力,增强网络通信设备的灵活性和互换性,而且无需将不必要的通信协议集中在一起,避免了资源的浪费。1. The present invention provides an FPGA-based serial bus communication online reconfiguration method. After the slave station is fully configured, when it detects that the communication protocol of the network communication link is inconsistent with the protocol of the network communication reconfiguration area, the reconfiguration is activated control block. By adopting partial hardware reconstruction for the network communication reconstruction area, the network communication reconstruction area is dynamically configured online, so that the FPGA-based serial bus network communication equipment has the ability to automatically adapt to network protocol changes online, and enhance the flexibility of network communication equipment and interchangeability, and there is no need to gather unnecessary communication protocols together, avoiding the waste of resources.
2.在整个通信重构过程中,非重构区域(即静态区域)一直保持不变,则其历史数据及状态可以得以保持,应用功能块可以继续正常的完成数据采集、控制量计算、信号输出等功能,极大的保证了系统的稳定运行。2. During the entire communication reconstruction process, if the non-reconfiguration area (i.e. static area) remains unchanged, its historical data and status can be maintained, and the application function block can continue to complete data collection, control quantity calculation, signal Output and other functions greatly ensure the stable operation of the system.
3.本发明实现了Modbus ASCII通信设备和Modbus RTU通信设备的互换性,增强了产品的互换性,可以实现多种网络的通信的自适应,对多种网络通信协议并存的工业控制领域具有重大意义。3. The present invention realizes the interchangeability of Modbus ASCII communication equipment and Modbus RTU communication equipment, enhances the interchangeability of products, can realize the self-adaptation of communication of various networks, and is suitable for the industrial control field where various network communication protocols coexist has great significance.
附图说明Description of drawings
图1为本发明逻辑架构及重构区域划分示意图。FIG. 1 is a schematic diagram of the logical architecture and division of reconfiguration areas of the present invention.
图2为本发明主要实现步骤示意图。Fig. 2 is a schematic diagram of main implementation steps of the present invention.
图3为本发明的具体实施例流程示意图。Fig. 3 is a schematic flow chart of a specific embodiment of the present invention.
图4为本发明的通信协议类型的判别过程示意图。Fig. 4 is a schematic diagram of the process of discriminating the communication protocol type in the present invention.
图5为本发明的具体实施例通信模型异同点对比示意图。Fig. 5 is a schematic diagram of comparing the similarities and differences of the communication models of the specific embodiment of the present invention.
图6是Modbus总线网络的拓扑图。Figure 6 is a topology diagram of the Modbus bus network.
具体实施方式Detailed ways
本发明提供一种基于FPGA的串行总线通信在线重构方法,通过对网络通信重构区域采用部分硬件重构的方式,使得基于FPGA的串行总线网络通信设备具备在线自动适应网络协议变化的能力,增强网络通信设备的灵活性和互换性。由于串行总线具有多种,比如RS-485总线、RS-232总线以及RS-422总线等,并且网络通信协议也具有多种,如Modbus RTU、Modbus ASCII、Profibus-DP,CC-Link等,因此,本发明以RS-485总线,并以Modbus RTU和Modbus ASCII两种通信协议作为具体实施例对本发明作进一步描述。The present invention provides an FPGA-based serial bus communication online reconfiguration method. By adopting a partial hardware reconfiguration method for the network communication reconfiguration area, the FPGA-based serial bus network communication device has the ability to automatically adapt to network protocol changes online. Capability, enhance the flexibility and interchangeability of network communication equipment. Since there are many serial buses, such as RS-485 bus, RS-232 bus and RS-422 bus, etc., and there are also many network communication protocols, such as Modbus RTU, Modbus ASCII, Profibus-DP, CC-Link, etc., Therefore, the present invention further describes the present invention with RS-485 bus, and with Modbus RTU and Modbus ASCII two kinds of communication protocols as specific embodiment.
图1为本发明逻辑架构及重构区域划分示意图。如图1所示,本发明提供的Modbus从站通过部分重构方法,实现在线自动适应Modbus ASCII与Modbus RTU的系统功能结构图,包含:FIG. 1 is a schematic diagram of the logical architecture and division of reconfiguration areas of the present invention. As shown in Figure 1, the Modbus slave station provided by the present invention realizes the system function structure diagram of online automatic adaptation to Modbus ASCII and Modbus RTU through a partial reconstruction method, including:
通信检测模块1,在Modbus主站与Modbus从站通信过程中,所有Modbus从站均可以通过RS-485总线引入链路信号,通信检测模块和网络通信重构区域同时将该信号作为输入。正如第一实施例流程示意图所描述,通信检测模块根据Modbus ASCII和Modbus RTU的数据链路层差异特征,实现区分链路通信协议。本发明中“主站”也称“主站设备”,“从站”也称“从站设备”。Communication detection module 1. During the communication process between the Modbus master station and the Modbus slave station, all Modbus slave stations can introduce link signals through the RS-485 bus, and the communication detection module and the network communication reconstruction area simultaneously use this signal as input. As described in the schematic flow chart of the first embodiment, the communication detection module realizes the distinguishing link communication protocol according to the data link layer difference characteristics of Modbus ASCII and Modbus RTU. In the present invention, "master station" is also called "master station device", and "slave station" is also called "slave station device".
重构控制块2,该模块作为整个重构控制的中心,当通信检测模块识别到当前网络通信协议与网络通信重构区域的通信协议不一致时,则激活重构控制块。已激活的重构控制块首先屏蔽网络通信重构区域的输入信号,然后向重构主节点发送重构请求信号,接着等待来自重构主节点的重构准备完成信号。当重构准备信号被声明时,重构控制块从存储控制块中取出配置数据,并将该数据传递至重构主节点,直到重构完成或重构错误信号出现。若重构主节点的重构完成信号声明时,重构控制块马上撤销重构请求信号,然后复位网络通信重构区域,并解除网络通信重构区域的屏蔽控制信号。本发明实施例中的重构主控模块接收重构控制块的重构请求后进行重构准备,所述重构准备是指当重构主控模块收到重构请求后,进行基于FPGA的串行总线通信在线重构的常规自检的过程,目的是检测从站设备是否具备重构的基本条件,例如用户对否已经自定义划分好重构区域,重构区域的的大小是否适度等等。Reconfiguration control block 2, which is the center of the entire reconfiguration control, activates the reconfiguration control block when the communication detection module recognizes that the current network communication protocol is inconsistent with the communication protocol of the network communication reconfiguration area. The activated reconfiguration control block first shields the input signal of the network communication reconfiguration area, then sends a reconfiguration request signal to the reconfiguration master node, and then waits for the reconfiguration preparation completion signal from the reconfiguration master node. When the reconstruction ready signal is asserted, the reconstruction control block fetches the configuration data from the storage control block, and transmits the data to the reconstruction master node until the reconstruction is completed or the reconstruction error signal occurs. If the reconfiguration completion signal of the reconfiguration master node is declared, the reconfiguration control block cancels the reconfiguration request signal immediately, then resets the network communication reconfiguration area, and releases the shielding control signal of the network communication reconfiguration area. The reconstruction main control module in the embodiment of the present invention receives the reconstruction request of the reconstruction control block and then prepares for reconstruction. The reconstruction preparation means that after the reconstruction main control module receives the reconstruction request, it performs FPGA-based The routine self-inspection process of serial bus communication online reconstruction is to detect whether the slave device has the basic conditions for reconstruction, such as whether the user has customized the reconstruction area and whether the size of the reconstruction area is appropriate, etc. wait.
具体为,若在重构过程中,出现重构错误信号,则取消重构请求信号,然后等待20个重构时钟以后重新执行重构步骤。值得注意的是,当重构成功信号出现后,需要等待该信号解除后才能对复位网络通信重构区域和解除该区域的屏蔽控制信号。Specifically, if a reconfiguration error signal occurs during the reconfiguration process, cancel the reconfiguration request signal, and then wait for 20 reconfiguration clocks to re-execute the reconfiguration step. It is worth noting that when the reconstruction success signal appears, it is necessary to wait for the signal to be released before reconfiguring the reset network communication area and releasing the shielding control signal of the area.
存储控制块3,该功能块根据外部存储器定义读取数据应用接口,当重构控制块启动网络通信重构时,该模块根据重构控制块提供的存储器地址,连续从外部存储器中取出数据。Storage control block 3, this function block defines the application interface for reading data according to the external memory, when the reconfiguration control block starts network communication reconstruction, this module continuously fetches data from the external memory according to the memory address provided by the reconfiguration control block.
外部存储器模块4,该存储器按地址分别存储了Modbus RTU和Modbus ASCII数据链路层的配置文件。External memory module 4, this memory stores the configuration file of Modbus RTU and Modbus ASCII data link layer respectively by address.
重构主控模块5,Altera Cyclone V或Arria V或Stratix V器件内部都集成了该控制块,重构控制块通过预留的交互接口,即可实现对网络通信重构区域的重新配置。Reconfiguration main control module 5, Altera Cyclone V or Arria V or Stratix V devices are integrated with this control block, and the reconfiguration control block can realize the reconfiguration of the network communication reconfiguration area through the reserved interactive interface.
应用功能块,Modbus网络中每个设备从站都通过应用功能块实现自身应用功能,该模块包括两个单元:Modbus应用层单元61,该单元主要实现Modbus通信协议应用层的协议数据包解析及封装等;用户应用单元62,该单元主要功能与本设备站具体功能有关,例如控制信号的输出、控制量的计算、传感器信号采集等等。除此之外,该模块通过Modbus网络同其它通信站相连,实现站与站之间的数据交互。Application function block, each device slave station in the Modbus network realizes its own application function through the application function block, this module includes two units: Modbus application layer unit 61, this unit mainly realizes the protocol data packet analysis and analysis of the Modbus communication protocol application layer Packaging, etc.; user application unit 62, the main functions of this unit are related to the specific functions of the equipment station, such as the output of control signals, the calculation of control quantities, the acquisition of sensor signals, and so on. In addition, the module is connected with other communication stations through the Modbus network to realize data interaction between stations.
图2为本发明主要实现步骤示意图。Fig. 2 is a schematic diagram of main implementation steps of the present invention.
步骤S1.对FPGA进行区域划分,并划分为静态区域和通信重构区域,其中,静态区域至少包括重构控制模块2以及重构主控模块5,当然,静态区域还还包括应用功能模块、存储器控制模块3以及链路通信检测模块1,其中应用功能模块用于控制信号的输出、控制量的计算、传感器信号采集等;存储器控制模块用于当重构控制模块气动网络通信重构时根据重构控制提供的存储器地址,连续从外置存储器中读取配置文件数据;重构主控模块为AlteraCyclone V、Arria V以及Stratix V等系列的FPGA器件内部集成的控制模块,重构控制模块通过预留的交互接口,即可实现对网络通信重构区域的重新配置。本实施例中所述的FPGA(Field-Programmable Gate Array),即现场可编程门阵列,它是作为专用集成电路(ASIC)领域中的一种半定制电路而出现的,既解决了定制电路的不足,又克服了原有可编程器件门电路数有限的缺点。Step S1. The FPGA is divided into areas and divided into static areas and communication reconstruction areas, wherein the static area includes at least the reconfiguration control module 2 and the reconfiguration main control module 5. Of course, the static area also includes application function modules, The memory control module 3 and the link communication detection module 1, wherein the application function module is used for the output of the control signal, the calculation of the control amount, the acquisition of the sensor signal, etc.; The memory address provided by the reconstruction control continuously reads the configuration file data from the external memory; the reconstruction main control module is the internal integrated control module of FPGA devices such as AlteraCyclone V, Arria V and Stratix V series, and the reconstruction control module passes The reserved interactive interface can realize the reconfiguration of the network communication reconstruction area. The FPGA (Field-Programmable Gate Array) described in this embodiment, that is, field programmable gate array, appears as a semi-custom circuit in the field of application-specific integrated circuits (ASIC), which not only solves the problem of custom circuits Insufficient, and overcome the shortcomings of the limited number of gate circuits of the original programmable device.
步骤S2.识别串行总线的通信协议类型,当串行总线的通信协议类型与重构区域中的通信协议类型不一致时,激活重构控制模块;若一致,则不动作,等待下次串行总线的报文信息并进行识别,直到通信协议不一致的情况下执行下一步,其中,对于串行总线的通信协议类型与重构通信协议类型的识别是通过链路通信检测模块实现的,链路通信检测模块根据串行总线的报文信息识别当前网络的通信协议类型,以Modbus ASCII协议以及Modbus RTU协议对识别过程进行详细的表述:Step S2. Identify the communication protocol type of the serial bus. When the communication protocol type of the serial bus is inconsistent with the communication protocol type in the reconstruction area, activate the reconstruction control module; if they are consistent, do not act and wait for the next serial The message information of the bus is identified, and the next step is executed until the communication protocol is inconsistent. Among them, the identification of the communication protocol type and the reconstructed communication protocol type of the serial bus is realized through the link communication detection module. The communication detection module identifies the communication protocol type of the current network according to the message information of the serial bus, and describes the identification process in detail with the Modbus ASCII protocol and the Modbus RTU protocol:
根据Modbus传输协议标准的规定:通讯首先由主站向从站发起请求,而且Modbus的主站每次只能发起一个通信事务,网络中所有从站都会接收到该请求报文,然后通过解析该报文的地址域内容,判断该内容是否为本站地址,若是则作出相应的应答响应,否则丢弃该报文。其中地址域的有效范围为1-247,另外0号地址为广播地址,所有从站收到“0号地址”请求时均不进行报文应答。从另一个方面,网络的整个通信方式由Modbus主站决定,所有网络从站都必须与之一致才能正常通信。According to the regulation of the Modbus transmission protocol standard: firstly, the master station initiates a request to the slave station for communication, and the Modbus master station can only initiate one communication transaction at a time, all slave stations in the network will receive the request message, and then analyze the request message The content of the address field of the message, judge whether the content is the address of the station, if so, make a corresponding response, otherwise discard the message. The effective range of the address field is 1-247, and the address 0 is a broadcast address, and all slave stations will not respond with a message when they receive the request of "address 0". From another aspect, the entire communication mode of the network is determined by the Modbus master station, and all network slave stations must be consistent with it to communicate normally.
步骤S3.重构控制模块向重构主控模块发送重构请求,重构控制模块接收重构主控模块的准备完成信号后对重构区域重新进行协议配置,即对重构区域进行重构。Step S3. The reconfiguration control module sends a reconfiguration request to the reconfiguration main control module, and the reconfiguration control module reconfigures the protocol for the reconfiguration area after receiving the preparation completion signal of the reconfiguration main control module, that is, reconfigures the reconfiguration area .
图3为本发明的具体实施例流程示意图。如图3所示,是本实施例提供的Modbus从站通过重构网络数据链路层的实现自动适应网络通信协议变化的详细流程图,其包含了具体实施过程的诸多细节,有助于理解本发明,但是对于本领域技术人员而言,这诸多细节限定而成的技术方案仅是本发明较优的技术方案,不应理解为本发明的唯一实现方式或者对保护范围的限定。具体流程包括:Fig. 3 is a schematic flow chart of a specific embodiment of the present invention. As shown in Figure 3, it is a detailed flow chart of the Modbus slave station provided in this embodiment to automatically adapt to network communication protocol changes by reconfiguring the network data link layer. It contains many details of the specific implementation process, which is helpful for understanding The present invention, but for those skilled in the art, the technical solution defined by these many details is only a better technical solution of the present invention, and should not be understood as the only way of realizing the present invention or limiting the scope of protection. The specific process includes:
步骤S301、判断当前网络链路通信类型是否与网络重构区域的通信协议类型一致,该步骤等同于第一实施例的步骤S301-S310后,根据当前通信计数器值确定当前链路通信协议类型,然后再将该类型与图1中网络通信重构区域里的通信协议类型相比较,若此二者显示的通信类型一致,不需要改变,则进入下一次条件判断;若此二者显示通信类型不一致,则进入步骤S302。Step S301, judging whether the current network link communication type is consistent with the communication protocol type of the network reconstruction area, this step is equivalent to steps S301-S310 of the first embodiment, and then determining the current link communication protocol type according to the current communication counter value, Then compare this type with the communication protocol type in the network communication reconstruction area in Figure 1. If the communication types displayed by the two are consistent and do not need to be changed, enter the next conditional judgment; if the two display the communication type If not, go to step S302.
步骤S302、若步骤S301判断结果为假时,说明该从站通信协议与网络主站通信协议不一致,则激活重构控制块,屏蔽网络通信重构区域的输入信号,避免在重构过程中,外界信号变换影响网络重构。Step S302, if the judgment result of step S301 is false, indicating that the communication protocol of the slave station is inconsistent with the communication protocol of the network master station, activate the reconfiguration control block, shield the input signal of the network communication reconfiguration area, and avoid External signal transformation affects network reconstruction.
步骤S303、根据当前检测的网络通信协议,确定外部存储器的通信地址,建立数据通路。Step S303, according to the currently detected network communication protocol, determine the communication address of the external memory, and establish a data path.
其中,外部存储器是用作存放网络通信重构区域的部分重构配置文件,本实施例是实现Modbus ASCII与Modbus RTU数据链路的自动重构,即在该存储其中按地址分段存储了ModbusASCII数据链路配置文件和Modbus RTU数据链路层配置文件。当存储控制块向该存储器发送读命令,同时将读的起始地址发送值存储器,然后该存储器将数据按照时钟周期节拍传送至存储器控制块。Wherein, the external memory is used to store the partial reconstruction configuration file of the network communication reconstruction area. This embodiment is to realize the automatic reconstruction of the Modbus ASCII and Modbus RTU data links, that is, the ModbusASCII is stored in sections according to the addresses in the storage. Data Link Profile and Modbus RTU Data Link Layer Profile. When the storage control block sends a read command to the memory, at the same time, the read start address is sent to the value memory, and then the memory transmits the data to the memory control block according to the clock cycle beat.
步骤S304、重构控制块向FPGA中的重构主控节点准备重构时钟,并发送重构请求信号,该请求信号表明外部请求对网络通信重构区域重新配置,而且该信号需要一直保持高电平,直到重构成功信号出现。Step S304, the reconfiguration control block prepares the reconfiguration clock to the reconfiguration master control node in the FPGA, and sends a reconfiguration request signal, which indicates an external request to reconfigure the network communication reconfiguration area, and the signal needs to be kept high level until the reconstruction success signal appears.
其中,重构时钟由重构控制块提供,该时钟信号时重构主节点的工作的基准时钟,而且重构控制块应当在整个重构过程中为重构主控节点提供该时钟信号。步骤S303、判断重构主控节点准备完成信号是否被发生。重构控制模块发送重构请求信号后,FPGA需要一段时间反应,准备数据接收等操作,在此期间对重构主节点送人数据是无效的。Wherein, the reconfiguration clock is provided by the reconfiguration control block, and the clock signal is the working reference clock of the reconfiguration master node, and the reconfiguration control block should provide the clock signal for the reconfiguration master control node during the whole reconfiguration process. Step S303, judging whether the reconfiguration master control node preparation completion signal is generated. After the reconfiguration control module sends the reconfiguration request signal, the FPGA needs a period of time to respond and prepare for data reception and other operations. During this period, the data sent by the reconfiguration master node is invalid.
步骤S306、若步骤S304判断为真,则等待四个重构时钟周期,并通过存储器烤制块取出第一个16bit数据,并将其放在重构主节点的数据总线上。Step S306, if the judgment of step S304 is true, wait for four reconstruction clock cycles, and take out the first 16-bit data through the memory baking block, and put it on the data bus of the reconstruction master node.
其中,重构准备完成信号出现后,需要等待四个时钟周期,在此我们称之为“握手协定”,保证重构数据域时钟同步。Among them, after the reconstruction ready signal appears, it needs to wait for four clock cycles. Here we call it the "handshake agreement" to ensure the clock synchronization of the reconstructed data domain.
其中,由于重构主节点的数据位宽为16,则每次都需要从存储器取出两个字节数据,其中第一个字节为低8位,第二字节为高第8位。Wherein, since the data bit width of the reconstructed master node is 16, two bytes of data need to be fetched from the memory each time, wherein the first byte is the lower 8 bits, and the second byte is the upper 8 bits.
步骤S307、按照时钟节拍,每次从外部存储器中取出16bit数据,并在重构时钟的下降沿将该配置数据放在数据总线上。Step S307 , taking out 16-bit data from the external memory each time according to the clock beat, and putting the configuration data on the data bus at the falling edge of the reconstruction clock.
当S306等待四个重构时钟周期后,重构主节点将在时钟的上升沿或数据总线数据。本实例提供的方法约定,在每个时钟的下降沿准备好重构数据,以保证在上升沿采集的时候数据的有序及有效性。After S306 waits for four reconfiguration clock cycles, the reconfiguration master node will send data on the rising edge of the clock or the data bus. The method provided in this example agrees to prepare the reconstructed data on the falling edge of each clock to ensure the order and validity of the data when it is collected on the rising edge.
步骤S308、判断重构主节点的重构成功信号是否被置高。若该电平保持为低,则说明配置文件尚未传输完成,则返回步骤S307;若该电平被置高,说明重构结束,然后进入步骤S309。Step S308, judging whether the reconstruction success signal of the reconstruction master node is set high. If the level remains low, it means that the configuration file transmission has not been completed, and then return to step S307; if the level is set high, it means that the reconstruction is completed, and then go to step S309.
步骤S309、取消重构请求信号,等待重构成功信号置0。为避免重构主节点启动第二次重构,规定重构请求信号在8个重构时钟内必须清除为0,本实施例规定,当出现重构成功信号后,则立即取消重构请求信号。Step S309, cancel the reconstruction request signal, and wait for the reconstruction success signal to be set to 0. In order to prevent the reconfiguration master node from starting the second reconfiguration, it is stipulated that the reconfiguration request signal must be cleared to 0 within 8 reconfiguration clocks. This embodiment stipulates that when the reconfiguration success signal appears, the reconfiguration request signal is immediately canceled .
其中,当重构信号出现后,FPGA将会保持重构成功信号一段时间,在该期间内,不允许网络通信重构区域的屏蔽信号及复位信号仍需要保持为高。Wherein, when the reconfiguration signal appears, the FPGA will keep the reconfiguration success signal for a period of time, and during this period, the shielding signal and reset signal that do not allow the network communication reconfiguration area still need to be kept high.
步骤S310、取消屏蔽网络通信重构区域输入信号,复位网络通信重构区域。在步骤S309中,当重构成功信号由高变为低后,整个重构过程已经结束。重构控制块则取消步骤S302的屏蔽控制信号,并复位该网络通信重构区域,以保证所有的通信状态保持为初始值。Step S310, unmask the input signal of the network communication reconfiguration area, and reset the network communication reconfiguration area. In step S309, when the reconstruction success signal changes from high to low, the entire reconstruction process has ended. The reconfiguration control block cancels the shielding control signal in step S302, and resets the network communication reconfiguration area, so as to ensure that all communication states remain at initial values.
需要注意的是,整个FGPA需要在整体配置成功一次之后,才能进行该实施例的重构过程,该整体配置同时将静态区域和网络部分重构区域同时配置,该过程可以保证通信识别通信检测模块、应用控制块、存储器控制块等正常工作。It should be noted that the reconstruction process of this embodiment can only be carried out after the overall configuration of the entire FGPA is successful once. The overall configuration configures the static area and the network partial reconstruction area at the same time. This process can ensure that the communication identification communication detection module , application control block, memory control block, etc. work normally.
本实施例初始完全配置过程中网络通信重构区域的初始通信方式可以为Modbus ASCII和Modbus RTU中的任意一种,均满足本实施例的要求。此外,整个FPGA的重构次数是根据实际情况确定,没有严格限制。The initial communication mode of the network communication reconstruction area in the initial complete configuration process of this embodiment can be any one of Modbus ASCII and Modbus RTU, all of which meet the requirements of this embodiment. In addition, the number of reconfigurations of the entire FPGA is determined according to the actual situation and is not strictly limited.
图4为本发明的通信协议类型的判别过程示意图。Fig. 4 is a schematic diagram of the process of discriminating the communication protocol type in the present invention.
Modbus ASCII和Modbus RTU均包括物理层、数据链路层和应用层,但其数据链路层差异较大,尤其是数据位宽、数据编码方式等。如图4所示:Both Modbus ASCII and Modbus RTU include physical layer, data link layer and application layer, but the data link layer is quite different, especially the data bit width and data encoding method. As shown in Figure 4:
步骤S401.Modbus从站(满足Modbus RTU或Modbus ASCII其中任意一种通信协议)通过RS-485总线数据输入信号,并监视该输入信号的起始信号;Step S401.Modbus slave station (satisfying any communication protocol of Modbus RTU or Modbus ASCII) through the RS-485 bus data input signal, and monitor the start signal of the input signal;
其中,起始信号是Modbus通信站传输每个字节的起始位,规定为低电平。当接收比特流计数值为零,且链路输入信号为低电平时,则该信号为起始信号,表明一个字节传输开始;Among them, the start signal is the start bit of each byte transmitted by the Modbus communication station, which is specified as a low level. When the received bit stream count value is zero and the link input signal is low, the signal is a start signal, indicating that a byte transmission starts;
步骤S402.判断采样比特流数据的时间是否到,该采样时间尚未到时,则继续等待;Step S402. Judging whether the time for sampling the bit stream data is up, if the sampling time is not yet up, continue to wait;
步骤S403.若步骤S402判断采样时间到时,则将当前链路输入数据放入接收缓存,然后将比特流接收计数器加1,其中,比特流数据存放的相对地址由比特流计数值决定;Step S403. If step S402 determines that the sampling time is up, put the current link input data into the receiving buffer, and then add 1 to the bit stream receiving counter, wherein the relative address of the bit stream data storage is determined by the bit stream count value;
步骤S404.判断比特流计数值是否等于9,并且判断步骤S403接收的比特数据是否等于1;Step S404. Judging whether the bit stream count value is equal to 9, and judging whether the bit data received in step S403 is equal to 1;
具体地,由Modbus ASCII传输协议标准规定,在数据链路层传输的每个字节数据包括1个起始位+7个数据位+1个奇偶校验位+1个停止位,Modbus RTU传输协议标准规定,在数据链路层的每个字节包括1个起始位+8个数据位+1个奇偶校验位,其中起始位为0,停止位为1,奇偶检验位由数据位和奇偶检验方式决定。当步骤S404中判断比特流计数值为9,则说明本次字节传送的起始位、数据位、奇偶检验位均已被接收,若当前接收的比特流数据为1,则表明符合Modbus ASCII停止位要求,然后进入步骤S408,进行奇偶检验检查;Specifically, as stipulated by the Modbus ASCII transmission protocol standard, each byte of data transmitted at the data link layer includes 1 start bit + 7 data bits + 1 parity bit + 1 stop bit, and Modbus RTU transmission The protocol standard stipulates that each byte in the data link layer includes 1 start bit + 8 data bits + 1 parity bit, where the start bit is 0, the stop bit is 1, and the parity bit is determined by the data bit and parity check mode. When it is judged that the bit stream count value is 9 in step S404, it means that the start bit, data bit, and parity bit of this byte transmission have all been received. If the currently received bit stream data is 1, it indicates that it conforms to Modbus ASCII Stop bit request, then enter step S408, carry out parity check;
步骤S405.判断比特流计数值是否等于10。若步骤404与步骤S405判断结果同时为假时,则返回S402,准备接收下一个数据;若步骤S405判断结果为真时,说明已接收的数据不符合Modbus ASCII帧格式要求,而且此时已经接收了10比特数据,满足Modbus RTU字节比特流校验要求,则进入步骤S406;Step S405. Determine whether the bit stream count value is equal to 10. If step 404 and step S405 judging result are false simultaneously, then return to S402, prepare to receive next data; If step S405 judging result is true, explain that the data received does not meet the Modbus ASCII frame format requirement, and this moment has received 10-bit data is obtained, and the Modbus RTU byte bit stream verification requirement is satisfied, and then step S406 is entered;
步骤S406.判断bit1-bit9奇偶检验是否正确,若正确则进入步骤S407,Step S406. Judging whether the bit1-bit9 parity check is correct, if correct, enter step S407,
步骤S407.对通信计数器加1;Step S407. Add 1 to the communication counter;
步骤S408.判断bit1-bit8的奇偶检验是否正确,按照Modbus ASCII协议规定,接收缓存的bit1-bit8包括了全部的数据位和奇偶检验位。若该校验结果错误,即不符合ModbusASCII的帧格式,则重新进入步骤S304,继续接收第10个比特数据;若该校验结果正确,即符合Modbus ASCII的帧格式,然后进入步骤S409,将通信计数器减1;Step S408. Determine whether the parity check of bit1-bit8 is correct. According to the Modbus ASCII protocol, bit1-bit8 of the receiving buffer includes all data bits and parity check bits. If the verification result is wrong, that is, it does not conform to the frame format of ModbusASCII, then re-enter step S304, continue to receive the 10th bit data; if the verification result is correct, that is, it meets the frame format of Modbus ASCII, then enter step S409, and The communication counter is decremented by 1;
步骤S210.清零比特流计数器,当完成Modbus ASCII和Modbus RTU正确校验后,然后进入该步骤对比特流计数器进行清零操作,表明一个字节接收完毕,重新返回开始操作,进行下一个字节数的接收及判断。Step S210. clear the bit stream counter, after completing the correct verification of Modbus ASCII and Modbus RTU, then enter this step to clear the bit stream counter, indicating that a byte has been received, return to the start operation, and perform the next word Receiving and judging the number of sessions.
通过上述步骤,完成对Modbus ASCII以及Modbus RTU的识别,上述识别方式仅仅是以Modbus总线的两种模式Modbus ASCII以及Modbus RTU为例进行协议识别说明,在实际应用中,其他的网络通信协议也可以采用上述的方法进行识别,只是其他协议的字节的起始位、校验位等设置不同而已。Through the above steps, the identification of Modbus ASCII and Modbus RTU is completed. The above identification method only uses the two modes of Modbus bus, Modbus ASCII and Modbus RTU, as examples for protocol identification description. In practical applications, other network communication protocols can also be used. The above method is used for identification, but the settings of the start bit and check bit of the byte of other protocols are different.
图5为本发明的具体实施例通信模型异同点对比示意图。如图5所示,Modbus总线传输模式分为Modbus ASCII和Modbus RTU两种传输模式。按OSI七层模型,Modbus ASCII和Modbus RTU均包括物理层、数据链路层和应用层,但其数据链路层差异较大,尤其是数据位宽、数据编码方式等。本发明正是基于此思路,提供一种通过改变网络通信数链路层,在线自动适应Modbus ASCII与Modbus RTU通信协议的方法。串行链路的通信协议所包括的物理层,数据链路层和应用层,通常情况下,基于FPGA平台的网络通信重构区域包含数据链路层和应用层,若从站设备的物理层没有设置可与FPGA芯片相匹配对接的对外接口,则网络通信重构区域包含数据链路层和应用层,但是,若从站设备的物理层设置有可与FPGA芯片匹配对接的对外接口,依然可以通过本发明所提供的方法实现基于FPGA的串行总线通信在线重构。虽然在本发明的实施例中,对Modbus ASCII和Modbus RTU的通信重构中只重构数据链路层,是因为剩余的应用层和物理层是一样的,不再做重复表述。Fig. 5 is a schematic diagram of comparing the similarities and differences of the communication models of the specific embodiment of the present invention. As shown in Figure 5, the Modbus bus transmission mode is divided into two transmission modes: Modbus ASCII and Modbus RTU. According to the OSI seven-layer model, both Modbus ASCII and Modbus RTU include the physical layer, data link layer and application layer, but the data link layer is quite different, especially in data bit width and data encoding method. Based on this idea, the present invention provides a method for automatically adapting to the Modbus ASCII and Modbus RTU communication protocols online by changing the link layer of the network communication number. The communication protocol of the serial link includes the physical layer, the data link layer and the application layer. Usually, the network communication reconstruction area based on the FPGA platform includes the data link layer and the application layer. If the physical layer of the slave device If there is no external interface that can be matched and docked with the FPGA chip, the network communication reconstruction area includes the data link layer and the application layer. The online reconfiguration of serial bus communication based on FPGA can be realized through the method provided by the invention. Although in the embodiments of the present invention, only the data link layer is reconfigured in the communication reconstruction of Modbus ASCII and Modbus RTU, because the remaining application layer and the physical layer are the same, and no longer repeat the description.
图6是Modbus总线网络的拓扑图。如图6所示,其主要由一个Modbus主站和若干个Modbus从站构成,其中各个站之间通过RS-485总线连接,并在485总线两端分别接入120Ω的终端电阻。Modbus网络中各站之间通信均采用该总线传输,而且每个正确的通信报文均符合Modbus传输协议标准。Figure 6 is a topology diagram of the Modbus bus network. As shown in Figure 6, it is mainly composed of a Modbus master station and several Modbus slave stations, among which the stations are connected through the RS-485 bus, and 120Ω terminal resistors are connected to both ends of the 485 bus. The communication between the stations in the Modbus network is transmitted by this bus, and each correct communication message conforms to the Modbus transmission protocol standard.
根据Modbus传输协议标准的规定:通讯首先由主站向从站发起请求,而且Modbus的主站每次只能发起一个通信事务,网络中所有从站都会接收到该请求报文,然后通过解析该报文的地址域内容,判断该内容是否为本站地址,若是则作出相应的应答响应,否则丢弃该报文。其中地址域的有效范围为1-247,另外0号地址为广播地址,所有从站收到“0号地址”请求时均不进行报文应答。从另一个方面,网络的整个通信方式由Modbus主站决定,所有网络从站都必须与之一致才能正常通信。根据Modbus总线传输协议标准的定义:Modbus总线传输模式分为Modbus ASCII和Modbus RTU两种传输模式。According to the regulation of the Modbus transmission protocol standard: firstly, the master station initiates a request to the slave station for communication, and the Modbus master station can only initiate one communication transaction at a time, all slave stations in the network will receive the request message, and then analyze the request message The content of the address field of the message, judge whether the content is the address of the station, if so, make a corresponding response, otherwise discard the message. The effective range of the address field is 1-247, and the address 0 is a broadcast address, and all slave stations will not respond with a message when they receive the request of "address 0". From another aspect, the entire communication mode of the network is determined by the Modbus master station, and all network slave stations must be consistent with it to communicate normally. According to the definition of the Modbus bus transmission protocol standard: the Modbus bus transmission mode is divided into two transmission modes: Modbus ASCII and Modbus RTU.
应当指出,以上具体实施方式可以使本领域的技术人员更全面地理解本发明创造,但不以任何方式限制本发明创造。因此,尽管本说明书和实施例对本发明创造已进行了详细的说明,但是,本领域技术人员应当理解,仍然可以对本发明创造进行修改或者等同替换;而一切不脱离本发明的精神和范围的技术方案及其改进,其均涵盖在本发明创造专利的保护范围当中。It should be pointed out that the above specific embodiments can enable those skilled in the art to understand the invention more fully, but do not limit the invention in any way. Therefore, although the description and examples have described the invention in detail, those skilled in the art should understand that the invention can still be modified or equivalently replaced; and all technologies that do not depart from the spirit and scope of the invention The scheme and its improvement are all included in the protection scope of the invention patent.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410471276.8A CN104219121B (en) | 2014-09-16 | 2014-09-16 | Serial bus communication on-line reorganization method based on FPGA |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410471276.8A CN104219121B (en) | 2014-09-16 | 2014-09-16 | Serial bus communication on-line reorganization method based on FPGA |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN104219121A true CN104219121A (en) | 2014-12-17 |
| CN104219121B CN104219121B (en) | 2017-11-07 |
Family
ID=52100274
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410471276.8A Active CN104219121B (en) | 2014-09-16 | 2014-09-16 | Serial bus communication on-line reorganization method based on FPGA |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN104219121B (en) |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105656600A (en) * | 2015-12-29 | 2016-06-08 | 湖南先步信息股份有限公司 | Communication method for slave station to adapt to two communication protocols |
| CN106027510A (en) * | 2016-05-13 | 2016-10-12 | 西南大学 | Dynamic reconstruction method and system for communication network of industrial Ethernet |
| CN111857866A (en) * | 2020-06-29 | 2020-10-30 | 浪潮电子信息产业股份有限公司 | Method, device and computer-readable storage medium for loading multiple dynamic cores |
| CN111937297A (en) * | 2018-05-14 | 2020-11-13 | 欧姆龙株式会社 | Motor control device |
| WO2021042597A1 (en) * | 2019-09-03 | 2021-03-11 | 苏州浪潮智能科技有限公司 | Fpga dynamic reconfiguration method, apparatus and device, and readable storage medium |
| WO2021164170A1 (en) * | 2020-02-21 | 2021-08-26 | 山东超越数控电子股份有限公司 | Multi-path high-speed protocol interface dynamic reconfiguration system and implementation method therefor |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080229326A1 (en) * | 2007-01-26 | 2008-09-18 | Objective Interface Systems, Inc. | Hardware communications infrastructure supporting location transparency and dynamic partial reconfiguration |
| US7509617B1 (en) * | 2005-09-12 | 2009-03-24 | Xilinx, Inc. | Design methodology to support relocatable bit streams for dynamic partial reconfiguration of FPGAs to reduce bit stream memory requirements |
| CN101436225A (en) * | 2008-12-11 | 2009-05-20 | 国网电力科学研究院 | Implementing method of dynamic local reconstructing embedded type data controller chip |
| CN101677284A (en) * | 2008-09-19 | 2010-03-24 | 中国人民解放军信息工程大学 | Hardware component generation method and device capable of being downloaded to reconfigurable hardware body |
| CN101788931A (en) * | 2010-01-29 | 2010-07-28 | 杭州电子科技大学 | Dynamic local reconfigurable system for real-time fault tolerance of hardware |
-
2014
- 2014-09-16 CN CN201410471276.8A patent/CN104219121B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7509617B1 (en) * | 2005-09-12 | 2009-03-24 | Xilinx, Inc. | Design methodology to support relocatable bit streams for dynamic partial reconfiguration of FPGAs to reduce bit stream memory requirements |
| US20080229326A1 (en) * | 2007-01-26 | 2008-09-18 | Objective Interface Systems, Inc. | Hardware communications infrastructure supporting location transparency and dynamic partial reconfiguration |
| CN101677284A (en) * | 2008-09-19 | 2010-03-24 | 中国人民解放军信息工程大学 | Hardware component generation method and device capable of being downloaded to reconfigurable hardware body |
| CN101436225A (en) * | 2008-12-11 | 2009-05-20 | 国网电力科学研究院 | Implementing method of dynamic local reconstructing embedded type data controller chip |
| CN101788931A (en) * | 2010-01-29 | 2010-07-28 | 杭州电子科技大学 | Dynamic local reconfigurable system for real-time fault tolerance of hardware |
Non-Patent Citations (3)
| Title |
|---|
| 彭晓明 等: "《动态可重构技术研究综述》", 《计算机工程与设计》 * |
| 王春玲 等: "《FPGA的可重构测控系统应用设计》", 《单片机与嵌入式系统应用》 * |
| 陈一骄 等: "《基于FPGA的可重构硬件实现技术研究》", 《信息工程大学学报》 * |
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105656600A (en) * | 2015-12-29 | 2016-06-08 | 湖南先步信息股份有限公司 | Communication method for slave station to adapt to two communication protocols |
| CN105656600B (en) * | 2015-12-29 | 2019-05-10 | 湖南先步信息股份有限公司 | A kind of communication means of the adaptive two kinds of communication protocol of slave station |
| CN106027510A (en) * | 2016-05-13 | 2016-10-12 | 西南大学 | Dynamic reconstruction method and system for communication network of industrial Ethernet |
| CN106027510B (en) * | 2016-05-13 | 2019-07-26 | 西南大学 | Method and system for dynamic reconfiguration of communication network of industrial Ethernet |
| CN111937297A (en) * | 2018-05-14 | 2020-11-13 | 欧姆龙株式会社 | Motor control device |
| WO2021042597A1 (en) * | 2019-09-03 | 2021-03-11 | 苏州浪潮智能科技有限公司 | Fpga dynamic reconfiguration method, apparatus and device, and readable storage medium |
| US11474815B2 (en) | 2019-09-03 | 2022-10-18 | Inspur Suzhou Intelligent Technology Co., Ltd. | FPGA dynamic reconfiguration method, apparatus, device and readable storage medium |
| WO2021164170A1 (en) * | 2020-02-21 | 2021-08-26 | 山东超越数控电子股份有限公司 | Multi-path high-speed protocol interface dynamic reconfiguration system and implementation method therefor |
| CN111857866A (en) * | 2020-06-29 | 2020-10-30 | 浪潮电子信息产业股份有限公司 | Method, device and computer-readable storage medium for loading multiple dynamic cores |
| CN111857866B (en) * | 2020-06-29 | 2022-06-17 | 浪潮电子信息产业股份有限公司 | Loading method and device of multiple dynamic cores and computer readable storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104219121B (en) | 2017-11-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104219121B (en) | Serial bus communication on-line reorganization method based on FPGA | |
| CN104345717B (en) | Intelligent remote data acquisition system based on Internet of Things | |
| CN102546843B (en) | A kind of method by the multiple UART communication interfaces of software simulated implementation | |
| CN102664902B (en) | Hardware implementing method for kernels of POWERLINK communication protocol master and slave stations | |
| CN106789258A (en) | The collocation method of EPA | |
| CN202077061U (en) | Multi-port and multi-network protocol converter | |
| CN108449250A (en) | An IO-LINK master station device and method supporting multiple buses | |
| US12153388B2 (en) | Circuit for coupling a field bus and a local bus | |
| CN104932472A (en) | Network online reconfigurable industrial security monitoring system | |
| CN106027510A (en) | Dynamic reconstruction method and system for communication network of industrial Ethernet | |
| CN111447084A (en) | A method and system for interconnection and fusion of heterogeneous industrial networks | |
| CN201860344U (en) | System supporting various fieldbus protocols | |
| CN102594871B (en) | A kind of data encapsulation method, system, adapter and Internet of things middleware | |
| CN208272993U (en) | A kind of hub integrated chip | |
| CN102332948B (en) | Control the method and system of main micro/nano satellite communication | |
| CN104022934A (en) | Communication method of communication equipment based on PROFIBUS-DP protocol | |
| CN106789290A (en) | A kind of data cut-in method and system based on Modbus rtu protocols | |
| JP2012048475A (en) | Optical communication controller | |
| CN117749559A (en) | Communication method, device and system based on EtherCAT and computing equipment | |
| CN101750988A (en) | Cigarette making machine data communication and monitoring device and method for controlling same | |
| JP2014096698A (en) | Communication device | |
| CN210488282U (en) | Multi-protocol data acquisition board card | |
| CN210380890U (en) | Communication system and SIS system of Modbus equipment | |
| CN108540294B (en) | Hub integrated chip | |
| CN110445767B (en) | Integrated module integrated system capable of supporting various processors |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |