Data transmission method, communication system and storage medium

By adopting a ring topological connection structure and broadcast packet delivery mechanism in the communication system, the problem of low data transmission reliability is solved, accurate data transmission and hardware resources are achieved, and the reliability of data transmission is improved.

CN119652699AInactive Publication Date: 2025-03-18DESSMANN CHINA MACHINERY & ELECTRONICS +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510174492.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, the reliability of data transmission is low, especially in the case of a large number of slave devices, resulting in waste of hardware resources and unstable data transmission.

Method used

By adopting a ring topological connection structure in the communication system, the master device sends a broadcast packet to the first-level slave device, and the broadcast packet is transmitted step by step to the last-level slave device, receives the address packet of the slave device and generates configuration information, and then transmits the data packet based on the configuration information in the data transmission mode.

Benefits of technology

It realizes accurate data transmission based on the configuration information of the slave device in the data transmission mode, and shares and optimizes hardware resources through hand-in-hand connection, ensuring the accurate identification and configuration of the slave device and improving the reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652699A_ABST
    Figure CN119652699A_ABST
Patent Text Reader

Abstract

The invention relates to a data transmission method, a communication system and a storage medium, and the data transmission method comprises the steps: transmitting a broadcast packet to a first-stage slave device under the condition that the communication system is in a configuration mode; the broadcast packet is transmitted to the last-stage slave device stage by stage backwards from the first-stage slave device based on a ring topology connection structure; receiving an address packet of each slave device sent by the last-level slave device; the address packet carries a device configuration address of the slave device; the address packets are correspondingly generated when the slave devices receive the broadcast packets, and are transmitted backwards to the last-stage slave device step by step based on a ring topology connection structure; generating configuration information of the slave device according to the device configuration address; and transmitting a data packet to the slave device according to the configuration information based on the ring topology connection structure under the condition that the communication system is switched from the configuration mode to the data transmission mode. According to the invention, the problem of low reliability of data transmission is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a data transmission method, a communication system and a storage medium. Background Art

[0002] Serial communication is a widely used single bus data communication, which is widely used in computer serial interface and data communication between devices. Serial communication is simple to use, fast, and is a full-duplex communication method. Data can be sent and received simultaneously between two devices. At present, in traditional designs, each slave device may need an independent serial port to communicate with the master device, resulting in a waste of hardware resources, especially when there are a large number of slave devices, and it is easy to affect the reliability of data transmission.

[0003] Currently, no effective solution has been proposed for the problem of low reliability of data transmission in related technologies. Summary of the invention

[0004] The embodiments of the present application provide a data transmission method, a communication system and a storage medium to at least solve the problem of low reliability of data transmission in the related art.

[0005] In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a master device in a communication system, wherein the communication system includes the master device and a plurality of cascaded slave devices; a sending port of the master device is connected to a first-level slave device among the plurality of cascaded slave devices, a receiving port of the master device is connected to a last-level slave device among the plurality of cascaded slave devices, and the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; the method includes: When the communication system is in configuration mode, a broadcast packet is sent to the first-level slave device; the broadcast packet is transmitted from the first-level slave device to the last-level slave device step by step based on the ring topology connection structure; receiving an address packet of each slave device sent by the last-level slave device; the address packet carries a device configuration address of the slave device; the address packet is generated correspondingly when the slave device receives the broadcast packet, and is transmitted backward to the last-level slave device step by step based on the ring topology connection structure; Generate configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet is transmitted to the slave device according to the configuration information.

[0006] In some embodiments, the method further comprises: receiving a count accumulation mark returned by the last-level slave device; the count accumulation mark is added to the broadcast packet by each slave device in the process of transmitting the broadcast packet by each slave device; The configuration information is generated according to the count accumulation identifier and the device configuration address.

[0007] In some embodiments, the address packet includes a master-slave device category identification bit; the master-slave device category identification bit is used to indicate whether the device currently sending the address packet is the master device; the method further includes: The slave devices at each level in the ring topology connection structure receive the address packet, and determine whether the address packet is sent by the master device based on the master-slave device category identification bit; If so, the slave device that currently receives the address packet will process the address packet; otherwise, the address packet will continue to be passed on step by step.

[0008] In some embodiments, the transmitting of the data packet to the slave device based on the ring topology connection structure and according to the configuration information includes: The data packet is sent to the first-level slave device; the data packet is transmitted from the first-level slave device to the last-level slave device step by step based on the ring topology connection structure; the protocol packet header of the data packet carries the target address; Wherein, in the process that each of the slave devices sequentially receives the data packet, each of the slave devices parses the protocol packet header, and determines whether to receive the data packet based on a matching result between the parsed target address and the device configuration information in the configuration information; If so, the data packet is received by the slave device that is currently parsed to the target address; otherwise, the slave device continues to forward the data packet until the data packet is received by one of the slave devices.

