Data communication method, device, equipment and medium

By introducing a virtual public address translation mechanism into the I2C communication link, the problem of data communication without modifying the hardware circuit layout is solved, and bus utilization and communication security are improved.

CN119988273AActive Publication Date: 2025-05-13SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510198786.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-21
Publication Date
2025-05-13
Estimated Expiration
2045-02-21

AI Technical Summary

Technical Problem

The prior art has difficulties in data communication without modifying the hardware circuit layout, especially in the refined configuration of complex devices, and has low bus utilization.

Method used

By introducing a virtual common address translation mechanism in the master device, the current communication request on the bus is monitored, and whether there are multiple communication requests for the same set of slave devices exist, and the multiple communication requests are transmitted to the corresponding virtual common addresses in the preset configuration table to realize batch transmission and response.

Benefits of technology

Improve bus utilization without modifying the hardware circuit layout and enhance communication security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988273A_ABST
    Figure CN119988273A_ABST
Patent Text Reader

Abstract

The invention discloses a data communication method and device, equipment and a medium, relates to the technical field of communication, is applied to a main device, and comprises the following steps: monitoring a target bus to obtain a current communication request on the target bus; comparing a slave device address carried by the current communication request with a slave device address in a preset configuration table to determine whether the current communication request comprises a plurality of communication requests for the same group of slave devices; and if the current communication request comprises a plurality of communication requests for the same group of slave devices, transmitting the plurality of communication requests to corresponding virtual public addresses in a preset configuration table, so that the slave devices in the same group of slave devices send the communication requests to the corresponding virtual public addresses after monitoring that the communication requests needing to be responded by the slave devices exist on the virtual public addresses. Executing a corresponding response operation to obtain a response result; and obtaining a plurality of response results corresponding to the plurality of communication requests and returned by the same group of slave devices in batches. According to the invention, the bus utilization rate and the communication security are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a data communication method, device, equipment and medium. Background Art

[0002] I2C (Inter-Integrated Circuit) bus is a two-wire serial bus used to connect microcontrollers and their peripherals. It is a bus standard widely used in the field of microelectronic communication control. It is a special form of synchronous communication with the advantages of fewer interface lines, simple control method, small device package, and higher communication rate.

[0003] I2C transmits information between devices connected to the bus through the serial data (SDA, SerialData) line and the serial clock (SCL, Serial Clock Line) line. Each device has a unique address identification and can act as a transmitter or receiver (determined by the function of the device). The host is the device that initializes the data transmission of the bus and generates a clock signal that allows transmission. At this time, any addressed device is considered a slave. Usually, the I2C link is in a state of one master and multiple slaves, that is, the relevant communication messages will be broadcast throughout the link, so the link is at risk of information leakage and information tampering. Attackers can use any link device with the function of a master device to scan local devices and monitor link communications, or even pretend to be a master device to modify the register information of other devices. Honeypot technology is a network security technology that aims to attract potential attackers through deception and deception. It deploys hosts, network services or information as bait to induce attackers to attack these baits, so that the attack behavior can be captured and analyzed. The honeypot system can collect information about the tools and methods, attack intentions and motivations of the attacker, help the defender understand the security threats they face, and take technical and management measures to strengthen the security protection capabilities of the actual system. In some technologies, in order to read and write in batches, the method sets up a deserialization device and connects multiple identical I2C devices to the deserialization device. In essence, it is a hierarchical management method. The upper level only communicates with the deserialization device, and the deserialization device distributes to the lower level. However, this method is suitable for simple sensor devices. In addition to unified configuration, complex devices also require refined individual configuration, and do not have an advantage in individual configuration. This method requires special modification of the hardware circuit layout to form a cascade of upper and lower levels, which requires a lot of additional work.

[0004] It can be seen that how to perform data communication without modifying the hardware circuit layout is a problem that needs to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a data communication method, apparatus, device and medium, which can perform data communication without modifying the hardware circuit layout and improve bus utilization.

[0006] In a first aspect, the present invention discloses a data communication method, which is applied to a master device, comprising:

[0007] Monitor the target bus to obtain the current communication request on the target bus;

[0008] Compare the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address;

