A communication method, apparatus, device, and medium
Patent Information
- Application Number
- CN202310544678.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-12
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-05-12
AI Technical Summary
当与从机结束通信后,与其他设备连接时,需要再次与该装置建立联系,再通过协议导通其中的一条从机接口线路,在使用时,当一次通信结束,再与其他从机通信时,需要再次通过协议建立线路才能实现通信,当频繁更换从机通信时,通信效率降低
[0035]可见,本申请提供了一种通信方法,包括获取主机为本地的各接口分配的各地址信息,当检测到所述主机发送开始信号时,建立各所述接口与相应的外部设备之间的第一通信关系;获取所述主机发送的通信地址信息,从本地的各所述地址信息中筛选出与所述通信地址信息相同的目标地址信息,并确定出与所述目标地址相对应的目标接口;判断所述主机的时钟线是否为低电平,若所述主机的时钟线为低电平,则确定出与所述目标接口连接的目标外部设备,并建立所述主机与所述目标接口之间的第二通信关系;利用所述第一通信关系和所述第二通信关系进行所述主机与所述目标外部设备之间的通信。本申请主要通过对相同设备赋予不同的地址代号,主机直接通过地址代号与从机建立总线连接,从而在保证相同的设备挂载在同一IIC总线的情况下,主机完成接口地址配置后,与不同的设备可以直接建立连接通路进行通信,无需主机再来控制通路的连接,本申请的技术关键点是,将扩展装置的各个接口地址中,提前预存连接设备的地址代号,当主机与不同接口的设备进行通信时,不需要再与扩展装置进行交互打开连接通路,只需要发送接口预存的地址代号就可以实现与设备的交互,可以减少主机与扩展装置之间的交互次数,提高效率。
Smart Images