[0009] In some embodiments, when the communication system switches from the configuration mode to the data transmission mode, the method further includes: If an abnormality in data transmission is detected during the data transmission process, the communication system switches from the data transmission mode to the configuration mode, and when the communication system switches back to the configuration mode, reconfigures the slave device to generate first updated configuration information of the slave device; Obtaining pre-stored initial configuration information; According to the comparison result between the first updated configuration information and the initial configuration information, an abnormal device among the slave devices is determined, and abnormal alarm information is generated for the abnormal device.

[0010] In some embodiments, a corresponding switch circuit is respectively provided between each of the slave devices and a preset short circuit; after determining the abnormal device among the slave devices, the method further includes: The switch circuit corresponding to the abnormal device is controlled to switch from an open state to a closed state; the switch circuit is used to connect the abnormal device and the short circuit in the closed state.

[0011] In some embodiments, the method further comprises: When the communication system enters a power-off recovery state from a power-off state, the configuration mode of the communication system is started, and when the communication system is in the configuration mode, each of the slave devices is configured to generate second updated configuration information of the slave device; When it is detected based on the second updated configuration information that a slave device is newly added or a slave device is deleted in each of the slave devices, the initial configuration information is updated based on the second updated configuration information to obtain and store new initial configuration information.

[0012] In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to any slave device of multiple cascaded slave devices of a communication system; the communication system also includes a master device; the sending port of the master device is connected to the first-level slave device of the multiple cascaded slave devices, and the receiving port of the master device is connected to the last-level slave device of the multiple cascaded slave devices, and the master device and the multiple cascaded slave devices are connected in series to form a ring topology connection structure; the method includes: When the communication system is in configuration mode, receiving a broadcast packet sent by the master device or an upper-level slave device, and generating an address packet corresponding to the slave device in response to the received broadcast packet; the address packet carries a device configuration address of the slave device; Based on the ring topology connection structure, the broadcast packet and the address packet are transmitted backward step by step to the last level device or the master device; Wherein, the master device generates configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet transmitted by the master device according to the configuration information is received.

[0013] In a third aspect, an embodiment of the present application provides a communication system, including a master device and a plurality of cascaded slave devices; a sending port of the master device is connected to a first-level slave device among the plurality of cascaded slave devices, a receiving port of the master device is connected to a last-level slave device among the plurality of cascaded slave devices, and the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; The master device is used to execute the data transmission method as described in the first aspect above; Any of the slave devices is used to execute the data transmission method as described in the second aspect above.

[0014] In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the data transmission method as described in the first aspect or the second aspect above is implemented.

[0015] Compared with the related art, the data transmission method, communication system and storage medium provided by the embodiments of the present application, the communication system includes a master device and multiple cascaded slave devices; the sending port of the master device is connected to the first-level slave device among the multiple cascaded slave devices, and the receiving port of the master device is connected to the last-level slave device among the multiple cascaded slave devices, and the master device and the multiple cascaded slave devices are connected in series to form a ring topology connection structure; by sending a broadcast packet to the first-level slave device when the communication system is in configuration mode; the broadcast packet is based on the ring topology connection structure, starting from the first-level slave device, and is passed backward step by step to the last-level slave device; the address packet of each slave device sent by the last-level slave device is received; the address packet carries the device configuration address of the slave device; the address packet is generated correspondingly when the slave device receives the broadcast packet, and is passed backward step by step to the last-level slave device based on the ring topology connection structure; according to the device configuration address, the configuration information of the slave device is generated; when the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet is transmitted to the slave device according to the configuration information.

[0016] Based on this, the problem of completing accurate data transmission based on the configuration information of the slave device in the data transmission mode is solved, the sharing and optimization of hardware resources are realized based on the hand-in-hand series connection mode, and the accurate identification and configuration of the slave device are ensured through a specific broadcast packet and data packet format, and the reliability of data transmission is effectively ensured. In addition, in the embodiment of the present application, by setting the configuration mode and the data transmission mode separately, conflicts between the configuration process and the data transmission process are avoided, thereby realizing a highly reliable data transmission method in which the two modes do not interfere with each other.