[0009] If the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to the corresponding virtual public addresses in the preset configuration table, so that the slave devices in the same group of slave devices perform corresponding response operations after monitoring the existence of communication requests that need to be responded to by themselves on the virtual public address, so as to obtain response results;

[0010] Get multiple response results corresponding to multiple communication requests returned in batches from the same group of slave devices.

[0011] Optionally, before comparing the slave device address carried in the current communication request with the slave device address in the preset configuration table, the method further includes:

[0012] Determine the grouping of slave devices according to the type of slave devices, and determine the grouping sequence number corresponding to each group of slave devices; the slave devices in the same group have the same type;

[0013] Determine whether the internal register addresses corresponding to the slave devices in the same group of slave devices are the same;

[0014] If the internal register addresses corresponding to the slave devices in the same group of slave devices are the same, a virtual public address corresponding to the slave devices in the same group of slave devices is randomly generated to obtain a virtual public slave device address;

[0015] If the internal register addresses corresponding to the slave devices in the same group of slave devices are different, a virtual public address corresponding to each internal register of each slave device in the same group of slave devices is generated based on the internal register address of any slave device in the same group of slave devices to obtain a virtual public register address;

[0016] A preset configuration table is constructed according to the grouping sequence number of each slave device, the slave device address, the internal register address of the slave device, the virtual common slave device address and the virtual common register address.

[0017] Optionally, if the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to corresponding virtual public addresses in the preset configuration table, including:

[0018] If the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are the same, the multiple communication requests are transmitted to the corresponding virtual public slave device addresses in the preset configuration table;

[0019] If the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are different, the multiple communication requests are transmitted to the corresponding virtual public register addresses in the preset configuration table.

[0020] Optionally, comparing the slave device address carried in the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices, including:

[0021] Compare the slave device address carried in the current communication request with the slave device address in the preset configuration table;

[0022] If the addresses of the slave devices carried in the current communication request are the same as the corresponding addresses of the slave devices in the same group of slave devices in the preset configuration table, it is determined that the current communication request includes multiple communication requests for the same group of slave devices;

[0023] Otherwise, it is determined that the current communication request does not include multiple communication requests for the same group of slave devices.

[0024] Optionally, after determining whether the current communication request includes multiple communication requests for the same group of slave devices, the method further includes:

[0025] If the current communication request does not include multiple communication requests for the same group of slave devices, the current communication request is directly sent to the corresponding slave device according to the addresses of each slave device carried by the current communication request, so that after the slave device receives the communication request for its response, it performs the corresponding response operation and returns the corresponding response result to the master device.

[0026] Optionally, after the slave devices in the same group of slave devices monitor that there is a communication request requiring a response from themselves on the virtual public address, the process of performing a corresponding response operation to obtain a response result further includes:

[0027] Determine whether the slave device has completed reception of the current communication request when the target bus is idle;

[0028] If the slave device completes receiving the current communication request, it determines whether the received communication request is complete and obtains a corresponding determination result, so that the slave device performs a corresponding response operation based on the determination result to obtain a response result.

[0029] Optionally, obtaining a corresponding judgment result so that the slave device performs a corresponding response operation based on the judgment result to obtain a response result includes:

[0030] If the received communication request is complete, the slave devices in the same group of slave devices perform corresponding response operations on the communication request that needs to be responded to by the slave devices on the virtual public address to obtain a response result;

[0031] If the received communication request is incomplete, the process jumps again to the step of transmitting the multiple communication requests to the corresponding virtual public addresses in the preset configuration table, so that the slave device re-monitors whether there is a communication request that needs to be responded to by itself on the virtual public address.

[0032] In a second aspect, the present invention discloses a data communication device, applied to a master device, comprising:

[0033] A communication request acquisition module is used to monitor the target bus to obtain the current communication request on the target bus;

[0034] A determination module, used for comparing the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address;

[0035] A communication request transmission module, for transmitting the multiple communication requests to the corresponding virtual public addresses in the preset configuration table if the current communication request includes multiple communication requests for the same group of slave devices, so that the slave devices in the same group of slave devices perform corresponding response operations to obtain response results after monitoring the existence of communication requests that need to be responded to by themselves on the virtual public address;

