Switch and switching method based on CAN network multicast technology

By adopting switches and switching methods based on CAN network multicast technology in CAN networks, using forwarding tables to achieve accurate forwarding of data frames, the problems of communication conflicts and low bandwidth utilization in traditional CAN bus direct connection solutions when the network scale is expanded, and the real-time and bandwidth utilization of the system are improved.

CN120128559AActive Publication Date: 2025-06-10ANHUI ZHONGKE ZHONGHUAN INTELLIGENT EQUIP CO LTD

Patent Information

Application Number
CN202510615117.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-06-10
Estimated Expiration
2045-05-14

AI Technical Summary

Technical Problem

When the network scale is expanded, the traditional CAN bus direct connection solution will increase communication conflicts and reduce bandwidth utilization, which will not effectively solve the problem of multiple devices communicating simultaneously, affecting the real-time nature of the system.

Method used

The switch and switching method based on CAN network multicast technology are adopted. By presetting the forwarding table in the processor, the mapping relationship between the CAN port and the identifier of the target device is recorded, and accurate forwarding of data frames is achieved to avoid broadcasting data.

Benefits of technology

By maintaining the mapping relationship between the identifier of each target device and the corresponding CAN port, broadcast data is avoided, unnecessary bus usage is reduced, and the real-time and bandwidth utilization of the system are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120128559A_ABST
    Figure CN120128559A_ABST
Patent Text Reader

Abstract

The invention discloses a switch and a switching method based on a CAN network multicast technology, and relates to the field of switches. Wherein the port module comprises a plurality of independent CAN (Controller Area Network) ports, and the plurality of independent CAN ports are electrically connected with the processor respectively; a forwarding table is preset in the processor, and identifiers of the CAN port and the corresponding target equipment are recorded in the forwarding table; when a certain CAN port receives a data frame, the processor is used for analyzing the data frame to obtain an identifier of a target device of the data frame, searching the corresponding CAN port in the forwarding table according to the identifier of the target device, and forwarding the data frame to the corresponding CAN port. By maintaining the mapping relation between the identifier of each target device and the corresponding CAN port, data broadcasting can be avoided, and unnecessary bus occupation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of switches, and in particular, to a switch and a switching method based on CAN network multicast technology. Background Art

[0002] In the fields of modern industrial automation, intelligent transportation, automotive electronics, and intelligent manufacturing, the CAN (Controller Area Network) bus is widely used in distributed control systems due to its high reliability, real-time performance, and anti-interference ability. However, traditional CAN bus direct connection schemes, such as Figure 1 and Figure 2 shown, adopt a broadcast communication method, where all nodes share the same bus. As the network scale expands, it will lead to an increase in communication conflicts and a decrease in bandwidth utilization, and cannot solve the problem of simultaneous communication of multiple devices, affecting the real-time performance of the system. Summary of the Invention

[0003] To solve the technical problems in the background art, the present invention proposes a switch and a switching method based on CAN network multicast technology.

[0004] In a first aspect, a switch based on CAN network multicast technology proposed by the present invention includes: a port module and a processor; wherein, the port module includes a plurality of independent CAN ports, and the plurality of independent CAN ports are respectively electrically connected to the processor; a forwarding table is preset in the processor, and the forwarding table records the CAN ports and the identifiers of the corresponding target devices. When a certain CAN port receives a data frame, the processor is used to parse the data frame to obtain the identifier of the target device of the data frame, and find the corresponding CAN port in the forwarding table according to the identifier of the target device, and forward the data frame to the corresponding CAN port.

[0005] Preferably, when the corresponding CAN port cannot be found in the forwarding table according to the identifier of the target device, the processor broadcasts the data frame to all CAN ports until the target device responds; when the target device responds and sends a data frame through a certain CAN port, the processor updates the forwarding table according to the CAN port and the identifier not recorded in the forwarding table.

[0006] Preferably, it further includes a data cache module, the plurality of independent CAN ports are respectively electrically connected to the data cache module, and the data cache module is electrically connected to the processor through a high-speed bus, and the data cache module is used to temporarily store the received CAN data frames.

[0007] Preferably, a priority scheduling policy and arbitration rules are preset in the processor; the processor is further configured to, when receiving or transmitting multiple data frames through multiple CAN ports simultaneously, determine the priority of each data frame according to the arbitration rules, and forward each data frame from high to low according to its priority according to the priority scheduling policy.

