A method and communication system compatible with one-wire communication and i2c communication

By achieving compatibility between the One-Line Communication and I2C protocols in the communication system, and utilizing the master device's IO ports and I2C bus for dynamic address configuration, the additional cost issues caused by different protocol versions are resolved, thereby improving the system's compatibility and flexibility.

CN118740957BActive Publication Date: 2026-04-28SHANGHAI FOURSEMI SEMICON CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI FOURSEMI SEMICON CO LTD
Filing Date
2024-06-12
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In existing communication systems, the chips of each communication device need to be manufactured in different versions according to the protocol used by the system, which leads to additional costs and there is no communication control logic that is compatible with different communication protocols.

Method used

A method and system compatible with both one-wire communication and I2C communication are provided. The compatibility of the two protocols is achieved through the I/O port of the master device and the I2C bus. When the master device switches between different protocol modes, the slave device address is dynamically configured, and communication-related logic control is added inside the device chip.

Benefits of technology

It improves the compatibility and flexibility of communication systems, reduces product development and system costs, and adapts to different working environments and equipment requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740957B_ABST
    Figure CN118740957B_ABST
Patent Text Reader

Abstract

The application discloses a method and a communication system compatible with one-wire communication and I2C communication, and belongs to the technical field of communication. The method compatible with one-wire communication and I2C communication comprises the following steps: if the communication system runs in a one-wire protocol mode, a master device communicates with a slave device connected with the IO port based on a one-wire communication protocol through the IO port; and if the communication system runs in an I2C protocol mode, the master device selects the slave device capable of communicating with the master device by controlling the potential of the IO port, and the master device communicates with the slave device based on an I2C communication protocol through an I2C bus. The technical scheme provided by the embodiment can effectively improve the compatibility of the communication system, and can effectively reduce the product development cost and the cost of the communication system without developing and configuring different versions of chips in the device for different protocols.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a method and communication system compatible with both One-Wire Communication and I2C Communication. Background Technology

[0002] In communication systems, various communication protocols exist between the chips of different communication devices. Commonly used protocols include one-wire communication and I2C (Inter-Integrated Circuit) communication. In related technologies, communication control logic compatible with different communication protocols is not provided. To match the communication protocols used by different systems, the same functional chip needs to be manufactured in versions corresponding to different communication protocols, resulting in additional costs. Summary of the Invention

[0003] This invention provides a method and communication system compatible with both One-Wire Communication and I2C Communication, thereby improving the compatibility of the communication system. It also eliminates the need to develop for different protocols and configure different versions of chips in the device, effectively reducing product development costs and system costs.

[0004] In a first aspect, embodiments of the present invention provide a method compatible with both one-wire communication and I2C communication. The communication system includes a master device and multiple slave devices. The master device includes multiple I / O ports, which are respectively connected to each of the slave devices, and the master device is connected to each of the slave devices via an I2C bus.

[0005] The method for compatibility between I2C and 1-line communication includes:

[0006] If the communication system operates in the One-Line Communication Protocol mode, the master device communicates with the slave device connected to the IO port through the IO port based on the One-Line Communication Protocol.

[0007] If the communication system operates in I2C protocol mode, the master device can select the slave device that can communicate with the master device by controlling the potential of the IO port, and the master device communicates with the slave device through the I2C bus based on the I2C communication protocol.

[0008] Optionally, when the communication system operates in the I2C protocol mode, before the master device and the slave device communicate, the following method is further included:

[0009] The master device configures the addresses of each slave device through the IO port and the I2C bus.

[0010] Optionally, the process of configuring the address of any slave device to be configured by the master device includes:

[0011] The master device controls the I / O port connected to the slave device to be configured to an effective potential, so that the slave device to be configured can interact with the master device through the I2C bus.

[0012] The master device broadcasts the address configuration command of the slave device to be configured to all the slave devices through the I2C bus;

[0013] The slave device to be configured responds to the address configuration command, stores the corresponding configuration address according to the address configuration command, and sends an address configuration confirmation signal back to the master device through the I2C bus;

[0014] When the master device receives the address configuration confirmation signal, it confirms that the address configuration of the slave device to be configured is complete.

[0015] Optionally, the method for compatibility between one-wire communication and I2C communication further includes:

[0016] If the master device does not receive the address configuration confirmation signal, the master device will again broadcast the address configuration command of the slave device to be configured to all the slave devices via the I2C bus.

[0017] Optionally, after the master device receives the address configuration confirmation signal, the method further includes:

[0018] If it is necessary to change the configuration address of the slave device to be configured, the master device broadcasts the changed address configuration command of the slave device to be configured to all slave devices through the I2C bus.

[0019] Optionally, the method for being compatible with both One-Line Communication and I2C Communication further includes: when the communication system switches from the One-Line Communication protocol mode to the I2C protocol mode, during the process of the master device configuring the addresses of each of the slave devices, each of the slave devices maintains the working state corresponding to the last working configuration instruction issued by the master device based on the One-Line Communication protocol before the protocol mode switch.

[0020] Optionally, the communication system operates in the one-line communication protocol mode when the master device is powered on; the method for being compatible with both one-line communication and I2C communication further includes:

[0021] After the main device is powered on, it is determined whether the communication system needs to switch to the I2C communication mode;

[0022] If so, the master device selects a slave device that can communicate with the master device by controlling the potential of the IO port, and the master device communicates with the slave device through the I2C bus based on the I2C communication protocol;

[0023] If not, the master device communicates with the slave device connected to the IO port via the IO port based on the One-Line Communication Protocol.

[0024] Optionally, the method for being compatible with both One-Line Communication and I2C Communication further includes: when the communication system switches from the One-Line Protocol mode to the I2C Protocol mode, the slave device stores the last working configuration instruction issued by the master device in the One-Line Protocol mode;

[0025] When the communication system switches from the I2C protocol mode to the One-Line Protocol mode, the slave device runs the last working configuration command issued by the master device in the previous One-Line Protocol mode.

[0026] Optionally, the method for compatibility with both I2C and 1-wire communication further includes:

[0027] In the I2C protocol mode, the master device controls the slave device connected to the I / O port to communicate with the master device by controlling the I / O port to be at an active potential; the master device controls the slave device connected to the I / O port to stop communicating with the master device by controlling the I / O port to be at an inactive potential.

[0028] And / or,

[0029] In the I2C protocol mode, the instructions sent by the master device to the slave device through the I2C bus include: power-on instructions and / or power-off instructions.

[0030] Secondly, embodiments of the present invention also provide a communication system, including: a master device and multiple slave devices; the master device includes multiple I / O ports, which are respectively connected to the multiple slave devices, and the master device is connected to each of the slave devices via an I2C bus; the master device and each of the slave devices communicate using a method compatible with both one-wire communication and I2C communication provided in any embodiment of the present invention.

[0031] The technical solution of this invention provides communication logic for a communication system operating in both the I2C and I1C protocol modes. It also provides methods for using master and slave devices compatible with both protocols, enabling the master device to communicate with the slave device based on the corresponding communication protocol under different protocol modes. This achieves coexistence of two communication protocols, effectively improving the compatibility of the communication system. Furthermore, by using master and slave devices compatible with both protocols to build the communication system, and by adding communication-related logic control methods within the device chip, it is unnecessary to develop and configure different versions of chips for different protocols. This effectively reduces product development and system costs. Moreover, by switching protocol modes through software logic, the master and slave devices can adapt to different working environments and device requirements, improving the system's flexibility and adaptability.

[0032] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present invention;

[0035] Figure 2 A flowchart illustrating a method for compatibility between one-wire communication and I2C communication provided in an embodiment of the present invention;

[0036] Figure 3 This is a schematic diagram illustrating the process of a master device configuring the address of a slave device according to an embodiment of the present invention.

[0037] Figure 4 A timing diagram of a master device executing an address configuration command in a communication system, provided as an embodiment of the present invention;

[0038] Figure 5 A timing diagram of a communication system during protocol mode switching, provided as an embodiment of the present invention;

[0039] Figure 6 A flowchart illustrating another method for compatibility between one-wire communication and I2C communication provided in an embodiment of the present invention;

[0040] Figure 7A communication timing diagram of a communication system provided in an embodiment of the present invention;

[0041] Figure 8 A flowchart illustrating another method for compatibility between one-wire communication and I2C communication provided in an embodiment of the present invention;

[0042] Figure 9 This is a schematic diagram of another communication system provided in an embodiment of the present invention. Detailed Implementation

[0043] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 should fall within the scope of protection of the present invention.

[0044] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0045] This invention provides a method compatible with both one-wire communication and I2C communication, applicable to communication systems configured with both one-wire and I2C communication protocols. For ease of explanation, the following will first describe the method in conjunction with... Figure 1 A brief description of the structure of the communication system is provided.