[0036] The response result acquisition module is used to acquire multiple response results corresponding to multiple communication requests returned in batches from the same group of slave devices.

[0037] In a third aspect, the present invention provides an electronic device, comprising:

[0038] Memory for storing computer programs;

[0039] The processor is used to execute the computer program to implement the above-mentioned data communication method.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and the computer program implements the aforementioned data communication method when executed by a processor.

[0041] In the present invention, a master device monitors a target bus to obtain a current communication request on the target bus; compares a slave device address carried in the current communication request with a slave device address in a preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address; if the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to the corresponding virtual public addresses in the preset configuration table, so that the slave devices in the same group of slave devices perform corresponding response operations to obtain response results after monitoring that there are communication requests that need to be responded to by themselves on the virtual public addresses; and obtain multiple response results corresponding to the multiple communication requests returned in batches by the same group of slave devices.

[0042] Beneficial effect: The present invention sets up a virtual public address conversion mechanism. When the master device monitors the current communication request on the bus, it first determines whether the current communication request includes multiple communication requests for the same group of slave devices. If so, multiple communication requests are sent in batches using the virtual public address. In this way, the utilization rate of the bus is improved, and the existence of the virtual public address also improves the security of communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A flow chart of a data communication method provided by an embodiment of the present invention;

[0045] Figure 2 A schematic diagram of a data communication framework provided by an embodiment of the present invention;

[0046] Figure 3 A schematic diagram of a management module structure provided by an embodiment of the present invention;

[0047] Figure 4 A specific data communication method flow chart provided by an embodiment of the present invention;

[0048] Figure 5A schematic diagram of the structure of a data communication device provided by an embodiment of the present invention;

[0049] Figure 6 A structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] In some technologies, in order to read and write in batches, the method sets up a deserialization device and connects multiple identical I2C devices to the deserialization device. Its essence is a hierarchical management method. The superior only communicates with the deserialization device, and the deserialization device distributes to the subordinate. However, this method is suitable for simple sensor devices. In addition to the unified configuration, complex devices also require refined individual configuration, and do not have advantages in individual configuration. This method requires special modification of the hardware circuit layout to become a cascade of upper and lower levels, which requires a lot of extra work. In order to solve the above technical problems, the present invention discloses a data communication method, device, equipment and medium, which can perform data communication without modifying the hardware circuit layout, while improving bus utilization.

[0052] See also Figure 1 As shown, an embodiment of the present invention provides a data communication method, which is applied to a master device, including:

[0053] Step S11: monitor the target bus to obtain the current communication request on the target bus.

[0054] In the embodiment of the present invention, after the system link is initialized, the master and slave devices are powered on and prepared based on their respective configurations. The master device then monitors the integrated circuit bus, and when there is an integrated circuit bus communication request on the bus, the master device obtains the current communication request on the bus and parses the current communication request to obtain the slave device address carried by the current communication request.

[0055] Step S12: compare the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address.

[0056] In the embodiment of the present invention, a management module is introduced on the I2C communication link, which includes a set of management tables to integrate the register addresses with the same configuration strategy into one group. Figure 2 As shown, assuming that an I2C bus has a master device, slave device 1, slave device 2, slave device 3 and slave device 4, the present invention connects a management module to the bus. The management module can be integrated in the master device, or it can be a separate device with storage function. The initial configuration table is recorded by manual entry through master-slave communication. The management module completes register grouping and virtual address generation according to the configuration information, and completes a series of configuration processes. Among them, Figure 3 As shown, the management module includes an internal register, a processing module, and a transmission module. The processing module and the transmission module are connected to the I2C bus. Among them, the processing module is responsible for completing automatic grouping and virtual address generation according to the configuration information, and storing the configuration information and virtual address related information in the internal register. After completing the initialization configuration, the processing module will monitor the communication for the virtual address and record the corresponding situation of the slave device. The internal register is used to store the grouping information and the virtual address generated for the group. Transmission module: The function of this module is to cooperate with the processing module to confirm data to each group of slave devices; at the same time, the module will receive bus data transmission information and pass it to the processing module for analysis. It should also be pointed out that the present invention can be applied not only to I2C communication links, but also to other open communication communication links.