[0008] Preferably, an aging mechanism is preset in the processor, and the processor is further configured to age the forwarding table according to the aging mechanism; wherein, the aging mechanism means that the mapping relationship between the identifier of the target device in the forwarding table and the CAN port will automatically become invalid after a preset cumulative time without use.

[0009] Preferably, a remote management module is further included, and the remote management module is electrically connected to the processor. The remote management module supports serial port, Ethernet or USB for remote debugging and configuration to improve the operation and maintenance efficiency.

[0010] In a second aspect, the present invention further provides a switching method based on CAN network multicast technology, including: Obtain a data frame; Parse the data frame to obtain the identifier of the target device of the data frame; Find the corresponding CAN port in the preset forwarding table according to the identifier of the target device, and forward the data frame to the corresponding CAN port; wherein, the forwarding table records the CAN port and the identifier of the corresponding target device.

[0011] Preferably, when the corresponding CAN port cannot be found in the forwarding table according to the identifier of the target device, the data frame is broadcast to all CAN ports until the target device responds; when the target device responds and sends a data frame through a certain CAN port, update the forwarding table according to the CAN port and the identifier not recorded in the forwarding table.

[0012] Preferably, after obtaining the data frame, it further includes: temporarily storing the CAN data frame.

[0013] Preferably, in the process of forwarding the data frame to the corresponding CAN port, when receiving or transmitting multiple data frames through multiple CAN ports simultaneously, determine the priority of each data frame according to the preset arbitration rules, and forward each data frame from high to low according to its priority according to the preset priority scheduling policy.

[0014] Preferably, the forwarding table has an aging mechanism; wherein, the aging mechanism means that the mapping relationship between the identifier of the target device in the forwarding table and the CAN port will automatically become invalid after a preset cumulative time without use.

[0015] In the present invention, a switch and a switching method based on CAN network multicast technology are proposed. The mapping relationship between the identifier (CAN ID) of each target device and the corresponding CAN port is recorded through a forwarding table. When the switch receives a data frame, it looks up the forwarding table based on the identifier (CAN ID) of the target device in the data frame to determine which CAN port the data frame should be forwarded to. By maintaining the mapping relationship between the identifier (CAN ID) of each target device and the corresponding CAN port, the present invention can avoid broadcasting data and reduce unnecessary bus occupancy. Description of the Drawings

[0016] Figure 1 It is a schematic diagram of a traditional CAN bus direct connection scheme.

[0017] Figure 2 It is a schematic diagram of communication conflicts generated by a traditional CAN bus direct connection scheme.

[0018] Figure 3 It is a schematic diagram of the connection between a switch based on CAN network multicast technology in an embodiment proposed by the present invention and an external target device.

[0019] Figure 4 It is a schematic diagram of communication between a switch based on CAN network multicast technology in an embodiment proposed by the present invention and an external target device.

[0020] Figure 5 It is a schematic diagram of the structure of a switch based on CAN network multicast technology in an embodiment proposed by the present invention.

[0021] Figure 6 It is a schematic diagram of the flow of a switching method based on CAN network multicast technology in an embodiment proposed by the present invention. Detailed Embodiment

[0022] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the drawings and in combination with the embodiments.

[0023] In the first aspect, referring to Figures 3 - 5 , a switch based on CAN network multicast technology proposed by the present invention includes: a port module and a processor; wherein, the port module includes a plurality of independent CAN ports, and each CAN port is used to receive a data frame or forward the data frame to a target device; the plurality of independent CAN ports are respectively electrically connected to the processor; A forwarding table is preset in the processor, and the CAN port and the identifier of the corresponding target device are recorded in the forwarding table; When a data frame is received by a certain CAN port, the processor is used to parse the data frame to obtain the identifier of the target device of the data frame, and find the corresponding CAN port in the forwarding table according to the identifier of the target device, and forward the data frame to the corresponding CAN port, so as to forward it to the target device.

[0024] Each CAN interface in this embodiment is used to connect a CAN network or a target device. Each port can receive data frames from other CAN networks or target devices and send data to other networks or target devices.

[0025] The present invention records the mapping relationship between the identifier (CAN ID) of each target device and the corresponding CAN port through a forwarding table; when the switch receives a data frame, it will look up the forwarding table according to the identifier (CAN ID) of the target device in the data frame to determine which CAN port the data frame should be forwarded to. By maintaining the mapping relationship between the identifier (CAN ID) of each target device and the corresponding CAN port, the present invention can avoid broadcasting data and reduce unnecessary bus occupancy.