[0046] Figure 1 This is a schematic diagram of the structure of a communication system provided in an embodiment of the present invention, with reference to... Figure 1 The communication system provided in this embodiment of the invention includes a master device 10 and multiple slave devices; the master device 10 includes multiple I / O ports, which are respectively connected to each slave device, and the master device 10 is connected to each slave device through an I2C bus. Figure 1Five slave devices are illustrated, including slave device 21, slave device 22, slave device 23, slave device 24, and slave device 25, and correspondingly, five I / O ports of the master device 10 are shown: I / O 1, I / O 2, I / O 3, I / O 4, and I / O 5. Exemplarily, the number of slave devices can be set according to the number of I / O ports configured on the master device. The I2C bus may include a serial data line (SDA) and a serial clock line (SCL). Figure 1 For example, the I / O port wiring is represented by short dashed lines, the serial data line SDA by solid lines, and the serial clock line SCL by dotted dashed lines. The master device 10 connects to each slave device via I / O ports and an I2C bus. The master device 10 may have a built-in microprocessor, with the microprocessor chip including multiple functional pins for connecting to the master device's I / O ports and for connecting to the I2C bus. The slave devices may have built-in processing chips, with the processing chip including multiple functional pins for connecting to the master device's I / O ports and for connecting to the I2C bus. Both the master device 10 and the slave devices are compatible with both the One-Wire Communication Protocol and the I2C Communication Protocol. The master device and the slave devices communicate using the communication strategy provided by the method for compatible One-Wire Communication and I2C Communication provided in this embodiment of the invention. This method is described below.

[0047] Figure 2 A flowchart illustrating a method for compatible I2C and 1-wire communication provided in an embodiment of the present invention is shown below. Figure 2 Methods compatible with both I2C and 1C communication include:

[0048] S200. If the communication system is operating in the One-Line Communication Protocol mode, the master device communicates with the slave device connected to the IO port through the IO port based on the One-Line Communication Protocol.

[0049] The One-Wire communication protocol allows high-speed communication over a single cable, using only one signal line at the physical layer. In this embodiment of the invention, this signal line is the one connecting the I / O port of the master device and the slave device.

[0050] Specifically, when the communication system operates in One-Line Communication (IPC) mode, the master and slave devices communicate using the IPC protocol. Since the master device is connected to each slave device via a corresponding I / O port, it can directly communicate with the slave device through the appropriate I / O port. The master device can transmit communication commands to the corresponding slave device via the I / O port, based on the IPC protocol. These commands may include, for example, the slave device's operating configuration parameters. In this mode, the I2C bus can be idle; alternatively, if the communication system also includes other functional devices connected to the I2C bus and configured only with the I2C communication protocol, the master device can still control the operating status of these other functional devices normally via the I2C bus.

[0051] S201. If the communication system operates in I2C protocol mode, the master device can select the slave device that can communicate with the master device by controlling the potential of the IO port, and the master device communicates with the slave device through the I2C bus based on the I2C communication protocol.

[0052] In the I2C communication protocol, the master device is the device that initializes the data transmission of the bus and generates a clock signal that allows transmission. Each slave device has a unique address for identification.

[0053] Specifically, when the communication system operates in I2C protocol mode, the master device and slave device communicate using the I2C communication protocol. In this mode, the master device can communicate with the slave device via the I2C bus based on the I2C communication protocol. Specifically, the master device can identify the slave device communicating with it in I2C protocol mode using the slave device's address information, and can send communication commands to the corresponding slave device based on its address information. Furthermore, in this mode, the I / O ports do not transmit communication commands, but can be used as switches. Specifically, the master device can perform chip selection on the slave device via the I / O ports, for example, by controlling the potential of the I / O port to control whether the corresponding slave device is turned on and can interact with the master device via the I2C bus. For example, when a valid potential is transmitted on the I / O port, the slave device receiving the valid potential is turned on and communicates with the master device via the I2C bus based on the I2C communication protocol; when an invalid potential is transmitted on the I / O port, the slave device receiving the invalid potential is turned off and cannot communicate with the master device. Among them, the effective potential is different from the ineffective potential. For example, the effective potential is a high potential (or a low potential), and the corresponding ineffective potential is a low potential (or a high potential).

