CN117112475A - I2C bus driving capability automatic regulating system and method - Google Patents

I2C bus driving capability automatic regulating system and method Download PDF

Info

Publication number
CN117112475A
CN117112475A CN202311377144.4A CN202311377144A CN117112475A CN 117112475 A CN117112475 A CN 117112475A CN 202311377144 A CN202311377144 A CN 202311377144A CN 117112475 A CN117112475 A CN 117112475A
Authority
CN
China
Prior art keywords
bus
pull
resistance value
slave
slaves
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311377144.4A
Other languages
Chinese (zh)
Other versions
CN117112475B (en
Inventor
彭云武
李未未
秦思林
刘雅婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Cetc Xingtuo Technology Co ltd
Original Assignee
Chengdu Cetc Xingtuo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Cetc Xingtuo Technology Co ltd filed Critical Chengdu Cetc Xingtuo Technology Co ltd
Priority to CN202311377144.4A priority Critical patent/CN117112475B/en
Publication of CN117112475A publication Critical patent/CN117112475A/en
Application granted granted Critical
Publication of CN117112475B publication Critical patent/CN117112475B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4022Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0016Inter-integrated circuit (I2C)

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides an automatic regulating system and method for I2C bus driving capability, belongs to the technical field of I2C buses, and solves the problem that the prior art cannot automatically regulate the bus driving capability; firstly, determining an address range of an I2C bus, and judging the number of slaves according to a level change signal of a data line SDA; then, addresses are allocated for the newly added slaves, the total number of each type of slaves is obtained, a plurality of types of variables are formed, and the magnitude of a pull-up resistance value required by an I2C bus is calculated by combining the capacitance influence value of the I2C bus and an I2C standard protocol; inquiring a pull-up resistance value truth table of the controllable resistance network, selecting a matched switch state combination, generating a control signal by a microprocessor, enabling the controllable resistance network to act, and changing the pull-up resistance value and the driving current; the invention can automatically adjust the driving capability of the I2C bus without manual intervention, and the I2C bus can always maintain a stable and efficient working state and adapt to the change of the load quantity.

Description

I2C bus driving capability automatic regulating system and method
Technical Field
The invention belongs to the technical field of I2C buses, and particularly relates to an automatic regulating system and method for I2C bus driving capability based on the number of slave devices hung on a bus.
Background
An integrated circuit bus (Inter-Integrated Circuit, IIC) is a simple, reliable, half-duplex and synchronous serial control bus, commonly referred to as an I2C bus. The I2C bus adopts a Master-Slave structure, one device serves as a Master (Master) and the other devices serve as slaves (Slave) in all the hung devices; the host computer is responsible for initiating and ending communication, and the slave computer responds to the communication instruction of the host computer and provides or receives data. The I2C bus includes a Serial Data Line (SDA) and a Serial clock Line (Serial Clock Line, SCL) through which Data bits are sequentially transferred in order to achieve bidirectional interactive communication of Data between a master and a slave. The I2C bus is widely applied to various electronic devices and embedded systems, and is connected with various devices to realize data interaction and communication.
In the practical application scenario of the I2C bus, the number and layout of devices connected to the same I2C bus may vary due to different working requirements, which results in a variation in the number of loads on the bus. In the I2C bus technology, the setting of a pull-up resistor is a technical key point; in the prior art, a safer and more reliable resistance value is determined in advance according to the possible range of the number of devices in a working scene and human experience, so that the pull-up resistors of the data line SDA and the clock line SCL are selected.
The traditional mode ensures that when the I2C communication system is used, the pull-up resistor is not changed in the process of data communication of the I2C bus; if the resistance value is to be changed, the pull-up resistor can be manually replaced only when the I2C bus is idle.
When the I2C bus is in data communication, in order to meet the working requirement, the number of the hung slave machines is temporarily increased, so that the load capacitance of the bus line is increased; since the resistance of the pull-up resistor is fixed, the time constant of the signals on the data line SDA and the clock line SCL becomes large, the slope of the rising edge of the signal becomes small, and the rising time increases, thus lowering the bit rate of signal transmission. The pull-up resistor essentially determines the driving capability of the I2C bus, i.e. the magnitude of the driving current. In the prior art, the driving current is not changed in the communication process of the I2C bus, so that when the load quantity of the I2C bus is increased, the driving capability is reduced, and the working state of a hanging device and the stability of data transmission are influenced.
Therefore, since the existing I2C technology has no relevant solution in practical application, how to automatically change the driving capability of the I2C bus according to the load number of the I2C bus without manual intervention becomes a research hotspot for those skilled in the art.
Disclosure of Invention
The invention aims to solve the defect that the traditional I2C bus technology can not automatically change the driving capability, and provides a system and a method for adaptively adjusting the bus driving capability mainly according to the number of slave machines hung on an I2C bus. According to the invention, through the hardware structural design of the controllable resistance network, the change of the load quantity on the I2C bus is detected, the influence of the load on the bus capacitance is quantized, and the influence is used as the basis for regulating the controllable resistance network and the driving current by the microprocessor. The invention can automatically adjust the driving capability of the I2C bus without manual intervention, and always maintains a stable and efficient working state so as to adapt to actual application scenes such as frequent or indirect change of the load quantity on the I2C bus.
The invention adopts the following technical scheme to achieve the purpose:
an I2C bus driving capability automatic regulating system comprises a host computer and a plurality of slaves which are connected by an I2C bus; the host is also connected with a controllable resistance network, and the controllable resistance network is connected to the I2C bus; the host is used for detecting and distributing the address data of the slaves and generating control signals for adjusting the controllable resistance network and the driving current according to the number change of the slaves; the controllable resistance network is used for changing the pull-up resistance value of the I2C bus according to the received control signal.
Specifically, the host comprises a microprocessor, and the microprocessor is respectively connected with the I2C bus and the controllable resistance network; the microprocessor is used for determining the number change condition of the slaves according to the detected slave address data, quantitatively determining the I2C bus capacitance influence value according to the number change condition of the slaves, and calculating and generating the control signal on the basis of the I2C bus capacitance influence value.
Preferably, the host further comprises a memory, and the memory is connected with the microprocessor; the memory stores address data of the host and the slave, a slave quantity detection program, an I2C bus capacitance influence value quantization program and a pull-up resistance value truth table corresponding to the controllable resistance network.
Further, the controllable resistor network comprises a plurality of triodes, the base electrode of each triode is connected to the microprocessor, and the base electrode is used for receiving a control signal correspondingly sent by the microprocessor and changing the switching state of the triode; the collector electrode of each triode is connected to a power supply through a resistor component, the plurality of resistor components jointly determine the pull-up resistance value of the I2C bus under the switching state of the triode, and the power supply is used for providing electric energy for the system; and the emitter of each triode is connected to the I2C bus, and the emitter is used for providing driving current for the I2C bus on the basis of the determined pull-up resistance value.
Preferably, the host is connected with a plurality of I/O cards through the I2C bus, and a host interface and a slave interface are arranged on the I/O cards; the host interface is connected with the I2C bus, and the slave is hung on the slave interface; the I/O card is used for carrying the slave machine and proxy communication and data transmission between the host machine and the slave machine through an I2C bus.
The invention also provides an automatic regulating method for the driving capability of the I2C bus, which adopts the automatic regulating system as a hardware basis and comprises the following steps: after the host computer is connected to a plurality of slave computers through an I2C bus, the system is electrified, and the detection and the distribution of the address data of the slave computers are started; in the communication process, the host detects the address data of the slave in real time and judges whether the number of the slave changes or not; when the number of the slaves changes, a microprocessor arranged in the master generates a control signal according to a pull-up resistance value truth table; the controllable resistance network receives the control signals, changes the switching states of the triodes, and further changes the pull-up resistance value of the I2C bus.
Further, the method specifically comprises the following steps:
s1, determining an address range of an I2C bus, and distributing address data for a plurality of slaves connected to the I2C bus in a hanging mode;
s2, judging whether the number of slaves changes according to the level change signal of the serial data line in the I2C bus; if no change occurs, completing the communication process according to the preset initial pull-up resistance value;
s3, if the slave machine equipment is newly added, after address data are allocated to the newly added slave machine, classifying and acquiring all the slave machine quantity of each class according to the slave machine type; storing the data obtained by classification in multi-class variables corresponding to different slave types;
s4, on the basis of the acquired multiple types of variables, calculating a pull-up resistance value and a driving current required by the I2C bus according to the I2C bus capacitance influence value and an I2C standard protocol;
s5, the microprocessor inquires a truth table of the pull-up resistance value of the controllable resistance network according to the required pull-up resistance value, selects a switch state combination of a plurality of triodes matched in the truth table, generates a control signal and sends the control signal to the controllable resistance network;
s6, the controllable resistance network receives the control signal, and the corresponding triode is turned on or off to finish the change of the actual pull-up resistance value; meanwhile, the microprocessor controls the conduction current of the triode, and the quantity of the slaves is combined, so that the conduction current is higher than the required driving current, and the communication process after the slaves are newly added is completed.
Optionally, in step S1, the address range of the I2C bus includes a 7-bit address and a 10-bit address, and both the two types of addresses are composed of a fixed portion and a programmable portion.
Further, in step S4, the I2C bus capacitance influence value is calculated according to the acquired multiple types of variables; on the basis of the influence value of the I2C bus capacitance, determining the value range of the required pull-up resistor value through the maximum and minimum value calculation process of the pull-up resistor; based on an I2C standard protocol comprising a standard mode and a quick mode, selecting a pull-up resistance value which accords with a pull-up resistance value range in a pull-up resistance value truth table as a pull-up resistance value after a slave device is newly added; and calculating the required driving current according to the selected pull-up resistance value.
Further, in step S5, the pull-up resistance value truth table of the controllable resistance network is obtained by: the switching states of a plurality of triodes in the controllable resistance network are changed in advance, the pull-up resistance value under the condition of each switching state combination is determined, the determined pull-up resistance value and the corresponding switching state combination are matched and recorded, and the pull-up resistance value and the corresponding switching state combination are stored in a pull-up resistance value truth table.
In summary, by adopting the technical scheme, the invention has the following beneficial effects:
according to the invention, through the hardware foundation and the method concept, under the assistance of software and hardware adaptation and programming, the driving capability of the I2C bus can be automatically adjusted according to the change condition of the load quantity on the I2C bus, so that the I2C bus can maintain stable communication performance under different load conditions; therefore, the stability and the reliability of the whole communication system are improved, and the communication problem caused by load change is reduced.
According to the technical scheme, the control strategy of the driving capability can be flexibly adjusted according to different application scenes through the controllable resistance network and the corresponding regulation and control modes; this way the whole communication system can adaptively adjust the driving capability in the face of different types and numbers of slave machines.
The invention makes the I2C bus realize the effect of adjusting the driving capability according to the load change, which can avoid the phenomenon of power consumption waste caused by overlarge driving capability, thus being beneficial to optimizing the overall power consumption level of the communication system and prolonging the service life of functional equipment such as batteries and the like.
The invention also provides convenience for future development of the I2C communication system; when the communication system needs to add more slave machine parts or related equipment, the communication system can automatically adapt to new load conditions without manually replacing the pull-up resistor of the I2C bus or performing complicated drive current debugging work, and the resistance range of the pull-up resistor is determined to be the optimal working range.
Drawings
FIG. 1 is a schematic diagram of the architecture and connection of the system of the present invention;
fig. 2 is a schematic flow diagram of the method of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
As shown in FIG. 1, an I2C bus driving capability automatic regulating system can automatically detect the number change of slaves on an I2C bus, and quantify the influence of the number change of the slaves on the capacitance of the I2C bus through a program algorithm, and control and regulate the pull-up resistance value and the magnitude of driving current based on the influence.
The automatic regulating system comprises a host computer and a plurality of slaves which are connected by an I2C bus; the host is connected with a controllable resistance network, and the controllable resistance network is connected to the I2C bus; the host is used for detecting and distributing address data of the slaves and generating control signals for adjusting the controllable resistance network and the driving current according to the number change of the slaves; the controllable resistance network is used for changing the pull-up resistance value of the I2C bus according to the received control signal.
For a host in the system, the host is responsible for controlling the starting and ending processes of communication and simultaneously controlling the communication; the host generates a clock signal SCL of the I2C bus to control the data transmission cadence and rate, thereby ensuring synchronization and stability of the communication. The host detects the scanning slave device through the I2C bus, allocates a slave address, transmits and receives data, and performs the adjustment control operation for the controllable resistance network in the present embodiment.
For a slave in the system, the slave is responsible for responding to a communication request initiated by a host, providing data or executing corresponding operation according to the request content; the slave monitors the clock signal SCL of the I2C bus to realize the clock synchronization process with the host computer, thereby ensuring the accuracy of data transmission; the slave machine can simultaneously receive and confirm the distributed address data.
In this embodiment, as shown in fig. 1, the host includes a built-in microprocessor, and the microprocessor is respectively connected to the I2C bus and the controllable resistance network; the method is characterized in that the influence of the number change of the slaves on the capacitance of the I2C bus is quantified through a program-implemented algorithm, and a control signal for adjusting the controllable resistance network and the driving current is generated according to the influence.
The host computer also comprises a built-in memory, the memory is connected with the microprocessor, address data of the host computer and the slave computers are stored in the memory, and a slave computer quantity detection program, an I2C bus capacitance influence value quantization program and a pull-up resistance value truth table corresponding to the controllable resistance network are also stored in the memory. The content in the memory is used by the microprocessor one by one in the process of adjusting the pull-up resistance value, so that the corresponding function is realized.
In this embodiment, the controllable resistance network is a key structural feature for realizing the adjustability of the pull-up resistor. As shown in fig. 1, the controllable resistance network includes 3 PNP transistors; the base electrode of each PNP type triode is connected to the microprocessor, and the base electrode is used for receiving a control signal correspondingly sent by the microprocessor and changing the switching state of the PNP type triode; the collector electrode of each PNP triode is connected to a power supply through a resistor componentThe plurality of resistor components jointly determine the pull-up resistance value of the I2C bus under the switching state of the PNP triode, and the power supply is +.>For providing electrical energy to the automatic regulating system; the emitter of each PNP triode is connected to the I2C bus, and the emitter is used for providing driving current for the I2C bus on the basis of the determined pull-up resistance value.
Based on the above hardware structure of the present embodiment, the introduction and adjustment process of the driving capability of the I2C bus can be summarized as follows:
the driving capability of the I2C bus is generally reflected by the signal rise time of the data line SDA and the clock line SCLAnd the driving current which the output stage generates when the transistor is turned on +.>Is of a size of (a) and (b). Wherein the rise time +.>And drive current +.>Are all subject to I2C bus capacitance +.>And pull-up resistor->Is a function of (1); bus capacitor->Including PCB capacitance, master capacitance, and capacitance of each slave.
Bus capacitance when the number of slaves increases (or decreases)Will increase (or decrease) resulting in rise timeIncrease (or decrease), drive current +.>Reduce%Or increased). Therefore, when the host detects that the number of slaves is increased (or decreased), the pull-up resistor can be decreased (or increased) by the microprocessor>And increasing (or decreasing) the driving current +.>Can offset bus capacitance +.>The stable driving capability of the I2C bus in the communication process is always kept under the influence of increasing (or reducing).
Example 2
On the basis of applying the system of embodiment 1 as a hardware structure, this embodiment provides an I2C bus driving capability automatic adjustment method. Fig. 2 shows the overall principle flow of the method, which can be synchronously referred to in the description of the present embodiment. The automatic adjusting method comprises the following steps: after the host computer is connected to a plurality of slave computers through an I2C bus, the system is electrified, and the detection and the distribution of the address data of the slave computers are started; in the communication process, the host detects the address data of the slave in real time and judges whether the number of the slave changes or not; when the number of the slaves changes, a microprocessor arranged in the master generates a control signal according to a pull-up resistance value truth table; the controllable resistance network receives the control signal, changes the switching state of the 3 triodes, and further changes the pull-up resistance value of the I2C bus.
The present embodiment will describe in detail the details of each step in the order of the method steps.
S1, determining an address range of the I2C bus.
In the I2C standard protocol, the address data of both the master and slave are 7-bit binary numbers, so the I2C bus address range can be from 0x00 to 0x7F. Wherein the 0x00 address is a reserved address for special purposes; while 0x01 to 0x7F addresses may be assigned to each of the master and slave devices for communication, and each device uses a separate address. Due to the rapid increase of application functions, the I2C bus also provides 10-bit addressing addresses to meet the need for greater addressing space; therefore, the I2C bus address range of the present embodiment may be selected from the 7-bit address type and the 10-bit address type according to the actual situation. For a 7-bit address, up to 127 different slave devices can be connected on 1I 2C bus; for a 10 bit address, up to 1023 different slave devices may be connected on 1I 2C bus. The step S1 is only needed to be executed after the host computer of the automatic regulating system is powered on for the first time, and addresses are distributed by relevant programs after the address ranges of the host computer and the slave computers on the I2C bus are determined. The following description of this embodiment uses a 7-bit address.
S2, judging whether the number of the slaves is changed.
If the initial host and the slave are connected, the slave equipment is not added to the I2C bus, the subsequent steps are not needed to change the driving capability of the I2C bus, and the whole communication process can be reasonably and stably completed according to the preset pull-up resistance value when the system is initially built, which is also a standard building mode of the I2C communication system without the driving capability adjusting function in the prior art.
The scenario of this embodiment faces the situation that the number of slaves changes, and after a new slave device is connected to the I2C bus, the master receives a level change signal from the data line SDA; then, according to the I2C bus address range determined in step S1, the host allocates unused address data to the newly-attached slave device according to the preset slave address custom rule, and stores the address data of the new slave device in the memory.
The address data of the host or the address data allocated to each slave consists of a fixed part and a programmable part. In this embodiment, for a 7-bit address, the first 4 bits determine the type of the corresponding device, which cannot be changed during the communication process; the last 3-bit address can be personalized and customized as required by setting software.
S3, acquiring multi-class variables representing different slave types.
When facing the scene of the change of the number of the slaves, the microprocessor of the master stores the slaves address data into the memory according to the first 4 bits and the last 3 bits of the slaves address dataAll slave addresses connected on the stored I2C bus are classified by slave type. The categories to which this classification relates may include: input devices, indicator lights, switches, IO extensions, and sensors, etc. After counting the number of each type of equipment, the equipment is stored in different variables. The embodiment enumerates stored variables including、/>、/>、/>And->
S4, calculating the required pull-up resistance value and the drive current.
The method comprises the steps of firstly calculating the influence value of the I2C bus capacitance for calculating key contents in the whole method process. Bus capacitorThe general calculation formula of (2) is:
since the variable of the number of slaves of various types is already stored in step S3, the bus capacitanceThe calculation formula of (2) can be converted into:
and the microprocessor executes an I2C bus capacitance influence value quantization program in the memory, and the bus capacitance after the number of slaves is changed can be obtained through the calculation process.
Then, according to the pull-up resistorThe maximum value calculation formula:
calculating to obtain the maximum value of pull-up resistance after the number of slaves is changed
According to pull-up resistorThe minimum value calculation formula:
calculating to obtain the minimum value of pull-up resistor after the number of slaves is changedThe method comprises the steps of carrying out a first treatment on the surface of the Thereby determining the pull-up resistance after the number of slaves is changed>The range of the value of (2) is +.>To->
In the above calculation process, the relevant calculation parameters will be obtained according to the specifications in the I2C standard protocol: characteristic parameters of I/O stages and bus lines of I2C bus devices in Standard mode and Fast mode, including maximum rise time of communication signalsMaximum bus capacitance->Maximum output voltage->And minimum drive currentAs shown in table 1 below.
TABLE 1I/O stage and bus line characteristic parameter Table for I2C bus devices
Drive currentWill be combined with the pull-up resistor +.>Selecting a specific pull-up resistance value +.>After that, the following calculation formula is adopted:
wherein the method comprises the steps ofIs the current output voltage.
Selecting pull-up resistance valueThe specific procedure of (2) is detailed in step S5 of this example.
S5, inquiring a pull-up resistance value truth table, selecting a switch state combination, and generating a control signal.
This embodimentThe pull-up resistance value truth table of the controllable resistance network is obtained by the following steps: the switching states of 3 PNP triodes in the controllable resistance network are changed in advance, the pull-up resistance value under each switching state combination condition is determined, and the determined pull-up resistance value and the corresponding switching state combination are matched and recorded and stored in a pull-up resistance value truth table. Thus, this embodiment has a total of 8 different switch state combinations, as shown in Table 2 below. In Table 2, PNP type triode is according to、/>The mode number of which is +.>、/>、/>The method comprises the steps of carrying out a first treatment on the surface of the Pull-up resistance values determined under different combinationsI.e. the parameters in the table.
Selecting the pull-up resistor in the pull-up resistor value truth table to meet the value rangeTo->Resistance value +.>As a new pull-up resistance value of the I2C bus after the number of slaves changes to ensure a stable signal rise time +.>. And the switching states of the 3 PNP triodes corresponding to the switching states are combined to generate control signals, and the control signals are sent to the controllable resistance network.
Table 2 Pull-up resistance truth table for controllable resistance network
S6, the controllable resistance network acts to change the driving capability of the I2C bus.
After receiving a control signal of the microprocessor, the controllable resistance network controls the high and low levels of pins of 3 PNP triodes to finish the change of the actual switch state, thereby changing the pull-up resistance value of the I2C bus; subsequently, according to the selected pull-up resistorBy means of the drive current in step S4 +.>Calculation formula, calculate driving current +.>The microprocessor then drives the currentJudging whether higher on-current is required to be provided or not to ensure sufficient and stable driving capability; if the on current needs to be improved, the corresponding triode is controlled, and the number of the slaves is increased, so that the on current is higher than the required driving current, and the communication process after the slaves are increased is completed.
The method of the embodiment can complete the programming of corresponding method codes according to the actually selected hardware platform and programming language, and realize the function of automatically changing the driving capability of the I2C bus according to the number of slaves in I2C communication.
Example 3
Based on embodiment 2, the present embodiment verifies the automatic adjustment capability of the automatic adjustment system and method of the present invention through specific example scenarios.
As a preferable form of the actual scene of the present embodiment, 1 master and 9 different types of slaves are provided. The slave comprises: 3 temperature sensors, 3 humidity sensors and 3 OLED display screens. Every 3 slaves (namely 1 set of subunits comprising 1 temperature sensor, 1 humidity sensor and 1 OLED display screen) are hung on a slave interface of one I/O card, and the I/O card is connected with an I2C bus through a host interface on the I/O card to realize connection with a host; the I2C bus communication mode operates as a standard mode.
In this embodiment, the initial condition is set as the host connected with 1I/O card; in the communication process, 2I/O cards are temporarily added to the I2C bus and are in communication connection with the host, so that the driving capability of the I2C bus needs to be automatically adjusted. The specific process is as follows:
when a new 2I/O card is connected, the data line SDA in the I2C bus is pulled from a high level to a low level; the microprocessor in the host monitors the signal change, recognizes that a new slave device is connected to the I2C bus, and starts to detect and allocate the slave address. The host computer distributes 6 slaves of a temperature sensor, a humidity sensor and an OLED display screen on 2 new I/O cards to 7-bit addresses which are not repeated and are not used respectively, and stores address data of the 6 new slaves into a memory.
Then, the microprocessor classifies all addresses of the slaves connected on the I2C bus stored in the memory according to the type according to the information of the first 4 bits and the last 3 bits in the address data of the slaves, acquires the respective numbers of the temperature sensor, the humidity sensor and the OLED display screen to be 3, and stores the numbers to the variable、/>And->Now each variable value is 3. Before 2 new I/O cards are accessed, each variable value is 1.
The calculation process is entered next. The microprocessor will、/>And->Substituting the bus capacitance calculation formula:
the specific parameters in the calculation formula are the capacitance typical values of the corresponding equipment in the scene of the embodiment, and are respectively、/>、/>And->
Then calculate the pull-up resistanceMaximum value:
calculating pull-up resistanceMinimum value:
in the controllable resistor network of the embodiment, the resistor component、/>、/>The method comprises the steps of carrying out a first treatment on the surface of the Selecting the value in +.>To->Pull-up resistor in the range->New pull-up resistor with resistance value as I2C bus>. In this embodiment, a relatively small resistance is selected as the new pull-up resistor +.>I.e. directly select the resistor element->As a new pull-up resistor->
This pull-up resistance value avoids signal rise timeBecause of->Is too large and at the same time is advantageous for providing a larger drive current +.>The method comprises the steps of carrying out a first treatment on the surface of the After the pull-up resistance value is determined, the driving current can be calculated>The method comprises the following steps:
when the data is turned on according to the triode,the value of (2) is generally not more than +.>Is determined.
In contrast, the bus capacitance was calculated as before 2 new I/O cards were connected to the hostPull-up resistorMaximum and minimum values are +.>And 0.97->. Because the number of slaves on the bus is smaller and the driving pressure is smaller at this time, in order to avoid the phenomena of overlarge driving capability and system power consumption caused by overlarge pull-up resistance value, the embodiment presets the pull-up resistance before the number of slaves changes>For resistor component->Thereby reducing additional power consumption.
Finally, when the number of the slaves changes, the microprocessor in the master generates commands after acquiring the opening and closing states corresponding to the 3 PNP triodes in the current controllable resistance network、/>For closing and/or opening>The base pin level of each PNP triode is controlled by a conducting control signal; based on the calculated driving current +.>The control transistor generates no less than +.>Since 2I/O cards connected with the host are added, the microprocessor increases the conduction current in a proper range and adjusts the conduction current to be +.>The system can provide sufficient and stable driving capability, so that the I2C communication process after 2I/O cards are added is completed.