[0017] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 is a hardware structure block diagram of a terminal of a data transmission method according to an embodiment of the present application; Figure 2 is a structural diagram of a communication system according to an embodiment of the present application; Figure 3 is a flow chart of a data transmission method according to an embodiment of the present application; Figure 4 is a flowchart of another data transmission method according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0020] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0021] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application means greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0022] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1 1 is a hardware structure block diagram of a terminal of a data transmission method according to an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0023] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data transmission method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0024] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0025] This embodiment provides a data transmission method, which is applied to a master device in a communication system, wherein the communication system includes a master device and multiple cascaded slave devices; a sending port of the master device is connected to a first-level slave device among the multiple cascaded slave devices, and a receiving port of the master device is connected to a last-level slave device among the multiple cascaded slave devices, and the master device and the multiple cascaded slave devices are connected in series to form a ring topology connection structure.

[0026] More specifically, see Figure 2 , the communication system is a serial communication system; the master device and each slave device in the communication system each have a transmit (TX) port and a receive (RX) port. Among them, the transmit port of the master device is connected to the receive port of the first-level slave device No. 1, the transmit port of the first-level slave device No. 1 is connected to the receive port of the next-level slave device No. 2, and the transmit port of slave device No. 2 is connected to the receive port of the next-level slave device No. 3, and so on until the receive port of the last-level slave device No. N is connected; finally, the transmit port of the last-level slave device No. N is connected to the receive port of the master device, thereby forming a closed-loop ring topology connection structure. Among them, N is used to identify the number of slave devices, and N is a positive integer. Through the above-mentioned ring serial communication method, when there are multiple similar slave devices that need to complete serial communication with the master device, in order to save hardware resources, a hand-in-hand series method is used to complete the communication closed loop, avoiding the waste of hardware resources.

[0027] Figure 3 is a flow chart of a data transmission method according to an embodiment of the present application. Figure 3 As shown, the process includes the following steps: Step S310, when the communication system is in configuration mode, a broadcast packet is sent to the first-level slave device; the broadcast packet is based on a ring topology connection structure, starting from the first-level slave device and transmitted backward step by step to the last-level slave device.

[0028] In the data transmission application process of the above communication system, different application modes can be distinguished. In order to ensure the accuracy of the configuration, in this step, the application mode of the communication system is set to a configuration mode; the configuration mode refers to the application mode in which the master device configures the slave devices at all levels.

[0029] Specifically, in this configuration mode, the master device first sends a broadcast packet to slave devices at each level; the broadcast packet is transmitted in the following manner: the first-level slave device receives the broadcast packet transmitted by the master device, and transmits the broadcast packet to the next-level slave device based on the ring topology connection structure, and the next-level slave device then transmits the broadcast packet to the slave devices connected to it step by step until the broadcast packet is transmitted to the last-level slave device.

[0030] Step S320, receiving the address packet of each slave device sent by the last level slave device; the address packet carries the device configuration address of the slave device; the address packet is generated when the slave device receives the broadcast packet, and is passed backward step by step to the last level slave device based on the ring topology connection structure.

[0031] In order to further ensure the accuracy and reliability of the configuration, in this step, the slave devices at all levels sequentially transmit their own device configuration addresses backwards step by step based on the ring topology connection structure. Specifically, for the slave devices at all levels, when receiving the broadcast packet, in response to the received broadcast packet, an address packet carrying the device configuration address is sent to the serial port bus.

[0032] Step S330: Generate configuration information of the slave device according to the device configuration address.

[0033] The master device records the parsed device configuration address of each slave device, and completes the initialization configuration of each slave device in the configuration mode.

[0034] Step S340: When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, transmit the data packet to the slave device according to the configuration information.

[0035] Specifically, after completing the initialization configuration of the first part through the above steps, normal data transmission can be carried out between the devices in the communication system. At this time, the application mode of the communication system is switched to the data transmission mode; in this data transmission mode, data transmission is carried out between the master device and multiple cascaded slave devices.

[0036] More specifically, since the configuration information of each slave device generated by the master device in the configuration mode includes the device configuration address corresponding to the slave device; therefore, the master device can first determine the slave device that needs to receive the data packet, and based on the configuration information that has been generated, find the device configuration address corresponding to the slave device that needs to receive the data packet, and use the found device configuration address as the target address, add it to the data packet, transmit it based on the above-mentioned ring topology connection structure, and finally the data packet is successfully received by the slave device that meets the target address.