[0054] The technical solution of this invention provides communication logic for a communication system operating in both the I2C and I1C protocol modes. It also provides methods for using master and slave devices compatible with both protocols, enabling the master device to communicate with the slave device based on the corresponding communication protocol under different protocol modes, achieving coexistence of two communication protocols and effectively improving the compatibility of the communication system. Furthermore, by using master and slave devices compatible with both communication protocols to build the communication system, and by adding communication-related logic control methods within the device chip, it is unnecessary to develop and configure different versions of chips for different protocols, effectively reducing product development and system costs. Moreover, by switching protocol modes through software logic, the master and slave devices can adapt to different working environments and device requirements, improving the system's flexibility and adaptability.

[0055] Based on the above embodiments, there are alternatively multiple ways to configure the address of the device, which will be described below.

[0056] In one implementation, the slave device's address can optionally be fixed, with each slave device assigned a fixed address at the factory. It is understood that each slave device's address is unique, and different slave devices have different addresses, so that the master device can identify slave devices based on their addresses and avoid address conflicts.

[0057] In another implementation, optionally, the master device can dynamically allocate addresses to each slave device according to demand, so that the selection of physical addresses is no longer limited by physical wiring, thus improving the flexibility of address allocation. This will be explained in detail below.

[0058] For example, when the communication system is running in I2C protocol mode, before the master device and the slave device communicate, the method of being compatible with both one-line communication and I2C communication also includes: the master device configuring the address of each slave device through the IO port and the I2C bus.

[0059] Specifically, when the communication system operates in I2C protocol mode, the master device broadcasts address configuration commands to all connected slave devices via the I2C bus. Due to the chip select function of the I / O ports, the selected slave device (i.e., the slave device connected to the I / O port with the valid output voltage) can continuously listen for the master device's address configuration commands and respond when they appear. The address-related data in the address configuration command is stored in the slave device's built-in memory, serving as the communication address for subsequent slave devices. For example, the master device can select each slave device individually through each I / O port and configure an address for each slave device. It is understood that configuring different addresses for different slave devices ensures that each slave device has a unique address, avoiding address conflicts and thus enhancing the reliability and stability of the communication system.

[0060] The technical solution provided by this invention allows the master device to configure the addresses of each slave device via I / O ports and the I2C bus when the communication system needs to operate in I2C protocol mode. The master device broadcasts address configuration commands on the I2C bus, and utilizing the chip select function of the I / O ports, the selected slave device can continuously listen to and identify the configuration commands sent by the master device. Unselected slave devices do not receive commands broadcast on the I2C bus. Based on this, one-to-one address configuration of each slave device can be achieved, improving configuration efficiency and reducing communication latency between the master and slave devices. Simultaneously, the master device can dynamically allocate addresses according to scenario requirements; the selection of physical addresses is no longer limited by physical wiring, improving the flexibility of address allocation.

[0061] Optionally, the master device also includes a memory for storing address configuration and other related information. The master device is responsible for providing one-wire communication control and I2C bus communication clock synchronization and address configuration functions, as well as address conflict handling functions, enabling the master device to communicate with slave devices based on different communication protocols.

[0062] Figure 3 This is a schematic diagram illustrating a process for a master device to configure the address of a slave device according to an embodiment of the present invention. (Refer to...) Figure 3 Based on the above embodiments, optionally, the process of the master device configuring the address of any slave device to be configured includes:

[0063] S301. The master device controls the I / O port connected to the slave device to be configured to an effective potential, so that the slave device to be configured can interact with the master device through the I2C bus.

[0064] Specifically, since the I / O port has a chip select function, the master device selects the slave device by controlling the potential of the I / O port connected to the slave device. For example, when the potential of the I / O port connected to the slave device is at a valid potential, the slave device is selected as the slave device to be configured. The slave device to be configured will continuously listen for the configuration command from the master device and respond when the configuration command appears.

[0065] S302. The master device broadcasts the address configuration command of the slave device to be configured to all slave devices via the I2C bus.

[0066] Specifically, the master device broadcasts an address configuration command to all slave devices connected to the I2C bus via the I2C bus. Only the slave device selected via the valid potential of the I / O port (i.e., the slave device to be configured) can receive and respond to the address configuration command; other slave devices do not respond to the address configuration command.

[0067] S303. The slave device to be configured responds to the address configuration command, stores the corresponding configuration address according to the address configuration command, and sends an address configuration confirmation signal back to the master device through the I2C bus.

[0068] Specifically, the address configuration confirmation signal can be an address response frame, indicating that the slave device to be configured has detected the broadcast of the master device's address configuration command and has completed the address configuration. This configured address is stored in the slave device's internal memory as its subsequent communication address.

[0069] S304. When the master device receives the address configuration confirmation signal, it confirms that the address configuration of the slave device to be configured is complete.