Claims (10)

1. An I2C bus driving capability automatic regulating system, characterized in that: the system comprises a host computer and a plurality of slaves which are connected by an I2C bus; the host is also connected with a controllable resistance network, and the controllable resistance network is connected to the I2C bus; the host is used for detecting and distributing the address data of the slaves and generating control signals for adjusting the controllable resistance network and the driving current according to the number change of the slaves; the controllable resistance network is used for changing the pull-up resistance value of the I2C bus according to the received control signal.
2. An I2C bus driving capability automatic regulating system according to claim 1, wherein: the host comprises a microprocessor, and the microprocessor is respectively connected with the I2C bus and the controllable resistance network; the microprocessor is used for determining the number change condition of the slaves according to the detected slave address data, quantitatively determining the I2C bus capacitance influence value according to the number change condition of the slaves, and calculating and generating the control signal on the basis of the I2C bus capacitance influence value.
3. An I2C bus driving capability automatic regulating system according to claim 2, wherein: the host also comprises a memory, and the memory is connected with the microprocessor; the memory stores address data of the host and the slave, a slave quantity detection program, an I2C bus capacitance influence value quantization program and a pull-up resistance value truth table corresponding to the controllable resistance network.
4. An I2C bus driving capability automatic regulating system according to claim 2, wherein: the controllable resistor network comprises a plurality of triodes, the base electrode of each triode is connected to the microprocessor, and the base electrode is used for receiving a control signal correspondingly sent by the microprocessor and changing the switching state of the triode; the collector electrode of each triode is connected to a power supply through a resistor component, the plurality of resistor components jointly determine the pull-up resistance value of the I2C bus under the switching state of the triode, and the power supply is used for providing electric energy for the system; and the emitter of each triode is connected to the I2C bus, and the emitter is used for providing driving current for the I2C bus on the basis of the determined pull-up resistance value.
5. An I2C bus driving capability automatic regulating system according to claim 1, wherein: the host is connected with a plurality of I/O cards through the I2C bus, and a host interface and a slave interface are arranged on the I/O cards; the host interface is connected with the I2C bus, and the slave is hung on the slave interface; the I/O card is used for carrying the slave machine and proxy communication and data transmission between the host machine and the slave machine through an I2C bus.
6. An automatic regulating method for the driving capability of an I2C bus is characterized by comprising the following steps: the method adopts the automatic regulating system as the hardware basis, and comprises the following steps: after the host computer is connected to a plurality of slave computers through an I2C bus, the system is electrified, and the detection and the distribution of the address data of the slave computers are started; in the communication process, the host detects the address data of the slave in real time and judges whether the number of the slave changes or not; when the number of the slaves changes, a microprocessor arranged in the master generates a control signal according to a pull-up resistance value truth table; the controllable resistance network receives the control signals, changes the switching states of the triodes, and further changes the pull-up resistance value of the I2C bus.
7. The method for automatically adjusting the driving capability of an I2C bus according to claim 6, wherein: the method specifically comprises the following steps:
s1, determining an address range of an I2C bus, and distributing address data for a plurality of slaves connected to the I2C bus in a hanging mode;
s2, judging whether the number of slaves changes according to the level change signal of the serial data line in the I2C bus; if no change occurs, completing the communication process according to the preset initial pull-up resistance value;
s3, if the slave machine equipment is newly added, after address data are allocated to the newly added slave machine, classifying and acquiring all the slave machine quantity of each class according to the slave machine type; storing the data obtained by classification in multi-class variables corresponding to different slave types;
s4, on the basis of the acquired multiple types of variables, calculating a pull-up resistance value and a driving current required by the I2C bus according to the I2C bus capacitance influence value and an I2C standard protocol;
s5, the microprocessor inquires a truth table of the pull-up resistance value of the controllable resistance network according to the required pull-up resistance value, selects a switch state combination of a plurality of triodes matched in the truth table, generates a control signal and sends the control signal to the controllable resistance network;
s6, the controllable resistance network receives the control signal, and the corresponding triode is turned on or off to finish the change of the actual pull-up resistance value; meanwhile, the microprocessor controls the conduction current of the triode, and the quantity of the slaves is combined, so that the conduction current is higher than the required driving current, and the communication process after the slaves are newly added is completed.
8. The method for automatically adjusting the driving capability of an I2C bus according to claim 7, wherein: in step S1, the address range of the I2C bus includes a 7-bit address and a 10-bit address, which are both composed of a fixed portion and a programmable portion.
9. The method for automatically adjusting the driving capability of an I2C bus according to claim 7, wherein: in step S4, the I2C bus capacitance influence value is calculated according to the acquired multi-class variables; on the basis of the influence value of the I2C bus capacitance, determining the value range of the required pull-up resistor value through the maximum and minimum value calculation process of the pull-up resistor; based on an I2C standard protocol comprising a standard mode and a quick mode, selecting a pull-up resistance value which accords with a pull-up resistance value range in a pull-up resistance value truth table as a pull-up resistance value after a slave device is newly added; and calculating the required driving current according to the selected pull-up resistance value.
10. The method for automatically adjusting the driving capability of an I2C bus according to claim 7, wherein: in step S5, the pull-up resistance value truth table of the controllable resistance network is obtained by: the switching states of a plurality of triodes in the controllable resistance network are changed in advance, the pull-up resistance value under the condition of each switching state combination is determined, the determined pull-up resistance value and the corresponding switching state combination are matched and recorded, and the pull-up resistance value and the corresponding switching state combination are stored in a pull-up resistance value truth table.
CN202311377144.4A 2023-10-24 2023-10-24 I2C bus driving capability automatic regulating system and method Active CN117112475B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311377144.4A CN117112475B (en) 2023-10-24 2023-10-24 I2C bus driving capability automatic regulating system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311377144.4A CN117112475B (en) 2023-10-24 2023-10-24 I2C bus driving capability automatic regulating system and method