[0057] Therefore, before comparing the slave device address carried by the current communication request with the slave device address in the preset configuration table, the grouping of the slave devices is determined according to the type of the slave devices, and the grouping sequence number corresponding to each group of slave devices is determined; the slave device types of the same group of slave devices are the same; it is determined whether the internal register addresses corresponding to each slave device in the same group of slave devices are the same; if the internal register addresses corresponding to each slave device in the same group of slave devices are the same, a virtual public address corresponding to each slave device in the same group of slave devices is randomly generated to obtain a virtual public slave device address; if the internal register addresses corresponding to each slave device in the same group of slave devices are different, a virtual public address corresponding to each internal register of each slave device in the same group of slave devices is generated based on the internal register address of any slave device in the same group of slave devices to obtain a virtual public register address; a preset configuration table is constructed according to the grouping sequence number of each slave device, the slave device address, the internal register address of the slave device, the virtual public slave device address, and the virtual public register address. The specific preset configuration table is shown in Table 1.

[0058] Table 1

[0059]

[0060] Among them, number: This is the serial number of each record. At the same time, for the same group read request, each device will reply one by one according to the coding order. Group serial number: This is the serial number used to distinguish different groups; slave device address: stores the slave device address of the same group, and each slave device address is different; internal register address: the register address inside the device, which stores some configuration information or sensor data of the slave device; virtual slave device address: the public slave device address generated by the management module; virtual public register address: for the same internal register address of the same group, the internal register address is used as the virtual address by default. If the internal register addresses of two devices are different, the management module will generate a virtual address as the public register address; data validity: optionally, after completing the batch transmission, the transmission module will confirm with each device whether the data has been received, and the unwritten devices will be marked and reported. In a specific embodiment, grouping is performed according to the same device, where device 1 and device 2 are a group, and a virtual address 0x88 is generated, and device 3 and device 4 are a group, and a virtual address 0x78 is generated. Since the internal register addresses of 3 and 4 are different, a second-order virtual address 0x02 is generated.

[0061] In the embodiment of the present invention, the slave device address carried by the current communication request is compared with the slave device address in the preset configuration table; if the slave device addresses carried by the current communication request are the same as the corresponding slave device addresses in the same group of slave devices in the preset configuration table, it is determined that the current communication request includes multiple communication requests for the same group of slave devices; otherwise, it is determined that the current communication request does not include multiple communication requests for the same group of slave devices. That is, it is determined whether the slave devices targeted by the current communication request are slave devices in the same group. If so, it is determined that the device communication data packet is a batch-accessible request within the group; if not, it is determined that the device communication data packet is not a batch-accessible request within the group.

[0062] Step S13: If the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to the corresponding virtual public addresses in the preset configuration table, so that the slave devices in the same group of slave devices perform corresponding response operations to obtain response results after monitoring the existence of communication requests that require their own response on the virtual public address.

[0063] In an embodiment of the present invention, after determining whether the current communication request includes multiple communication requests for the same group of slave devices, if the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to the corresponding virtual public addresses in the preset configuration table. Specifically, if the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are the same, the multiple communication requests are transmitted to the corresponding virtual public slave device addresses in the preset configuration table; if the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are different, the multiple communication requests are transmitted to the corresponding virtual public register addresses in the preset configuration table. Afterwards, after the slave devices in the same group of slave devices monitor that there are communication requests that need to be responded to by themselves on the virtual public address, they can perform corresponding response operations to obtain response results.

[0064] In addition, if the current communication request does not include multiple communication requests for the same group of slave devices, the current communication request is sent directly to the corresponding slave device according to the addresses of each slave device carried by the current communication request, so that after the slave device receives the communication request for its response, it performs the corresponding response operation and returns the corresponding response result to the master device.