[0070] Specifically, the master device receives the address response frame of the slave device to be configured via the I2C bus, confirming that the address configuration of the slave device to be configured is complete.

[0071] This embodiment illustrates the process of a master device configuring the address of a slave device to be configured through steps S301-S304. The address configuration process for each slave device by the master device can refer to the above steps. After the master device has completed the address configuration for each slave device, it can execute the I2C communication process. During the I2C communication process, each I / O port can maintain a valid potential so that each slave device can continuously receive relevant instructions and commands broadcast by the master device on the I2C bus.

[0072] Based on the above embodiments, optionally, during the process of the master device configuring the address of the slave device, situations such as address conflicts, configuration errors, or the slave device failing to respond normally may occur, preventing the master device from receiving the address configuration confirmation signal from the slave device. Therefore, when the master device does not receive the address configuration confirmation signal, it can again broadcast the address configuration command of the slave device to be configured to all slave devices via the I2C bus. The master device and the slave device can then repeat the above steps S302-S304 to complete the address configuration of the slave device.

[0073] Based on the above embodiments, optionally, for any slave device to be configured, after completing the address configuration process of S301-S304, i.e., after the master device receives the address configuration confirmation signal of the slave device, if it is necessary to change the configuration address of the slave device, the master device broadcasts the changed address configuration command of the slave device to be configured to all slave devices through the I2C bus, and executes the process of S302-S304 again based on the changed address configuration command to complete the address change of the slave device. For example, the reasons for needing to change the configuration address may be: the slave device to be configured has experienced a hardware or software failure, which may require changing its configuration address to solve the problem; or there may be address conflicts between devices, so to avoid conflicts and network chaos, the address of the device to be configured needs to be changed; or the system needs to expand or add new slave devices, so addresses are reallocated to ensure the uniqueness of all devices in the network. The function of the master device dynamically adjusting the address configuration of slave devices can ensure the normal operation, security, and maintainability of the system.

[0074] Based on the above embodiments, optionally, when the communication system switches from the One-Line Communication protocol mode to the I2C protocol mode, during the process of the master device configuring the addresses of each slave device, each slave device maintains the working state corresponding to the last working configuration instruction issued by the master device based on the One-Line Communication protocol before the protocol mode switch, so as to ensure the stability of the working state of the slave devices during the protocol mode switch. For example, the process of the master device configuring the addresses of each slave device may include: an initial address configuration process, and subsequent address configuration processes due to faults or address changes, etc.

[0075] Specifically, Figure 4 This invention provides a timing diagram of a master device executing an address configuration command in a communication system, according to an embodiment of the present invention. Figure 4 An example of a device-related timing sequence is given below. (See reference...) Figure 4During the switch from Singer WireCAN (SWC) protocol mode to I2C protocol mode, the I / O port is at a valid potential (exemplarily high) to ensure the slave device is selected and can receive signals from the I2C bus. Specifically, initially, the communication system operates in Singer WireCAN mode. The master device transmits communication commands to the slave device via the I / O port. For example, in Singer WireCAN mode, the last configuration command transmitted by the master device controls the slave device's configuration to configuration 3. When the communication system switches from Singer WireCAN mode to I2C mode, the master device configures an address for the slave device. The master device transmits the address configuration command via the I2C bus. The slave device parses the command and configures the address, storing it as, for example, address 4. During this address configuration process, the slave device's configuration remains at configuration 3. That is, during the switch between the two protocol modes, the slave device's operating mode is based on the working state corresponding to the last configuration command issued by the Singer WireCAN protocol. For example, the configuration command can be stored in the slave device's memory so that the slave device's processing chip can read and execute the command from memory during the protocol mode switch.

[0076] Furthermore, if the master device fails to receive a feedback confirmation signal from the slave device after configuring address 4, or if an address change is required, the master device resets the address to the slave device. Taking an address change as an example, the communication system can switch from I2C protocol mode to One-Line Protocol mode to prepare for the address reset. During this time, the slave device's operating configuration remains at configuration 3. During the reset process, the I / O port is at a valid potential to ensure the slave device is selected. The master device transmits the changed address configuration command via the I2C bus. The slave device parses the command and, after configuration, stores the configuration address as, for example, address 2. Throughout the address reset process, the slave device's operating configuration remains at configuration 3.

[0077] In summary, when the system needs to run in I2C protocol mode, its preprocessing, namely the various address configuration processes, ensures that the slave device's working configuration remains stable under the I2C protocol mode, and the address configuration process will not affect the slave device's working configuration, thus guaranteeing the stability of the system operation.

[0078] Based on the above embodiments, optionally, when the system switches from I2C protocol mode to One-Line protocol mode, the slave device can restore the last working configuration when it last ran One-Line protocol mode, which is beneficial to the stable operation of the system after the protocol mode switch.

[0079] Specifically, when the communication system switches from the One-Line Protocol mode to the I2C protocol mode, the slave device can store the last working configuration command issued by the master device in the One-Line Protocol mode. When the communication system switches back from the I2C protocol mode to the One-Line Protocol mode, the slave device executes the last working configuration command issued by the master device in the previous One-Line Protocol mode.

[0080] Figure 5 This is a timing diagram of a communication system during protocol mode switching, provided in an embodiment of the present invention. Figure 5 An example of a device-related timing sequence is given below. (See reference...) Figure 5 The system initially operates in One-Line Protocol mode. For example, in One-Line Protocol mode, the last working configuration command transmitted by the master device controls the slave device's working configuration to Configuration 7; the working configuration command corresponding to Configuration 7 is stored by the slave device. When the communication system switches to I2C protocol mode, after address configuration, during I2C communication, the master device transmits communication commands to the slave device via the I2C bus. These communication commands include, for example, parameter configuration commands and configuration protocol commands, all of which can be used to adjust the slave device's working configuration; in I2C protocol mode, the master device adjusts the slave device's working configuration to, for example, Configuration 5. When the system switches back from I2C protocol mode to One-Line Protocol mode, the slave device synchronously restores the last working configuration in the previous One-Line Protocol mode, i.e., Configuration 7.

[0081] The technical solution provided in this embodiment ensures that when the communication protocol of the communication system is switched, the working configuration of the slave device changes synchronously, thereby guaranteeing the stability of the slave device's working state and improving the stability and reliability of the communication system.

[0082] Based on the above embodiments, optionally, the communication system may run in the One-Line Communication Protocol mode by default when the master device is powered on. Figure 6 A flowchart of another method for compatible I2C communication and one-wire communication provided by an embodiment of the present invention is shown below. Figure 6 Methods compatible with both I2C and 1C communication include:

[0083] S601, the main device is powered on, and the communication system operates in the one-line communication protocol mode.

[0084] S602. Determine whether the communication system needs to switch to I2C communication mode; if yes, execute S603; if no, execute S604.

[0085] The master device can receive communication-related commands from users or other controllers to determine the protocol mode that the communication system needs to operate in.

[0086] S603. The master device selects the slave device and sends an address configuration command.

[0087] Specifically, this step includes: the master device configuring the addresses of each slave device via I / O ports and the I2C bus. After all slave devices receive the corresponding address configuration commands and provide confirmation, the master device communicates with each slave device via the I2C bus based on the I2C communication protocol.

[0088] S604. The master device communicates with the slave device connected to the IO port through the IO port based on the One-Line Communication Protocol.

[0089] Based on the above embodiments, optionally, in the I2C protocol mode, there are multiple ways for the master device to control whether the slave device is turned on. Several of them will be described below, but they are not intended to limit the present invention.

[0090] In one implementation, optionally, in I2C protocol mode, the master device controls the slave device connected to the I / O port to communicate with the master device by controlling the I / O port to be at an active potential; the master device controls the slave device connected to the I / O port to stop communicating with the master device by controlling the I / O port to be at an inactive potential.

[0091] Specifically, Figure 7 A communication timing diagram of a communication system provided in an embodiment of the present invention, with reference to... Figure 7 When the communication system operates in I2C protocol mode, the master device's I / O ports have communication functions and transmit communication commands. When the communication system operates in I2C protocol mode, the communication function is handled by the I2C bus-related structures; the master device's I / O ports no longer have communication functions, but can be configured with device switching functions. For example, the master device can control the I / O port to be active when it is high and inactive when it is low. Alternatively, the master device can control the I / O port to be inactive when it is high and active when it is low. In this embodiment, for example, when the communication system is in I2C protocol mode, a high potential on the I / O port is active, controlling communication between the slave device and the master device; a low potential on the I / O port is inactive, and the slave device is in an OFF state, ceasing communication with the master device. The technical solution provided in this embodiment, by setting the master device's I / O ports to have switching functions under the I2C protocol and communication functions under the I2C protocol, enables the communication system to adapt to different usage scenarios, enhancing the system's flexibility.