Publications (2)

Publication Number Publication Date
CN117112475A true CN117112475A (en) 2023-11-24
CN117112475B CN117112475B (en) 2024-01-30

Family

ID=88809538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311377144.4A Active CN117112475B (en) 2023-10-24 2023-10-24 I2C bus driving capability automatic regulating system and method

Country Status (1)

Country Link
CN (1) CN117112475B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117688893A (en) * 2024-02-01 2024-03-12 成都电科星拓科技有限公司 Chip conversion time violation repairing method and device, electronic equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101782885A (en) * 2009-12-29 2010-07-21 福建星网锐捷网络有限公司 Method and device for adjusting pull-up resistor of IIC bus and IIC bus device
CN102088383A (en) * 2010-11-23 2011-06-08 深圳市豪恩安全科技有限公司 Online slave query and response method and device, bus system
CN105446837A (en) * 2015-04-02 2016-03-30 北京天诚盛业科技有限公司 Method, device and system for detecting whether IIC (inter-integrated circuit) interface device is connected
CN107301147A (en) * 2017-06-20 2017-10-27 郑州云海信息技术有限公司 A kind of dynamic regulating method and device of I2C bus signals quality
CN207473599U (en) * 2017-12-04 2018-06-08 山东高云半导体科技有限公司 A kind of I2C bus control interfaces circuit
CN108647171A (en) * 2018-05-25 2018-10-12 深圳市度信科技有限公司 A kind of signal slope control system and method
CN109062832A (en) * 2018-07-26 2018-12-21 郑州云海信息技术有限公司 A kind of method, apparatus and storage medium adjusting I2C bus parameter
CN209570933U (en) * 2019-05-15 2019-11-01 上海东软载波微电子有限公司 Driving circuit
CN111552658A (en) * 2020-04-17 2020-08-18 北京中科银河芯科技有限公司 Communication method, communication control device and I2C bus system
CN112765064A (en) * 2019-11-05 2021-05-07 深圳市汇顶科技股份有限公司 Pull-up resistor adjusting method, control chip and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101782885A (en) * 2009-12-29 2010-07-21 福建星网锐捷网络有限公司 Method and device for adjusting pull-up resistor of IIC bus and IIC bus device
CN102088383A (en) * 2010-11-23 2011-06-08 深圳市豪恩安全科技有限公司 Online slave query and response method and device, bus system
CN105446837A (en) * 2015-04-02 2016-03-30 北京天诚盛业科技有限公司 Method, device and system for detecting whether IIC (inter-integrated circuit) interface device is connected
CN107301147A (en) * 2017-06-20 2017-10-27 郑州云海信息技术有限公司 A kind of dynamic regulating method and device of I2C bus signals quality
CN207473599U (en) * 2017-12-04 2018-06-08 山东高云半导体科技有限公司 A kind of I2C bus control interfaces circuit
CN108647171A (en) * 2018-05-25 2018-10-12 深圳市度信科技有限公司 A kind of signal slope control system and method
CN109062832A (en) * 2018-07-26 2018-12-21 郑州云海信息技术有限公司 A kind of method, apparatus and storage medium adjusting I2C bus parameter
CN209570933U (en) * 2019-05-15 2019-11-01 上海东软载波微电子有限公司 Driving circuit
CN112765064A (en) * 2019-11-05 2021-05-07 深圳市汇顶科技股份有限公司 Pull-up resistor adjusting method, control chip and electronic equipment
CN111552658A (en) * 2020-04-17 2020-08-18 北京中科银河芯科技有限公司 Communication method, communication control device and I2C bus system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117688893A (en) * 2024-02-01 2024-03-12 成都电科星拓科技有限公司 Chip conversion time violation repairing method and device, electronic equipment and storage medium
CN117688893B (en) * 2024-02-01 2024-04-26 成都电科星拓科技有限公司 Chip conversion time violation repairing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN117112475B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
CN117112475B (en) I2C bus driving capability automatic regulating system and method
US20210194758A1 (en) Distributed system of home device controllers
CN103259999B (en) HPD signal output control method, HDMI receiving device and system
CN109346014B (en) Virtual reality equipment and screen control method thereof
EP3310133A1 (en) Led driver, lighting device and led based lighting application
CN111965989B (en) System updating method and device, intelligent home control panel and storage medium
CN111651133A (en) Intelligent control display system and control method
CN105573664A (en) Multi-channel memory system and related power management method
CN110223652B (en) Time schedule controller control method, time schedule controller and drive circuit
CN111131720A (en) Television control method, television and storage medium
WO2015096200A1 (en) Led backlight drive circuit and drive method therefor
CN103957625A (en) Method for adjusting brightness of indicator lamp
CN105869607A (en) Backlight brightness regulation method and device
CN113805051B (en) Switch performance testing method and device, electronic equipment and storage medium
CN110377550A (en) A kind of method and computer equipment for realizing display warm connection function
CN114466479A (en) LED power supply output power adjusting method and LED power supply
CN111818695B (en) Control system, method and display module
CN212906266U (en) Intelligent control display system
US9661723B2 (en) Method for controlling lighting element and associated system
CN104868509A (en) Control method and external battery
US20220261055A1 (en) Electronic device and method for controlling the electronic device
EP2911481B1 (en) Method and device for calibrating a dimmer controller
CN109537178A (en) A kind of control function automatic switchover system, sewing machine control and sewing machine
TWI775095B (en) Display device and dynamic power distribution method
CN218678848U (en) Display device and power supply circuit

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant