Method capable of expanding multi-path MODBUS communication
By implementing a multi-parallel MODBUS communication module in FPGA, combined with software and hardware, the problem of insufficient number of SCI communication ports in DSP is solved, and scalable multi-channel MODBUS communication is realized, saving costs and improving system flexibility.
Patent Information
- Application Number
- CN202411840341.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-22
AI Technical Summary
In the existing converter control system, due to the limitations of the number of SCI communication ports in DSP, the needs of multiple 485 interfaces cannot be met, resulting in waste of resources and increased hardware and labor costs.
By implementing multiple parallel MODBUS communication modules in FPGAs, combined with software and hardware, expandable multi-MODBUS communication is realized, avoiding the addition of MCUs, and thus meeting different number of MODBUS communication needs.
It realizes high scalability of software and hardware, avoids resource waste, saves hardware and labor costs, and simplifies software maintenance.
Smart Images

Figure CN119862145A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method for scalable multi-channel MODBUS communication. Background Art
[0002] In current converter control or other power equipment systems, in order to save costs and reduce the system complexity of three processors, a two-processor system solution of DSP+FPGA is usually adopted. When communicating with external 485, due to the limitation of the number of SCI communication ports in DSP, more 485 interface requirements cannot be met in some applications. At present, most of them evaluate the maximum number of interfaces required at the beginning of system design, and adopt a three-processor method with MCU to realize more interface requirements in advance.
[0003] By adding three processors to the MCU and reserving more 485 hardware interfaces, this method increases the hardware cost; at the same time, the scalability is also poor. In most cases, there is not much demand for 485 interfaces, which results in a waste of resources. The additional MCU also requires the development and maintenance of a new set of software, which increases the labor cost and the complexity of the control system software. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method for scalable multi-channel MODBUS communication, which utilizes the execution parallelism and programmability of FPGA, combines software and hardware without adding MCU, and realizes scalable multi-channel MODBUS communication, thereby solving the problem of resource waste caused by insufficient or pre-reserved 485 communication interfaces.
[0005] In order to solve the above technical problems, the present invention provides a method for expandable multi-channel MODBUS communication, comprising multi-channel parallel MODBUS communication modules, wherein the MODBUS communication modules are connected to an external data RAM through a read-write RAM arbitration module; the MODBUS communication module comprises a serial data receiving module, a serial data sending module and a CRC check module, wherein the serial data receiving module is connected to a data buffer module and the CRC check module, wherein the data buffer module and the CRC check module are both connected to the data parsing module, wherein the data parsing module is connected to a data read-write operation module; wherein the data read-write operation module is connected to a data packaging module, wherein the data packaging module is connected to the CRC check module and a data sending control module, wherein the data sending control module is connected to the serial data sending module.
[0006] Furthermore, it includes hardware facilities, which include FPGA, DSP and expansion interface, and the FPGA is connected with the DSP and the expansion interface respectively.
[0007] Furthermore, the DSP is an execution unit of the algorithm, and an address-data bus is used to implement data interaction between the DSP and the FPGA.
[0008] Furthermore, the CRC check module receives the data from the data packaging module and obtains a check code, is connected to the data sending control module, and sends the check code.
[0009] Furthermore, the data cache module performs cache operations in a FIFO or register manner.
[0010] Beneficial effects of the present invention: The software and hardware of the present invention are highly scalable and can be increased or decreased at will according to actual needs. Hardware resources are reasonably utilized, resource waste is avoided, and costs are saved. At the same time, the software communication module is highly reproducible and the software maintenance is convenient. It can meet the MODBUS communication needs of different quantities. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a schematic diagram of the structure of the MODBUS communication module of the present invention.
[0012] Figure 2 It is a schematic diagram of the hardware structure of the present invention.
[0013] Figure 3 It is a multi-channel MODBUS communication expansion diagram of the present invention. DETAILED DESCRIPTION
[0014] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0015] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0016] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0017] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0018] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0019] It should be noted that when an element is referred to as being "fixed to" or "disposed on" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "upper", "lower", "left", "right" and similar expressions used herein are for illustrative purposes only and are not intended to be the only implementation method.
[0020] Reference Figures 1 to 3As shown, an embodiment of an expandable multi-channel MODBUS communication method of the present invention includes multi-channel parallel MODBUS communication modules, and the MODBUS communication modules are connected to the external data RAM through the read-write RAM arbitration module; the MODBUS communication module includes a serial data receiving module, a serial data sending module and a CRC check module, the serial data receiving module is connected to the data buffer module and the CRC check module, the data buffer module and the CRC check module are both connected to the data parsing module, and the data parsing module is connected to the data read-write operation module; the data read-write operation module is connected to the data packaging module, the data packaging module is connected to the CRC check module and the data sending control module, and the data sending control module is connected to the serial data sending module.
[0021] The system comprises hardware facilities, which include FPGA, DSP and expansion interface, and the FPGA is connected with the DSP and the expansion interface respectively.
[0022] The specific instructions are as follows:
[0023] FPGA is used as a MODBUS communication implementation unit, connected to DSP and expansion interface respectively. In the control system, DSP is usually used as the execution unit of the algorithm and is the final user of the data exchanged between the control system and external devices, so the address-data bus method is used to realize the data interaction between DSP and FPGA. The expansion interface can be extended and plugged in with the 485 module pins by means of female headers, or other methods such as terminal wiring. The 485 module adopts modular design.
[0024] Software implementation, realizes MODBUS communication and data storage in FPGA. The MODBUS communication module includes serial data receiving module, data cache module, CRC check module, data parsing module, data read and write operation module, read and write RAM arbitration module, data RAM, data packaging module, data sending control module, and serial data sending module.
[0025] The serial data receiving module receives the input serial data according to the set communication parameters, and temporarily stores it in the data cache module after receiving. The data cache can use FIFO or register mode. The received data is also sent to the CRC check module. The CRC check module calls the check table in the ROM to check the received data. When the serial data receiving module detects that the received data frame is completed, the CRC also completes the check. The check passes, indicating that the received data frame is correct. At this time, the data parsing module can parse according to the MODBUS RTU protocol. After parsing, if the data frame is a device instruction, the data operation module performs read and write operations on the data RAM after arbitration by the read-write RAM arbitration module. The read-write data register is defined in the dual-port RAM. The other end of the dual-port RAM is connected to the DSP's peripheral storage interface for the DSP to read and write data in the RAM. When multiple MODBUS communications perform read and write operations, the read-write RAM arbitration module needs to arbitrate to determine the order of read and write operations of the communication channel to prevent multiple MODBUS communications from performing read and write conflicts on the data register RAM at the same time. After completing the read and write operations, the response is made according to the instructions. The data packaging module packages the response data. At the same time, the data is sent to the CRC check module for verification. The check code is obtained and added to the sending data frame for packaging. The packaged response data frame is controlled by the data sending controller and output to the external device through the serial data sending module.
[0026] The multi-channel MODBUS communication expansion utilizes the execution parallelism and programmability of FPGA to instantiate multi-channel MODBUS communication modules. All data ends are connected to the read-write RAM arbitration module, and the data transceiver end is configured to the FPGA pin to transmit and receive data with the external 485 module.
[0027] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for scalable multi-channel MODBUS communication, characterized in that: It includes multiple parallel MODBUS communication modules, and the MODBUS communication modules are connected with the external data RAM through the read-write RAM arbitration module; The MODBUS communication module includes a serial data receiving module, a serial data sending module and a CRC check module, the serial data receiving module is connected to the data buffer module and the CRC check module, the data buffer module and the CRC check module are both connected to the data parsing module, and the data parsing module is connected to the data read and write operation module; The data reading and writing operation module is connected to the data packaging module, the data packaging module is connected to the CRC checking module and the data sending control module, and the data sending control module is connected to the serial data sending module.
2. The method for scalable multi-channel MODBUS communication as claimed in claim 1, characterized in that: The system comprises hardware facilities, which include FPGA, DSP and expansion interface, and the FPGA is connected with the DSP and the expansion interface respectively.
3. The method for scalable multi-channel MODBUS communication as claimed in claim 2, characterized in that: The DSP is the execution unit of the algorithm, and the address-data bus mode is adopted to realize the data interaction between the DSP and the FPGA.
4. The method for scalable multi-channel MODBUS communication as claimed in claim 1, characterized in that: The CRC check module receives the data from the data packaging module and obtains a check code, is connected to the data sending control module, and sends the check code.
5. The method for scalable multi-channel MODBUS communication as claimed in claim 1, characterized in that: The data cache module performs cache operations in the form of FIFO or register.