Device address processing method and electronic device

By using the data bus, clock bus, power line and ground line on the IIC bus as the address interface signal source, and using the feedback module, counting comparison module and decoding judgment module to determine the slave address, the device address setting in the existing technology is solved. The problem of small range enables effective addressing and data reception of multiple slave machines.

CN118503168BActive Publication Date: 2024-10-15成都星拓微电子科技股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410955746.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-15
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

In the existing technology, the number of IIC bus device address interfaces is limited, and it is impossible to allocate enough device addresses to multiple slaves. As a result, it is not suitable for applications that need to connect multiple slaves in low-rate communication scenarios in mobile devices and desktop computer systems. scene.

Method used

By introducing the data bus, clock bus, power line and ground line on the bus between the master and the slave as the address interface signal source, the broadcast target data signal is used and the slave is determined through the feedback module, counting comparison module and decoding judgment module. address to achieve a larger address range setting.

Benefits of technology

With the same number of address interfaces, the setting range of slave addresses is expanded, so that more slave devices can be addressed on the IIC bus, which improves the expansion capabilities of electronic devices and the ability to receive data signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503168B_ABST
    Figure CN118503168B_ABST
Patent Text Reader

Abstract

The present invention provides a device address processing method and an electronic device, the method is applied to an electronic device, the electronic device includes a host, multiple slaves and a bus, the host and each slave are connected to a data bus and a clock bus in the bus, the signal source of the first interface and the second interface of each slave includes: a data bus, a clock bus, a power line or a ground line, the method includes: the host broadcasts a target data signal containing a receiver address to each slave, the target slave determines whether to process the target data signal according to the receiver address and the signal source connected to the first interface and the second interface of the target slave, and if so, the target slave processes the target data signal. The present invention increases the slave address setting range by accessing the arrangement and combination of the signal source through the first interface and the second interface under the same number of address interfaces as in the prior art, so that more slave devices can be connected to the bus and process the target data signal sent by the host.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a device address processing method and electronic equipment. Background Art

[0002] The Inter-Integrated Circuit (IIC) is a serial half-duplex communication bus protocol used for low-speed communication in mobile devices and desktop computer systems. The purpose of the IIC bus is to control devices on the motherboard and collect corresponding information through a cheap and powerful bus consisting of two lines. The IIC bus is a multi-directional control bus. Multiple slaves can be mounted on a bus controlled by a host at the same time. Each device connected to the bus communicates with the device through a unique device address. The I2C serial bus generally includes two signal lines, one is a bidirectional data signal line (Serial Data, SDA), and the other is a clock signal line (Serial Clock, SCL). Among them, the SDA of each device is connected to the SDA of the bus, and the SCL of each device is connected to the SCL of the bus. When each slave is connected to the bus, an address needs to be assigned to each slave.

[0003] In the prior art, the method of connecting a slave to a bus and assigning an address to the slave is: connecting a power line and a ground line to the slave, and assigning an address to the slave according to the arrangement and combination of the connected power line and the connected ground line. Specifically, the slave address set through the IIC bus is usually 7 bits, of which some bits are fixed values, and the other bits need to be determined by the level of the address interface. At this time, if a slave has two address interfaces, the address interface can only assign the following device addresses to the slave based on the type of accessible signal source: 00, 01, 10 and 11.

[0004] However, in low-speed communication scenarios in mobile devices and desktop computer systems, a host may need to control multiple slaves, so more device addresses need to be allocated to the slaves. In the case of a limited number of slave address interfaces, the prior art can only set a limited number of slave addresses through the arrangement and combination of power lines and ground lines. Specifically, if a slave has two address interfaces, only a maximum of 4 slave addresses can be set. Therefore, the address setting range is small and cannot be applied to application scenarios that require connecting multiple slaves. Summary of the invention

[0005] The purpose of the present invention is to provide a device address processing method and an electronic device to solve the problem of a small setting range of slave addresses in the prior art, in view of the above-mentioned deficiencies in the prior art.

[0006] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0007] In a first aspect, the present invention provides a device address processing method, which is applied to an electronic device, wherein the electronic device includes a host, a plurality of slaves, and a bus, wherein the bus includes: a data bus and a clock bus, wherein the host and each of the slaves are connected to the data bus and the clock bus; the host stores the address of each slave, and the signal source connected to the first interface of each slave and the signal source connected to the second interface include: the data bus, the clock bus, a power line, or a ground line;

[0008] The method comprises:

[0009] The host broadcasts a target data signal to each slave through the bus, wherein the target data signal includes a receiver address, and the receiver address is an address of a target slave;

[0010] The target slave determines whether to process the target data signal according to the receiver address in the target data signal and the signal source connected to the first interface and the signal source connected to the second interface of the target slave;

[0011] If so, the target slave processes the target data signal.

[0012] Optionally, the host broadcasts a target data signal to each slave via the bus, including:

[0013] The host sends a start data signal in the data bus, generates the target data signal according to the address of the target slave after sending the start data signal, and broadcasts the target data signal through the data bus.

[0014] Optionally, the target slave includes a feedback module, a counting and comparison module and a decoding and judgment module;

[0015] The target slave determines whether to process the target data signal according to the receiver address in the target data signal and the signal source connected to the first interface and the signal source connected to the second interface of the target slave, including:

[0016] The feedback module is connected to the clock signal transmitted by the clock bus and the target data signal transmitted by the data bus. The feedback module samples the target data signal at the rising edge of each clock signal to obtain the receiver address, and sends the receiver address to the decoding judgment module;