[0092] In another implementation, optionally, in I2C protocol mode, the master device sends power-on / off state related commands to the slave device via the I2C bus to control the power-on / off state of the slave device. Specifically, the power-on / off state related commands may include: a power-on command to control the slave device to receive power and thus turn on (ON), and / or a power-off command to control the slave device to lose power and thus stop. (Continue to refer to...) Figure 7 When the communication system is in I2C protocol mode and the I / O ports are at valid potentials, if the master device sends a power-down command to the slave device via the I2C bus, the slave device's device state switches to OFF (shutdown) upon the end of the power-down command. If the master device sends a power-on command to the slave device via the I2C bus, the slave device's device state switches to ON (power-on) upon the end of the power-on command. It can be understood that while the master device is sending commands to the slave device via the I2C bus, the slave device's device state remains the same as before the command was sent; after the command ends, the slave device's device state changes accordingly.

[0093] In another implementation, optionally, the system can be configured with both of the above-mentioned functions for controlling whether the slave device is turned on, so as to support the system to use I2C instructions and IO ports to control the slave device to turn on and off according to the usage scenario.

[0094] Figure 8 A flowchart illustrating another method for compatible I2C and 1-wire communication provided in this embodiment of the invention is shown below. Figure 8 For example, methods compatible with both 1-wire communication and I2C communication include:

[0095] S801, the communication system operates in the One-Line Communication Protocol mode.

[0096] When the main device is powered on, the communication system can be set to run in the One-Line Communication Protocol mode by default.

[0097] S802. Determine whether the communication system needs to switch to I2C protocol mode; if yes, execute S803; if no, execute S812.

[0098] This judgment step can be performed by the main device.

[0099] S803, Master device selects slave device and address.

[0100] Specifically, the master device selects the slave devices that can communicate with it by controlling the potential of the IO ports, and the master device determines the addresses that need to be configured for each slave device.

[0101] S804, Master device assembly address configuration command, and broadcast to each slave device.

[0102] Specifically, the master device broadcasts the address configuration command of the selected slave device to be configured to all slave devices via the I2C bus.

[0103] S805. Determine if the slave device responds; if yes, proceed to S806; if no, proceed to S808.

[0104] This judgment step can be performed by the main device.

[0105] S806. The master device confirms that the slave device has stored the configuration address.

[0106] The slave device responds to the address configuration command, stores the corresponding configuration address according to the address configuration command, and then sends an address configuration confirmation signal back to the master device via the I2C bus. When the master device receives the address configuration confirmation signal, it confirms that the slave device has stored the configuration address and completes the address configuration of the slave device.

[0107] S807. The master device determines whether to change the address of the slave device; if yes, then execute S808; if no, then execute S809.

[0108] S808, Master device reassembles address configuration command and broadcasts it to each slave device.

[0109] S809 and I2C communication are operational.

[0110] That is, the master device and the slave device communicate based on the I2C communication protocol.

[0111] S810. Determine whether the communication system needs to switch to the One-Line Communication protocol mode; if yes, execute S811; if no, execute S809.

[0112] This judgment step can be performed by the main device.

[0113] S811, Master device assembly and configuration command, sent to slave device.

[0114] The configuration command can be a command related to enabling the One-Line Communication Protocol. The master device can transmit the configuration command to the slave device through the I / O port.

[0115] S812, One-line communication operation.

[0116] That is, the master device and the slave device communicate based on the One-Line Communication Protocol.

[0117] Based on steps S801-S812, this embodiment provides a specific communication control process for the communication system, which can ensure that the communication system can switch smoothly in different protocol modes and improve the system's flexibility and adaptability.

[0118] This invention also provides a communication system, including: a master device and multiple slave devices; the master device and each slave device communicate using the method of compatible one-wire communication and I2C communication provided in any of the above embodiments, possessing the beneficial effects provided in any of the above embodiments. For example, Figure 9 This is a schematic diagram of another communication system provided in an embodiment of the present invention, with reference to... Figure 9 The master device 10 includes multiple I / O ports, each corresponding to a multiple slave device 20, and the master device 10 connects to each slave device 20 via an I2C bus. The I2C bus may specifically include a serial data line SDA and a serial clock line SCL.

[0119] Continue to refer to Figure 9 Based on the above embodiments, optionally, the communication system may also include other functional devices 30 originally configured only with I2C communication function, connected to the I2C bus. The master device 10 can also control the working status of the other functional devices 30 normally via the I2C bus, based on the I2C communication protocol. It is understood that the addresses of the other functional devices 30 are different from the addresses of the slave devices 20, so that the master device 10 can identify different devices.

[0120] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.

[0121] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method compatible with both One-Wire Communication and I2C Communication, characterized in that, The communication system includes a master device and multiple slave devices; the master device includes multiple I / O ports, which are respectively connected to each of the slave devices, and the master device is connected to each of the slave devices via an I2C bus; The method for compatibility between I2C and 1-line communication includes: If the communication system operates in the One-Line Communication Protocol mode, the master device communicates with the slave device connected to the IO port through the IO port based on the One-Line Communication Protocol. If the communication system operates in I2C protocol mode, the master device can select the slave device that can communicate with the master device by controlling the potential of the IO port, and the master device communicates with the slave device through the I2C bus based on the I2C communication protocol; When the communication system operates in the I2C protocol mode, before the master device and the slave device communicate, the system further includes: The master device configures the addresses of each slave device through the IO port and the I2C bus; The process by which the master device configures the address of any slave device to be configured includes: The master device controls the I / O port connected to the slave device to be configured to an effective potential, so that the slave device to be configured can interact with the master device through the I2C bus. The master device broadcasts the address configuration command of the slave device to be configured to all the slave devices through the I2C bus; The slave device to be configured responds to the address configuration command, stores the corresponding configuration address according to the address configuration command, and sends an address configuration confirmation signal back to the master device through the I2C bus; When the master device receives the address configuration confirmation signal, it confirms that the address configuration of the slave device to be configured is complete; wherein, the address configuration confirmation signal is an address response frame, used to indicate that the slave device to be configured has detected the broadcast of the address configuration command from the master device and has completed the address configuration.

2. The method for compatible I2C and 1C communication according to claim 1, characterized in that, Also includes: If the master device does not receive the address configuration confirmation signal, the master device will again broadcast the address configuration command of the slave device to be configured to all the slave devices via the I2C bus.

3. The method for compatible I2C and 1C communication according to claim 1, characterized in that, After the master device receives the address configuration confirmation signal, the process further includes: If it is necessary to change the configuration address of the slave device to be configured, the master device broadcasts the changed address configuration command of the slave device to be configured to all slave devices through the I2C bus.

4. The method for compatible I2C and 1C communication according to claim 1, characterized in that, Also includes: When the communication system switches from the One-Line Communication Protocol mode to the I2C protocol mode, during the process of the master device configuring the addresses of each of the slave devices, each of the slave devices maintains the working state corresponding to the last working configuration instruction issued by the master device based on the One-Line Communication Protocol before the protocol mode switch.

5. The method for compatible I2C and 1C communication according to claim 1, characterized in that, The communication system operates in the one-line communication protocol mode when the main device is powered on; The method for compatibility with both I2C and 1-line communication further includes: After the main device is powered on, it is determined whether the communication system needs to switch to the I2C communication mode; If so, the master device selects a slave device that can communicate with the master device by controlling the potential of the IO port, and the master device communicates with the slave device through the I2C bus based on the I2C communication protocol; If not, the master device communicates with the slave device connected to the IO port via the IO port based on the One-Line Communication Protocol.

6. The method for compatible one-wire communication and I2C communication according to any one of claims 1-5, characterized in that, Also includes: When the communication system switches from the One-Line Protocol mode to the I2C protocol mode, the slave device stores the last working configuration command issued by the master device in the One-Line Protocol mode; When the communication system switches from the I2C protocol mode to the One-Line Protocol mode, the slave device runs the last working configuration command issued by the master device in the previous One-Line Protocol mode.

7. The method for compatible I2C and 1C communication according to claim 1, characterized in that, Also includes: In the I2C protocol mode, the master device controls the slave device connected to the I / O port to communicate with the master device by controlling the I / O port to be at an active potential; The master device controls the slave device connected to the IO port to stop communicating with the master device by controlling the IO port to an invalid potential; And / or, In the I2C protocol mode, the instructions sent by the master device to the slave device through the I2C bus include: power-on instructions and / or power-off instructions.

8. A communication system, characterized in that, include: A master device and multiple slave devices; the master device includes multiple I / O ports, each corresponding to one of the multiple slave devices, and the master device is connected to each of the slave devices via an I2C bus; The master device and each of the slave devices communicate using the method of compatible one-line communication and I2C communication as described in any one of claims 1-7.

Citation Information

Patent Citations

  • System and method for operating a one-wire protocol slave in a two-wire protocol bus environment

    US20130019039A1