I 2 C's multi-device co-located node sequencing communication method

Through the cooperation of I2C bus and GPIO pins, the master device records the order and type of sub-devices, solving the problems of complex device address setting and quantity limitation in the existing technology, and realizing efficient and flexible multi-device communication.

CN116866105BActive Publication Date: 2025-10-21GUANGZHOU UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211568082.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2025-10-21
Estimated Expiration
2042-12-08

AI Technical Summary

Technical Problem

The existing technology requires resetting the address when adding a device to a chain-connected multi-node device group, which makes the process complicated and the number of devices limited, making it impossible to flexibly expand.

Method used

A multi-device co-addressed node sorting communication method based on I2C is adopted. The communication enable flag is sent through the GPIO pin of the master device. The slave device detects and opens the I2C bus to send information. The master device records the device order and type. All slave devices share the same bus address.

Benefits of technology

It realizes flexible recording and efficient connection of device sequence, allows an unlimited number of devices to be connected, improves communication efficiency, and simplifies the process of adding devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116866105B_ABST
    Figure CN116866105B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of communication and discloses a multi-device same-site node ordering communication method based on I 2 C, which comprises the following steps: a GPIO port sends a communicable enabling sign; if a first sub-device does not detect the communicable enabling sign, the first step is returned, if the first sub-device detects the communicable enabling sign, an I 2 C bus is started, the first sub-device sends device information to a main device; after the main device receives the information, the first sub-device ends the I 2 C bus; the main device sends the communicable enabling sign to a second sub-device; if the second sub-device does not detect the communicable enabling sign, the fourth step is returned, if the second sub-device detects the communicable enabling sign, an I 2 C bus is started, the second sub-device sends device information to the main device; the cycle is continued until the (N+1)th sub-device finishes communication.
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, specifically based on I 2 C's multi-device co-location node sorting communication method. Background Art

[0002] For communication between chained multi-node devices, use I 2 Method C is simple and portable, but it requires setting a unique address for each node device before use, forming an orderly address chain. When a device is added to a normally operating device group, the newly added device address will disrupt the order of the existing address connections. At this time, new addresses must be set for the new device and subsequent devices, which is time-consuming and labor-intensive.

[0003] Chinese patent CN 110290227 B (Dynamic allocation method, system and storage medium for integrated circuit bus addresses) proposes a method for dynamically allocating bus addresses. The technical solution is based on address allocation rules, where a host sends an address allocation instruction to a first slave, and the first slave sends the address allocation instruction layer by layer to a second slave. The second slave is the last slave in the integrated circuit bus, and the second slave feeds back first address number information layer by layer to the host. Based on the first address number information, the host starts the integrated circuit bus.

[0004] The process of the above-mentioned prior art is relatively complicated, and due to I 2 The number of connected devices is limited by the characteristics of C. According to the above-mentioned technical solution for dynamic address allocation of devices, if there are n devices to be allocated addresses, a total of 2(n-1) communications are required between the devices. When the number of devices is large, the workload is large and the flexibility is not enough. The specific reason is that the dynamic address allocation mechanism designed by the author itself is caused by this. For this reason, we propose a method based on I 2 C's multi-device co-location node sorting communication method. Summary of the Invention

[0005] (1) Technical problems solved

[0006] In view of the deficiencies in the prior art, the present invention provides a 2 C's multi-device co-location node sorting communication method solves the above problems.

[0007] (2) Technical solution

[0008] In order to achieve the above-mentioned purpose, the present invention provides the following technical solutions: 2 The multi-device co-address node sorting communication method of C comprises the following steps:

[0009] Step 1: Turn on the main device 2C bus, a GPIO port sends a communication enable flag;

[0010] Step 2: If the first sub-device does not detect the communication enable flag, it returns to the first step. If it detects the communication enable flag, it turns on I 2 C bus, the first slave device sends device information to the master device;

[0011] Step 3: After the master device receives the information, the first slave device ends I 2 C bus;

[0012] Step 4: The master device sends a communication enable flag to the second slave device;

[0013] Step 5: If the second sub-device does not detect the communication enable flag, it returns to step 4. If it detects the communication enable flag, it turns on I 2 C bus, the second slave device sends device information to the master device;

[0014] Step 6: Repeat this cycle until the N+1th sub-device completes communication.

[0015] Preferably, the master device ends and records the waiting for the slave device information when the waiting time expires.

[0016] Preferably, the arrangement order of the first sub-device to the N+1th sub-device is random.

[0017] Preferably, each of the sub-devices has two or more GPIO pins and I 2 C bus, one GPIO pin is used to detect the communication enable flag, and the other GPIO pin is used to issue the communication enable flag. The bus address of each slave device is the same and consistent with the preset bus address of the master device.

[0018] Preferably, the master device is provided with a GPIO pin for issuing a communication enable flag and an I 2 C bus, the GPIO pin on the master device for issuing a communication enable flag is connected to the GPIO pin for detecting a communication enable flag on the first sub-device, and the GPIO pin for issuing a communication enable flag between two adjacent sub-devices is connected to the GPIO pin for detecting a communication enable flag.

[0019] (3) Beneficial effects

[0020] Compared with the prior art, the present invention provides a 2 C's multi-device co-location node sorting communication method has the following

[0021] Beneficial effects:

[0022] 1. Based on I2 C's multi-device co-location node sorting communication method records the arrangement order of sub-devices in the master device. If the master device needs to connect to a sub-device, it counts in sequence through the GPIO interface and starts communication after switching to the designated sub-device. This method is more efficient and flexible.

[0023] 2. Based on I 2 C's multi-device co-location node sorting communication method has no limit on the number of connections between sub-devices, ignoring the storage medium limitations of the devices. Therefore, the number of connected sub-devices is greatly improved compared to the existing technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a schematic diagram of the connection between the master device and the slave device of the present invention;

[0025] Figure 2 It is a schematic diagram of the process of the present invention;

[0026] Figure 3 It is a flow chart of the prior art;

[0027] Figure 4 It is a schematic diagram of the overall process of the prior art. DETAILED DESCRIPTION

[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.

[0029] See also Figure 1-3 , based on I 2 The multi-device co-location node sorting communication method of C includes the following contents:

[0030] The device connection is cbda (the master device does not know the type and arrangement order of the sub-devices). First, a GPIO port sends a communication enable flag. When the detection pin of the sub-device c detects the communication enable flag of the master device;

[0031] Open I 2 C bus, the slave device C sends the device information to the host. After the master device receives it, the first device is recorded as the slave device C, and C ends I 2 C communicates and sends a communication enable flag to sub-device b. When the detection pin of sub-device b detects the communication enable flag of sub-device c;

[0032] Open I 2On the C bus, slave device c sends device information to the host. After receiving it, the master device records the second device as slave device b. This continues in this order until the last slave device. At this point, the master device has recorded the order of the slave devices and their corresponding device types.

[0033] Each sub-device has two or more GPIO pins and I 2 C bus. One GPIO pin is used to detect the communication enable flag, while another pin is used to issue the communication enable flag. The bus address of each slave device is the same and must be consistent with the preset bus address of the master device.

[0034] When the detection pin of the sub-device detects the communication enable flag, it is necessary to open the I 2 C bus, communicate with the host, send the device type to the host, and the host disconnects and ends I after completion 2 C communication, and sends a communication enable flag through the signal pin. Figure 2 .

[0035] The master device does not directly assign physical slave addresses to the slave devices, but records the connection order in the master device. A multi-device co-location node sorting communication mechanism is proposed. The implementation scheme of the present invention is to use the GPIO port, which is respectively a detection pin and an enable pin. First, the master device sends a communication enable flag to the first slave device. After the slave device detects it, it turns on the communication pin according to the pre-set enable pin. 2 C communication, the master device records the type and location of the device, and after this process is completed, the device ends I 2 C communication and sends a communication enable flag to the next connected sub-device. The next sub-device detects the flag and turns on I 2 C communication, the master device continues to record the type and location of the device, and so on, until the master device records the type and location of the last sub-device.

[0036] The prior art, such as CN 110290227 B, has a technical solution based on an address allocation rule, wherein the host sends an address allocation instruction to the first slave, and the first slave sends the address allocation instruction layer by layer to the second slave, wherein the first slave is the last slave in the integrated circuit bus, and the second slave feeds back the first address number information layer by layer to the host, and according to the first address number information, the host starts the integrated circuit bus. The overall process is shown in FIG. Figure 4 .

[0037] The biggest difference between the two solutions is that in the present invention, the physical addresses of all sub-devices are consistent, and the main device does not need to assign physical addresses to them. The arrangement order of each device is stored in the main device, while in the prior art, the main device assigns a physical address to each sub-device according to the address allocation rules.

[0038] Therefore, in the present invention, ignoring the storage medium limitations of the device, theoretically, there is no limit to the number of connections between sub-devices. After the arrangement order of the sub-devices is recorded in the main device, if the main device needs to connect to a certain sub-device, it counts in order through the GPIO interface, and starts communication after switching to the specified sub-device.

[0039] The master device and the slave devices are connected to form a chain structure, and the master device communicates with the slave devices in sequence according to the connection order.

[0040] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A multi-device co-location node sorting communication method based on I2 C, characterized in that: The following steps are involved: Step 1: A GPIO port sends a communication enable flag; Step 2: If the first slave device does not detect the communication enable flag, it returns to the first step. If it detects the communication enable flag, it opens the I2 C bus and the first slave device sends the device information to the master device. Step 3: After the master device receives the information, the first slave device ends the I2 C bus; Step 4: The master device sends a communication enable flag to the second slave device; Step 5: If the second slave device does not detect the communication enable flag, it returns to step 4. If it detects the communication enable flag, it opens the I2 C bus and the second slave device sends the device information to the master device. Step 6: Repeat this process until the N+1th sub-device completes communication. Each of the sub-devices has two or more GPIO pins and an I2 C bus, one GPIO pin is used to detect a communication enable flag, and another GPIO pin is used to issue a communication enable flag. The bus address of each sub-device is the same and consistent with the preset bus address of the master device; The master device is provided with a GPIO pin for issuing a communication enable flag and an I2 C bus. The GPIO pin for issuing a communication enable flag on the master device is connected to the GPIO pin for detecting a communication enable flag on the first sub-device, and the GPIO pin for issuing a communication enable flag between two adjacent sub-devices is connected to the GPIO pin for detecting a communication enable flag.

2. The I2C-based multi-device co-location node sorting communication method according to claim 1, characterized in that: If the master device times out waiting for the slave device information, the waiting ends and is recorded.

3. The I2C-based multi-device co-location node sorting communication method according to claim 1, characterized in that: The arrangement order of the first sub-device to the N+1th sub-device is random.

Citation Information

Patent Citations

  • Dynamic allocation methods, systems, and storage media for integrated circuit bus addresses

    CN110290227B

  • I2C communication anti-collision method and system

    CN114302256A

  • System and method for dynamically distributing I2C address

    CN1783050A