[0065] In an embodiment of the present invention, after the slave devices in the same group of slave devices monitor that there is a communication request that needs to be responded to by themselves on the virtual public address, the corresponding response operation is performed to obtain the response result. In the process, when the target bus is idle, it is determined whether the slave device has completed the reception of the current communication request; if the slave device completes the reception of the current communication request, it is determined whether the received communication request is complete, and the corresponding judgment result is obtained, so that the slave device performs the corresponding response operation based on the judgment result to obtain the response result. More specifically, if the received communication request is complete, the slave devices in the same group of slave devices perform the corresponding response operation on the communication request that needs to be responded to by themselves on the virtual public address to obtain the response result; if the received communication request is incomplete, it is jumped again to the step of transmitting multiple communication requests to the corresponding virtual public address in the preset configuration table, so that the slave device re-monitors whether there is a communication request that needs to be responded to by itself on the virtual public address. In other words, when the slave device monitors its own virtual address request, it will complete the corresponding ACK (Acknowledge character, confirmation character) reply and complete the data reception. The management module will confirm that the slave device has completed the data reception when the bus is idle, and if there is data missing, the communication will be re-initiated.

[0066] In the case of data omission, the present invention will re-initiate communication, that is, jump to the step of transmitting multiple communication requests to the corresponding virtual public address in the preset configuration table, so that the slave device re-listens to whether there is a communication request on the virtual public address that needs to be responded to by itself. In this case, after completing the batch transmission, the transmission module will confirm with each device whether the data has been received, the unwritten devices will be marked and reported, and then the data validity corresponding to the marked slave device in the configuration table will be marked. Among them, 0 is written and 1 is not written. After that, the master device can specifically determine the slave device that has not received the data based on the data mark in the configuration table, and then send a targeted communication request to the slave device that has not received the data again, and it is unnecessary to transmit all communication requests. Thereby avoiding the waste of resources and improving the bus utilization rate.

[0067] It should also be pointed out that the present invention also replaces new virtual address values ​​by regularly updating the virtual address internal configuration table, thereby effectively improving the security of the internal bus network.

[0068] Step S14: Acquire multiple response results corresponding to multiple communication requests returned in batches from the same group of slave devices.

[0069] In the embodiment of the present invention, the slave device performs a corresponding response operation to obtain a response result, and returns the response result to the master device, and the master device obtains multiple response results corresponding to multiple communication requests returned in batches by the same group of slave devices, thereby completing the communication. After the communication is completed, the system will also reset to the initial state and wait for the next communication.

[0070] Beneficial effect: The present invention sets up a virtual public address conversion mechanism. When the master device monitors the current communication request on the bus, it first determines whether the current communication request includes multiple communication requests for the same group of slave devices. If so, multiple communication requests are sent in batches using the virtual public address. In this way, the utilization rate of the bus is improved, and the existence of the virtual public address also improves the security of communication.

[0071] Based on the previous embodiment, the present invention establishes a set of management tables on the I2C communication link to integrate the register addresses with the same configuration strategy into one group. After the management table is established, a virtual address that does not exist on the bus will be assigned to the group configuration strategy, and a data packet will be sent to the virtual address. After the configuration table is established, the slave devices of the same group will obtain the virtual address corresponding to the group, monitor the data packet of the virtual address, and request a batch communication based on the data packet. Next, a detailed description will be given for the specific data communication process.

[0072] The present invention connects a management module to the bus. The management module can be integrated in the main device, or it can be performed by a separate device with storage function. The initial configuration table is manually input through master-slave communication. The management module completes register grouping and virtual address generation according to the configuration information, and completes a series of configuration processes. The management module includes an internal register, a processing module, and a transmission module. The processing module and the transmission module are connected to the I2C bus. The processing module is responsible for completing automatic grouping and virtual address generation according to the configuration information, and storing the configuration information and virtual address related information in the internal register. After completing the initialization configuration, the processing module will monitor the communication for the virtual address and record the corresponding situation of the slave device. The internal register is used to store the grouping information and the virtual address generated for the group. The function of the transmission module is to cooperate with the processing module to confirm the data to each group of slave devices; at the same time, the module will receive the bus data transmission information and transmit it to the processing module for analysis.

[0073] See also Figure 4 As shown, after the system link is initialized, the master and slave devices are powered on and prepared based on their respective configurations, and the management module loads the initial configuration, which is mainly manual entry of configuration information. After the entry is completed, the following will be generated Figure 3 A configuration table is shown, which groups the same devices, where device 1 and device 2 are grouped together and a virtual address of 0x88 is generated, and device 3 and device 4 are grouped together and a virtual address of 0x78 is generated. Since the internal register addresses of 3 and 4 are different, a second-order virtual address of 0x02 is generated.

