I2C bus system, abnormal device troubleshooting method
By introducing the first and second switches into the I2C bus system, combined with signal generation, transmission, recording and detection circuits, the accurate positioning and recovery of the faulty slave device is achieved, solving the problem of fault detection of the slave device in the I2C bus system, and expanding This reduces the number of slave devices in the system and avoids address conflicts.
Patent Information
- Application Number
- CN201810140705.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-02-11
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2038-02-11
AI Technical Summary
It is difficult to detect slave device faults in the I2C bus system, causing the system to fail to work properly, and existing technologies cannot effectively troubleshoot and solve faults.
An I2C bus system is designed, including a master device, a slave device, a first switch and a second switch. Through signal generation, sending, recording and detection circuits, the faulty slave device is determined, and the switch is controlled by disconnecting and restarting the signal to recover. communication.
It realizes self-detection and troubleshooting of the I2C bus system, can accurately locate and restore faulty slave devices, expands the number of slave devices, and avoids address conflicts.
Smart Images

Figure CN108073540B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fault troubleshooting technology, and more specifically, to an abnormal device troubleshooting method and related equipment. Background Art
[0002] At present, electronic products usually include an I2C bus system, which is responsible for connecting the main control device of the electronic product with various peripheral devices, and the main control device controls the peripheral devices. Specifically, the I2C bus system includes a master device and several slave devices. The master device is the main control device of the electronic product, and the slave device is the peripheral device of the electronic product. Figure 1 As shown, the master device can be specifically a microcontroller unit (MCU), and the slave device can be various, such as a temperature sensor, a gravity sensor, a photosensitive module, etc. The master device and the slave device are connected through an I2C bus.
[0003] A certain slave device(s) in the I2C bus system may fail, thus causing the entire I2C bus system to fail to work properly. Therefore, a detection method is needed to detect the failed slave devices in the I2C bus system. Summary of the invention
[0004] In view of this, the present application provides a faulty device troubleshooting apparatus for troubleshooting a faulty slave device in an I2C bus system.
[0005] To achieve the above objectives, the technical solutions provided by this application are as follows:
[0006] In a first aspect, the present application provides an I2C bus system, including a master device, N slave devices, N first switches and N second switches; wherein:
[0007] The master device is connected to the slave device via an I2C bus;
[0008] The first switch is connected in series on the I2C bus between the master device and the slave device;
[0009] A first end of the second switch is connected to the slave device, and a second end of the second switch is connected to a power source.
[0010] In one implementation, the first switch is connected to a bus control port I2C_SEL of the master device, and the second switch is connected to a power control port VDD_SEL of the master device.
[0011] In one implementation, the first switch and the second switch are switches in the form of triodes.
[0012] In one implementation, the master device includes a signal generating circuit, a signal sending circuit, a signal recording circuit and a detection circuit; wherein:
[0013] The signal generating circuit is used to generate a disconnection signal or a connection signal of the first switch and the second switch;
[0014] The signal sending circuit is used to send the disconnection signal or the connection signal;
[0015] The signal recording circuit is used to record which first switches the master device sends the connection signal to;
[0016] The signal detection circuit is used to detect the signal recording circuit to determine to which first switches the master device sends connection signals before a communication failure occurs between the master device and a slave device.
[0017] In a second aspect, the present application provides an abnormal device troubleshooting method, which is applied to a master device in an I2C bus system, wherein the I2C bus system includes a master device, N slave devices, and N first switches; wherein the master device is connected to each slave device via an I2C bus, and the first switch is connected in series to the I2C bus; the method includes:
[0018] When a communication failure occurs between the master device and a certain slave device, a slave device connected to the master device when the failure occurs is determined among N-1 slave devices other than the certain slave device;
[0019] Determining a disconnection sequence for the determined slave devices; and determining the first slave device as the current slave device according to the disconnection sequence;
[0020] Sending a disconnection signal to a first switch corresponding to the current slave device, and determining whether the communication between the master device and the certain slave device has returned to normal; wherein the disconnection signal is used to control the first switch to disconnect the slave device from the master device;
[0021] If yes, determining the current slave device as a faulty slave device;
[0022] If not, determine whether there is any slave device after the current slave device based on the disconnection order. If so, determine the slave device after the current slave device as the current slave device, and return to execute the step of sending a disconnect signal to the first switch corresponding to the current slave device; if not, determine the slave device as a faulty slave device.
[0023] In one implementation, the I2C bus system further includes N second switches, wherein the second switches are respectively connected to the slave device and the power supply;
[0024] After the faulty slave device is identified, the following steps are also included:
[0025] Sending a restart signal to a second switch corresponding to the faulty slave device, and sending a connection signal to a first switch corresponding to the faulty slave device; wherein the restart signal is used to sequentially disconnect and establish a connection between the second switch and a power source, and the connection signal is used to establish a connection between the faulty slave device and the master device;
[0026] Determine whether the communication between the master device and the slave device has returned to normal; if so, send a connection signal to the first switch corresponding to the slave device before the faulty slave device; if not, send a disconnection signal to the first switch and the second switch corresponding to the faulty slave device.
[0027] In one implementation, the abnormal device troubleshooting method further includes:
[0028] After the faulty slave device is determined, fault information of the faulty slave device is recorded.
[0029] In one implementation, the abnormal device troubleshooting method further includes:
[0030] Determine the slave device to be connected;
[0031] According to the pre-recorded address of the slave device, determining whether there is a slave device connected to the master device with the same address as the slave device to be connected;
[0032] If so, determine whether it is necessary to disconnect the slave device with the same address as the slave device to be connected. If so, send a disconnect signal to the first switch corresponding to the slave device with the same address as the slave device to be connected, and send a connection signal to the first switch corresponding to the slave device to be connected.
[0033] In a third aspect, the present application provides an I2C bus system, including a master device, N slave devices and N first switches; wherein the master device is connected to each slave device via an I2C bus, and the first switch is connected in series to the I2C bus; wherein:
[0034] The master device is used to, when a communication failure occurs between the master device and a certain slave device, determine a slave device connected to the master device when the failure occurs among N-1 slave devices other than the certain slave device; determine a disconnection order for the determined slave devices; and determine the first slave device as the current slave device based on the disconnection order; send a disconnection signal to the first switch corresponding to the current slave device, and determine whether the communication between the master device and the certain slave device has returned to normal; wherein the disconnection signal is used to control the first switch to disconnect the slave device from the master device; if so, determine the current slave device as a faulty slave device; and if not, determine whether there is a slave device after the current slave device based on the disconnection order, if so, determine the slave device after the current slave device as the current slave device, and return to execute the step of sending a disconnection signal to the first switch corresponding to the current slave device; if not, determine the certain slave device as a faulty slave device.
[0035] In one implementation, the system may further include N second switches, wherein the second switches are respectively connected to the slave device and the power supply; then:
[0036] The master device is further used to send a restart signal to the second switch corresponding to the faulty slave device and a connection signal to the first switch corresponding to the faulty slave device after determining the faulty slave device; wherein the restart signal is used to disconnect and establish the connection between the second switch and the power supply in sequence, and the connection signal is used to establish the connection between the faulty slave device and the master device; and to determine whether the communication between the master device and the certain slave device has returned to normal; if so, send a connection signal to the first switch corresponding to the slave device before the faulty slave device; if not, send a disconnection signal to the first switch and the second switch corresponding to the faulty slave device.
[0037] In one implementation, the master device is further configured to record fault information of the faulty slave device after determining the faulty slave device.
[0038] In one implementation, the master device is also used to determine a slave device to be connected; based on the pre-recorded address of the slave device, determine whether there is a slave device with the same address as the slave device to be connected among the slave devices connected to the master device; and if so, determine whether it is necessary to disconnect the slave device with the same address as the slave device to be connected, and if so, send a disconnect signal to the first switch corresponding to the slave device with the same address as the slave device to be connected, and send a connection signal to the first switch corresponding to the slave device to be connected.
[0039] It can be seen from the above technical solutions that in the I2C bus system provided by the present application, a first switch can be deployed for slave devices with the same address, the master device can judge the address of the slave device, and can control the opening and closing of the first switch corresponding to the slave device, thereby avoiding conflicts between slave devices with the same address and expanding the number of slave devices in the I2C bus system. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0041] Figure 1 A structural diagram of an existing I2C bus system;
[0042] Figure 2 A schematic diagram of the structure of the I2C bus system provided by this application;
[0043] Figure 3 Another structural diagram of the I2C bus system provided by this application;
[0044] Figure 4 A flowchart of the abnormal device troubleshooting method provided by this application;
[0045] Figure 5 Another flowchart of the abnormal device troubleshooting method provided in this application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] See Figure 2 , which shows the structure of an I2C bus system provided by the present application. The I2C bus system is used to self-check the slave devices that have abnormalities in the I2C bus system. Figure 2 As shown, the I2C bus system includes a master device 201 , a plurality of slave devices 202 , a plurality of first switches 203 and a plurality of second switches 204 .
[0048] The master device 201 is connected to the slave device 201 via an I2C bus. The master device may be a microcontroller unit (MCU), and the slave device may be a temperature sensor, a gravity sensor, a photosensitive module or other modules.
[0049] The first switch 203 is connected in series on the I2C bus between the master device 201 and the slave device 202; the first end of the second switch 204 is connected to the slave device 202, and the second end of the second switch 204 is connected to the power supply 205. In a specific implementation, the first switch and the second switch can be switches in the form of triodes. It should be noted that the "first" and "second" in the first switch and the second switch in the present application do not have a sequence limiting function, but are only used to distinguish the two switches.
[0050] Compared with the existing I2C bus system, the I2C bus system provided by the present application can not only self-check abnormal slave devices, but also expand the number of slave devices. Before explaining the self-check of abnormal slave devices, the beneficial effect that the I2C bus system can expand the number of slave devices is first explained.
[0051] Specifically, in the existing I2C bus system, each slave device has its own unique address. Since the device address is limited in a specific I2C bus system, the number of slave devices that can be deployed in the I2C bus system is also limited. However, in the I2C bus system provided by the present application, slave devices with the same address can be deployed, and the first switch is connected in series on the I2C bus between the master device and the slave device. The master device can disconnect and connect the slave device to the master device by controlling the opening and closing of the first switch. If the addresses of multiple slave devices are the same, as long as the first switches of the slave devices with the same address are not closed at the same time, it can be ensured that the slave devices with the same address are not connected to the I2C bus at the same time, so that the number of slave devices connected to the master device is not limited by the address.
[0052] The first switch is connected in series on the I2C bus between the master device and the slave device, and the function of the first switch is to disconnect and establish the connection between the slave device and the master device. Specifically, the master device can send a connection signal to the first switch, and the connection signal is used to control the first switch to be closed to establish the connection between the slave device and the master device. The master device can send a disconnection signal to the first switch, and the disconnection signal is used to control the first switch to be opened to disconnect the connection between the slave device and the master device.
[0053] In order to achieve the above device expansion purpose, it is sufficient to ensure that the first switch is connected in series on the I2C bus between the slave device with the same address and the master device. The master device can record in advance which slave devices have the same address.
[0054] After the master device determines the slave device to be connected, it first determines whether there is a slave device identical to the slave device to be connected among the slave devices connected to the master device according to the pre-recorded addresses of the slave devices. It should be noted that, for ease of description, the slave device to be connected may be referred to as a slave device to be connected, and a slave device having the same address as the slave device to be connected may be referred to as an identical slave device.
[0055] If there is a slave device with the same address as the slave device to be connected, determine whether it is necessary to disconnect the slave device with the same address as the slave device to be connected. If so, send a disconnect signal to the first switch corresponding to the slave device with the same address as the slave device to be connected, and send a connection signal to the first switch corresponding to the slave device to be connected.
[0056] Specifically, the master device may decide whether to disconnect the same slave device according to factors such as the working state of the same slave device, the priority of the same slave device, etc. For example, if the working state of the same slave device is completed, a disconnection signal may be sent to the first switch of the same slave device to disconnect the same slave device from the master device, and a connection signal may be sent to the first switch of the slave device to be connected to establish the connection between the slave device to be connected and the master device.
[0057] Furthermore, if the working status of the same slave device is not completed, the judgment result is that there is no need to disconnect the slave device with the same address as the slave device to be connected, then you can wait until the working status of the slave device to be connected is completed, and then execute the above steps of sending the disconnect signal and the connection signal.
[0058] Furthermore, if there is no slave device with the same address as the slave device to be connected among the slave devices connected to the master device, a connection signal can be directly sent to the first switch of the slave device to be connected to establish a connection between the slave device to be connected and the master device.
[0059] It can be seen that in the above I2C bus system, the first switch can be deployed for slave devices with the same address, the master device can judge the address of the slave device, and can control the opening and closing of the first switch corresponding to the slave device, thereby avoiding conflicts between slave devices with the same address and expanding the number of slave devices in the I2C bus system.
[0060] The above introduces the advantages of expanding the number of slave devices. The following describes the specific process of self-checking abnormal slave devices in the I2C bus system.
[0061] exist Figure 1In the I2C bus system shown, if the communication between the master device and a certain slave device fails, among the N-1 slave devices except the certain slave device, determine which slave devices are connected to the master device when the failure occurs, and then disconnect the first switches of these slave devices one by one in turn, so that these slave devices are removed from the I2C bus in turn. After each disconnection of the first switch, determine whether the communication between the master device and the certain slave device has returned to normal. If it is found that the communication has returned to normal after disconnecting a certain first switch, it can be determined that the slave device corresponding to the certain first switch is the slave device with the failure. If the communication between the master device and the certain slave device has not returned to normal after disconnecting the first switches of all slave devices, it can be determined that the slave device with the failure is the certain slave device itself. After determining the failed slave device, the process of determining the failed slave device can be ended, and the failure information of the failed slave device can be recorded.
[0062] In order to realize the above control of the first switch, one way is to control the opening and closing of the first switch by the master device. Figure 3 , which shows another structure of the I2C bus system provided by the present application. Figure 3 As shown, the I2C bus system Figure 2 Based on the structure shown, a control bus and a power bus may also be included, wherein the control bus is used to connect the first switch to the bus control port I2C_SEL of the master device, and the power bus is used to connect the second switch to the power control port VDD_SEL of the master device. In this way, after the master device generates a disconnection signal and a connection signal, it can be sent to the first switch through the control bus to control the opening and closing of the first switch. Similarly, after the master device generates a restart signal for the second switch, it can be sent to the second switch through the power bus to control the opening and closing of the second switch, thereby controlling the restart of the slave device corresponding to the second switch.
[0063] It should be noted that in the above-mentioned I2C bus systems, a switch and a second switch are separately provided for each slave device, that is, the number of the first switches is the same as the number of the slave devices, and the number of the second switches is the same as the number of the slave devices. However, the form of the first switch and the second switch is not limited to the above-mentioned form, and can also be other forms, as long as the functions of the first switch and the second switch described above can be achieved. For example, the first switch is a switch with multiple contacts, one end of which can be normally connected to the master device, and each contact at the other end can be selectively connected to the slave device. The second switch can also be of this form.
[0064] In the I2C bus system, the master device can realize the above control through the hardware structure, and the master device includes multiple hardware circuits, such as signal generation circuit, signal transmission circuit, signal recording circuit, detection circuit, storage circuit, etc. The signal generation circuit can generate the disconnection signal and connection signal of the switch; the signal transmission circuit is used to send the generated disconnection signal or connection signal; the signal recording circuit can record which first switches have sent the disconnection signal or connection signal; after a fault occurs, the detection circuit can determine which slave devices are connected to the master device when the fault occurs by detecting the signal recording circuit; the storage circuit is used to record the fault information.
[0065] In another implementation, in addition to using the above hardware circuit, the functions of the master device can also be implemented through a software control method. Figure 4 , which shows the abnormal device troubleshooting method provided by the present application, which is applied to the master device in the I2C bus system. Figure 4 As shown, the abnormal device troubleshooting method may specifically include steps S401 to S407.
[0066] S401: When a communication failure occurs between a master device and a certain slave device, a slave device connected to the master device when the failure occurs is determined from N-1 slave devices except the certain slave device.
[0067] If a communication failure occurs between the master device and a slave device, the I2C bus system needs to perform self-detection. First, the master device determines which slave devices are connected to the master device when the communication failure occurs. The detection method can be to determine which slave devices have their first switches turned off and determine the slave devices corresponding to these first switches.
[0068] S402: Determine a disconnection sequence for the determined slave devices, and determine the first slave device as the current slave device according to the disconnection sequence.
[0069] The disconnection order of each slave device is determined, and the slave device with communication failure is determined as the last slave device in the order, and the disconnection order of other slave devices is determined. After the disconnection order is determined, the first slave device is used as the current slave device to perform step S403.
[0070] For example, assuming that the determined slave devices include slave device 1, slave device 2, and slave device 3, and assuming that the slave device with communication failure is slave device 4, assuming that the disconnection order determined for each slave device is the same as the slave device number, slave device 1 is determined as the current slave device according to the determined disconnection order.
[0071] S403: Send a disconnect signal to the first switch corresponding to the current slave device, and determine whether the communication between the master device and a slave device has returned to normal; the disconnect signal is used to control the first switch to disconnect the slave device from the master device; if so, execute step S404; if not, execute step S405.
[0072] The master device generates a disconnection signal and sends the disconnection signal to the first switch corresponding to the current slave device, so that the current slave device is disconnected from the master device, or the current slave device is removed from the I2C bus system. Further, it is determined whether the communication between the master device and the certain slave device is restored to normal. If it is restored to normal, it can be determined that the current slave device causes the communication failure between the master device and the certain slave device, so that step S404 is executed to determine the slave device as a failed slave device.
[0073] If the communication between the master device and the slave device is still not restored to normal after the current slave device is disconnected from the master device, step S405 may be executed to detect whether the next slave device is normal.
[0074] S404: Determine the current slave device as a faulty slave device.
[0075] S405: According to the disconnection sequence, determine whether there is a slave device after the current slave device. If so, execute step S406; if not, execute step S407.
[0076] S406: Determine the slave device after the current slave device as the current slave device, and return to execute step S403.
[0077] Specifically, according to the determined disconnection sequence, the subsequent slave device of the current slave device is determined as the current slave device to perform the next round of detection.
[0078] S407: Determine the certain slave device as a faulty slave device.
[0079] If, during the troubleshooting process, it is found that, except for the slave device with the communication failure, all other slave devices have been disconnected from the master device, then the slave device can be directly determined to be the faulty slave device.
[0080] As can be seen from the above technical solutions, the present application provides an abnormal device troubleshooting method applied to the master device of the I2C bus system. The method can determine which slave devices are connected to the master device when a communication failure occurs between the master device and a certain slave device, and disconnect the connection between these slave devices and the master device one by one, and detect whether the master device has restored normal communication with the certain slave device. If restored, it means that the currently disconnected slave device is the slave device with a fault. If the communication between the master device and the certain slave device has not been restored to normal after all the slave devices are disconnected, the certain slave device is directly determined as a faulty slave device. It can be seen that the I2C bus system provided by the present application can detect the faulty slave device through self-detection of the master device.
[0081] In order to record fault information and prepare for further investigation, after the faulty slave device is determined, the fault information of the faulty slave device may be recorded. The fault information may include the time of the fault, the device number of the faulty slave device, and other information.
[0082] In order to further determine whether the faulty slave device can recover to normal, the master device can control it to restart and perform detection after restarting. Specifically, in order to achieve the above functions, the present application provides another process for abnormal device fault detection. Figure 5 As shown, the abnormal equipment fault detection method is Figure 4 On the basis of the above, S408 to S411 may also be included. It should be noted that the description of steps S401 to S407 can be found above, and will not be repeated here.
[0083] S401: When a communication failure occurs between a master device and a certain slave device, a slave device connected to the master device when the failure occurs is determined from N-1 slave devices except the certain slave device.
[0084] S402: Determine a disconnection sequence for the determined slave devices, and determine the first slave device as the current slave device according to the disconnection sequence.
[0085] S403: Send a disconnect signal to the first switch corresponding to the current slave device, and determine whether the communication between the master device and a slave device has returned to normal; the disconnect signal is used to control the first switch to disconnect the slave device from the master device; if so, execute step S404; if not, execute step S405.
[0086] S404: Determine the current slave device as a faulty slave device, and execute step S408.
[0087] S405: According to the disconnection sequence, determine whether there is a slave device after the current slave device. If so, execute step S406; if not, execute step S407.
[0088] S406: Determine the slave device after the current slave device as the current slave device, and return to execute step S403.
[0089] S407: Determine the certain slave device as a faulty slave device, and execute step S408.
[0090] S408: Send a restart signal to the second switch corresponding to the faulty slave device, and send a connection signal to the first switch corresponding to the faulty slave device.
[0091] The restart signal is used to disconnect and establish the connection between the second switch and the power supply in sequence, that is, the restart signal is used to restart the faulty slave device. The connection signal is used to establish the connection between the faulty slave device and the master device, that is, the connection signal is used to add the faulty slave device to the I2C bus system again.
[0092] Since some faults may be temporary and may be eliminated after restarting, such faults can be eliminated by restarting.
[0093] S409: Determine whether the communication between the master device and a slave device has returned to normal; if so, execute step S410; if not, execute step S411.
[0094] If the communication returns to normal after the slave device marked as a fault is restarted, step S410 may be performed to restore the I2C bus system to the state before the fault occurs.
[0095] S410: Send a connection signal to a first switch corresponding to a slave device before the failed slave device.
[0096] S411: Send a disconnect signal to the first switch and the second switch corresponding to the faulty slave device.
[0097] If the communication of the slave device marked as faulty does not return to normal after restarting, the faulty slave device can be removed from the I2C bus system again. Further, in order to ensure the availability of the I2C bus system, a backup device can be set for the slave device and the backup slave device is also provided with a first switch and a second switch. After the faulty slave device is removed in step S411, a connection signal can be sent to the first switch corresponding to the backup device of the faulty slave device, so that the backup device of the faulty slave device is connected to the I2C bus system.
[0098] It can be seen that the fault type can be further determined through the above abnormal device troubleshooting method. If the fault can be recovered, the connection state of the I2C bus system is restored. If the fault cannot be recovered, the fault is directly removed from the device.
[0099] In addition, the present application also provides an I2C bus system, including a master device, N slave devices and N first switches; wherein the master device is connected to each slave device via an I2C bus, and the first switch is connected in series to the I2C bus; wherein:
[0100] The master device is used to, when a communication failure occurs between the master device and a certain slave device, determine a slave device connected to the master device when the failure occurs among N-1 slave devices other than the certain slave device; determine a disconnection order for the determined slave devices; and determine the first slave device as the current slave device based on the disconnection order; send a disconnection signal to the first switch corresponding to the current slave device, and determine whether the communication between the master device and the certain slave device has returned to normal; wherein the disconnection signal is used to control the first switch to disconnect the slave device from the master device; if so, determine the current slave device as a faulty slave device; and if not, determine whether there is a slave device after the current slave device based on the disconnection order, if so, determine the slave device after the current slave device as the current slave device, and return to execute the step of sending a disconnection signal to the first switch corresponding to the current slave device; if not, determine the certain slave device as a faulty slave device.
[0101] In one example, the I2C bus system may further include N second switches, which are respectively connected to the slave device and the power supply; then: the master device is further used to send a restart signal to the second switch corresponding to the faulty slave device after determining the faulty slave device, and send a connection signal to the first switch corresponding to the faulty slave device; wherein the restart signal is used to disconnect and establish the connection between the second switch and the power supply in sequence, and the connection signal is used to establish the connection between the faulty slave device and the master device; and determine whether the communication between the master device and the certain slave device has returned to normal; if so, send a connection signal to the first switch corresponding to the slave device before the faulty slave device; if not, send a disconnection signal to the first switch and the second switch corresponding to the faulty slave device.
[0102] In one example, in the I2C bus system, the master device is further configured to record fault information of the faulty slave device after determining the faulty slave device.
[0103] In one example, in the I2C bus system, the master device is also used to determine a slave device to be connected; based on the pre-recorded address of the slave device, determine whether there is a slave device with the same address as the slave device to be connected among the slave devices connected to the master device; and if so, determine whether it is necessary to disconnect the slave device with the same address as the slave device to be connected, and if so, send a disconnect signal to the first switch corresponding to the slave device with the same address as the slave device to be connected, and send a connection signal to the first switch corresponding to the slave device to be connected.
[0104] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0105] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the presence of other identical elements in the process, method, article or device including the above elements.
[0106] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An I2C bus system, characterized in that: It includes a master device, N slave devices, N first switches and N second switches; wherein: The master device is connected to the slave device via an I2C bus; The first switch is connected in series on the I2C bus between the master device and the slave device, and the first switches corresponding to the slave devices with the same address are not closed at the same time; A first end of the second switch is connected to the slave device, and a second end of the second switch is connected to a power source; The main device includes a signal generating circuit, a signal sending circuit, a signal recording circuit and a signal detecting circuit; wherein: The signal generating circuit is used to generate a disconnection signal or a connection signal of the first switch and the second switch; The signal sending circuit is used to send the disconnection signal or the connection signal; The signal recording circuit is used to record which first switches the master device sends the connection signal to; The signal detection circuit is used to detect the signal recording circuit to determine to which first switches the master device sends connection signals before a communication failure occurs between the master device and a slave device.
2. The I2C bus system according to claim 1, characterized in that: The first switch is connected to the bus control port I2C_SEL of the master device, and the second switch is connected to the power control port VDD_SEL of the master device.
3. The I2C bus system according to claim 1, characterized in that: The first switch and the second switch are switches in the form of triodes.
4. A method for troubleshooting abnormal equipment, characterized in that: A master device applied to an I2C bus system, wherein the I2C bus system comprises a master device, N slave devices and N first switches; wherein the master device is connected to each slave device via an I2C bus, the first switches are connected in series to the I2C bus, and the first switches corresponding to the slave devices with the same address are not closed at the same time; the method comprises: When a communication failure occurs between the master device and a certain slave device, a slave device connected to the master device when the failure occurs is determined among N-1 slave devices other than the certain slave device; Determining a disconnection sequence for the determined slave devices; and determining the first slave device as the current slave device according to the disconnection sequence; Sending a disconnection signal to a first switch corresponding to the current slave device, and determining whether the communication between the master device and the certain slave device has returned to normal; wherein the disconnection signal is used to control the first switch to disconnect the slave device from the master device; If yes, the current slave device is determined as a faulty slave device, and fault information of the faulty slave device is recorded; If not, judging whether there is another slave device after the current slave device according to the disconnection sequence; if so, determining the slave device after the current slave device as the current slave device, and returning to execute the step of sending a disconnection signal to the first switch corresponding to the current slave device; if not, determining the certain slave device as a faulty slave device; Restarting the faulty slave device; If the fault is not restored, the faulty slave device is removed.
5. The abnormal device troubleshooting method according to claim 4, characterized in that: The I2C bus system further includes N second switches, wherein the second switches are respectively connected to the slave device and the power supply; After the faulty slave device is identified, the following steps are also included: Sending a restart signal to the second switch corresponding to the faulty slave device, and sending a connection signal to the first switch corresponding to the faulty slave device; The restart signal is used to disconnect and establish the connection between the second switch and the power supply in sequence, and the connection signal is used to establish the connection between the faulty slave device and the master device; Determine whether the communication between the master device and the slave device has returned to normal; if so, send a connection signal to the first switch corresponding to the slave device before the faulty slave device; if not, send a disconnection signal to the first switch and the second switch corresponding to the faulty slave device.
6. The abnormal device troubleshooting method according to claim 4, characterized in that: Also includes: Determine the slave device to be connected; According to the pre-recorded address of the slave device, determining whether there is a slave device connected to the master device with the same address as the slave device to be connected; If so, determine whether it is necessary to disconnect the slave device with the same address as the slave device to be connected. If so, send a disconnect signal to the first switch corresponding to the slave device with the same address as the slave device to be connected, and send a connection signal to the first switch corresponding to the slave device to be connected.
7. An I2C bus system, characterized in that: It comprises a master device, N slave devices and N first switches; wherein the master device is connected to each slave device via an I2C bus, the first switches are connected in series to the I2C bus, and the first switches corresponding to the slave devices with the same address are not closed at the same time; wherein: The master device is used to, when a communication failure occurs between the master device and a certain slave device, determine a slave device connected to the master device when the failure occurs among N-1 slave devices other than the certain slave device; determine a disconnection order for the determined slave devices; and determine the first slave device as the current slave device based on the disconnection order; send a disconnection signal to the first switch corresponding to the current slave device, and determine whether the communication between the master device and the certain slave device has returned to normal; wherein the disconnection signal is used to control the first switch to disconnect the slave device from the master device; if so, determine the current slave device as a faulty slave device, and record the fault information of the faulty slave device; and if not, determine whether there is a slave device after the current slave device based on the disconnection order, if so, determine the slave device after the current slave device as the current slave device, and return to execute the step of sending a disconnection signal to the first switch corresponding to the current slave device; if not, determine the certain slave device as a faulty slave device.
8. The I2C bus system according to claim 7, characterized in that: The system may further include N second switches, wherein the second switches are respectively connected to the slave device and the power supply; then: The master device is further used to send a restart signal to the second switch corresponding to the faulty slave device and a connection signal to the first switch corresponding to the faulty slave device after determining the faulty slave device; wherein the restart signal is used to disconnect and establish the connection between the second switch and the power supply in sequence, and the connection signal is used to establish the connection between the faulty slave device and the master device; and to determine whether the communication between the master device and the certain slave device has returned to normal; if so, send a connection signal to the first switch corresponding to the slave device before the faulty slave device; if not, send a disconnection signal to the first switch and the second switch corresponding to the faulty slave device.
Citation Information
Patent Citations
Electronic system
CN102200953A
Method for solving communication deadlock of I2C (Inter-Integrated Circuit) bus
CN102521187A
Bus system
JP2000165420A
Serial bus system and hung slave reset method
JP2010055474A