[0037] In the above data transmission method, the broadcast packet is transmitted to each level of slave devices step by step based on the ring topology connection structure through the master device in the communication system, and the device configuration address transmitted by each level of slave devices based on the ring topology connection structure is received to complete the configuration of the slave device, thereby completing accurate data transmission based on the configuration information of the slave device in the data transmission mode, realizing the sharing and optimization of hardware resources based on the hand-in-hand series connection method, and using a data transparent transmission mechanism through specific broadcast packets and data packet formats to ensure accurate identification and configuration of the slave device, and effectively ensure the reliability of data transmission. In addition, in the embodiment of the present application, by setting the configuration mode and the data transmission mode separately, conflicts between the configuration process and the data transmission process are avoided, thereby realizing a highly reliable data transmission method in which the two modes do not interfere with each other.

[0038] In some embodiments, the above data transmission method may further include the following steps: Receive the count accumulation mark returned by the last-level slave device; the count accumulation mark is added by each slave device to the broadcast packet during the process of each slave device transmitting the broadcast packet; generate configuration information according to the count accumulation mark and the device configuration address.

[0039] In the process of transmitting the broadcast packet to multiple cascaded slave devices step by step, each slave device adds a counting accumulation mark to the broadcast packet when receiving the broadcast packet, so as to realize the autonomous reporting of the slave device. The counting accumulation mark can be a mark that starts from 1 and is added by 1 each time the number is reported.

[0040] Optionally, the broadcast packet may be a data packet of 1 byte in size with a format defined in advance. An example of a broadcast packet format definition is given below, as shown in Table 1: Table 1 Broadcast packet format Bit 7 6 5 4 3 2 1 0 Value 0 1 0 0 0 0 1 0 In the above Table 1, the 0th bit is the master-slave device type identification bit. When this bit is 1, it means that the broadcast packet is sent by the slave, and when it is 0, it means that the broadcast packet is sent by the host. Bits 1 to 4 are used for device counting, so the communication system in this embodiment can access up to 16 slave devices. Bits 5 to 7 are broadcast packet flag bits. When the values ​​of these three bits are 111, it means that the type of data packet transmitted at this time is a broadcast packet. Specifically, for the above 1-byte broadcast packet, it is actively sent out by the master device after reset; when the first-level slave device receives a broadcast packet with a flag bit of 111, it will modify bits 1 to 4 in the broadcast packet data, that is, add 1 to the count accumulation flag whose current initial value is 0000, complete the device reporting, and transmit the processed broadcast packet backward to the next-level slave device. The next-level slave device also adds 1 to the count accumulation identifier of the broadcast packet sent by the first-level slave device and continues to pass it backward; when it is transmitted to the last-level slave device, the last-level slave device returns it to the master device, so that the master device can know the total number of slave devices based on the final count accumulation identifier.

[0041] It should also be noted that when the slave devices at all levels receive the broadcast packet and complete the count, they will send the address packet to the serial bus. In this way, the master device completes the address configuration through the received count accumulation mark and address packet.

[0042] Optionally, the device configuration address can be determined according to the device type of the corresponding slave device. In the communication system configuration mode, the master device records each slave device as device address 1, device address 2, ..., device address N based on the address packet and the broadcast packet, and each device address corresponds to the device type information, that is, the functional attributes of the slave device. Therefore, the master device can obtain the arrangement order of each slave device and the total number of slave devices through a 1-byte broadcast packet, and then complete the initialization configuration.

[0043] Through the above-mentioned embodiment, while the master device sends a broadcast packet, slave devices at all levels respond to the received broadcast packet by adding corresponding counting accumulation identifiers and completing active reporting, so that the master device can obtain the accurate total number of devices of each slave device, which is convenient for the master device to timely detect the changes of each slave device, thereby helping to improve the accuracy and reliability of data transmission.

[0044] In some embodiments, the address packet includes a device configuration address and device type information; and generating the configuration information of the slave device according to the device configuration address may further include the following steps: Parse the address packets of each slave device to obtain the device configuration address and device type information corresponding to each slave device; establish a mapping relationship between the device configuration address and the device type information, and generate configuration information based on the mapping relationship.

[0045] Optionally, the address packet may be a data packet of 1 byte in size with a format defined in advance. An example of an address packet format definition is given below, as shown in Table 2: Table 2 Address packet format

[0046] In the above address packet format, bit 0 is the master-slave device type identification bit. When this bit is 1, it means that the address packet is sent by the slave device, and when it is 0, it means that the address packet is sent by the master device. Bits 1 to 4 are the device configuration address of the corresponding slave device, and also represent the device serial number of the slave device in the ring topology connection structure. Bits 5 to 7 are used to store device type information, which also represents the device function attributes of the corresponding slave device.