[0074] After the configuration table is generated, the transmission module writes the virtual address information into each slave device. In addition to monitoring its own real address data, the slave device will also monitor the virtual address data packet. When there is an I2C communication request on the bus, the master device monitors and parses the data packet to determine whether the device communication data packet is a batch-accessible request within the group, specifically by comparing the slave device address in the communication data with the data in the internal register.

[0075] If it is a non-batch access request, the communication will not be interfered with and the data packet will be sent normally. For batch data requests, data transmission is performed according to the virtual address based on the relevant information of the internal register. When the slave device monitors its own virtual address request, it will complete the ACK corresponding reply and complete the data reception. The management module will confirm that the slave device has completed the data reception when the bus is idle. If there is data missing, the communication will be re-initiated. After the communication is completed, the system resets to the initial state and waits for the next communication. At the same time, the present invention effectively improves the security of the internal bus network by regularly updating the virtual address internal configuration table and replacing the new virtual address value.

[0076] Beneficial effects: The present invention introduces a virtual address mechanism into the hardware bottom-layer bus network, establishes a set of batch read and write strategies, and improves bus utilization and stability.

[0077] See also Figure 5 As shown, an embodiment of the present invention provides a data communication device, which is applied to a master device, including:

[0078] The communication request acquisition module 11 is used to monitor the target bus to obtain the current communication request on the target bus;

[0079] A determination module 12 is used to compare the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address;

[0080] The communication request transmission module 13 is used for transmitting the multiple communication requests to the corresponding virtual public addresses in the preset configuration table if the current communication request includes multiple communication requests for the same group of slave devices, so that the slave devices in the same group of slave devices perform corresponding response operations to obtain response results after monitoring the existence of communication requests that need to be responded to by themselves on the virtual public address;

[0081] The response result acquisition module 14 is used to acquire multiple response results corresponding to multiple communication requests returned in batches from the same group of slave devices.

[0082] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.

[0083] Beneficial effect: The present invention sets up a virtual public address conversion mechanism. When the master device monitors the current communication request on the bus, it first determines whether the current communication request includes multiple communication requests for the same group of slave devices. If so, multiple communication requests are sent in batches using the virtual public address. In this way, the utilization rate of the bus is improved, and the existence of the virtual public address also improves the security of communication.

[0084] Furthermore, the present application also discloses an electronic device. Figure 6It is a structural diagram of an electronic device according to an exemplary embodiment, and the content in the figure cannot be regarded as any limitation on the scope of use of this application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the data communication method disclosed in any of the aforementioned embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.

[0085] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0086] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0087] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data communication method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0088] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed data communication method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.

[0089] Furthermore, the present application also discloses a computer program product, including a computer program / instruction; wherein the computer program / instruction, when executed by a processor, implements the aforementioned disclosed response transmission method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiment, and will not be repeated here.

[0090] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0091] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0092] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0093] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0094] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A data communication method, characterized in that: Applied to main devices, including: Monitoring a target bus to obtain a current communication request on the target bus; Compare the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address; If the current communication request includes multiple communication requests for the same group of slave devices, the multiple communication requests are transmitted to the corresponding virtual public addresses in the preset configuration table, so that the slave devices in the same group of slave devices perform corresponding response operations after monitoring the existence of communication requests that need to be responded to by themselves on the virtual public address, so as to obtain response results; Acquire a plurality of response results corresponding to the plurality of communication requests returned in batches from the same group of slave devices.

2. The data communication method according to claim 1, characterized in that: Before comparing the slave device address carried in the current communication request with the slave device address in the preset configuration table, the method further includes: Determining the grouping of the slave devices according to the types of the slave devices, and determining the grouping sequence number corresponding to each group of slave devices; the slave devices in the same group have the same type; Determining whether the internal register addresses corresponding to the slave devices in the same group of slave devices are the same; If the internal register addresses corresponding to the slave devices in the same group of slave devices are the same, a virtual public address corresponding to the slave devices in the same group of slave devices is randomly generated to obtain a virtual public slave device address; If the internal register addresses corresponding to the slave devices in the same group of slave devices are different, then based on the internal register address of any slave device in the same group of slave devices, a virtual public address corresponding to each internal register of each slave device in the same group of slave devices is generated to obtain a virtual public register address; The preset configuration table is constructed according to the group sequence number of each of the slave devices, the slave device address, the internal register address of the slave device, the virtual common slave device address and the virtual common register address.