[0026] It should be noted that the identifier (CAN ID) of each target device is unique.

[0027] In this embodiment, when the identifier of the target device is not recorded in the forwarding table, the processor broadcasts the data frame to all CAN ports until the target device responds; when the target device responds and sends a data frame through a certain CAN port, the processor updates the forwarding table according to the CAN port and the identifier not recorded in the forwarding table.

[0028] Specifically, when the target ID is not recorded in the forwarding table, that is, when a data frame from a new device is received, the switch will broadcast, wait for the target device to respond, and update the forwarding table according to the response to store the ID of the device and the receiving port in the forwarding table. If data from the same device is received in the future, the switch can directly look up the forwarding table and direct the data frame to the corresponding port.

[0029] This embodiment is arranged in this way to ensure that data can still be transmitted to all possible devices when the identifier (CAN ID) of the target device has not been learned into the forwarding table, effectively avoiding data loss. Moreover, once the target device responds and sends a data frame to the switch, the processor will update the forwarding table to avoid broadcasting (i.e., flooding) again. This embodiment enables the switch to dynamically adapt when the network topology changes, effectively improving the flexibility and self-adaptive ability of the switch.

[0030] Among them, each CAN port supports CAN 2.0A and CAN 2.0B, and can be extended to CAN FD to improve the data transmission rate.

[0031] In this embodiment, a data cache module is further included. Multiple independent CAN ports are respectively electrically connected to the data cache module, and the data cache module is electrically connected to the processor through a high-speed bus. The data cache module is used to temporarily store the received CAN data frames to prevent frame loss caused by too fast data arrival speed or processing delay.

[0032] In this embodiment, by caching the received frames, the switch can achieve more efficient scheduling in data processing. Caching can prevent network congestion caused by excessive instantaneous traffic, ensuring that all data frames can be effectively received, processed, and correctly forwarded.

[0033] In one specific embodiment, the data cache module adopts DMA (Direct Memory Access).

[0034] In this embodiment, a priority scheduling policy and an arbitration rule are preset in the processor; the processor is also used to determine the priority of each data frame according to the arbitration rule when multiple CAN ports receive or send multiple data frames simultaneously, and forward each data frame from high to low according to its priority according to the priority scheduling policy.

[0035] This embodiment can ensure that high-priority data frames are preferentially transmitted according to the priority scheduling policy and the arbitration rule when the CAN ports are highly loaded, so as to ensure that the data transmission of system critical tasks is not delayed or lost, and avoid transmission conflicts.

[0036] In this embodiment, an aging mechanism is preset in the processor, and the processor is also used to age the forwarding table according to the aging mechanism; among them, the aging mechanism means that the mapping relationship between the identifier (CAN ID) of the target device in the forwarding table and the CAN port will automatically become invalid after a preset cumulative time without use.

[0037] This embodiment regularly clears the identifiers of target devices that have not been used for a long time through the aging mechanism, ensuring that the information in the forwarding table is up-to-date, avoiding the existence of outdated information in the forwarding table, and reducing unnecessary network overhead. Especially in the case of frequent changes in the network topology, the aging mechanism can effectively prevent data forwarding errors caused by expired information.

[0038] In this embodiment, a remote management module is further included. The remote management module is electrically connected to the processor, and the remote management module supports serial port, Ethernet or USB for remote debugging and configuration to improve the operation and maintenance efficiency.

[0039] In one specific embodiment, the processor is an ARM Cortex-M embedded processor.

[0040] Among them, in this embodiment, the port module uses the S32K358 module, which supports 8 CAN port communications.

[0041] In a second aspect, as Figure 6 shown, the present invention also proposes a switching method based on CAN network multicast technology, including: Obtain a data frame; Parse the data frame to obtain the identifier of the target device of the data frame; Find the corresponding CAN port in a preset forwarding table according to the identifier of the target device, and forward the data frame to the corresponding CAN port; wherein, the forwarding table records the CAN port and the identifier of the corresponding target device.

[0042] In this embodiment, when the corresponding CAN port cannot be found in the forwarding table according to the identifier of the target device, the data frame is broadcast to all CAN ports until the target device responds; when the target device responds and sends a data frame through a certain CAN port, update the forwarding table according to the CAN port and the identifier not recorded in the forwarding table.

[0043] In this embodiment, after obtaining the data frame, it further includes: Temporarily store the CAN data frame.