[0017] The counting and comparing module receives an interface signal, wherein the interface signal includes the clock signal, the target data signal, a first signal connected to the first interface, and a second signal connected to the second interface; the counting and comparing module counts based on a falling edge of the interface signal, determines a signal source connected to the first interface and a signal source connected to the second interface according to the counting result, and sends the signal source connected to the first interface and the signal source connected to the second interface to the decoding judgment module;

[0018] The decoding judgment module determines the address to be judged according to the signal source connected to the first interface and the signal source connected to the second interface, and determines to process the target data signal if the address to be judged is equal to the receiver address.

[0019] Optionally, the counting and comparing module comprises: a counting submodule and a comparing submodule;

[0020] The counting comparison module counts based on the falling edge of the interface signal, and determines the signal source connected to the first interface and the signal source connected to the second interface according to the counting result, including:

[0021] The counting submodule counts based on the falling edge of the interface signal, and sends the counting result to the comparison submodule, wherein the counting result includes: a first counting signal, a second counting signal, a clock counting signal and a data counting signal;

[0022] The comparison submodule compares the counting result with the first signal and the second signal respectively to determine the signal source connected to the first interface and the signal source connected to the second interface.

[0023] Optionally, the counting submodule includes: a first counting unit, a second counting unit, a third counting unit and a fourth counting unit;

[0024] The counting submodule counts based on the falling edge of the interface signal, including:

[0025] The first counting unit receives the clock signal, counts the falling edges of the clock signal according to a preset number of counting bits, generates a clock counting signal, and sends the clock counting signal to the comparison submodule, generates a counting stop signal when the clock counting signal is equal to the preset number of counting bits plus one, and sends the counting stop signal to the second counting unit, the third counting unit, and the fourth counting unit;

[0026] The second counting unit receives the target data signal, and before receiving the counting stop signal, counts the falling edges of the target data signal, generates a data counting signal and sends it to the comparison submodule;

[0027] The third counting unit receives the first signal, and before receiving the counting stop signal, counts the falling edges of the first signal, generates a first counting signal and sends it to the comparison submodule;

[0028] The fourth counting unit receives the second signal, and before receiving the counting stop signal, counts the falling edges of the second signal, generates a second counting signal, and sends it to the comparison submodule.

[0029] Optionally, the comparison submodule includes: a first comparison unit and a second comparison unit;

[0030] The comparing submodule compares the counting result with the first signal and the second signal respectively to determine the signal source connected to the first interface and the signal source connected to the second interface, including:

[0031] The first comparison unit receives the clock count signal, the data count signal, the first count signal and the first signal, compares the first count signal with the clock count signal, the data count signal and the first signal respectively, and determines the signal source connected to the first interface;

[0032] The second comparison unit receives the clock count signal, the data count signal, the second count signal and the second signal, compares the second count signal with the clock count signal, the data count signal and the second signal respectively, and determines the signal source connected to the second interface.

[0033] Optionally, comparing the first counting signal with the clock counting signal, the data counting signal and the first signal respectively to determine a signal source connected to the first interface includes:

[0034] Determine whether the first counting signal is equal to the clock counting signal, and if so, determine that the signal source connected to the first interface is a clock bus;

[0035] If not, determining whether the first counting signal is equal to the data counting signal, and if so, determining that the signal source connected to the first interface is a data bus;

[0036] If not, determine whether the first counting signal is 0; if it is 0, determine whether the first signal is 0; if the first signal is 0, the signal source connected to the first interface is a ground line;

[0037] If the first signal is 1, the signal source connected to the first interface is a power line.

[0038] Optionally, before the target slave processes the target data signal, the method further includes:

[0039] If it is determined that the address to be determined is equal to the receiver address, the target slave sends a positive feedback signal to the host, otherwise it sends a negative feedback signal.

[0040] Optionally, after obtaining the recipient address, the method further includes:

[0041] It is determined whether the address of the receiver is a preset invalid address, and if so, a negative feedback signal is sent to the host.

[0042] In a second aspect, the present invention provides an electronic device, the electronic device comprising a host, a plurality of slaves and a bus, the bus comprising: a data bus and a clock bus, the host and each of the slaves are connected to the data bus and the clock bus, the host stores the address of each slave, and the signal source connected to the first interface of each slave and the signal source connected to the second interface include: the data bus, the clock bus, a power line or a ground line;

[0043] The electronic device is used to execute the steps of the method described in the first aspect to perform device address processing.

[0044] The beneficial effect of the present invention is that the signal source connected to the first interface of each slave and the signal source connected to the second interface include a data bus, a clock bus, a power line or a ground line. Therefore, under the same number of address interfaces as in the prior art, 16 slaves can be set by the arrangement and combination of the first interface and the second interface to access the signal source. Compared with the prior art, which can only set 4 slaves, the range of the slave address set in this embodiment is increased, and more slave devices can be addressed on the IIC bus, and then, more slave devices can receive and process the target data signal sent by the host. Further, the host broadcasts the target data signal containing the receiver address to each slave, and the target slave determines whether to process the target data signal according to the receiver address and the signal source connected to the first interface of the target slave and the signal source connected to the second interface. If so, the target slave processes the target data signal. In this process, when the number of slave pins is limited, more slave devices are connected to the bus to receive and process the target data signal, thereby improving the expansion capability of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0046] Figure 1 It is a schematic diagram of a slave connection structure in the prior art;

[0047] Figure 2 This is a schematic diagram of a slave connection structure proposed by the present invention;

[0048] Figure 3 It is a flow chart of a device address processing method provided by the present invention;

[0049] Figure 4 It is a schematic diagram for comparing target slave signal waveforms provided by the present invention;

[0050] Figure 5 is a structural schematic diagram of a target slave proposed by the present invention;

[0051] Figure 6 It is a structural schematic diagram of a counting comparison module provided by the present invention;