3. The data communication method according to claim 2, characterized in that: If the current communication request includes multiple communication requests for the same group of slave devices, transmitting the multiple communication requests to the corresponding virtual public addresses in the preset configuration table includes: If the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are the same, the multiple communication requests are transmitted to the corresponding virtual public slave device addresses in the preset configuration table; If the current communication request includes multiple communication requests for the same group of slave devices, and the internal register addresses corresponding to the slave devices in the same group of slave devices are different, the multiple communication requests are transmitted to the corresponding virtual public register addresses in the preset configuration table.

4. The data communication method according to claim 2, characterized in that: The comparing the slave device address carried by the current communication request with the slave device address in the preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices includes: Compare the slave device address carried in the current communication request with the slave device address in the preset configuration table; If the slave device addresses carried by the current communication request are the same as the corresponding slave device addresses in the same group of slave devices in the preset configuration table, then it is determined that the current communication request includes multiple communication requests for the same group of slave devices; Otherwise, it is determined that the current communication request does not include multiple communication requests for the same group of slave devices.

5. The data communication method according to claim 4, characterized in that: After determining whether the current communication request includes multiple communication requests for the same group of slave devices, the method further includes: If the current communication request does not include multiple communication requests for the same group of slave devices, the current communication request is directly sent to the corresponding slave device according to the addresses of each slave device carried by the current communication request, so that after the slave device receives the communication request for its response, it performs the corresponding response operation and returns the corresponding response result to the master device.

6. The data communication method according to any one of claims 1 to 5, characterized in that: After the slave devices in the same group of slave devices monitor that there is a communication request requiring a response from themselves on the virtual public address, the process of performing a corresponding response operation to obtain a response result also includes: determining whether the slave device has completed receiving the current communication request when the target bus is idle; If the slave device completes receiving the current communication request, it determines whether the received communication request is complete and obtains a corresponding determination result, so that the slave device performs a corresponding response operation based on the determination result to obtain a response result.

7. The data communication method according to claim 6, characterized in that: The obtaining of the corresponding judgment result so that the slave device performs a corresponding response operation based on the judgment result to obtain a response result includes: If the received communication request is complete, the slave devices in the same group of slave devices perform corresponding response operations on the communication request that needs to be responded to by the slave devices on the virtual public address to obtain a response result; If the received communication request is incomplete, the process jumps again to the step of transmitting the multiple communication requests to the corresponding virtual public addresses in the preset configuration table, so that the slave device re-monitors whether there are any communication requests on the virtual public address that need to be responded to by itself.

8. A data communication device, characterized in that: Applicable to main devices, including: A communication request acquisition module, used for monitoring the target bus to acquire the current communication request on the target bus; A determination module, used to compare the slave device address carried by the current communication request with the slave device address in a preset configuration table to determine whether the current communication request includes multiple communication requests for the same group of slave devices; the preset configuration table is used to record the slave device addresses of several groups of slave devices and the corresponding virtual public addresses, and each group of slave devices corresponds to a different virtual public address; A communication request transmission module, configured to transmit the multiple communication requests to the corresponding virtual public addresses in the preset configuration table if the current communication request includes multiple communication requests for the same group of slave devices, so that the slave devices in the same group of slave devices perform corresponding response operations to obtain response results after monitoring the existence of communication requests that need to be responded to by themselves on the virtual public address; The response result acquisition module is used to acquire a plurality of response results corresponding to the plurality of communication requests returned in batches from the same group of slave devices.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the data communication method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data communication method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method and device for allocating bus address to slave station, electronic equipment and storage medium

    CN117812044A

  • Data protection method and device, equipment and storage medium

    CN119004499A

  • Video system and method for data communication

    US20150070503A1

  • Load store cache microarchitecture

    US20240281249A1