[0044] In this embodiment, in the process of forwarding the data frame to the corresponding CAN port, when multiple CAN ports receive or send multiple data frames simultaneously, determine the priority of each data frame according to a preset arbitration rule, and forward each data frame from high to low according to its priority according to a preset priority scheduling strategy.

[0045] The forwarding table in this embodiment has an aging mechanism; wherein, the aging mechanism means that the mapping relationship between the identifier (CAN ID) of the target device in the forwarding table and the CAN port will automatically become invalid after not being used for a preset cumulative time.

[0046] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent replacements or changes, and should be covered by the protection scope of the present invention.

Claims

1. A switch based on CAN network multicast technology, characterized in that: include: A port module and a processor; wherein the port module includes a plurality of independent CAN ports, and the plurality of independent CAN ports are electrically connected to the processor respectively; a forwarding table is preset in the processor, and the forwarding table records the identifiers of the CAN ports and the corresponding target devices; When a CAN port receives a data frame, the processor is used to parse the data frame to obtain the identifier of the target device of the data frame, find the corresponding CAN port in the forwarding table according to the identifier of the target device, and forward the data frame to the corresponding CAN port.

2. The switch based on CAN network multicast technology according to claim 1, characterized in that: When the corresponding CAN port cannot be found in the forwarding table according to the identifier of the target device, the processor broadcasts the data frame to all CAN ports until the target device responds; When the target device responds and sends a data frame through a certain CAN port, the processor updates the forwarding table according to the CAN port and the identifier that is not recorded in the forwarding table.

3. The switch based on CAN network multicast technology according to claim 1, characterized in that: It also includes a data cache module. Multiple independent CAN ports are electrically connected to the data cache modules respectively. The data cache module is electrically connected to the processor through a high-speed bus. The data cache module is used to temporarily store received CAN data frames.

4. The switch based on CAN network multicast technology according to claim 3 is characterized in that: The processor is preset with a priority scheduling strategy and arbitration rules; the processor is also used to determine the priority of each data frame according to the arbitration rules when multiple CAN ports simultaneously receive or send multiple data frames, and forward each data frame according to its priority from high to low according to the priority scheduling strategy.

5. The switch based on CAN network multicast technology according to claim 1, characterized in that: The processor is preset with an aging mechanism, and the processor is also used to age the forwarding table according to the aging mechanism; wherein the aging mechanism means that the mapping relationship between the identifier of the target device in the forwarding table and the CAN port will automatically become invalid after a preset cumulative time of non-use.

6. A switching method based on CAN network multicast technology, characterized in that: include: Get the data frame; Parsing the data frame to obtain an identifier of a target device of the data frame; The corresponding CAN port is searched in a preset forwarding table according to the identifier of the target device, and the data frame is forwarded to the corresponding CAN port; wherein the forwarding table records the identifier of the CAN port and the corresponding target device.

7. The switching method based on CAN network multicast technology according to claim 6 is characterized in that: When the corresponding CAN port cannot be found in the forwarding table according to the identifier of the target device, the data frame is broadcast to all CAN ports until the target device responds; When the target device responds and sends a data frame through a certain CAN port, the forwarding table is updated according to the CAN port and the identifier that is not recorded in the forwarding table.

8. The switching method based on CAN network multicast technology according to claim 6 is characterized in that: After acquiring the data frame, the method further includes: temporarily storing the CAN data frame.

9. The switching method based on CAN network multicast technology according to claim 8 is characterized in that: In the process of forwarding the data frame to the corresponding CAN port, when multiple CAN ports receive or send multiple data frames at the same time, the priority of each data frame is determined according to the preset arbitration rules, and each data frame is forwarded according to its priority from high to low according to the preset priority scheduling strategy.

10. The switching method based on CAN network multicast technology according to claim 6, characterized in that: The forwarding table has an aging mechanism; the aging mechanism means that the mapping relationship between the identifier of the target device and the CAN port in the forwarding table will automatically become invalid after being unused for a preset cumulative time.

Citation Information

Patent Citations

  • Ethernet network equipment and method for forwarding FCoE (Fibre Channel Over Ethernet) data

    CN102624613A

  • Ethernet interconnection structure capable of realizing information interaction in communication equipment and method thereof

    CN105763415A

  • Time-triggered Ethernet switching device and method compatible with 1553B

    CN110417630A

  • Multicast system and multicast method based on identification analysis routing

    CN112187644A

  • Data forwarding table generation and data forwarding method

    CN115801671A

Cited By

  • CAN2.0 data frame real-time priority scheduling method and system

    CN121486129A