[0052] Figure 7 It is a structural schematic diagram of a counting submodule provided by the present invention;

[0053] Figure 8 It is a structural schematic diagram of a comparison submodule provided by the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described in conjunction with the drawings in the embodiment of the present invention. It should be understood that the drawings in the present invention only serve the purpose of illustration and description and are not used to limit the scope of protection of the present invention. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowcharts used in the present invention illustrate the operations implemented according to some embodiments of the present invention. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, under the guidance of the content of the present invention, those skilled in the art can add one or more other operations to the flowchart, or remove one or more operations from the flowchart.

[0055] In addition, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.

[0056] It should be noted that the term “comprising” will be used in the embodiments of the present invention to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0057] IIC is a serial half-duplex communication bus protocol used for low-speed communication in mobile devices and desktop computer systems. The integrated circuit bus is designed to control devices on the motherboard and collect corresponding information through a cheap and powerful bus consisting of two lines. The IIC bus is a multi-directional control bus. Multiple slaves can be mounted on a host-controlled bus at the same time. Each device connected to the bus communicates with the device through a unique device address. The I2C serial bus generally includes two signal lines, one is the bidirectional SDA and the other is SCL. Among them, the SDA of each device is connected to the SDA of the bus, and the SCL of each device is connected to the SCL of the bus. When each slave is connected to the bus, an address needs to be assigned to each slave.

[0058] In the prior art, the method of connecting a slave to a bus and assigning an address to the slave is: connecting a power line and a ground line to the slave, and assigning an address to the slave according to the arrangement and combination of the connected power line and the connected ground line. Specifically, the slave address set through the IIC bus is usually 7 bits, of which some bits are fixed values, and the other bits need to be determined by the level of an additional address interface, such as connecting two address interfaces to the power line and the ground line respectively, so as to determine that the last two bits of the slave address are 0 or 1 respectively.

[0059] For example, Figure 1 The following is a schematic diagram of a slave connection structure in the prior art. Figure 1The invention comprises a host, a first slave s1, a second slave s2, a third slave s3, a fourth slave s4 and a bus, wherein a data interface sda0 and a clock interface scl0 in each slave are connected to a data bus SDA0 and a clock bus SCL0 in the bus, an existing first interface a1 of the first slave s1 is connected to a power line VDD0, an existing second interface a2 of the first slave s1 is connected to a ground line GND0, and the address of the first slave s1 may be 2'b10, an existing first interface a1 and an existing second interface a2 of the second slave s2 are both connected to a power line VDD0, and the address of the second slave s2 may be 2'b11, an existing first interface a1 and an existing second interface a2 of the third slave s3 are both connected to a ground line GND0, and the address of the third slave s3 may be 2'b00, an existing first interface a1 of the fourth slave s4 is connected to a ground line GND0, an existing second interface a2 of the fourth slave s4 is connected to a power line VDD0, and the address of the fourth slave s4 may be 2'b01.

[0060] In summary, Figure 1 The existing first interface a1 and the existing second interface a2 of the address interface of the slave can only be connected to the power line VDD0 and the ground line GND0, so only four slave addresses can be set, and the address range is small.

[0061] Based on this, the present invention proposes a device address processing method, which is applied to an electronic device, wherein the signal source connected to the first interface of the slave included in the electronic device and the signal source connected to the second interface include: a data bus, a clock bus, a power line and a ground line. Therefore, according to the arrangement and combination of the data bus, the clock bus, the power line and the ground line, 16 slave addresses can be set in advance and stored in the host, and the host broadcasts the target data signal containing the address of the target slave to each slave through the bus, and the target slave determines whether to process the target data signal according to the address of the target slave and the signal source connected to the first interface of the target slave and the signal source connected to the second interface. If so, the target slave processes the target data signal. Since the first interface and the second interface as the address interface in each slave can be connected to the data bus, the clock bus, the power line and the ground line respectively, the slave can be assigned 16 addresses. Compared with the prior art, under the condition of the same number of address interfaces, the range of the slave address set by the present invention is increased, more IIC devices can be addressed on the IIC bus, and then more slave devices can receive and process the target data signal sent by the host.

[0062] For example, Figure 2 Schematic diagram of a slave connection structure proposed by the present invention. Figure 2In the embodiment, the data interface sda ​​and the clock interface scl of each slave are connected to the data bus SDA and the clock bus SCL in the bus. The first interface A1 and the second interface A2 of each slave can be connected not only to the power line VDD and the ground line GND, but also to the clock bus SCL and the address bus SDA. Based on the arrangement and combination of the four lines of the data bus, clock bus, power line and ground line connected to each slave address interface, the address interface mapping relationship table can also be pre-set and generated, as shown in Table 1. Among them, Figure 2 The slaves are S1, S2, S3, S4, S5, S6 and S16, and the number of slaves is 16.

[0063] Table 1 The mapping relationship between the signal source connected to each address interface of the slave and the slave address

[0064]

[0065] The mapping relationship table shown in Table 1 is stored in the host, and the slave circuit is set according to the mapping relationship table, so that the slave can determine the address of the local machine according to the signal source connected to the address interface.

[0066] Next, refer to Figure 2 The device address processing method in the present invention is introduced. The method is applied to an electronic device, which includes a host, multiple slaves and a bus. The bus includes: a data bus SDA and a clock bus SCL. The host and each slave are connected to the data bus SDA and the clock bus SCL. The host stores the address of each slave. The signal source connected to the first interface A1 of each slave and the signal source connected to the second interface A2 include: a data bus SDA, a clock bus SCL, a power line VDD or a ground line GND. It is worth mentioning that the number of address interfaces of the slaves in the electronic device is not limited to 2 in the example of the present invention, namely the first interface A1 and the second interface A2. If the number of address interfaces is more, more slave addresses can be set.

[0067] The host and the slave may be chips in an electronic device, and the host may send a data signal to each slave so that a target slave receives and processes the data signal.

[0068] Figure 3 FIG. 1 is a flow chart of a device address processing method provided by the present invention. Figure 3 As shown, the device address processing method includes:

[0069] 301. The host broadcasts a target data signal to each slave through a bus. The target data signal includes a receiver address, and the receiver address is the address of the target slave.

[0070] The first 7 bits in the target data signal are the receiver address, and a chip read / write control bit is included after the receiver address.

[0071] It is worth mentioning that the target slave is one of the multiple slaves connected to the bus.

[0072] 302. The target slave determines whether to process the target data signal according to the receiver address in the target data signal and the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2 of the target slave.

[0073] It should be understood that the waveform of the signal received by the first interface A1 and the second interface A2 of the target slave is consistent with the waveform of the connected signal source. Specifically, Figure 4 1 is a schematic diagram of target slave signal waveform comparison provided by the present invention. Figure 4 As shown, if the first interface A1 of the target slave is connected to the clock bus SCL, the waveform of the signal received by the first interface A1 is the same as the waveform of the clock signal transmitted on the clock bus SCL, if the first interface A1 of the target slave is connected to the data bus SDA, the waveform of the signal received by the first interface A1 is the same as the waveform of the data signal transmitted on the data bus SDA, if the first interface A1 of the target slave is connected to the power line VDD, the waveform of the signal received by the first interface A1 is a continuous high level, if the first interface A1 of the target slave is connected to the ground line GND, the waveform of the signal received by the first interface A1 is a continuous low level. The same is true for the second interface A2 of the target slave.

[0074] Furthermore, the target slave machine can determine the signal source connected to the first interface A1 based on the waveform of the signal connected to the first interface A1, and determine the signal source connected to the second interface A2 based on the waveform of the signal connected to the second interface A2, thereby determining the address of the local machine based on the circuit structure of the slave machine itself, and determining whether to process the target data signal based on the address of the local machine and the address of the recipient.

[0075] It is worth mentioning that, before the slave leaves the factory, the circuit structure is set so that the slave can determine the address of the slave according to the data source connected to the interface. In the prior art, another method of connecting the slave to the bus and assigning an address to the slave is to integrate a non-volatile storage unit in the chip, write the slave address to the non-volatile storage unit through the IIC interface after the chip is produced, and enable the slave address during normal IIC communication. Therefore, the method in this embodiment can avoid the use of a non-volatile unit, thereby saving costs.

[0076] 303. If yes, the target slave processes the target data signal.

[0077] Specifically, if the local address of the target slave is the same as the receiver address, the target slave can process the target data signal. As an optional implementation, the target slave receives and processes the data after the receiver address in the target data signal.

[0078] If not, the target data signal sent by the host is not processed by the target slave, so the target slave does not process the target data signal.

[0079] In this embodiment, the signal source connected to the first interface of each slave and the signal source connected to the second interface include a data bus, a clock bus, a power line or a ground line. Therefore, under the same number of address interfaces as in the prior art, 16 slaves can be set by the arrangement and combination of the first interface and the second interface to access the signal source. Compared with the prior art, which can only set 4 slaves, the range of the slave address set in this embodiment is increased, and more slave devices can be addressed on the IIC bus, and then, more slave devices can receive and process the target data signal sent by the host. Further, the host broadcasts the target data signal containing the receiver address to each slave, and the target slave determines whether to process the target data signal according to the receiver address and the signal source connected to the first interface of the target slave and the signal source connected to the second interface. If so, the target slave processes the target data signal. In this process, when the number of slave pins is limited, more slave devices are connected to the bus to receive and process the target data signal, thereby improving the expansion capability of the electronic device.

[0080] It is worth mentioning that the method of expanding the address range in the prior art is usually: based on the power line and the ground line, the voltage is divided by the voltage comparison circuit, so as to generate a variety of analog signals as the signal source of the first interface and the second interface, so as to achieve the expansion of the slave address. In this embodiment, in addition to using the power line and the ground line as the signal source for the first interface and the second interface of the slave, the existing clock bus and data bus are also used as the signal source of the first interface and the second interface of the slave. Compared with the prior art, this embodiment avoids using the circuit for voltage division such as the voltage comparison circuit as the signal source, thereby reducing the size and cost of the electronic device, and the circuit connection is simple.

[0081] As an optional implementation, the specific implementation of the host broadcasting the target data signal to each slave through the bus in the above step 301 is as follows:

[0082] Optionally, the host sends a start data signal start in the data bus SDA, generates a target data signal according to the address of the target slave after sending the start data signal start, and broadcasts the target data signal through the data bus SDA.

[0083] Among them, when the IIC interface starts to communicate, the host pulls down the level of the data signal in the data bus SDA and uses it as the start data signal start. After the start data signal start is issued, the target data signal is generated according to the address of the target slave. Specifically, a target data signal including a 7-bit address of the target slave and a chip read / write control bit is generated, and then the target data signal is broadcast through the data bus SDA. After the start data signal start, each slave starts to determine whether to process the target data signal.

[0084] It is worth mentioning that after the host broadcasts the target data signal, it is necessary to receive the feedback signal from each slave at the A / NA position to confirm whether the target data signal is received and processed.

[0085] In this embodiment, the host sends a start data signal in the data bus, generates a target data signal according to the address of the target slave after sending the start data signal, and broadcasts the target data signal through the data bus, thereby starting the process of the slave determining whether to process the target data signal through the start data signal.

[0086] After introducing the overall process of the device address processing method, the following will introduce the process of how the target slave determines whether to process the target data signal.

[0087] Figure 5 Schematic diagram of the structure of a target slave proposed by the present invention. Figure 5 As shown, the target slave includes a feedback module 501, a counting comparison module 502 and a decoding judgment module 503. Based on the structure of the target slave, the specific steps of determining whether to process the target data signal Sda in step 302 include:

[0088] Optionally, the feedback module 501 is connected to the clock signal Scl transmitted by the clock bus SCL, and is connected to the target data signal Sda transmitted by the data bus SDA. The feedback module 501 samples the target data signal Sda at the rising edge of each clock signal Scl, obtains the receiver address, and sends the receiver address to the decoding judgment module 503.

[0089] Specifically, after receiving the start data signal start transmitted from the data bus SDA, the feedback module 501 receives the clock signal Scl transmitted by the clock bus SCL and the target data signal Sda transmitted by the data bus SDA.

[0090] As an optional implementation, the feedback module 501 samples the target data signal Sda at each rising edge of the clock signal Scl based on a preset count bit number. The preset count bit number is the same as the address bit number of the target slave. That is, if the address of the target slave is 7 bits, the preset count bit number is 7 bits.

[0091] After sampling the levels of the target data signal Sda for a preset number of count bits, the feedback module 501 generates a receiver address and sends the receiver address to the decoding judgment module 503 so that the decoding judgment module 503 can determine whether to process the target data signal Sda according to the receiver address and the local address.

[0092] Optionally, the counting and comparison module 502 receives an interface signal, the interface signal including a clock signal Scl, a target data signal Sda, a first signal Aa1 connected to the first interface A1, and a second signal Aa2 connected to the second interface A2. The counting and comparison module 502 counts based on the falling edge of the interface signal, determines the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2 according to the counting result, and sends the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2 to the decoding judgment module 503.

[0093] The counting and comparing module 502 receives the clock signal Scl connected to the clock interface scl, receives the target data signal Sda connected to the data interface sda, the first signal Aa1 connected to the first interface A1 and the second signal Aa2 connected to the second interface A2.

[0094] The counting comparison module 502 counts based on the falling edge of each interface signal and the preset counting bit number, and determines the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2 according to the counting result. Specifically, since the waveform of the signal received by each interface is the same as the waveform of the signal transmitted by the connected signal source, the signal source C2 connected to the first interface A1 and the second interface A2 is determined by comparing the counting result and the access signal.

[0095] Optionally, the decoding determination module 503 determines the address to be determined according to the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2, and determines to process the target data signal Sda if the address to be determined is equal to the receiver address.

[0096] Specifically, after the decoding judgment module 503 determines the signal source C2 connected to the first interface A1 and the second interface A2, it determines the addresses corresponding to the two connected signal sources through its own circuit structure and uses the address as the local address, that is, the address to be determined.

[0097] As an optional implementation, if the address to be determined is not equal to the recipient address, the target data signal Sda is not processed.

[0098] In this embodiment, the target slave includes a feedback module, a counting comparison module, and a decoding judgment module, wherein the feedback module samples the target data signal to obtain the receiver address and sends it to the decoding judgment module, the counting comparison module receives the interface signal and counts, determines the signal source connected to the first interface and the second interface by comparing the counting result with the interface signal, and sends the signal source to the decoding judgment module, and the decoding judgment module determines the address to be determined according to the received signal source, and determines to process the target data signal if the address to be determined is equal to the receiver address. In this embodiment, the feedback module, the counting comparison module, and the decoding judgment module determine whether to process the target data signal, so that when multiple slaves are connected to the bus, each slave determines whether to process the target data signal through the connected signal source.

[0099] After introducing the structure of the target slave and the device address processing method, the structure and processing process of the counting comparison module 502 in the target slave are further introduced. Figure 6 Schematic diagram of the structure of a counting comparison module provided by the present invention. Figure 6 As shown, the counting and comparing module 502 includes: a counting submodule 601 and a comparing submodule 602 .

[0100] The counting submodule 601 is used to count the signal waveforms received by each interface of the target slave. The comparison submodule 602 is used to receive the result of the counting submodule 601, and compare the counting result with the interface signal to determine the signal source connected to the first interface A1 and the second interface A2 of the target slave. The specific implementation method is as follows:

[0101] Optionally, the counting submodule 601 counts based on the falling edge of the interface signal and sends the counting result to the comparison submodule 602, where the counting result includes: a first counting signal Aa1-c, a second counting signal Aa2-c, a clock counting signal Scl-c and a data counting signal Sda-c.

[0102] Specifically, the counting submodule 601 counts the falling edges of the clock signal Scl, the target data signal Sda, the first signal Aa1 connected to the first interface A1, and the second signal Aa2 connected to the second interface A2 until the number of falling edges of the clock signal Scl reaches a preset number of counting bits, and the number of falling edges of each signal is used as the counting result.

[0103] Optionally, the comparison submodule 602 compares the counting result with the first signal Aa1 and the second signal Aa2 respectively to determine the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2.

[0104] The comparison submodule 602 compares the counting result with the first signal Aa1 to determine the signal source C1 connected to the first interface A1, and compares the counting result with the second signal Aa2 to determine the signal source C2 connected to the second interface A2.

[0105] In this embodiment, the counting comparison module includes a counting submodule and a comparing submodule. The counting submodule sends the counting result to the comparing submodule, and the comparing submodule compares the counting result with the first signal and the second signal respectively, so as to determine the signal source connected to each interface. In this embodiment, the signal source connected to each interface is determined by counting each access signal in a low-cost manner, so as to determine the address to be determined, thereby realizing low-cost device address processing, and the algorithm logic is simple and easy to implement.