Figure CN116578519B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip design, and in particular to a communication method, apparatus, device, and medium. Background Technology
[0002] IIC (Inter-Integrated Circuit) is a bidirectional two-wire synchronous serial bus based on a serial data line (SDA) and a serial clock line (SCL). In existing technology, during operation, the master generates a clock signal and uses a defined address signal to locate and interact with the slave device. One current communication method involves using one IIC interface to drive a device with multiple IIC interfaces. This device includes a master interface for connecting to the master and multiple slave interfaces for connecting to the slave devices. During operation, the master first establishes contact with the device, then establishes a connection with one of the slave interface lines via a protocol, and then establishes a connection with the slave device through this circuit. When communication with a slave ends and connection to other devices is needed, it is necessary to re-establish contact with the device and re-establish a connection with one of the slave interface lines via a protocol. In practice, when communication ends and communication with other slave devices resumes, a new connection must be established via a protocol to achieve communication. Frequent switching between slave devices reduces communication efficiency.
[0003] As can be seen from the above, how to achieve communication without establishing multiple connection paths and improve communication efficiency while ensuring that the same devices can be connected to the same IIC bus is a problem that needs to be solved in this field. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a communication method, apparatus, device, and medium that enables communication without the need for multiple connection establishments, thus improving communication efficiency, while ensuring that identical devices can be connected to the same IIC bus. The specific solution is as follows:
[0005] In a first aspect, this application discloses a communication method applied to an extension device, comprising:
[0006] Obtain the address information assigned by the host to each local interface, and when the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device;
[0007] Obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address;
[0008] Determine whether the host's clock line is low. If the host's clock line is low, identify the target external device connected to the target interface and establish a second communication relationship between the host and the target interface.
[0009] The host communicates with the target external device using the first communication relationship and the second communication relationship.
[0010] Optionally, obtaining the address information allocated by the host to each local interface includes:
[0011] Establish the initial connection between each local interface and the corresponding external device;
[0012] Establish a second connection between the local host interface and the host, and use the second connection to allocate address information to each local interface.
[0013] Optionally, the step of establishing a first communication relationship between each interface and the corresponding external device when the host sends a start signal includes:
[0014] When the host sends a start signal, an interface start signal identical to the start signal is generated synchronously for each local interface, and a first communication relationship is established between each interface and the corresponding external device.
[0015] Optionally, after establishing the second communication relationship between the host and the target interface, the method further includes:
[0016] Determine whether the clock line of the host is currently at a high level;
[0017] If the clock line of the host is currently high, a stop signal is generated for each of the local interfaces except for the target interface.
[0018] Optionally, after establishing the second communication relationship between the host and the target interface, the method further includes:
[0019] If the host sends secondary communication address information, the target external device is filtered based on the secondary communication address information to obtain the filtered target external device;
[0020] The host communicates with the filtered target external devices using the first communication relationship and the second communication relationship.
[0021] Optionally, after establishing communication between the host and the target external device using the first communication relationship and the second communication relationship, the method further includes:
[0022] Perform signal detection on the host computer;
[0023] When a stop signal is detected from the host, the first communication relationship and the second communication relationship are set to a disconnected state.
[0024] Optionally, after setting the first communication relationship and the second communication relationship to a disconnected state, the method further includes:
[0025] The host is subjected to communication detection, and the host is set to a waiting state. When the host sends a start signal again, the process jumps to the step of obtaining the communication address information sent by the host.
[0026] Secondly, this application discloses a communication device, comprising:
[0027] The first communication relationship establishment module is used to obtain the address information allocated by the host to each local interface, and when the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device.
[0028] The target interface determination module is used to obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address;
[0029] The second communication relationship establishment module is used to determine whether the clock line of the host is low. If the clock line of the host is low, the target external device connected to the target interface is identified, and a second communication relationship is established between the host and the target interface.
[0030] A communication module is used to communicate between the host and the target external device using the first communication relationship and the second communication relationship.
[0031] Thirdly, this application discloses an electronic device, including:
[0032] Memory, used to store computer programs;
[0033] A processor for executing the computer program to implement the aforementioned communication method.
[0034] Fourthly, this application discloses a computer storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed communication method.
[0035] As can be seen, this application provides a communication method, including obtaining address information allocated by a host to each local interface; when a start signal is detected from the host, establishing a first communication relationship between each interface and a corresponding external device; obtaining communication address information sent by the host; filtering out target address information that is the same as the communication address information from the local address information; determining the target interface corresponding to the target address; determining whether the host's clock line is low; if the host's clock line is low, determining the target external device connected to the target interface; and establishing a second communication relationship between the host and the target interface; and using the first communication relationship and the second communication relationship to perform communication between the host and the target external device. This application primarily addresses identical devices by assigning different address codes. The host directly establishes a bus connection with the slave device through the address code. This ensures that identical devices are connected to the same IIC bus. After configuring the interface address, the host can directly establish a connection path with different devices for communication without the host needing to control the connection. The key technical point of this application is that the address codes of the connected devices are pre-stored in the interface addresses of the expansion device. When the host communicates with devices with different interfaces, it does not need to interact with the expansion device to open a connection path. It only needs to send the pre-stored address code to achieve interaction with the device, which can reduce the number of interactions between the host and the expansion device and improve efficiency. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0037] Figure 1 This is a flowchart of a communication method disclosed in this application;
[0038] Figure 2 This is a schematic diagram of an expansion device structure disclosed in this application;
[0039] Figure 3 This is a schematic diagram illustrating the specific process of a communication method disclosed in this application;
[0040] Figure 4 This is a flowchart of a communication method disclosed in this application;
[0041] Figure 5 This is a schematic diagram of the structure of a communication device disclosed in this application;
[0042] Figure 6This application provides a structural diagram of an electronic device. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] IIC (Inter-Integrated Circuit) is a bidirectional two-wire synchronous serial bus based on a serial data line (SDA) and a serial clock line (SCL). In existing technology, during operation, the master generates a clock signal and uses a defined address signal to locate and interact with the slave device. One current communication method involves using one IIC interface to drive a device with multiple IIC interfaces. This device includes a master interface for connecting to the master and multiple slave interfaces for connecting to the slave devices. During operation, the master first establishes contact with the device, then establishes a connection with one of the slave interface lines via a protocol, and then establishes a connection with the slave device through this circuit. When communication with a slave ends and connection to other devices is needed, it is necessary to re-establish contact with the device and re-establish a connection with one of the slave interface lines via a protocol. In practice, when communication ends and communication with other slave devices resumes, a new connection must be established via a protocol to achieve communication. When frequently switching between slave devices, communication efficiency decreases.
[0045] See Figure 1 As shown, this embodiment of the invention discloses a communication method applied to an extension device, which may specifically include:
[0046] Step S11: Obtain the address information assigned by the host to each local interface. When the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device.
[0047] In this embodiment, a first connection relationship is established between each local interface and the corresponding external device; a second connection relationship is established between the local host interface and the host; address information is allocated to each local interface using the second connection relationship; when the host sends a start signal, an interface start signal identical to the start signal is synchronously generated for each local interface, and a first communication relationship is established between each interface and the corresponding external device.
[0048] Step S12: Obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address.
[0049] Step S13: Determine whether the clock line of the host is low. If the clock line of the host is low, identify the target external device connected to the target interface and establish a second communication relationship between the host and the target interface.
[0050] In this embodiment, after establishing the second communication relationship between the host and the target interface, the method further includes: if the host sends secondary communication address information, filtering the target external device based on the secondary communication address information to obtain the filtered target external device; and using the first communication relationship and the second communication relationship to conduct communication between the host and the filtered target external device.
[0051] Step S14: Use the first communication relationship and the second communication relationship to communicate between the host and the target external device.
[0052] A schematic diagram of the structure of the extension device in this application is shown below. Figure 2 As shown, the host interface connects to the host, and interfaces 1, 2, 3, 4… connect to various external devices. The specific workflow during operation is as follows: Figure 3As shown, the first step is to establish a connection between the host and the expansion device, assigning corresponding address information to each interface of the expansion device. For example, the address of device A connected to interface 1 is 1010111 (binary, all subsequent addresses are binary addresses), and the host assigns it the address 0000001; the device connected to interface 2 is the same as interface 1, both being device A, with the same address 1010111, and the host assigns it the address 0000010. This method assigns entirely new address information to all interfaces. The second step is that when the host communicates with an external device, it sends two START signals (i.e., start signals). The expansion device then... After detecting the first START signal, the expansion device generates START signals on each pin in sync with the host during the next SCL (clock line) clock cycle. In each subsequent clock cycle, it generates the correct address (1010111) on the interface. After the host sends the seventh bit of the address, the expansion device establishes a data transmission path between the host and the corresponding interface (i.e., after the host sends the start signal, the expansion device generates a start signal synchronized with the host, establishing the first synchronous communication relationship between the expansion device's interface and the external device). Other interfaces generate STOP signals (stop signals), thus selecting the data transmission path. Third, the host and device perform normal data communication interaction until the communication ends. Fourth, when the host interacts with the slave device for the last time, it sends two STOP signals. When the expansion device detects the two STOP signals, it closes the path.
[0053] Fifth, the extension device enters monitoring mode and waits for the host to send the START signal again.
[0054] In this embodiment, the address information allocated by the host to each local interface is obtained. When the host sends a start signal, a first communication relationship is established between each interface and the corresponding external device. The communication address information sent by the host is obtained, and target address information that is the same as the communication address information is filtered from the local address information. The target interface corresponding to the target address is determined. It is determined whether the host's clock line is low. If the host's clock line is low, the target external device connected to the target interface is determined, and a second communication relationship is established between the host and the target interface. Communication between the host and the target external device is performed using the first communication relationship and the second communication relationship. This application primarily addresses identical devices by assigning different address codes. The host directly establishes a bus connection with the slave device through the address code. This ensures that identical devices are connected to the same IIC bus. After configuring the interface address, the host can directly establish a connection path with different devices for communication without the host needing to control the connection. The key technical point of this application is that the address codes of the connected devices are pre-stored in the interface addresses of the expansion device. When the host communicates with devices with different interfaces, it does not need to interact with the expansion device to open a connection path. It only needs to send the pre-stored address code to achieve interaction with the device, which can reduce the number of interactions between the host and the expansion device and improve efficiency.
[0055] See Figure 4 As shown, this embodiment of the invention discloses a communication method applied to an extension device, which may specifically include:
[0056] Step S21: Obtain the address information assigned by the host to each local interface. When the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device.
[0057] Step S22: Obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address.
[0058] Step S23: Determine whether the clock line of the host is at a low level. If the clock line of the host is at a low level, then identify the target external device connected to the target interface and establish a second communication relationship between the host and the target interface.
[0059] Step S24: Determine whether the clock line of the host is currently at a high level. If the clock line of the host is currently at a high level, then generate a stop signal for each of the local interfaces except for the target interface.
[0060] Step S25: Use the first communication relationship and the second communication relationship to communicate between the host and the target external device.
[0061] Step S26: Perform signal detection on the host. When a stop signal is detected from the host, set the first communication relationship and the second communication relationship to a disconnected state.
[0062] In this embodiment, after setting the first communication relationship and the second communication relationship to a disconnected state, the method further includes: performing communication detection on the host and setting itself to a waiting state; when the host sends a start signal again, the method jumps to the step of obtaining the communication address information sent by the host.
[0063] Taking four identical sensors (i.e., four identical external devices) as an example, the specific process is as follows: First, connect the four sensors with address 1101001 to interfaces 1, 2, 3, and 4 of the expansion device respectively. The host interface of the host device and the expansion device (refer to...) Figure 2 The first step involves the host establishing a connection between the interface marked "Master" and the expansion device. The second step involves the host configuring address 0000001 for interface 1, address 0000010 for interface 2, address 0000011 for interface 3, and address 0000100 for interface 4. The third step involves the host sending two START signals. Upon receiving the first START signal, the expansion device synchronously generates START signals on interfaces 1, 2, 3, and 4 in the next clock cycle (establishing the first synchronous communication relationship between the interface and the four external devices). The fourth step involves the host sending address 0000010, and the expansion device synchronously generates address 1101001 on interfaces 1, 2, 3, and 4. The fifth step involves the expansion device checking if the host's SCL is low after the host sends address 0000010. If the host's SCL is low, the path between the host and interface 2 is established. Then, the expansion device checks if the host's SCL is high. If the SCL is high, a STOP signal is generated on interfaces 1, 3, and 4. Step 6: The host communicates normally with the device on interface 2, and the expansion device enters monitoring mode. Step 7: After completing communication with the device on interface 2, the host sends two STOP signals. Upon detecting these signals, the expansion device blocks the communication path between the host and the device on interface 2. Step 8: The expansion device enters waiting mode, waiting for the host to send two START signals, and repeats steps 3 through 8.
[0064] Taking the use of 10 EEPROMs (Electrically Erasable Programmable Read-Only Memory) and 4 sensors as an example, i.e., 14 external devices, each EEPROM has 4 fixed addresses and 3 configurable addresses. This means that the same EEPROM can have a maximum of 8 addresses. In this example, with 10 EEPROMs, the address space is insufficient during normal allocation. Therefore, this example divides the EEPROMs into two groups of 5, assigning different addresses to each group's EEPROMs: EEPROM 1 is 1010001, EEPROM 2 is 1010010, EEPROM 3 is 1010011, EEPROM 4 is 1010100, and EEPROM 5 is 1010101. The 4 sensors all have the same address: 1101001. When the host communicates with EEPROM No. 3 in the first group of EEPROMs, the steps are as follows: Step 1: Connect the four sensors to interfaces 1, 2, 3, and 4 respectively. Extend the IIC bus on interfaces 5 and 6 respectively. Connect the first group of EEPROMs to interface 5 and the second group of EEPROMs to interface 6. The host and the expansion device establish a connection. Step 2: Obtain the addresses configured by the host for interface 1 (0001), interface 2 (0010), interface 3 (0011), interface 4 (0100), interface 5 (0101), and interface 6 (0110). Step 3: The host sends two START signals. After the expansion device receives the first START signal, it synchronously generates START signals with the host on interfaces 1, 2, 3, 4, 5, and 6 in the next SCL cycle. Step 4: The host sends address 0101. The expansion device synchronously generates address 1101 on interfaces 1, 2, 3, and 4, and address 1010 on interfaces 5 and 6. Step 5: When the host sends address 0101 and then the SCL level is low, the expansion device connects the host and interface 5. When the SCL level is high, it generates STOP signals on interfaces 1, 2, 3, 4, and 6. Step 6: The host continues to send address 011 (i.e., the secondary communication address information) to communicate with EEPROM 3. The expansion device enters monitoring mode. Step 7: After the host completes communication with EEPROM 3 on interface 5, it sends two STOP signals. Upon detecting these signals, the expansion device blocks the connection between the host and the device on interface 5. Step 8: The expansion device enters a waiting state, waiting for the host to send two START signals, and repeats steps 3 to 8. Furthermore, this application applies to all IIC devices, and the number of devices is not limited to 4 or 14.
[0065] In this embodiment, the address information allocated by the host to each local interface is obtained. When the host sends a start signal, a first communication relationship is established between each interface and the corresponding external device. The communication address information sent by the host is obtained, and target address information that is the same as the communication address information is filtered from the local address information. The target interface corresponding to the target address is determined. It is determined whether the host's clock line is low. If the host's clock line is low, the target external device connected to the target interface is determined, and a second communication relationship is established between the host and the target interface. Communication between the host and the target external device is performed using the first communication relationship and the second communication relationship. This application primarily addresses identical devices by assigning different address codes. The host directly establishes a bus connection with the slave device through the address code. This ensures that identical devices are connected to the same IIC bus. After configuring the interface address, the host can directly establish a connection path with different devices for communication without the host needing to control the connection. The key technical point of this application is that the address codes of the connected devices are pre-stored in the interface addresses of the expansion device. When the host communicates with devices with different interfaces, it does not need to interact with the expansion device to open a connection path. It only needs to send the pre-stored address code to achieve interaction with the device, which can reduce the number of interactions between the host and the expansion device and improve efficiency.
[0066] See Figure 5 As shown, an embodiment of the present invention discloses a communication device, which may specifically include:
[0067] The first communication relationship establishment module 11 is used to obtain the address information allocated by the host to each local interface, and when the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device.
[0068] The target interface determination module 12 is used to obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address.
[0069] The second communication relationship establishment module 13 is used to determine whether the clock line of the host is low. If the clock line of the host is low, the target external device connected to the target interface is identified, and a second communication relationship is established between the host and the target interface.
[0070] The communication module 14 is used to communicate between the host and the target external device using the first communication relationship and the second communication relationship.
[0071] In this embodiment, the address information allocated by the host to each local interface is obtained. When the host sends a start signal, a first communication relationship is established between each interface and the corresponding external device. The communication address information sent by the host is obtained, and target address information that is the same as the communication address information is filtered from the local address information. The target interface corresponding to the target address is determined. It is determined whether the host's clock line is low. If the host's clock line is low, the target external device connected to the target interface is determined, and a second communication relationship is established between the host and the target interface. Communication between the host and the target external device is performed using the first communication relationship and the second communication relationship. This application primarily addresses identical devices by assigning different address codes. The host directly establishes a bus connection with the slave device through the address code. This ensures that identical devices are connected to the same IIC bus. After configuring the interface address, the host can directly establish a connection path with different devices for communication without the host needing to control the connection. The key technical point of this application is that the address codes of the connected devices are pre-stored in the interface addresses of the expansion device. When the host communicates with devices with different interfaces, it does not need to interact with the expansion device to open a connection path. It only needs to send the pre-stored address code to achieve interaction with the device, which can reduce the number of interactions between the host and the expansion device and improve efficiency.
[0072] In some specific embodiments, the first communication relationship establishment module 11 may specifically include:
[0073] The first connection relationship establishment module is used to establish the first connection relationship between each local interface and the corresponding external device;
[0074] The second connection relationship establishment module is used to establish a second connection relationship between the local host interface and the host, and to allocate address information to each local interface using the second connection relationship.
[0075] In some specific embodiments, the first communication relationship establishment module 11 may specifically include:
[0076] The first communication relationship establishment module is used to generate an interface start signal identical to the start signal for each local interface when the host sends a start signal, and to establish a first communication relationship between each interface and the corresponding external device.
[0077] In some specific embodiments, the second communication relationship establishment module 13 may specifically include:
[0078] The judgment module is used to determine whether the clock line of the host is currently at a high level;
[0079] A stop signal generation module is used to generate stop signals for each of the local interfaces other than the target interface if the clock line of the host is currently at a high level.
[0080] In some specific embodiments, the second communication relationship establishment module 13 may specifically include:
[0081] The target external device filtering module is used to filter the target external devices based on the secondary communication address information when the host sends secondary communication address information, so as to obtain the filtered target external devices.
[0082] A communication module is used to communicate between the host and the filtered target external devices using the first communication relationship and the second communication relationship.
[0083] In some specific embodiments, the communication module 14 may specifically include:
[0084] The signal detection module is used to detect signals from the host computer.
[0085] The disconnection module is used to set the first communication relationship and the second communication relationship to a disconnected state when a stop signal is detected from the host.
[0086] In some specific embodiments, the communication module 14 may specifically include:
[0087] The communication detection module is used to perform communication detection on the host and set itself to a waiting state. When the host sends a start signal again, it jumps to the step of obtaining the communication address information sent by the host.
[0088] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 20 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. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the communication method performed by the electronic device disclosed in any of the foregoing embodiments.
[0089] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire 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.
[0090] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored on it include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0091] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform operations and processing on the data 223 in the memory 22. The operating system 221 can be Windows, Unix, Linux, etc. The computer program 222, in addition to including computer programs capable of performing the communication methods executed by the electronic device 20 as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the communication device from external devices, as well as data collected by its own input / output interface 25.
[0092] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0093] Furthermore, embodiments of this application also disclose a computer-readable storage medium storing a computer program, which, when loaded and executed by a processor, implements the communication method steps disclosed in any of the foregoing embodiments.
[0094] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0095] The communication method, apparatus, device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A communication method, characterized in that, Applied to expansion devices, including: Obtain the address information assigned by the host to each local interface, and when the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device; Obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address; Determine whether the host's clock line is low. If the host's clock line is low, identify the target external device connected to the target interface and establish a second communication relationship between the host and the target interface. The host and the target external device communicate using the first communication relationship and the second communication relationship. When a start signal is detected from the host, the first communication relationship between each interface and the corresponding external device is established, including: when a start signal is detected from the host, an interface start signal identical to the start signal is synchronously generated for each local interface, and the first communication relationship between each interface and the corresponding external device is established. After establishing the second communication relationship between the host and the target interface, the process also includes: determining whether the current host clock line is high; if the current host clock line is high, then generating stop signals for all local interfaces except the target interface.
2. The communication method according to claim 1, characterized in that, The step of obtaining the address information allocated by the host to each local interface includes: Establish the initial connection between each local interface and the corresponding external device; Establish a second connection between the local host interface and the host, and use the second connection to allocate address information to each local interface.
3. The communication method according to claim 1, characterized in that, After establishing the second communication relationship between the host and the target interface, the method further includes: If the host sends secondary communication address information, the target external device is filtered based on the secondary communication address information to obtain the filtered target external device; The host communicates with the filtered target external devices using the first communication relationship and the second communication relationship.
4. The communication method according to any one of claims 1 to 3, characterized in that, After establishing communication between the host and the target external device using the first communication relationship and the second communication relationship, the method further includes: Perform signal detection on the host computer; When a stop signal is detected from the host, the first communication relationship and the second communication relationship are set to a disconnected state.
5. The communication method according to claim 4, characterized in that, After setting the first communication relationship and the second communication relationship to a disconnected state, the method further includes: The host is subjected to communication detection, and the host is set to a waiting state. When the host sends a start signal again, the process jumps to the step of obtaining the communication address information sent by the host.
6. A communication device, characterized in that, include: The first communication relationship establishment module is used to obtain the address information allocated by the host to each local interface, and when the host sends a start signal, establish the first communication relationship between each interface and the corresponding external device. The target interface determination module is used to obtain the communication address information sent by the host, filter out the target address information that is the same as the communication address information from the local address information, and determine the target interface corresponding to the target address; The second communication relationship establishment module is used to determine whether the clock line of the host is low. If the clock line of the host is low, the target external device connected to the target interface is identified, and a second communication relationship is established between the host and the target interface. A communication module is used to communicate between the host and the target external device using the first communication relationship and the second communication relationship; When a start signal is detected from the host, the first communication relationship between each interface and the corresponding external device is established, including: when a start signal is detected from the host, an interface start signal identical to the start signal is synchronously generated for each local interface, and the first communication relationship between each interface and the corresponding external device is established. After establishing the second communication relationship between the host and the target interface, the process also includes: determining whether the current host clock line is high; if the current host clock line is high, then generating stop signals for all local interfaces except the target interface.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the communication method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the communication method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Communication method and communication system for preventing I2C bus address conflict
CN111221765A
Method for achieving multi-machine communication based on I2C bus and multi-machine communication system
CN112416841A