[0047] It should be noted that, when there are two or more slave devices with the same configuration type among multiple cascaded slave devices, the addresses of the multiple slave devices with the same device type should be distinguished to ensure that the address of each slave device is unique.

[0048] It should also be noted that after the initialization configuration is completed and the communication system enters the data transmission mode, when the master device first determines the slave device that needs to receive the data packet, it can search for the device configuration address corresponding to the slave device to receive the data packet according to the device type information in the configuration information that has been generated, and then determine the target address. For example, if the data packet currently needs to be sent to a slave device with device type information of 010 (the device type information 010 can be manually specified or generated according to the current application scenario) to achieve the corresponding functional attributes, the master device can search for the corresponding device configuration address in the configuration information according to the device type information, and add the device configuration address as the target address to the data packet, so that each slave device can pass it step by step during the data transmission process, and analyze whether the target address in the data packet is its own address, and complete the data transmission.

[0049] Through the above embodiment, a configuration method for device type information and device configuration address is also provided, thereby improving the configuration information of each slave device and improving the accuracy of the configuration process.

[0050] In some embodiments, the address packet includes a master-slave device category identification bit; the master-slave device category identification bit is used to indicate whether the device currently sending the address packet is a master device; the data transmission method may further include the following steps: The slave devices at each level in the ring topology connection structure receive the address packet and determine whether the address packet is sent by the master device based on the master-slave device category identification bit; if so, the slave device that currently receives the address packet processes the address packet; otherwise, the address packet continues to be passed back level by level.

[0051] Taking the address packet format definition shown in Table 2 as an example, the low bit of the address packet data is the master-slave device category identification bit. If the value of this identification bit is 1, it means that the address packet is sent by the slave device. For this address packet, it only needs to be transmitted to the master device based on the above ring topology connection structure. Therefore, the slave device that receives the address packet does not need to process the data at this time, but directly transmits the address packet backward until it is transmitted from the last level of slave device to the master device.

[0052] Through the above embodiment, a master-slave device category identification bit is added to each address packet, so that each slave device can determine whether data processing is required based on the master-slave device category identification bit, thereby effectively improving the reliability of data transmission.

[0053] In some embodiments, the above-mentioned transmission of data packets to the slave device according to the configuration information based on the ring topology connection structure may also include the following steps: Obtain the data packet to be transmitted, and determine the target address corresponding to the target receiving device of the data packet to be received according to the configuration information; send the data packet to the first-level slave device; the data packet is based on a ring topology connection structure, starting from the first-level slave device, and is passed backward step by step to the last-level slave device; the data packet carries the target address; wherein, in the process of each slave device receiving the data packet in turn, determine whether the resolved target address matches the device configuration address of the slave device itself; if so, the slave device currently parsed to the target address receives the data packet; otherwise, the slave device continues to pass the data packet backward until the data packet is received by one of the slave devices.

[0054] Among them, when the master device completes the above configuration mode, the devices at all levels in the communication system can start normal data transmission. Specifically, in the data transmission mode, the master device encapsulates the protocol header based on the original communication protocol, and the protocol header is used to identify that this is a normal data packet. The slave device address is used to identify the recipient address of the data packet and is encapsulated in the data packet header.

[0055] Optionally, the format definition of the above data packet header may be as shown in Table 3: Table 3 Data packet header format

[0056] In the above example, the lowest bit of the byte is used to distinguish whether it is sent by the master device or the slave device. Bits 1 to 4 are the destination address, representing the device serial number of the slave device that needs to receive the data packet in the ring topology connection structure. Bits 5 to 7 are the send identification bits, and when the first 3 bits are 000, it represents the normal data sending mode.

[0057] Specifically, in the process of the master device transmitting normal data packets to slave devices at each level step by step based on the ring topology connection structure, the slave device that currently receives the data packet parses the target address carried in the data packet header; if it is determined that the resolved target address is the same as the device configuration address of the slave device itself, it means that the slave device address is correct and the data packet can be processed; conversely, if it is determined that the target address is different from the device configuration address of the slave device itself, it means that the slave device address does not match and needs to continue to be transmitted backwards until the correct slave device is found on the serial port bus.

[0058] In another embodiment, in the process of the slave device sending the slave device data packet to the master device step by step based on the ring topology connection structure, the following steps are also included: the slave device adds its own device configuration address to the slave device data packet, and passes the slave device data packet carrying the device configuration address backward to the master device step by step. When the master device receives the slave device data packet, it parses the device configuration address carried in the data packet, and matches the parsed device configuration address with the configuration information generated in the configuration mode, so as to identify the correct device address and the corresponding device type.