[0106] After introducing the structure and processing method of the counting comparison module 502, the structure and processing process of the counting submodule 601 in the counting comparison structure are further introduced. Figure 7 Schematic diagram of the structure of a counting submodule provided by the present invention. Figure 7 As shown, the counting submodule 601 includes: a first counting unit 701 , a second counting unit 702 , a third counting unit 703 and a fourth counting unit 704 .

[0107] The steps of the counting submodule 601 for counting based on the falling edge of the interface signal are specifically as follows:

[0108] Optionally, the first counting unit 701 receives the clock signal Scl, and counts the falling edges of the clock signal Scl according to a preset number of counting bits, generates a clock counting signal Scl-c, and sends the clock counting signal Scl-c to the comparison submodule 602. When the clock counting signal Scl-c is equal to the preset number of counting bits plus one, a counting stop signal is generated, and the stop signal is sent to the second counting unit 702, the third counting unit 703 and the fourth counting unit 704.

[0109] Specifically, after receiving the start data signal start, the first counting unit 701 resets the count to zero, and starts counting the falling edges of the clock signal Scl according to a preset number of count bits to generate a clock counting signal Scl-c.

[0110] If the address of the target slave is 7 bits, the preset counting bit number is 7 bits. When the clock counting signal Scl-c indicates 8 falling edges, a counting stop signal is generated, so that the second counting unit 702, the third counting unit 703 and the fourth counting unit 704 stop counting after receiving the stop signal.

[0111] As an optional implementation, the second counting unit 702, the third counting unit 703 and the fourth counting unit 704 are provided with a stop counting interface for receiving a stop signal. The first counting unit 701 can send a stop signal by pulling up the level.

[0112] Optionally, the second counting unit 702 receives the target data signal Sda, and before receiving the stop signal, counts the falling edges of the target data signal Sda, generates a data counting signal Sda-c, and sends it to the comparison submodule 602 .

[0113] Optionally, the third counting unit 703 receives the first signal Aa1 and counts falling edges of the first signal Aa1 before receiving the counting stop signal, generates a first counting signal Aa1 - c and sends it to the comparison submodule 602 .

[0114] Optionally, the fourth counting unit 704 receives the second signal Aa2 and counts falling edges of the second signal Aa2 before receiving the counting stop signal, generates a second counting signal Aa2 - c and sends it to the comparison submodule 602 .

[0115] It is worth noting that if the signal source connected to the address interface is the ground line GND, the count value is 0.

[0116] In this embodiment, the counting submodule includes a first counting unit, a second counting unit, a third counting unit and a fourth counting unit. The first counting unit counts the falling edges of the clock signal and generates a counting stop signal to send to the second counting unit, the third counting unit and the fourth counting unit. The second counting unit, the third counting unit and the fourth counting unit respectively count the falling edges of the target data signal, the first signal and the second signal based on the stop signal, thereby counting each interface in a low-cost manner.

[0117] After introducing the structure and processing method of the counting submodule 601, the structure and processing process of the comparison submodule 602 in the counting comparison structure will be introduced next. Figure 8 Schematic diagram of the structure of a comparison submodule provided by the present invention. Figure 8 As shown, the comparison submodule 602 includes: a first comparison unit 801 and a second comparison unit 802 .

[0118] The specific process of the comparison submodule 602 comparing the counting result with the first signal Aa1 and the second signal Aa2 respectively to determine the signal source C1 connected to the first interface A1 and the signal source C2 connected to the second interface A2 includes:

[0119] Optionally, the first comparison unit 801 receives the clock counting signal Scl-c, the data counting signal Sda-c, the first counting signal Aa1-c and the first signal Aa1, compares the first counting signal Aa1-c with the clock counting signal Scl-c, the data counting signal Sda-c and the first signal Aa1 respectively, and determines the signal source C1 connected to the first interface A1.

[0120] Specifically, if the first counting signal Aa1-c is equal to the clock counting signal Scl-c, it means that the first interface A1 is connected to the clock bus SCL; if the first counting signal Aa1-c is equal to the data counting signal Sda-c, it means that the first interface A1 is connected to the data bus SDA; otherwise, the signal source C1 connected to the first interface A1 is determined according to the value of the first signal Aa1: if the first signal Aa1 is 0, it means that the first interface A1 is connected to the ground line GND; if the first signal Aa1 is 1, it means that the first interface A1 is connected to the power line VDD.

[0121] Optionally, the second comparison unit 802 receives the clock counting signal Scl-c, the data counting signal Sda-c, the second counting signal Aa2-c and the second signal Aa2, compares the second counting signal Aa2-c with the clock counting signal Scl-c, the data counting signal Sda-c and the second signal Aa2, and determines the signal source C2 connected to the second interface A2.

[0122] Specifically, if the second counting signal Aa2-c is equal to the clock counting signal Scl-c, it means that the second interface A2 is connected to the clock bus SCL; if the second counting signal Aa2-c is equal to the data counting signal Sda-c, it means that the second interface A2 is connected to the data bus SDA; otherwise, the signal source C2 connected to the second interface A2 is determined according to the value of the second signal Aa2: if the second signal Aa2 is 0, it means that the second interface A2 is connected to the ground line GND; if the second signal Aa2 is 1, it means that the second interface A2 is connected to the power line VDD.

[0123] In this embodiment, the first comparison unit and the second comparison unit respectively determine the signal sources connected to the first interface and the second interface, thereby efficiently and cost-effectively determining the address of the local device, and then determining whether to process the target data signal.

[0124] As an optional implementation manner, the specific process of the first comparison unit 801 determining the signal source C1 connected to the first interface A1 is as follows:

[0125] It is determined whether the first counting signal Aa1-c is equal to the clock counting signal Scl-c. If so, it is determined that the signal source C1 connected to the first interface A1 is the clock bus SCL.

[0126] If not, it is determined whether the first counting signal Aa1-c is equal to the data counting signal Sda-c. If so, it is determined that the signal source C1 connected to the first interface A1 is the data bus SDA.

[0127] If not, it is determined whether the first counting signal Aa1 - c is 0. If it is 0, it is determined whether the first signal Aa1 is 0. If the first signal Aa1 is 0, the signal source C1 connected to the first interface A1 is the ground line GND.

[0128] If the first signal Aa1 is 1, the signal source C1 connected to the first interface A1 is the power line VDD.

[0129] It should be understood that the first signal Aa1 being 0 may indicate that the first signal Aa1 is a low level signal. The first signal Aa1 being 1 may indicate that the first signal Aa1 is a high level signal. The second signal Aa2 is the same as above and will not be described in detail here.

[0130] As an optional implementation manner, the specific process of the second comparison unit 802 determining the signal source C2 connected to the second interface A2 is as follows:

[0131] It is determined whether the second counting signal Aa2-c is equal to the clock counting signal Scl-c. If so, it is determined that the signal source C2 connected to the second interface A2 is the clock bus SCL.

[0132] If not, it is determined whether the second counting signal Aa2-c is equal to the data counting signal Sda-c. If so, it is determined that the signal source C2 connected to the second interface A2 is the data bus SDA.

[0133] If not, it is determined whether the second counting signal Aa2-c is 0. If it is 0, it is determined whether the second signal Aa2 is 0. If the second signal Aa2 is 0, the signal source C2 connected to the second interface A2 is the ground line GND.

[0134] If the second signal Aa2 is 1, the signal source C2 connected to the second interface A2 is the power line VDD.

[0135] It is worth mentioning that after the first comparison unit 801 and the second comparison unit 802 respectively determine the signal source C2 connected to the first interface A1 and the second interface A2, the comparison results can be sent to the decoding judgment module 503 through the first comparison result transmission line.

[0136] Specifically, a first clock comparison result transmission line A1-Scl, a first data comparison result transmission line A1-Sda, a first power comparison result transmission line A1-vvd, and a first ground comparison result transmission line A1-gnd are set between the first comparison unit 801 and the decoding judgment module 503. The first comparison unit 801 pulls up the corresponding first comparison result transmission line according to the signal source C1 connected to the first interface A1. Exemplarily, if the first comparison unit 801 determines that the signal source C1 connected to the first interface A1 is the data bus SDA, the first data comparison result A1-Sda transmission line is pulled up to a high level, and other first comparison result transmission lines remain at a low level.

[0137] A second clock comparison result transmission line A2-Scl, a second data comparison result transmission line A2-Sda, a second power comparison result transmission line A2-vvd and a second ground comparison result transmission line A2-gnd are arranged between the second comparison unit 802 and the decoding judgment module 503. The second comparison unit 802 pulls up the corresponding second comparison result transmission line according to the signal source C2 connected to the second interface A2.

[0138] In this embodiment, since the signal source that the first interface can access is changed from two signal sources in the prior art to four signal sources, the first comparison unit needs to determine the signal source accessed by the first interface in combination with the newly added clock signal and the target data signal, thereby determining the address to be determined and realizing device address processing. The second comparison unit is similar and will not be described in detail here.

[0139] As an optional implementation, in step 303, that is, before the target slave processes the target data signal Sda, the following steps may also be performed:

[0140] If it is determined that the address to be determined is equal to the receiver address, the target slave sends a positive feedback signal to the host, otherwise it sends a negative feedback signal.

[0141] Specifically, after the host sends the start data signal start, the target slave can determine whether the address to be determined is equal to the receiver address at the falling edge of the clock signal Scl of the preset count number of bits, and then send a feedback signal to the host at the A / NA bit.

[0142] The target slave can make a positive feedback signal by pulling down the data signal level in the data bus SDA. If a negative feedback signal needs to be sent, the data signal level in the data bus SDA is not pulled down.

[0143] In this embodiment, the target slave sends a positive feedback signal or a negative feedback signal to the host, so that the host confirms whether the target data signal is received and processed.

[0144] Furthermore, after the feedback module 501 obtains the address of the recipient, the following steps may be performed:

[0145] Optionally, it is determined whether the receiver address is a preset invalid address, and if so, a negative feedback signal is sent to the host.

[0146] The preset invalid address is a preset address that cannot be recognized by the target slave. Exemplarily, the preset invalid address may be 7'b000 0000 and 7'b111 1111. When the receiver address obtained by the feedback module 501 is the preset invalid address, a negative feedback signal is directly sent to the host.

[0147] In this embodiment, by determining whether the receiver address is a preset invalid address and sending a negative feedback signal to the host, the processing accuracy of the device is improved.

[0148] The embodiment of the present invention also provides an electronic device, the electronic device includes a host, multiple slaves and a bus, the bus includes: a data bus and a clock bus, the host and each slave are connected to the data bus and the clock bus, the host stores the address of each slave, the signal source connected to the first interface of each slave and the signal source connected to the second interface include: a data bus, a clock bus, a power line or a ground line. The electronic device is used to execute the steps of the above-mentioned device address processing method to perform device address processing.

