Device for connecting multiple pieces of I2C equipment with same address in embedded system

By combining an MCU module with a multiplexer in an embedded system, a stable, flexible, and efficient connection of multiple I2C devices with the same address is achieved, solving the problems of limited hardware resources and instability of software-simulated I2C, and improving the stability and efficiency of the system.

CN223513536UActive Publication Date: 2025-11-04SUZHOU MAICUI SEMICONDUCTOR EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202423056202.6
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-11-04
Estimated Expiration
2034-12-11

AI Technical Summary

Technical Problem

In embedded systems, traditional methods struggle to reliably connect multiple I2C devices with the same address, especially due to hardware resource limitations and the instability and inefficiency of software-simulated I2C, leading to communication errors and system performance degradation.

Method used

By combining an MCU module with a multiplexer (such as a digital demultiplexer or a bidirectional multiplexer), and by connecting the SDA line of the I2C devices in parallel and selectively connecting the SCL line, stable communication between multiple I2C devices with the same address can be achieved using a small number of I/O ports.

Benefits of technology

It improves the stability and reliability of data transmission, reduces hardware requirements, enhances system flexibility and efficiency, and is suitable for embedded systems with limited resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN223513536U_ABST
    Figure CN223513536U_ABST
Patent Text Reader

Abstract

The utility model relates to a device for connecting a plurality of I2C devices with the same address in an embedded system, which is characterized in that a plurality of I2C devices are connected in parallel and are connected to an SDA pin of an MCU module through a pull-up resistor, SCL lines of the plurality of I2C devices are respectively connected to an input port of a multiplexer, and an output port of the multiplexer is connected to an SCL pin of the MCU module; and a plurality of IO ports of the MCU module are connected to a selection control end of the multiplexer. The design scheme provided by the utility model has high flexibility, and can be connected with different numbers and types of I2C devices according to actual requirements. Through reasonable configuration and programming, the functions of the system can be easily expanded, and the requirements of different application scenes are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This utility model relates to the field of embedded systems, and in particular to a device for connecting multiple I2C devices with the same address in an embedded system. Background Technology

[0002] In today's embedded system applications, MCUs (Microcontroller Units) are widely used as core controllers. However, in practical applications, the hardware I2C resources of MCUs are often limited. When a system needs to connect to multiple I2C devices with the same address, traditional solutions have many shortcomings. On the one hand, relying on multiple MCU I2C modules not only increases system cost and complexity, but also fails to meet this requirement in many practical applications due to space and power consumption constraints. On the other hand, while software-simulated I2C can solve the problem of connecting multiple devices to some extent, its stability and reliability are difficult to guarantee.

[0003] Software-simulated I2C has the following main shortcomings:

[0004] 1. Inaccurate Timing: Software-simulated I2C uses software to control GPIO (General Purpose Input / Output) ports to simulate I2C communication timing. Because software execution takes time and is subject to interference from other tasks in the system, it's difficult to guarantee that the simulated I2C timing perfectly conforms to the standard. For example, when generating the SCL clock signal, the software may not be able to precisely control the high and low levels of the clock, resulting in an unstable clock cycle. This can cause connected I2C devices to fail to correctly recognize the communication signals, leading to communication errors.

[0005] 2. Susceptible to Interference: In embedded systems, the execution of software-simulated I2C depends on the CPU. If other high-priority tasks are running simultaneously, these tasks may interrupt the execution of the software-simulated I2C, leading to communication interruptions or data errors. Furthermore, other hardware devices in the system may also generate electromagnetic interference, affecting the signal quality of the software-simulated I2C.

[0006] 3. Low efficiency: Software-simulated I2C requires constant monitoring of GPIO port status and data read / write operations, which is significantly less efficient than hardware I2C modules. In applications requiring frequent I2C communication, software-simulated I2C consumes substantial CPU resources, impacting overall system performance.

[0007] 4. Lack of hardware support: Hardware I2C modules typically have interrupt functionality, data buffering, and other hardware support, which can improve communication efficiency and reliability. Software-simulated I2C lacks this hardware support, requiring software developers to implement various functions themselves, increasing the difficulty and complexity of development.

[0008] In view of the above-mentioned shortcomings, the designer actively researched and innovated in order to create a device that connects multiple I2C devices with the same address in an embedded system, making it more valuable for industrial use. Utility Model Content

[0009] To solve the above-mentioned technical problems, the purpose of this utility model is to provide a device for connecting multiple I2C devices with the same address in an embedded system.

[0010] To achieve the above objectives, the present invention adopts the following technical solution:

[0011] An apparatus for connecting multiple I2C devices with the same address in an embedded system includes an MCU module and several I2C devices;

[0012] Several I2C devices are connected in parallel and connected to the SDA pin of the MCU module through a pull-up resistor. The SCL lines of the several I2C devices are connected to the input port of a multiplexer, and the output port of the multiplexer is connected to the SCL pin of the MCU module.

[0013] Several I / O ports of the MCU module are connected to the selection control terminal of the multiplexer.

[0014] As a further improvement of this utility model, the three IO ports of the MCU module are connected to the selection control terminal of the multiplexer through a decoder. By setting the level state of these three IO ports, the SCL pin of the MCU module can be selected to be connected to the SCL line of different I2C devices.

[0015] As a further improvement of this utility model, the two I / O ports of the MCU module are directly connected to the selection control terminal of the multiplexer. By setting the level state of these two I / O ports, different I2C devices can be selected for communication.

[0016] As a further improvement of this utility model, the multiplexer is a digital demultiplexer.

[0017] As a further improvement of this utility model, the multiplexer is a bidirectional multiplexer.

[0018] By means of the above solution, this utility model has at least the following advantages:

[0019] 1. Enhanced Stability: Using a hardware I2C module significantly improves the stability and reliability of data transmission. Compared to software-simulated I2C, the hardware I2C module is unaffected by other system tasks, ensuring accurate and timely data transmission. This reduces the possibility of data transmission errors and system failures caused by software instability, thereby improving the overall stability and reliability of the embedded system.

[0020] 2. Reduced Hardware Requirements: Utilizing only a small number of I / O operations reduces the system's hardware requirements. In embedded systems with limited hardware resources, this saves valuable I / O resources, reducing system cost and complexity. Simultaneously, this design makes the system more compact and concise, facilitating its application in miniaturized, low-power embedded devices.

[0021] 3. Enhanced Flexibility: The design of this utility model offers high flexibility, allowing for the connection of varying numbers and types of I2C devices according to actual needs. Through proper configuration and programming, the system's functionality can be easily expanded to meet the requirements of different application scenarios.

[0022] The above description is only an overview of the technical solution of this utility model. In order to better understand the technical means of this utility model and to implement it in accordance with the contents of the specification, the preferred embodiments of this utility model are described in detail below with reference to the accompanying drawings. Attached Figure Description

[0023] To more clearly illustrate the technical solutions of the embodiments of this utility model, the drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this utility model and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the first embodiment of the present invention.

[0025] The meanings of the labels in the figures are as follows.

[0026] MCU module 1, I2C device 2, multiplexer 3. Detailed Implementation

[0027] The specific embodiments of this utility model will be further described in detail below with reference to the accompanying drawings and examples. The following examples are used to illustrate this utility model, but are not intended to limit the scope of this utility model.

[0028] 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 a part of the embodiments of the present invention, and not all of them. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0029] Example

[0030] like Figure 1 As shown,

[0031] An apparatus for connecting multiple I2C devices with the same address in an embedded system includes an MCU module 1 and several I2C devices 2.

[0032] Several I2C devices 2 are connected in parallel and connected to the SDA pin of MCU module 1 through a pull-up resistor. The SCL lines of several I2C devices 2 are respectively connected to the input port of a multiplexer 3. The output port of multiplexer 3 is connected to the SCL pin of MCU module 1. Several IO ports of MCU module 1 are connected to the selection control terminal of multiplexer 3.

[0033] The three I / O ports of MCU module 1 are connected to the selection control terminal of multiplexer 3 through a decoder. By setting the level state of these three I / O ports, the SCL pin of MCU module 1 can be selected to be connected to the SCL line of different I2C devices 2.

[0034] The two I / O ports of MCU module 1 are directly connected to the selection control terminal of multiplexer 3. By setting the level state of these two I / O ports, different I2C devices 2 can be selected for communication.

[0035] Among them, multiplexer 3 is a digital demultiplexer or a bidirectional multiplexer.

[0036] The purpose of this invention is to provide an innovative method and apparatus that can efficiently and stably connect multiple I2C devices with the same address to the same I2C bus using a single MCU, thus solving the problems of limited resources and insufficient stability in the prior art.

[0037] This invention employs a unique design scheme, enabling the connection of multiple I2C devices with the same address using only an I2C module within a single MCU module and a small number of I / O (input / output ports). The specific implementation is as follows:

[0038] SDA Connection Method: The SDA (serial data line) of multiple I2C devices are connected in parallel, and then connected to the SDA pin of the I2C module (hereinafter referred to as the MCU module) through carefully selected appropriate pull-up resistors. This connection method ensures that multiple devices can share the same data line during data transmission, and the pull-up resistors ensure that the SDA line is in a stable high-level state in the idle state.

[0039] SCL Connection Method: The SCL (Serial Clock Line) of multiple I2C devices is connected to a digital demultiplexer or bidirectional multiplexer respectively. A digital demultiplexer or bidirectional multiplexer is an electronic component capable of distributing input signals to multiple output channels or switching between different input channels according to control signals. In this invention, the function of the digital demultiplexer or bidirectional multiplexer is to select and connect the SCL line of a specific I2C device to the SCL pin of the MCU module according to the IO control signals of the MCU module, thereby enabling independent operation of different devices.

[0040] Logical mapping: This involves the logical design of the mapping between I / O and specific I2C devices. For example, binary encoding can be used to map different I / O state combinations to different I2C devices. Suppose three I / O ports are used to control an eight-channel digital demultiplexer or bidirectional multiplexer; then the eight different level combinations of these three I / O ports can be mapped to eight different I2C devices. Through proper programming and configuration, it can be ensured that the MCU module can accurately identify and select the specific I2C device to operate during operation.

[0041] Operation Procedure: When operating a specific I2C device, firstly, switch the SCL of the MCU module to the corresponding device's SCL by configuring the MCU module's I / O port. Then, perform normal read and write operations using the MCU module's I2C module. This procedure ensures both accuracy and system efficiency.

[0042] Example 1:

[0043] In an industrial automation control system, multiple pressure sensors of the same model need to be connected to an MCU module. Using the method described in this invention, the SDA lines of these sensors are connected in parallel and then connected to the SDA pin of the MCU module through a 10KΩ pull-up resistor. The SCL lines of the sensors are connected to a four-channel digital demultiplexer or bidirectional multiplexer, and the output of the digital demultiplexer or bidirectional multiplexer is connected to the SCL pin of the MCU module. Two I / O ports of the MCU module are directly connected to the selection control terminals of the digital demultiplexer or bidirectional multiplexer. By setting the level states of these two I / O ports, communication with different pressure sensors can be selected.

[0044] In industrial production processes, the MCU module can read data from various pressure sensors as needed to monitor and adjust the production process in real time. For example, as shown in Table 1, setting the level of two I / O ports to 00 indicates selecting the first sensor; 01 indicates selecting the second sensor; 10 indicates selecting the third sensor; and 11 indicates selecting the fourth sensor. This connection method not only improves the stability and reliability of the system but also reduces hardware costs and complexity, providing a strong guarantee for the efficient operation of industrial automation control systems.

[0045] Table 1

[0046] Device Select(SEL0: SEL1) Device 00 Device 1 01 Device 2 10 Device 3 11 Device 4

[0047] Example 2:

[0048] In a smart home control system, there are multiple temperature and humidity sensors, all using the same I2C address. To achieve accurate monitoring and control of these sensors, the method described in this invention is used for connection. First, the SDA lines of each sensor are connected in parallel and then connected to the SDA pin of the MCU module through a 4.7KΩ pull-up resistor. Then, the SCL lines of each sensor are connected to the input port of an eight-channel digital demultiplexer or bidirectional multiplexer, and the output port of the digital demultiplexer or bidirectional multiplexer is connected to the SCL pin of the MCU module. The three I / O ports of the MCU module are connected to the selection control terminal of the digital demultiplexer or bidirectional multiplexer through a decoder. By setting the level states of these three I / O ports, the SCL of the MCU module can be selectively connected to the SCL lines of different sensors.

[0049] During system operation, when data from a specific sensor needs to be read, the MCU module sets the corresponding I / O port levels according to a pre-defined logical correspondence, selecting the SCL line of the corresponding sensor. For example, setting the level of the three I / O ports to 001 indicates selecting the first sensor; setting it to 010 indicates selecting the second sensor, and so on. Then, the MCU module performs the data reading operation. In this way, data from various sensors can be acquired efficiently and accurately, enabling real-time monitoring and control of the home environment.

[0050] Note: Explanation of some terms used in this article:

[0051] MCU (Microcontroller Unit): A microcontroller unit is a chip that reduces the frequency and specifications of a central processing unit (CPU) and integrates peripheral interfaces such as memory, timer, USB, A / D conversion, UART, PLC, DMA, and even LCD driver circuits onto a single chip, forming a chip-level computer that can perform different combinations of control for different applications.

[0052] I2C (Inter-Integrated Circuit): A two-wire serial bus used to connect microcontrollers and their peripherals. It was developed by Philips in the 1980s to allow motherboards, embedded systems, or mobile phones to connect low-speed peripherals.

[0053] SDA (Serial Data Line): The serial data line in the I2C bus, used to transfer data between master and slave devices.

[0054] SCL (Serial Clock Line): The serial clock line in the I2C bus, used for synchronizing data transmission.

[0055] GPIO (General Purpose Input / Output): A general purpose input / output port, which is a pin whose input / output state can be controlled by software.

[0056] Multiplexer: A multiplexer is an electronic component that can select one of multiple input signals and output it based on a control signal.

[0057] Digital demultiplexer: A digital demultiplexer is an electronic component that can distribute an input signal to multiple output channels according to a control signal.

[0058] Bi-directional multiplexer: A bidirectional multiplexer is an electronic component that can switch between different input channels and supports bidirectional data transmission.

[0059] In the description of this utility model, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing this utility model and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this utility model. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this utility model, unless otherwise stated, "a plurality of" means two or more.

[0060] In the description of this utility model, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this utility model based on the specific circumstances.

[0061] The above description is only a preferred embodiment of the present utility model and is not intended to limit the present utility model. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present utility model, and these improvements and modifications should also be considered within the protection scope of the present utility model.

Claims

1. A device for connecting multiple I2C devices with the same address in an embedded system, comprising an MCU module (1) and a plurality of I2C devices (2); Its features are: A number of I2C devices (2) are connected in parallel and connected to the SDA pin of the MCU module (1) through a pull-up resistor. The SCL lines of the number of I2C devices (2) are respectively connected to the input port of a multiplexer (3). The output port of the multiplexer (3) is connected to the SCL pin of the MCU module (1). Several I / O ports of the MCU module (1) are connected to the selection control terminal of the multiplexer (3).

2. The apparatus for connecting multiple I2C devices with the same address in an embedded system as described in claim 1, characterized in that, The three IO ports of the MCU module (1) are connected to the selection control terminal of the multiplexer (3) through a decoder. By setting the level state of these three IO ports, the SCL pin of the MCU module (1) can be selected to be connected to the SCL line of different I2C devices (2).

3. The apparatus for connecting multiple I2C devices with the same address in an embedded system as described in claim 1, characterized in that, The two IO ports of the MCU module (1) are directly connected to the selection control terminal of the multiplexer (3). By setting the level state of these two IO ports, different I2C devices (2) can be selected for communication.

4. The apparatus for connecting multiple I2C devices with the same address in an embedded system as described in claim 1, characterized in that, The multiplexer (3) is a digital demultiplexer.

5. The apparatus for connecting multiple I2C devices with the same address in an embedded system as described in claim 1, characterized in that, The multiplexer (3) is a bidirectional multiplexer.