[0059] Through the above embodiment, through the above designed data message format, data transmission is completed based on address matching, thereby ensuring that the data packet can be accurately transmitted to the corresponding slave device, which helps to improve the reliability of data transmission.

[0060] In some embodiments, when the communication system switches from the configuration mode to the data transmission mode, the data transmission method further includes the following steps: If an abnormality in data transmission is detected during the data transmission process, the communication system switches from the data transmission mode to the configuration mode, and when the communication system switches back to the configuration mode, the slave device is reconfigured to generate the first updated configuration information of the slave device; the pre-stored first configuration information is obtained; based on the comparison result between the first updated configuration information and the first configuration information, the abnormal device in the slave device is determined, and abnormal alarm information is generated for the abnormal device.

[0061] Among them, data transmission has abnormal conditions, which usually include data packet loss, error or delay, etc. Such abnormalities may be caused by a variety of reasons, including but not limited to network congestion, hardware failure, software error, etc. The abnormal situation can be detected by the master device. For example, the master device can detect in real time during the data communication process whether there is a slave device that cannot communicate and connect; if so, it means that there is an abnormality in data transmission.

[0062] The above-mentioned first configuration information refers to the configuration information generated by the master device when it is powered on for the first time to configure each slave device; the first configuration information can be stored in the storage space of the master device. When an abnormal data transmission situation is detected, the entire communication system switches back to the configuration mode, the master device restarts the configuration process, and checks the number of addresses of each slave device in the first updated configuration information generated by the reconfiguration, and compares the number of addresses with the device configuration address obtained in the first configuration information to determine whether the report of any device is missing. Alternatively, in another embodiment, when the slave devices at all levels also report by adding a count accumulation mark in response to the broadcast packet sent by the master device, the master device generates the first updated configuration information according to the count accumulation mark and the device configuration address under the current configuration process, and compares the slave device report information obtained based on the count accumulation mark in the first updated configuration information with the report information stored in the first configuration information.

[0063] If the comparison method above determines that a slave device is missing a certain number of reports, then the abnormal alarm information generated based on the abnormal device that is missing a certain number of reports is pushed through log, push, alarm, etc. to inform the slave device of the abnormality. In addition, in the line connection of each device in the communication system, a switch circuit is added to each slave device. When the abnormal device is detected, the master device can send an indication signal to control the switch circuit corresponding to the abnormal device, so that the abnormal device can be automatically short-circuited, thereby avoiding the situation where a single slave device abnormality affects the entire communication system.

[0064] Through the above-mentioned embodiment, when a data transmission anomaly is detected, the master device reconfigures each slave device and compares the reconfigured configuration information with the initial configuration information to determine the slave device where the anomaly occurs. This enables timely detection of communication anomalies in each slave device during the data transmission process, and timely response to the anomaly for processing, thereby further improving the reliability of data transmission.

[0065] In some embodiments, the data transmission method further includes the following steps: When the communication system enters a power-off recovery state from a power-off state, the configuration mode of the communication system is started, and when the communication system is in the configuration mode, each slave device is configured to generate second updated configuration information for the slave device; when it is detected based on the second updated configuration information that a new slave device has been added or a slave device has been deleted in each slave device, the initial configuration information is updated based on the second updated configuration information, and the new initial configuration information is obtained and stored.

[0066] It should be noted that, in actual application, slave devices connected to the ring topology connection structure in the communication system can be added, deleted or reordered at any time. For example, when the communication system is powered off, there may be a situation where some slave devices need to be added or deleted in the ring topology connection structure. After completing the change operations such as adding, deleting or replacing the slave device, the master device is powered on again, and enters the configuration mode after resetting, and then in this configuration mode, the configuration of slave devices at all levels is completed again based on the ring topology connection structure; in this embodiment, the configuration information generated when the slave device changes is used as the above-mentioned second updated configuration information to complete this round of initialization configuration. In this way, during subsequent data transmission, the master device can determine the target address that the data packet to be transmitted needs to carry according to the second updated configuration information, and then the data packet to be transmitted is transmitted to the slave device step by step using the ring topology connection structure until it is transmitted to the slave device whose own device configuration address matches the target address in the data packet.

[0067] On the other hand, since the number or address configuration of the slave devices has changed during this configuration compared to the initial configuration information determined when the power is first turned on, in order to ensure the accuracy of subsequent abnormality detection, the initial configuration information can also be updated to the second updated configuration information; that is, the initial configuration information can be updated once each time a change occurs in the slave device.