[0149] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A device address processing method, characterized in that: Applied to an electronic device, the electronic device comprises a host, a plurality of slaves and a bus, the bus comprises: a data bus and a clock bus, the host and each of the slaves are connected to the data bus and the clock bus; the host stores the address of each slave, and the signal source connected to the first interface of each slave and the signal source connected to the second interface comprise: the data bus, the clock bus, a power line or a ground line; The method comprises: The host broadcasts a target data signal to each slave through the bus, wherein the target data signal includes a receiver address, and the receiver address is an address of a target slave; The target slave determines whether to process the target data signal according to the receiver address in the target data signal and the signal source connected to the first interface and the signal source connected to the second interface of the target slave; If yes, the target slave processes the target data signal; The target slave includes a feedback module, a counting and comparison module and a decoding and judgment module; The target slave determines whether to process the target data signal according to the receiver address in the target data signal and the signal source connected to the first interface and the signal source connected to the second interface of the target slave, including: The feedback module is connected to the clock signal transmitted by the clock bus and the target data signal transmitted by the data bus. The feedback module samples the target data signal at the rising edge of each clock signal to obtain the receiver address, and sends the receiver address to the decoding judgment module; The counting and comparing module receives an interface signal, wherein the interface signal includes the clock signal, the target data signal, a first signal connected to the first interface, and a second signal connected to the second interface; the counting and comparing module counts the falling edges of each of the interface signals respectively, determines the signal source connected to the first interface and the signal source connected to the second interface according to the counting result, and sends the signal source connected to the first interface and the signal source connected to the second interface to the decoding judgment module; The decoding judgment module determines the address to be judged according to the signal source connected to the first interface and the signal source connected to the second interface, and determines to process the target data signal if the address to be judged is equal to the receiver address; The counting and comparing module comprises: a counting submodule and a comparing submodule; The counting and comparison module counts the falling edges of each of the interface signals respectively, and determines the signal source connected to the first interface and the signal source connected to the second interface according to the counting result, including: The counting submodule counts based on the falling edge of the interface signal, and sends the counting result to the comparison submodule, wherein the counting result includes: a first counting signal, a second counting signal, a clock counting signal and a data counting signal; The comparison submodule compares the first counting signal in the counting result with the clock counting signal, the data counting signal and the first signal respectively to determine the signal source connected to the first interface, and compares the second counting signal in the counting result with the clock counting signal, the data counting signal and the second signal respectively to determine the signal source connected to the second interface.

2. The device address processing method according to claim 1, characterized in that: The host broadcasts a target data signal to each slave via the bus, including: The host sends a start data signal in the data bus, generates the target data signal according to the address of the target slave after sending the start data signal, and broadcasts the target data signal through the data bus.

3. The device address processing method according to claim 1, characterized in that: The counting submodule includes: a first counting unit, a second counting unit, a third counting unit and a fourth counting unit; The counting submodule counts based on the falling edge of the interface signal, including: The first counting unit receives the clock signal, counts the falling edges of the clock signal according to a preset number of counting bits, generates a clock counting signal, and sends the clock counting signal to the comparison submodule, generates a counting stop signal when the clock counting signal is equal to the preset number of counting bits plus one, and sends the counting stop signal to the second counting unit, the third counting unit, and the fourth counting unit; The second counting unit receives the target data signal, and before receiving the counting stop signal, counts the falling edges of the target data signal, generates a data counting signal and sends it to the comparison submodule; The third counting unit receives the first signal, and before receiving the counting stop signal, counts the falling edges of the first signal, generates a first counting signal and sends it to the comparison submodule; The fourth counting unit receives the second signal, and before receiving the counting stop signal, counts the falling edges of the second signal, generates a second counting signal, and sends it to the comparison submodule.

4. The device address processing method according to claim 3, characterized in that: The comparison submodule includes: a first comparison unit and a second comparison unit; The comparing submodule compares the counting result with the first signal and the second signal respectively to determine the signal source connected to the first interface and the signal source connected to the second interface, including: The first comparison unit receives the clock count signal, the data count signal, the first count signal and the first signal, compares the first count signal with the clock count signal, the data count signal and the first signal respectively, and determines the signal source connected to the first interface; The second comparison unit receives the clock count signal, the data count signal, the second count signal and the second signal, compares the second count signal with the clock count signal, the data count signal and the second signal respectively, and determines the signal source connected to the second interface.

5. The device address processing method according to claim 4, characterized in that: The comparing the first counting signal with the clock counting signal, the data counting signal and the first signal respectively to determine the signal source connected to the first interface includes: Determine whether the first counting signal is equal to the clock counting signal, and if so, determine that the signal source connected to the first interface is a clock bus; If not, determining whether the first counting signal is equal to the data counting signal, and if so, determining that the signal source connected to the first interface is a data bus; If not, determine whether the first counting signal is 0; if it is 0, determine whether the first signal is 0; if the first signal is 0, the signal source connected to the first interface is a ground line; If the first signal is 1, the signal source connected to the first interface is a power line.

6. The device address processing method according to claim 1, characterized in that: Before the target slave processes the target data signal, the method further includes: If it is determined that the address to be determined is equal to the receiver address, the target slave sends a positive feedback signal to the host, otherwise it sends a negative feedback signal.

7. The device address processing method according to claim 1, characterized in that: After obtaining the recipient address, the method further includes: It is determined whether the address of the receiver is a preset invalid address, and if so, a negative feedback signal is sent to the host.

8. An electronic device, characterized in that: The electronic device comprises a host, a plurality of slaves and a bus, wherein the bus comprises: a data bus and a clock bus, the host and each of the slaves are connected to the data bus and the clock bus, the host stores the address of each slave, and the signal source connected to the first interface of each slave and the signal source connected to the second interface comprise: the data bus, the clock bus, a power line or a ground line; The electronic device is used to execute the steps of any method as claimed in claims 1-7 to perform device address processing.