Low-pin I2C serial transmission method and low-pin I2C transmission system using same
By coupling the interrupt requirement pin of multiple I2C serial transmission slave devices to the same interrupt input pin of the I2C serial transmission master device and outputting different voltages during interruption, the problem of additional hardware pin requirements and interrupt conflicts in the existing I2C serial transmission protocol is solved, and more efficient interrupt processing is achieved.
Patent Information
- Application Number
- CN202311715078.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-27
- Filing Date
- 2023-12-13
- Publication Date
- 2025-04-29
AI Technical Summary
The existing I2C serial transmission protocol requires additional hardware pins during interrupt processing, and interrupt collisions are prone to occur when multiple slave devices send interrupts simultaneously.
The interrupt source is determined by coupling the interrupt requirement pin of multiple I2C serial transmission slave devices to the same interrupt input pin of the I2C serial transmission master device and outputting different voltages during interruption.
It reduces the hardware pin requirement of the I2C serial transmission master device, avoids interrupt conflicts, and improves the efficiency of interrupt processing.
Smart Images

Figure CN119903009A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an I2C transmission technology, and in particular to a low-pin I2C serial transmission method and a low-pin I2C transmission system using the same. Background Art
[0002] I2C (Inter-Integrated Circuit) is a serial communication protocol used to connect different digital electronic components, such as microcontrollers, sensors, displays, etc., to achieve data exchange. The I2C protocol was developed by Philips (now NXP) in 1982. Its main feature is that it uses two lines (a data line SDA and a frequency line SCL) for communication and supports multiple slave devices connected to the same set of lines.
[0003] Figure 1 The diagram is a schematic diagram of the I2C transmission method of the prior art. Figure 1 ,exist Figure 1 In FIG. 1 , an I2C serial transmission master controller 101 and multiple I2C serial transmission slave devices 102 are shown. The basic operation mode of the I2C communication protocol is that the I2C serial transmission master controller 101 initiates communication and selects the I2C serial transmission slave device 102 to be transmitted with it. The I2C serial transmission master controller 101 generates a frequency signal to control the rhythm of data transmission. The data transmission is carried out in the form of a bit string. The I2C serial transmission slave device 102 reads or transmits data under the trigger of the frequency. The end of communication is indicated by the master controller generating a stop condition to indicate the end of transmission.
[0004] When the I2C serial transmission slave device 102 wants to send an interrupt to the I2C serial transmission master controller 101, it needs to use a specific pin, usually called an "interrupt input pin", to notify the I2C serial transmission master controller 101. However, such a design has the following disadvantages:
[0005] 1. Additional hardware pin requirements: The I2C serial transmission master controller 101 requires additional hardware pin support, which may cause inconvenience for some applications with limited pins.
[0006] 2. Interrupt conflict: When multiple slave devices need to send interrupts, interrupt conflicts may occur, and additional logic processing is required to manage the priority of these interrupts. Summary of the invention
[0007] The present invention provides a low-pin I2C serial transmission method and a low-pin I2C transmission system using the same, which are used to change the interrupt design between an I2C serial transmission master device and an I2C serial transmission slave device, so that the I2C serial transmission master device only needs one interrupt input pin to connect multiple I2C serial transmission slave devices.
[0008] An embodiment of the present invention provides a low pin I2C transmission system, which includes an I2C serial transmission data flat cable, a plurality of I2C serial transmission slave devices and an I2C serial transmission master device. The I2C serial transmission data flat cable includes an I2C serial transmission data line and an I2C serial transmission clock line. Each of the I2C serial transmission slave devices includes an I2C serial transmission data pin, an I2C serial transmission clock pin and an interrupt request pin, wherein the I2C serial transmission data pin of each of the I2C serial transmission slave devices is coupled to the I2C serial transmission data line of the I2C serial transmission data flat cable, and the I2C serial transmission clock pin of each of the I2C serial transmission slave devices is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable. An I2C serial transmission master device includes an I2C serial transmission data pin, an I2C serial transmission clock pin and an interrupt input pin, wherein the I2C serial transmission data pin of the I2C serial transmission master device is coupled to the I2C serial transmission data line of the I2C serial transmission data flat cable, and the I2C serial transmission clock pin of the I2C serial transmission master device is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable, wherein the interrupt request pin of each of the I2C serial transmission slave devices is coupled to the interrupt input pin of the I2C serial transmission master device, wherein each of the interrupt request pins of the I2C serial transmission slave devices outputs different voltages when making an interrupt request, wherein the I2C serial transmission master device determines whether each of the I2C serial transmission slave devices makes an interrupt request according to the voltage size received by the interrupt input pin of the I2C serial transmission master device.
[0009] According to the low pin I2C transmission system described in the preferred embodiment of the present invention, it further includes a first pull-up resistor, the first end of the first pull-up resistor is coupled to a power supply voltage, and the second end of the first pull-up resistor is coupled to the I2C serial transmission data line of the I2C serial transmission data flat cable. In another preferred embodiment, the low pin I2C transmission system further includes a second pull-up resistor, the first end of the second pull-up resistor is coupled to a power supply voltage, and the second end of the second pull-up resistor is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable. In another preferred embodiment, when each of the I2C serial transmission slave devices does not make an interrupt request, the interrupt request pin of each of the I2C serial transmission slave devices is in a high impedance state. In another preferred embodiment, the interrupt input pin of the I2C serial transmission master device is an analog-to-digital conversion input channel pin.
[0010] An embodiment of the present invention provides a method for low-pin I2C serial transmission, which includes: providing a plurality of I2C serial transmission slave devices; providing an I2C serial transmission master device, wherein the I2C serial transmission slave devices and the I2C serial transmission master device are electrically connected to an I2C serial transmission flat cable; coupling an interrupt request pin of each of the I2C serial transmission slave devices to an interrupt input pin of the I2C serial transmission master device; when a specific I2C serial transmission slave device among each of the I2C serial transmission slave devices makes an interrupt request, the interrupt request pin of the specific I2C serial transmission slave device outputs a voltage corresponding to the specification of the specific I2C serial transmission slave device; and judging whether each of the I2C serial transmission slave devices makes an interrupt request according to the voltage of the interrupt input pin of the I2C serial transmission master device.
[0011] In summary, the embodiment of the present invention allows the interrupt request pins of multiple I2C serial transmission slave devices to be coupled to the same interrupt input pin of the I2C serial transmission master device, and each interrupt request pin of the I2C serial transmission slave device outputs a different voltage when requesting an interrupt. Therefore, the I2C serial transmission master device can determine which I2C serial transmission slave device sends the interrupt request based on the voltage received by the interrupt input pin. Furthermore, in another preferred embodiment, if multiple devices send interrupt requests at the same time, the I2C serial transmission master device first processes the interrupt of the I2C serial transmission slave device with a lower interrupt request voltage.
[0012] In order to further understand the technology, means and effects of the present invention, reference may be made to the following detailed description and accompanying drawings, so that the purpose, features and concepts of the present invention can be thoroughly and specifically understood. However, the following detailed description and accompanying drawings are only used for reference and explanation of the implementation of the present invention, and are not intended to limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are provided to enable those with ordinary knowledge in the technical field to which the present invention belongs to further understand the present invention, and are incorporated into and constitute a part of the specification of the present invention. The accompanying drawings illustrate exemplary embodiments of the present invention, and together with the description of the present invention, are used to explain the principles of the present invention.
[0014] Figure 1 FIG. 4 is a schematic diagram of an I2C transmission method in the prior art.
[0015] Figure 2 FIG. 4 is a system block diagram of a low-pin I2C transmission system according to a preferred embodiment of the present invention.
[0016] Figure 3 FIG. 4 is a flow chart of a method for low-pin I2C serial transmission according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0017] Reference will now be made in detail to exemplary embodiments of the present invention, which are illustrated in the accompanying drawings. Where possible, the same component symbols are used in the drawings and the specification to refer to the same or similar components. In addition, the exemplary embodiments are only one of the implementation methods of the design concept of the present invention, and the following examples are not intended to limit the present invention.
[0018] Figure 2 FIG. 1 is a block diagram of a low pin I2C transmission system according to a preferred embodiment of the present invention. Figure 2, this low pin I2C transmission system includes an I2C serial transmission master device 201, multiple I2C serial transmission slave devices 202, and an I2C serial transmission data flat cable, the I2C serial transmission data flat cable includes an I2C serial transmission data line SDA and an I2C serial transmission clock line SCK. The I2C serial transmission data pin of each I2C serial transmission slave device 202 and the I2C serial transmission master device 201 is coupled to the I2C serial transmission data line SDA, and the I2C serial transmission clock pin of each I2C serial transmission slave device 202 and the I2C serial transmission master device 201 is coupled to the I2C serial transmission clock line SCK. In addition, in this embodiment, each I2C serial transmission slave device 202 has an interrupt request pin IRQ. More specifically, the interrupt request pin IRQ of each of the above-mentioned I2C serial transmission slave devices 202 is coupled to the same interrupt input pin IRI of the I2C serial transmission master device 201. In addition, in this embodiment, the I2C serial transmission data line SDA and the I2C serial transmission clock line SCK are respectively coupled to the first resistor R1 and the second resistor R2 as pull-up resistors for pulling the I2C serial transmission data line SDA and the I2C serial transmission clock line SCK to the power supply voltage VDD.
[0019] When performing general transmission, the transmission is initiated by the I2C serial transmission master device 201, and according to the I2C format, data is output or requested to the designated I2C serial transmission slave device 202. In addition, in this embodiment, the interrupt request pin IRQ of each I2C serial transmission slave device 202 is coupled to the same interrupt input pin IRI of the I2C serial transmission master device 201. In the prior art, the interrupt request pin IRQ of each I2C serial transmission slave device 202 is coupled to a different pin of the I2C serial transmission master device 201, which is generally a general-purpose input / output (GPIO) pin. The reason is that in the prior art, the interrupt requests sent from the I2C serial transmission slave device 202 are all logic low voltages. If the interrupt request pins IRQ of multiple I2C serial transmission slave devices 202 are coupled to the same pin of the I2C serial transmission master device 201, it is impossible to determine which I2C serial transmission slave device 202 issued the interrupt request, so an interrupt conflict will occur.
[0020] However, in this embodiment, the interrupt request pin IRQ of each I2C serial transmission slave device 202 is coupled to the same interrupt input pin IRI of the I2C serial transmission master device 201. And the interrupt request pin IRQ of each I2C serial transmission slave device 202 will output a different voltage when making an interrupt request. The interrupt input pin IRI of the I2C serial transmission master device 201 has a circuit that can distinguish voltage, such as an analog-to-digital converter (ADC).
[0021] Most microprocessors (MCUs) in the I2C serial transmission master device 201 have built-in analog-to-digital converters to convert the analog voltage on the analog-to-digital conversion input channel pin (ADC input channel pin) into digital values. For example, a 12-bit SAR-ADC usually has an accuracy of about 10 bits. To avoid misjudgment, this 10-bit accuracy is further divided into 2 7 =128 intervals. For example, the reference voltage of the analog-to-digital converter is 3.3V, which is divided into 128 intervals, and the range of each interval is approximately equal to 3.3V / 128=25.78mV. Assuming that the input analog-to-digital converter voltage can fall approximately in the middle of each interval, the microprocessor in the I2C serial transmission master device 201 can easily identify the conversion values of the analog-to-digital converter in different intervals.
[0022] Furthermore, it is assumed that each I2C serial transmission slave device 202 has a pin that can enable or disable the output voltage control, and can output a fixed and unique voltage (the output voltage value of each I2C serial transmission slave device 202 is different, but all fall roughly in the middle of each interval described in the previous paragraph, for example: 25.78mV / 2*(2N+1), N=0,1,2,…,127, that is, 12.89mV, 38.67mV, 64.45mV,…,3.287V). Generally, if the I2C serial transmission slave device 202 does not detect any changes (such as hand touch, change of direction axis or acceleration / deceleration) and needs the I2C serial transmission master device 201 to read data, the interrupt request pin IRQ outputs a floating voltage (floating, or high impedance). On the contrary, if the I2C serial transmission slave device 202 detects any abnormality, the interrupt request pin IRQ can output a fixed and unique voltage corresponding to the I2C serial transmission slave device 202 as a specific interrupt request to the I2C serial transmission master device 201 to notify the I2C serial transmission master device 201 to access the I2C serial transmission slave device 202.
[0023] Therefore, if Figure 2 As shown, it is only necessary to utilize an analog-to-digital conversion input channel pin (ADC input channel pin) of the microprocessor in the I2C serial transmission master device 201 to couple the output voltage pins of each I2C serial transmission slave device 202 to the same interrupt input pin IRI of the I2C serial transmission master device 201. When the I2C serial transmission master device 201 finds that the analog-to-digital conversion value corresponds to the fixed voltage value output by a certain I2C serial transmission slave device 202, the I2C serial transmission master device 201 can send I2C signals (SCL and SDA) to read data from the I2C serial transmission slave device 202. After the data of the I2C serial transmission slave device 202 is read, the I2C serial transmission slave device 202 disables the voltage output on the interrupt request pin IRQ and restores to the normal floating voltage output state.
[0024] In another preferred embodiment, if multiple I2C serial transmission slave devices 202 send voltages from the interrupt request pin IRQ during the same period, at this time, since the low voltage interrupt will be pulled up by the voltage of the high voltage interrupt, the interrupt input pin IRI of the I2C serial transmission master device 201 will receive the voltage of the I2C serial transmission slave device 202 that outputs the highest voltage. Therefore, the I2C serial transmission master device 201 will first perform the interrupt access processing corresponding to the I2C serial transmission slave device 202 with the highest voltage, and then perform the interrupt access processing of the I2C serial transmission slave device 202 in order from the largest voltage to the smallest voltage. In this way, the interrupt conflict in the prior art is also resolved.
[0025] From the above embodiments, it can be seen that, by means of the interrupt operation mechanism of the above embodiments, the I2C serial transmission master device 201 does not need to have multiple general-purpose input / output (GPIO) pins or interrupt input pins to receive the interrupt requests sent by each I2C serial transmission slave device 202, so as to save the number of general-purpose input / output (GPIO) pins or interrupt input pins of the I2C serial transmission master device 201.
[0026] According to the preferred embodiment of the low pin number I2C transmission system described above, it can be summarized into a low pin number I2C serial transmission method. Figure 3 The flowchart of the method of low pin I2C serial transmission according to a preferred embodiment of the present invention is shown. Figure 3 , the low pin I2C serial transmission method includes the following steps:
[0027] Step S301: Start.
[0028] Step S302: providing a plurality of I2C serial transmission slave devices.
[0029] Step S303: Provide an I2C serial transmission master device, wherein the I2C serial transmission slave device and the I2C serial transmission master device are electrically connected to an I2C serial transmission flat cable, and each of the I2C serial transmission slave devices has an interrupt request pin coupled to an interrupt input pin of the I2C serial transmission master device.
[0030] Step S304: Determine the voltage of the IRI pin of the I2C serial transmission master device. In this way, determine whether an interrupt request is issued among the multiple I2C serial transmission slave devices, and determine which of the multiple I2C serial transmission slave devices issued the interrupt request according to the voltage. Since each I2C serial transmission slave device 202 has a corresponding set of fixed voltages, when the interrupt request pin IRQ of a specific I2C serial transmission slave device 202 issues an interrupt request, the interrupt request pin IRQ of the specific I2C serial transmission slave device 202 outputs a voltage corresponding to the specification of the specific I2C serial transmission slave device 202.
[0031] Step S305: Determine whether each of the I2C serial transmission slave devices makes an interrupt request according to the voltage level of the interrupt input pin of the I2C serial transmission master device.
[0032] In summary, the embodiment of the present invention allows the interrupt request pins of multiple I2C serial transmission slave devices to be coupled to the same interrupt input pin of the I2C serial transmission master device, and each interrupt request pin of the I2C serial transmission slave device outputs a different voltage when requesting an interrupt. Therefore, the I2C serial transmission master device can determine which I2C serial transmission slave device sends the interrupt request based on the voltage received by the interrupt input pin. Furthermore, in another preferred embodiment, if multiple devices send interrupt requests at the same time, the I2C serial transmission master device first processes the interrupt of the I2C serial transmission slave device with a higher interrupt request voltage.
[0033] It should be understood that the examples and embodiments described herein are for illustrative purposes only and that various modifications or changes in view thereof will be suggested to those skilled in the art and are to be included within the spirit and scope of the present application and the scope of the appended claims.
Claims
1. A low pin I2C transmission system, characterized in that: include: I2C serial transmission data flat cable, including an I2C serial transmission data line and an I2C serial transmission clock line; A plurality of I2C serial transmission slave devices, wherein each of the I2C serial transmission slave devices comprises an I2C serial transmission data pin, an I2C serial transmission clock pin, and an interrupt request pin, wherein the I2C serial transmission data pin of each of the I2C serial transmission slave devices is coupled to the I2C serial transmission data line of the I2C serial transmission data flat cable, and the I2C serial transmission clock pin of each of the I2C serial transmission slave devices is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable; and I2C serial transmission master device, including I2C serial transmission data pin, I2C serial transmission clock pin and interrupt input pin, Wherein, the I2C serial transmission data pin of the I2C serial transmission master device is coupled to the I2C serial transmission data line of the I2C serial transmission data flat cable, and the I2C serial transmission clock pin of the I2C serial transmission master device is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable, Wherein, the interrupt request pin of each of the plurality of I2C serial transmission slave devices is coupled to the interrupt input pin of the I2C serial transmission master device. Wherein, each of the interrupt request pins of the plurality of I2C serial transmission slave devices outputs a different voltage when making an interrupt request. The I2C serial transmission master device determines whether each of the plurality of I2C serial transmission slave devices makes an interrupt request according to the voltage received by the interrupt input pin of the I2C serial transmission master device.
2. The low pin I2C transmission system according to claim 1, characterized in that: Also includes: The first pull-up resistor comprises a first end and a second end, wherein the first end of the first pull-up resistor is coupled to a power supply voltage, and the second end of the first pull-up resistor is coupled to an I2C serial transmission data line of the I2C serial transmission data flat cable.
3. The low pin I2C transmission system according to claim 1, characterized in that: Also includes: The second pull-up resistor comprises a first end and a second end, wherein the first end of the second pull-up resistor is coupled to the power supply voltage, and the second end of the second pull-up resistor is coupled to the I2C serial transmission clock line of the I2C serial transmission data flat cable.
4. The low pin I2C transmission system according to claim 1, characterized in that: When each of the I2C serial transmission slave devices does not make an interrupt request, the interrupt request pin of each of the I2C serial transmission slave devices is in a high impedance state.
5. The low pin I2C transmission system according to claim 1, characterized in that: The interrupt input pin of the I2C serial transmission master device is an analog-to-digital conversion input channel pin.
6. A method for low pin I2C serial transmission, characterized in that: include: Provide multiple I2C serial transmission slave devices; Providing an I2C serial transmission master device, wherein the I2C serial transmission slave device and the I2C serial transmission master device are electrically connected to an I2C serial transmission flat cable; Coupling the interrupt request pin of each of the I2C serial transmission slave devices to the interrupt input pin of the I2C serial transmission master device; When a specific I2C serial transmission slave device among each of the I2C serial transmission slave devices makes an interrupt request, an interrupt request pin of the specific I2C serial transmission slave device outputs a voltage corresponding to a specification of the specific I2C serial transmission slave device; According to the voltage level of the interrupt input pin of the I2C serial transmission master device, it is determined whether each of the I2C serial transmission slave devices makes an interrupt request.
7. The method for low pin I2C serial transmission according to claim 6, characterized in that: When each of the I2C serial transmission slave devices does not make an interrupt request, the interrupt request pin of each of the I2C serial transmission slave devices is in a high impedance state.
8. The method for low pin I2C serial transmission according to claim 6, characterized in that: The interrupt input pin of the I2C serial transmission master device is an analog-to-digital conversion input channel pin.