[0068] Through the above-mentioned embodiments, a configuration method for a slave device and a method for updating the first configuration information are provided when a slave device changes in a ring topology connection structure, thereby realizing flexible changes of slave devices in the ring topology connection structure, allowing the communication system to easily expand new slave devices by simply adding them to the ring topology connection structure, effectively improving the flexibility of the system, and also ensuring the reliability and stability of data transmission when the slave device changes.

[0069] This embodiment also provides a data transmission method, which is applied to any slave device among multiple cascaded slave devices in a communication system; the communication system also includes a master device; the sending port of the master device is connected to the first-level slave device among the multiple cascaded slave devices, and the receiving port of the master device is connected to the last-level slave device among the multiple cascaded slave devices, and the master device and the multiple cascaded slave devices are connected in series to form a ring topology connection structure.

[0070] Figure 4 is a flow chart of another data transmission method according to an embodiment of the present application. Figure 4 As shown, the process includes the following steps: Step S410, when the communication system is in configuration mode, receiving a broadcast packet sent by a master device or an upper-level slave device, and generating an address packet corresponding to the slave device in response to the received broadcast packet; the address packet carries the device configuration address of the slave device.

[0071] Step S420: Based on the ring topology connection structure, the broadcast packet and the address packet are transmitted backwards level by level to the last level device or the master device; wherein the master device generates the configuration information of the slave device according to the device configuration address.

[0072] Step S430, when the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, receiving the data packet transmitted by the master device according to the configuration information.

[0073] Through the above-mentioned embodiments, the slave devices at all levels transmit the device configuration address step by step in response to the broadcast packet based on the ring topology connection structure, thereby realizing the address configuration of each slave device, so that the data packet sent by the master device can be accurately received based on the ring topology connection structure and the device configuration address in the data transmission mode, effectively ensuring the reliability of data transmission, and realizing the sharing and optimization of hardware resources. In addition, in the embodiments of the present application, by setting the configuration mode and the data transmission mode separately, it is avoided that the different slave device data processing methods between the configuration process and the data transmission process are prone to conflict, thereby realizing a highly reliable data transmission method in which the two modes do not interfere with each other.

[0074] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0075] This embodiment also provides a communication system, including a master device and a plurality of cascaded slave devices; a sending port of the master device is connected to a first-stage slave device among the plurality of cascaded slave devices, a receiving port of the master device is connected to a last-stage slave device among the plurality of cascaded slave devices, and the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; A master device, used to execute the data transmission method according to the above embodiment, comprising: When the communication system is in configuration mode, a broadcast packet is sent to the first-level slave device; the broadcast packet is based on a ring topology connection structure, starting from the first-level slave device and transmitted backward to the last-level slave device step by step; Receive the address packets of each slave device sent by the last-level slave device; the address packets carry the device configuration address of the slave device; the address packets are generated when the slave device receives the broadcast packet, and are transmitted backward to the last-level slave device step by step based on the ring topology connection structure; Generate the configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, data packets are transmitted to the slave device according to the configuration information based on the ring topology connection structure.

[0076] Any slave device, used to execute the data transmission method as described in the above embodiment, comprising: Based on the ring topology connection structure, the broadcast packet and address packet are transmitted backward step by step to the last level device or the main device; Wherein, the master device generates the configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet transmitted by the main device according to the configuration information is received.

[0077] Through the above embodiments, a communication system based on serial communication is realized, and a plurality of slave devices are connected into a closed loop by a hand-in-hand series connection method, thereby realizing the sharing and optimization of hardware resources.

[0078] In addition, in combination with the data transmission method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the data transmission methods in the above embodiment is implemented.

[0079] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0080] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0081] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0082] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A data transmission method, characterized in that: A master device applied to a communication system, the communication system comprising the master device and a plurality of cascaded slave devices; a sending port of the master device is connected to a first-level slave device among the plurality of cascaded slave devices, a receiving port of the master device is connected to a last-level slave device among the plurality of cascaded slave devices, the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; the method comprising: When the communication system is in configuration mode, a broadcast packet is sent to the first-level slave device; the broadcast packet is transmitted from the first-level slave device to the last-level slave device step by step based on the ring topology connection structure; receiving an address packet of each slave device sent by the last-level slave device; the address packet carries a device configuration address of the slave device; the address packet is generated correspondingly when the slave device receives the broadcast packet, and is transmitted backward to the last-level slave device step by step based on the ring topology connection structure; Generate configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet is transmitted to the slave device according to the configuration information.

2. The data transmission method according to claim 1, characterized in that: The method further comprises: receiving a count accumulation mark returned by the last-level slave device; the count accumulation mark is added to the broadcast packet by each slave device in the process of transmitting the broadcast packet by each slave device; The configuration information is generated according to the count accumulation identifier and the device configuration address.

3. The data transmission method according to claim 1, characterized in that: The address packet includes the device configuration address and device type information; the generating the configuration information of the slave device according to the device configuration address also includes: Parsing the address packets of each slave device to obtain the device configuration address and the device type information corresponding to each slave device; A mapping relationship between the device configuration address and the device type information is established, and the configuration information is generated based on the mapping relationship.

4. The data transmission method according to claim 1, characterized in that: The address packet includes a master-slave device category identification bit; the master-slave device category identification bit is used to indicate whether the device currently sending the address packet is the master device; the method also includes: The slave devices at each level in the ring topology connection structure receive the address packet, and determine whether the address packet is sent by the master device based on the master-slave device category identification bit; If so, the slave device that currently receives the address packet will process the address packet; otherwise, the address packet will continue to be passed on step by step.

5. The data transmission method according to any one of claims 1 to 4, characterized in that: The transmitting of the data packet to the slave device based on the ring topology connection structure and according to the configuration information comprises: Acquire a data packet to be transmitted, and determine a target address corresponding to a target receiving device to receive the data packet according to the configuration information; Sending the data packet to the first-level slave device; the data packet is transmitted from the first-level slave device to the last-level slave device step by step based on the ring topology connection structure; the data packet carries the target address; Wherein, in the process of each of the slave devices receiving the data packet in sequence, it is determined whether the parsed target address matches the device configuration address of the slave device itself; If so, the data packet is received by the slave device that is currently parsed to the target address; otherwise, the slave device continues to forward the data packet until the data packet is received by one of the slave devices.

6. The data transmission method according to any one of claims 1 to 4, characterized in that: In the case where the communication system switches from the configuration mode to the data transmission mode, the method further includes: If an abnormality in data transmission is detected during the data transmission process, the communication system switches from the data transmission mode to the configuration mode, and when the communication system switches back to the configuration mode, reconfigures the slave device to generate first updated configuration information of the slave device; Obtaining pre-stored initial configuration information; According to the comparison result between the first updated configuration information and the initial configuration information, an abnormal device among the slave devices is determined, and abnormal alarm information is generated for the abnormal device.

7. The data transmission method according to claim 6, characterized in that: The method further comprises: When the communication system enters a power-off recovery state from a power-off state, the configuration mode of the communication system is started, and when the communication system is in the configuration mode, each of the slave devices is configured to generate second updated configuration information of the slave device; When it is detected based on the second updated configuration information that a slave device is newly added or a slave device is deleted in each of the slave devices, the initial configuration information is updated based on the second updated configuration information to obtain and store new initial configuration information.

8. A data transmission method, characterized in that: Any slave device among a plurality of cascaded slave devices of a communication system; the communication system further comprises a master device; a sending port of the master device is connected to a first-level slave device among the plurality of cascaded slave devices, a receiving port of the master device is connected to a last-level slave device among the plurality of cascaded slave devices, and the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; the method comprises: When the communication system is in configuration mode, receiving a broadcast packet sent by the master device or an upper-level slave device, and generating an address packet corresponding to the slave device in response to the received broadcast packet; the address packet carries a device configuration address of the slave device; Based on the ring topology connection structure, the broadcast packet and the address packet are transmitted backward step by step to the last level device or the master device; Wherein, the master device generates configuration information of the slave device according to the device configuration address; When the communication system switches from the configuration mode to the data transmission mode, based on the ring topology connection structure, the data packet transmitted by the master device according to the configuration information is received.

9. A communication system, characterized in that: It comprises a master device and a plurality of cascaded slave devices; the sending port of the master device is connected to a first-level slave device among the plurality of cascaded slave devices, the receiving port of the master device is connected to a last-level slave device among the plurality of cascaded slave devices, and the master device and the plurality of cascaded slave devices are connected in series to form a ring topology connection structure; The master device is used to perform the data transmission method according to any one of claims 1 to 7; Any of the slave devices is used to execute the data transmission method as described in claim 8.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the data transmission method according to any one of claims 1 to 8 when running.

Citation Information

Patent Citations

  • Real time synchronization network based on the standard Ethernet and its operating method

    CN101018115A

  • Annular redundancy series network structure and annular redundancy and hot plug methods thereof

    CN108134728A

  • Control method and apparatus

    CN113396565A

  • Control method and device

    CN116708193A

  • Method for clock synchronization in distributed system having ring topology and apparatus for the same

    KR1020120051632A