A detection circuit and impedance detection method

By detecting the discharge time characteristics of resistors and capacitors in the circuit and combining this with the processor to determine the pin status of the USB socket, the contact problem caused by corrosion in the USB socket is solved, achieving fast and low-cost impedance detection.

CN115236563BActive Publication Date: 2026-05-26LENOVO (BEIJING) LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2022-06-30
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In existing technologies, the AC charging confirmation signal line and adjacent pins of USB sockets are easily corroded by water or conductive liquids, leading to contact problems. Furthermore, impedance detection requires manual intervention and complex calculations, making it difficult to promote on a large scale.

Method used

The detection circuit includes a first resistor, a first capacitor, and a processor. By detecting the electrical parameters of the pin under test, the discharge time of the capacitor is determined based on the changes in the electrical parameters, and compared with a preset time threshold, the pin status is quickly determined.

Benefits of technology

It enables rapid screening of the status of the pins to be tested, reducing time and labor costs and simplifying the testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115236563B_ABST
    Figure CN115236563B_ABST
Patent Text Reader

Abstract

This application provides a detection circuit and impedance detection method. The detection circuit includes a first resistor, a first capacitor, and a processor. A first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and the second end of the first capacitor are connected to a reference ground. The first end of the first capacitor is connected to the pin to be tested. The processor detects the electrical parameters of the pin to be tested, determines the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value, and determines the state of the pin to be tested based on a comparison between the discharge time and a preset time threshold. This allows for the determination of the discharge time of the first capacitor through the electrical parameters of the pin to be tested, and thus the rapid determination of the state of the pin to be tested through the discharge time of the first capacitor. This achieves rapid screening for foreign objects on the pin to be tested, shortening the detection time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic circuit technology, and in particular to a detection circuit and impedance detection method. Background Technology

[0002] With the continuous development of smart terminal devices and the widespread adoption of Universal Serial Bus (USB) or Type-C interfaces, plugs can be inserted into sockets regardless of orientation, greatly facilitating daily plugging and unplugging operations and demonstrating the convenience of the Type-C interface. However, because the AC charging confirmation signal line of a USB socket is always under operating voltage, if water or other conductive liquids seep into the adjacent pins (e.g., in daily use, mobile phones often encounter moisture, sweat, or even raindrops), corrosion can occur on the AC charging confirmation signal line and adjacent pins. As corrosion worsens, it can lead to various difficult-to-diagnose functional abnormalities in the USB socket due to contact issues.

[0003] In related technologies, a dedicated impedance detection circuit is used to connect to the pin under test. This requires manual intervention and complex calculations to obtain the state of the pin under test. It is highly specialized, time-consuming, labor-intensive, and too costly, making it difficult to promote and enter the scope of daily use on a large scale. Summary of the Invention

[0004] This application provides a detection circuit and an impedance detection method.

[0005] The technical solution of this application embodiment is implemented as follows:

[0006] In a first aspect, embodiments of this application provide a detection circuit, which includes a first resistor, a first capacitor, and a processor. A first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and a second end of the first capacitor are connected to a reference ground. The first end of the first capacitor is connected to the pin to be tested.

[0007] The processor is used to detect the electrical parameters of the pin under test, determine the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value, and determine the state of the pin under test based on the comparison result of the discharge time and a preset time threshold.

[0008] In some embodiments, the preset time threshold includes a maximum time threshold and a minimum time threshold;

[0009] When the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, the pin under test is in the first state.

[0010] When the discharge time is greater than or equal to the highest time threshold, or when the discharge time is less than or equal to the lowest time threshold, the pin under test is in the second state.

[0011] In some embodiments, the processor is connected to the pin under test via a general purpose input / output port, wherein the pin under test is a predetermined pin on a Universal Serial Bus (USB) interface.

[0012] Secondly, embodiments of this application provide an impedance detection method, the method comprising:

[0013] Obtain the electrical parameters of the pin to be tested; wherein the pin to be tested is connected to a reference ground in parallel through a capacitor and a resistor;

[0014] The discharge time corresponding to the first capacitor is determined based on the change of the electrical parameters from the first value to the second value;

[0015] The state of the pin to be tested is determined based on the comparison between the discharge time and the preset time threshold.

[0016] In some embodiments, the preset time threshold includes a maximum time threshold and a minimum time threshold; determining the state of the pin under test based on the comparison result of the discharge time and the preset time threshold includes:

[0017] If the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, then the pin under test is determined to be in the first state.

[0018] If the discharge time is greater than or equal to the highest time threshold, or the discharge time is less than or equal to the lowest time threshold, then the pin under test is determined to be in the second state.

[0019] In some embodiments, when determining the state of the pin under test, the method further includes:

[0020] The equivalent impedance to ground of the pin under test is determined based on the discharge time, wherein the discharge time and the equivalent impedance to ground are correlated.

[0021] If the equivalent impedance to ground is less than the highest impedance threshold and the equivalent impedance to ground is greater than the lowest impedance threshold, then the pin under test is determined to be in the first state.

[0022] If the equivalent impedance to ground is greater than or equal to the highest impedance threshold, or the equivalent impedance to ground is less than or equal to the lowest impedance threshold, then the pin under test is determined to be in the second state.

[0023] In some embodiments, the method further includes:

[0024] The pin under test is detected based on general-purpose input / output ports;

[0025] The general-purpose input / output port is controlled to be in the first state, so that the first capacitor enters the charging mode until the voltage value of the first capacitor reaches the first voltage value;

[0026] The general-purpose input / output port is controlled to be in the second state, so that the first capacitor enters the discharge mode;

[0027] Accordingly, obtaining the electrical parameters of the pin under test includes: in discharge mode, obtaining the voltage value of the pin under test through the general-purpose input / output port.

[0028] In some embodiments, the control of the general-purpose input / output port in a first state includes:

[0029] Control the logic level at the general-purpose input / output port to the first level;

[0030] Accordingly, determining the discharge time corresponding to the first capacitor based on the change of the electrical parameter from the first value to the second value includes:

[0031] When the logic level of the general-purpose input / output port changes from the first level to the second level, the discharge time corresponding to the first capacitor is determined.

[0032] In some embodiments, determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level includes:

[0033] When the first capacitor enters the discharge mode, the logic level of the general-purpose input / output port is detected at first preset time intervals;

[0034] While maintaining the first logic level at the general-purpose input / output port, the first preset duration is accumulated;

[0035] If a change in the logic level of the general-purpose input / output port to the second level is detected, the current accumulated preset duration is determined as the second preset duration.

[0036] The discharge time corresponding to the first capacitor is determined based on the second preset duration.

[0037] In some embodiments, determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level includes:

[0038] When the first capacitor enters the discharge mode, the start timer is controlled to begin counting.

[0039] If a change in the logic level of the general-purpose input / output port is detected, the timer is interrupted to stop timing, and the discharge time corresponding to the first capacitor is determined.

[0040] This application provides a detection circuit and impedance detection method. The detection circuit includes a first resistor, a first capacitor, and a processor. A first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and the second end of the first capacitor are connected to a reference ground. The first end of the first capacitor is connected to the pin to be tested. The processor detects the electrical parameters of the pin to be tested, determines the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value, and determines the state of the pin to be tested based on a comparison between the discharge time and a preset time threshold. This allows for the determination of the discharge time of the first capacitor through the electrical parameters of the pin to be tested, and thus the rapid determination of the state of the pin to be tested through the discharge time of the first capacitor. This achieves rapid screening of the pin to be tested, shortens the detection time, and reduces both time and labor costs. Attached Figure Description

[0041] Figure 1 A schematic diagram of the composition structure of a detection circuit provided in an embodiment of this application;

[0042] Figure 2 A schematic diagram of the composition structure of another detection circuit provided in an embodiment of this application;

[0043] Figure 3 A schematic flowchart of an impedance detection method provided in an embodiment of this application;

[0044] Figure 4 A flowchart illustrating the pin status detection process in an impedance detection method provided in this application embodiment;

[0045] Figure 5 A flowchart illustrating the pin status detection process in another impedance detection method provided in this application embodiment;

[0046] Figure 6 This application provides a detailed schematic diagram of the composition structure of a detection circuit according to an embodiment of the present application.

[0047] Figure 7 A detailed flowchart illustrating an impedance detection method provided in this application embodiment;

[0048] Figure 8 This is a schematic diagram of the composition structure of an impedance detection device provided in an embodiment of this application;

[0049] Figure 9 This is a schematic diagram of the composition structure of a processor provided in an embodiment of this application. Detailed Implementation

[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It is understood that the specific embodiments described herein are merely for explaining the relevant application and not for limiting the application. Furthermore, it should be noted that, for ease of description, only the parts relevant to the application are shown in the accompanying drawings.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0052] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0053] It should be noted that the terms "first, second, and third" used in the embodiments of this application are merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0054] It's understandable that with the continuous development of smart terminal devices and the widespread adoption of USB Type-C interfaces, plugs can be inserted into sockets regardless of orientation, greatly facilitating daily plugging and unplugging operations and demonstrating the convenience of Type-C interfaces. However, because the AC charging confirmation signal line of a USB socket is always under operating voltage, if water or other conductive liquids seep into the adjacent pins—for example, in daily use, mobile phones often encounter moisture, sweat, or even raindrops—corrosion can occur on the AC charging confirmation signal line and adjacent pins. As corrosion worsens, it can also lead to various difficult-to-diagnose functional abnormalities in the USB socket due to contact issues.

[0055] In related technologies, a dedicated impedance detection circuit is used to connect to the pin under test. This requires manual intervention and complex calculations to obtain the state of the pin under test. It is highly specialized, time-consuming, labor-intensive, and too costly, making it difficult to promote and enter the scope of daily use on a large scale.

[0056] Based on this, embodiments of this application provide a detection circuit and impedance detection method. The detection circuit includes a first resistor, a first capacitor, and a processor. A first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and a second end of the first capacitor are connected to a reference ground. The first end of the first capacitor is connected to the pin to be tested. The processor detects the electrical parameters of the pin to be tested, determines the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value, and determines the state of the pin to be tested based on the comparison between the discharge time and a preset time threshold. In this way, the discharge time of the first capacitor can be determined through the electrical parameters of the pin to be tested, and the state of the pin to be tested can be quickly determined through the discharge time of the first capacitor. This achieves rapid screening of the pin to be tested, shortens the detection time, and reduces time and labor costs.

[0057] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and specific examples.

[0058] In one embodiment of this application, see Figure 1 This illustrates a schematic diagram of the composition of a detection circuit provided in an embodiment of this application. Figure 1 As shown, the detection circuit 10 includes a first resistor R1, a first capacitor C1, and a processor 101. The first end of the first resistor R1 is electrically connected to the first end of the first capacitor C1, and the second end of the first resistor R1 and the second end of the first capacitor C1 are connected to a reference ground. The first end of the first capacitor C1 is connected to the pin to be tested.

[0059] The processor 101 is used to detect the electrical parameters of the pin under test, determine the discharge time of the first capacitor C1 based on the change of the electrical parameters from a first value to a second value, and determine the state of the pin under test based on the comparison result of the discharge time and a preset time threshold.

[0060] It should be noted that the detection circuit 10 provided in this embodiment can be applied between the internal application circuit of the motherboard and the external contact point of the pin to be tested. Specifically, the detection circuit can be integrated inside the pin, and the state of the pin to be tested can be determined by the processor 101 inside the pin. Here, the pin to be tested can be a USB interface, Type C interface, Thunderbolt interface, HDMI interface, VGA interface, DVI interface, or other pins that need to be detected for foreign objects, etc., and no specific limitation is made here.

[0061] Furthermore, the testing process focuses on pins that consistently have a working voltage. If water or other conductive foreign matter is present on these pins, electrochemical corrosion can easily occur, rendering them malfunction. For example, the CC pin in a Type-C interface is the type of pin that needs to be tested.

[0062] It should also be noted that, in the embodiments of this application, determining the state of the pin to be tested based on the discharge time can be done by comparing the discharge time with a preset threshold and directly determining the state of the pin to be tested based on the comparison result, or by determining the equivalent impedance to ground of the pin to be tested based on the discharge time and comparing the equivalent impedance to ground with a preset impedance threshold and determining the state of the pin to be tested based on the comparison result.

[0063] It should also be noted that the state of the pin under test reflects whether there is a problem affecting the performance of the pin under test. It can include two states, which respectively indicate that there is no problem affecting the performance and that there is a problem affecting the performance.

[0064] In some embodiments, the preset time threshold includes a maximum time threshold and a minimum time threshold;

[0065] When the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, the pin under test is in the first state.

[0066] When the discharge time is greater than or equal to the highest time threshold, or when the discharge time is less than or equal to the lowest time threshold, the pin under test is in the second state.

[0067] It should be noted that, in the embodiments of this application, when the pin under test is in the first state, it indicates that the pin under test is in an abnormal state and cannot achieve the expected performance. When the pin under test is in the second state, it indicates that the pin under test is in a normal state and can achieve the expected performance.

[0068] It should also be noted that, in this embodiment, the abnormal state of the pin under test can be caused by the presence of foreign matter, such as conductive liquid, specifically water vapor, sweat, or even raindrops. Its conductivity and corrosiveness can cause the pin under test to be in an abnormal state, thus preventing it from achieving the expected performance.

[0069] In some embodiments, Figure 1 Based on the detection of single channel 10 shown, see... Figure 2The processor 101 is connected to the pin under test via a general purpose input / output port 102, wherein the pin under test can be a predetermined pin on a USB.

[0070] It should be noted that the general purpose input / output (GPIO) port can enable the processor to control the detection circuit 10 mentioned above, so as to realize the charging and discharging of the detection circuit, and determine the discharge time by measuring the voltage change, thereby determining the state of the pin under test and whether the pin under test meets the usage requirements.

[0071] In another embodiment of this application, based on the detection circuit 10 described in the foregoing embodiments, see [link to previous embodiment]. Figure 3 This illustrates a flowchart of an impedance detection method provided in an embodiment of this application. Figure 3 As shown, the method may include:

[0072] S301: Obtain the electrical parameters of the pin under test; wherein the pin under test is connected to the reference ground in parallel through a capacitor and a resistor.

[0073] It should be noted that, in the embodiments of this application, the electrical parameter can be voltage. Specifically, during the discharge process of the capacitor, the processor obtains the voltage of the pin to be tested through the general-purpose input / output interface.

[0074] In another embodiment, the electrical parameter can be capacitance. Specifically, during the discharge process of the capacitor, the processor obtains the remaining capacitance of the corresponding capacitor of the pin under test through a predetermined interface and a capacitance detection circuit.

[0075] It should also be noted that the pin to be tested can be a USB interface, Type-C interface, Thunderbolt interface, HDMI interface, VGA interface, DVI interface, or other pins that need to be detected for foreign objects, etc. There are no specific limitations here.

[0076] In some embodiments, the method may further include:

[0077] The pin under test is detected based on general-purpose input / output ports;

[0078] The general-purpose input / output port is controlled to be in the first state, so that the first capacitor enters the charging mode until the voltage value of the first capacitor reaches the first voltage value;

[0079] The general-purpose input / output port is controlled to be in the second state, so that the first capacitor enters the discharge mode;

[0080] Accordingly, obtaining the electrical parameters of the pin under test includes: in discharge mode, obtaining the voltage value of the pin under test through the general-purpose input / output port.

[0081] It should be noted that, in this embodiment of the application, before obtaining the electrical parameters of the pin to be tested, the first capacitor needs to be charged first, and then the first capacitor needs to be discharged. During the discharge process of the first capacitor, the electrical parameters of the pin to be tested are obtained.

[0082] It should also be noted that, in the embodiments of this application, the first state of the general-purpose input / output port is to output a high level. During the charging process of the first capacitor, charging stops when the voltage value of the first capacitor reaches the highest voltage value of the high-level output. The second state of the general-purpose input / output port is to turn off the voltage input. After the first capacitor enters the discharge mode, the voltage value of the pin to be tested is obtained through the general-purpose input / output interface.

[0083] In this way, the voltage value of the pin under test is obtained through the general purpose input / output port, so that the discharge time of the capacitor can be determined later based on the voltage value.

[0084] S302: Determine the discharge time corresponding to the first capacitor based on the change of the electrical parameter from the first value to the second value.

[0085] It should be noted that in the embodiments of this application, the electrical parameter can be a voltage value. During the process of the voltage value changing from the first value to the second value, the first capacitor is in the discharge process. The first value is greater than the second value. Specifically, for ease of detection, the first value can correspond to a high level and the second value can correspond to a low level.

[0086] In this embodiment, the electrical parameter can be capacitance, which is the change in the detector capacitance value from a first value to a second value during the discharge process of the first capacitor.

[0087] In some embodiments, controlling the general-purpose input / output port to be in a first state includes: controlling the logic level at the general-purpose input / output port to a first level;

[0088] Accordingly, determining the discharge time corresponding to the first capacitor based on the change of the electrical parameter from the first value to the second value includes:

[0089] When the logic level of the general-purpose input / output port changes from the first level to the second level, the discharge time corresponding to the first capacitor is determined.

[0090] It should be noted that in the embodiments of this application, the first level is a high level and the second level is a low level. Specifically, in some embodiments, the first value of the voltage is the maximum voltage in the high level and the second value is the maximum voltage in the low level. Therefore, the time length from the start of the first capacitor's discharge to the moment when the high level changes to the low level is the discharge time corresponding to the first capacitor.

[0091] In some embodiments, determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level includes:

[0092] When the first capacitor enters the discharge mode, the logic level of the general-purpose input / output port is detected at first preset time intervals;

[0093] While maintaining the first logic level at the general-purpose input / output port, the first preset duration is accumulated;

[0094] If a change in the logic level of the general-purpose input / output port to the second level is detected, the current accumulated preset duration is determined as the second preset duration.

[0095] The discharge time corresponding to the first capacitor is determined based on the second preset duration.

[0096] It should be noted that, in the embodiments of this application, the discharge time can be determined by polling. Specifically, the logic level of the pin to be tested is detected at each first preset time interval. If the logic level remains at a high level, it indicates that the first capacitor is still discharging. Therefore, the first preset time is accumulated to the second preset time. When the logic level changes from a high level to a low level, the first preset time is accumulated to the second preset time, and the second preset time at this time is determined as the final discharge time.

[0097] In some embodiments, determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level includes:

[0098] When the first capacitor enters the discharge mode, the start timer is controlled to begin counting.

[0099] If a change in the logic level of the general-purpose input / output port is detected, the timer is interrupted to stop timing, and the discharge time corresponding to the first capacitor is determined.

[0100] It should be noted that, in this embodiment of the application, the discharge time corresponding to the first capacitor can also be determined by setting a timer. The timer starts to run when the first capacitor begins to discharge, and when the logic level changes from high to low, an interrupt command is sent to the timer to stop the timer. In this way, the time displayed on the timer is the discharge time corresponding to the first capacitor.

[0101] In this way, the discharge time corresponding to the first capacitor is determined based on the change of voltage value from logic high level to logic low level, so as to detect the state of the pin to be tested later.

[0102] S303: Determine the state of the pin to be tested based on the comparison result between the discharge time and the preset time threshold.

[0103] It should be noted that, in the embodiments of this application, the state of the pin to be tested can be determined by the discharge time. This can be done by comparing the discharge time with a preset threshold and directly determining the state of the pin to be tested based on the comparison result, or by determining the equivalent impedance to ground of the pin to be tested based on the discharge time and comparing the equivalent impedance to ground with a preset impedance threshold and determining the state of the pin to be tested based on the comparison result.

[0104] In some embodiments, for S303, see [link to relevant documentation]. Figure 4 This illustrates a flowchart of the pin-to-test state detection process in an impedance detection method provided in this application embodiment. Figure 4 As shown, the preset time threshold includes a maximum time threshold and a minimum time threshold; determining the state of the pin under test based on the comparison between the discharge time and the preset time threshold may include:

[0105] If the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, then the pin under test is determined to be in the first state.

[0106] If the discharge time is greater than or equal to the highest time threshold, or the discharge time is less than or equal to the lowest time threshold, then the pin under test is determined to be in the second state.

[0107] It should be noted that, in this embodiment of the application, the state of the pin under test is determined by comparing the discharge time with a preset time threshold. When the discharge time is between the highest time threshold and the lowest time threshold, the pin under test is in the first state. When the discharge time is not between the highest time threshold and the lowest time threshold, the pin under test is in the second state.

[0108] It should also be noted that in the embodiments of this application, the first state is the state in which there is a foreign object in the pin to be tested and it cannot be used normally, and the second state is the state in which there is no foreign object in the pin to be tested and it can be used normally.

[0109] In some embodiments, see Figure 5 This illustrates a flowchart of the pin-to-test state detection process in another impedance detection method provided in this application embodiment. Figure 5 As shown, when determining the state of the pin to be tested, the method further includes:

[0110] The equivalent impedance to ground of the pin under test is determined based on the discharge time, wherein the discharge time and the equivalent impedance to ground are correlated.

[0111] If the equivalent impedance to ground is less than the highest impedance threshold and the equivalent impedance to ground is greater than the lowest impedance threshold, then the pin under test is determined to be in the first state.

[0112] If the equivalent impedance to ground is greater than or equal to the highest impedance threshold, or the equivalent impedance to ground is less than or equal to the lowest impedance threshold, then the pin under test is determined to be in the second state.

[0113] It should be noted that, in the embodiments of this application, the relationship between discharge time and equivalent ground impedance can be... This correlation allows the discharge time to be converted into the equivalent impedance to ground of the pin under test. The state of the pin under test can then be determined by comparing the equivalent impedance to ground with a preset impedance threshold.

[0114] It should also be noted that, in this embodiment of the application, the state of the pin to be tested is determined by comparing the equivalent impedance to ground with a preset impedance threshold. When the equivalent impedance to ground is between the highest impedance threshold and the lowest impedance threshold, the pin to be tested is in the first state. When the equivalent impedance to ground is not between the highest impedance threshold and the lowest impedance threshold, the pin to be tested is in the second state.

[0115] It should also be noted that in the embodiments of this application, the first state is the state in which there is a foreign object in the pin to be tested and it cannot be used normally, and the second state is the state in which there is no foreign object in the pin to be tested and it can be used normally.

[0116] Thus, the state of the pin to be tested is determined based on the comparison between the discharge time and the preset time threshold.

[0117] This application provides a detection circuit and impedance detection method. The detection circuit includes a first resistor, a first capacitor, and a processor. A first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and the second end of the first capacitor are connected to a reference ground. The first end of the first capacitor is connected to the pin to be tested. The processor detects the electrical parameters of the pin to be tested, determines the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value, and determines the state of the pin to be tested based on a comparison between the discharge time and a preset time threshold. This allows for the determination of the discharge time of the first capacitor through the electrical parameters of the pin to be tested, and thus the rapid determination of the state of the pin to be tested. This achieves rapid screening of the pin to be tested, reducing time and labor costs.

[0118] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, the discharge time characteristics of a capacitor and resistor connected in series are utilized. The discharge time of the capacitor is used to determine whether there are foreign objects on the input pin causing changes in impedance to ground, thus affecting the capacitor's discharge time. Changes in the capacitor voltage are detected using the GPIO level connected to it. The smaller the series resistor, the shorter the capacitor discharge time, and the shorter the time required for the GPIO logic level to change.

[0119] Specifically, see Figure 6 It shows a detailed schematic diagram of the composition of a detection circuit, such as... Figure 6 As shown, the detection circuit may include a motherboard-side design capacitor C (i.e., the first capacitor in the aforementioned embodiment), a motherboard-side design impedance R (i.e., the first resistor in the aforementioned embodiment), a motherboard GPIO internal design pull-up impedance Rp, and a processor. The first end of the design impedance R is electrically connected to the first end of the design capacitor C, and the second end of the design impedance R and the second end of the design capacitor C are connected to a reference ground. The first end of the design capacitor C is connected to the pin to be tested.

[0120] It should be noted that the detection circuit is connected between the internal application circuit of the pin under test and the external connection point of the pin. It is used to detect whether there are foreign objects in the pin under test and whether the state of the pin under test meets the usage requirements.

[0121] It should also be noted that the pull-up impedance Rp can be adjusted according to the design impedance R, so that the design pull-up impedance Rp is much larger than the design impedance R. During the discharge process of the design capacitor C, the design pull-up impedance Rp is close to the open circuit state, so that the voltage value obtained by the voltage measurement at the GPIO terminal can be equivalent to the voltage at the design capacitor C, thereby simplifying the process of obtaining the pin discharge time.

[0122] See Figure 7 It shows a schematic flowchart of an impedance detection method, such as Figure 7 As shown, the method may include:

[0123] S701: Sets the GPIO to output high and waits for a preset time, such as 1 second.

[0124] It should be noted that after setting the GPIO to output a high level (e.g., 1.8V), the design capacitor C enters the charging state. After waiting for 1 second, the design capacitor C is fully charged, and at this time the voltage of the design capacitor C is 1.8V.

[0125] S702: Set GPIO to disable voltage input (input no-pull).

[0126] It should be noted that after setting the GPIO to disable voltage input, the capacitor C begins to discharge.

[0127] S703: Detects the logic level of GPIO.

[0128] It should be noted that logic levels can include low and high levels. A fully charged design capacitor C is at a high level, but as the design capacitor C discharges, its voltage will decrease and in some cases it will switch to a low level.

[0129] S704: Determines whether the logic level of the GPIO is high.

[0130] Specifically, when the GPIO logic level is high, S605 is executed; when the GPIO logic level is low, S607 is executed.

[0131] S705: Wait 20 milliseconds, total delay increments by 20 milliseconds: delay_time += 20 milliseconds.

[0132] S706: Determine if the total delay_time is >= 400 milliseconds.

[0133] Specifically, if the total delay_time >= 400 milliseconds, the equivalent ground impedance Rx <= 31.8kΩ is determined, and S609 is executed; if the total delay_time < 400 milliseconds, S603 is returned.

[0134] S707: Determine if the total delay_time is less than or equal to 100 milliseconds.

[0135] Specifically, if the total delay_time <= 100 milliseconds, the equivalent ground impedance Rx <= 31.8kΩ is determined, and S609 is executed; if the total delay_time > 100 milliseconds, S608 is executed.

[0136] S708: Determine that 31.8 kΩ < Rx < 967 kΩ, and report that a foreign object is connected.

[0137] S709: The detection is completed, and the GPIO is set to input pull - down.

[0138] Specifically, in some embodiments, taking the detection of the equivalent impedance Rx introduced by a foreign object on the USB vbus pin as an example, the method may include:

[0139] Step 1: First, charge the voltage on the USB pin capacitor C to V0 = 1.8 V by configuring the GPIO as output high and outputting a high level of 1.8 V.

[0140] Step 2: Then set the GPIO to input no - pull to turn off the GPIO voltage output. At this time, the capacitor C starts to discharge through the resistor Rx and R, and record the discharge time t. The capacitor can finally discharge to the voltage V1 = 0 V.

[0141] Step 3: Detect the logic level of the GPIO every 20 milliseconds. When the voltage Vt of the capacitor C, that is, the voltage on the GPIO, at time t is lower than the voltage range of its logic high level, the detected logic level of the GPIO will no longer be high level. At this time, it is considered that the detection is completed, and the impedance range of Rx is calculated.

[0142] It should be noted that in the embodiments of the present application, the logic level voltage range of the GPIO depends on the definition of the processor where it is located. Generally, the high level is greater than 1 V, and the low level is less than 0.6 V. Different processors may have slight differences, but determining the accurate range through the chip manual can improve the accuracy of program detection.

[0143] Step 4: According to the description of the logic level voltage range of the processor where the GPIO is located, assume that the lowest voltage of the logic high level is Vt = 1.2 V. Then, according to the formula: Calculate the time when the GPIO logic level changes: t = Re × C × ln(1.5) = Re × C × 0.405, that is

[0144] At this time, assume that the USB pin capacitance C to ground in the hardware design is 10 uF, and the designed DC impedance to ground R is 110 kΩ. Then, the equivalent impedance introduced by a foreign object on the USB pin

[0145] If the time t required for the GPIO to complete the logic level change is 400 milliseconds, then

[0146] If the time t required for the GPIO to complete the logic level change is 100 milliseconds, then

[0147] Similarly, it is set that when the impedance range of Rx is detected to be 31.8 - 967 kΩ, it is considered that there is a foreign object introduced into the USB pin. Then, when the time 100 milliseconds < t < 400 milliseconds required for the GPIO to complete the logic level change in the detection program, it can be determined that there is a foreign object present.

[0148] Through the above embodiments, the specific implementation of the foregoing embodiments is elaborated in detail. It can be seen from this that through the technical solutions of the foregoing embodiments, the characteristics of the parallel discharge time of the capacitor and the resistor are utilized, and according to the capacitor discharge time, it is judged whether a foreign object causes a change in the impedance to the ground and affects the capacitor discharge time at the input pin. The change in the capacitor voltage is detected using the GPIO level connected to it. The smaller the series resistor, the shorter the capacitor discharge time and the shorter the time required for the GPIO logic level change. In this way, the discharge time of the first capacitor can be determined through the electrical parameters of the to-be-tested pin, and then the state of the to-be-tested pin can be quickly judged through the discharge time of the first capacitor. The rapid screening of the to-be-tested pin is achieved, and the time cost and labor cost are reduced.

[0149] In another embodiment of the present application, based on the same inventive concept as the foregoing embodiment, refer to Figure 8 , which shows a schematic structural diagram of the composition of an impedance detection device 80 provided by an embodiment of the present application. As Figure 8 shown, the impedance detection device 80 may include: an acquisition unit 801, a determination unit 802, and a detection unit 803; wherein,

[0150] The acquisition unit 801 is configured to acquire the electrical parameters of the to-be-tested pin; wherein, the to-be-tested pin is connected to the reference ground in parallel through a capacitor and a resistor.

[0151] The determination unit 802 is configured to determine the discharge time corresponding to the first capacitor based on the change of the electrical parameter from the first value to the second value.

[0152] The detection unit 803 is configured to determine the state of the to-be-tested pin according to the comparison result between the discharge time and a preset time threshold.

[0153] In some embodiments, the detection unit 803 is specifically configured to determine that the pin under test is in a first state if the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold; and to determine that the pin under test is in a second state if the discharge time is greater than or equal to the highest time threshold or the discharge time is less than or equal to the lowest time threshold.

[0154] In some embodiments, the detection unit 803 is further configured to determine the equivalent impedance to ground of the pin under test based on the discharge time, wherein the discharge time is correlated with the equivalent impedance to ground; and if the equivalent impedance to ground is less than a maximum impedance threshold and the equivalent impedance to ground is greater than a minimum impedance threshold, then the pin under test is determined to be in a first state; and if the equivalent impedance to ground is greater than or equal to the maximum impedance threshold, or the equivalent impedance to ground is less than or equal to the minimum impedance threshold, then the pin under test is determined to be in a second state.

[0155] In some embodiments, the acquisition unit 801 is further configured to detect the pin to be tested based on a general-purpose input / output port; control the general-purpose input / output port to a first state, causing the first capacitor to enter a charging mode until the voltage value of the first capacitor reaches a first voltage value; and control the general-purpose input / output port to a second state, causing the first capacitor to enter a discharging mode; correspondingly, the acquisition unit 801 is specifically configured to acquire the voltage value of the pin to be tested through the general-purpose input / output port in the discharging mode.

[0156] In some embodiments, the logic level at the general-purpose input / output port is controlled to be a first level; correspondingly, the acquisition unit 801 is specifically configured to determine the discharge time corresponding to the first capacitor when the logic level at the general-purpose input / output port changes from the first level to the second level.

[0157] In some embodiments, the determining unit 802 is specifically configured to: detect the logic level of the general-purpose input / output port at first preset time intervals when the first capacitor enters the discharge mode; accumulate the first preset time interval if the logic level at the general-purpose input / output port remains at a first level; determine the currently accumulated preset time interval as a second preset time interval if the logic level of the general-purpose input / output port is detected to change to a second level; and determine the discharge time corresponding to the first capacitor based on the second preset time interval.

[0158] In some embodiments, the determining unit 802 is further configured to control a start timer to begin timing when the first capacitor enters a discharge mode; and to interrupt the timer to terminate timing and determine the discharge time corresponding to the first capacitor when a change in the logic level of the general-purpose input / output port is detected.

[0159] Understandably, in this embodiment, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional module.

[0160] If the integrated unit is implemented as a software functional module and not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0161] Therefore, this embodiment provides a computer storage medium storing a computer program that, when executed by at least one processor, implements the steps of the method described in any of the foregoing embodiments.

[0162] Based on the composition of the impedance detection device 80 and the computer storage medium described above, see [link to relevant documentation]. Figure 9 This illustrates a schematic diagram of the structural composition of a processor 101 provided in an embodiment of this application. Figure 9 As shown, the processor 101 may include the impedance detection device 80 described in any of the foregoing embodiments.

[0163] In this embodiment, the processor 101 acquires the electrical parameters of the pin under test. The pin under test is connected to a reference ground via a capacitor and a resistor. The discharge time corresponding to the first capacitor is determined based on the change in the electrical parameters from a first value to a second value. The state of the pin under test is determined based on a comparison between the discharge time and a preset time threshold. This allows for the determination of the discharge time of the first capacitor using the electrical parameters of the pin under test, and thus the rapid assessment of the pin's state. This achieves rapid screening of the pin under test, shortens the detection time, and reduces both time and labor costs.

[0164] It should be noted that, in this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0165] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0166] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0167] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0168] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0169] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A detection circuit, the detection circuit comprising a first resistor, a first capacitor and a processor, wherein a first end of the first resistor is electrically connected to a first end of the first capacitor, and a second end of the first resistor and a second end of the first capacitor are connected to a reference ground; and the first end of the first capacitor is connected to a pin to be tested, the processor being connected to the pin to be tested via a general purpose input / output port, the general purpose input / output port including a pull-up impedance; in, The processor is used to detect the electrical parameters of the pin under test, and to determine the discharge time of the first capacitor based on the change of the electrical parameters from a first value to a second value; the processor determines the discharge time by polling the electrical parameters, and determines the state of the pin under test based on the comparison result of the discharge time and a preset time threshold.

2. The detection circuit according to claim 1, wherein the preset time threshold includes a maximum time threshold and a minimum time threshold; When the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, the pin under test is in the first state. When the discharge time is greater than or equal to the highest time threshold, or when the discharge time is less than or equal to the lowest time threshold, the pin under test is in the second state.

3. The detection circuit according to claim 2, wherein, The pin to be tested is a predetermined pin on the Universal Serial Bus (USB) interface.

4. An impedance detection method, the method comprising: Obtain the electrical parameters of the pin under test; wherein the pin under test is connected to a reference ground in parallel through a first capacitor and a first resistor, the pin under test is connected to the processor through a general purpose input / output port, the general purpose input / output port includes a pull-up impedance, and the processor detects the pin under test based on the general purpose input / output port; The discharge time corresponding to the first capacitor is determined based on the change of the electrical parameter from a first value to a second value; the processor determines the discharge time by polling the electrical parameter. The state of the pin to be tested is determined based on the comparison between the discharge time and the preset time threshold.

5. The method according to claim 4, wherein the preset time threshold includes a maximum time threshold and a minimum time threshold; and determining the state of the pin to be tested based on the comparison result of the discharge time and the preset time threshold includes: If the discharge time is less than the highest time threshold and the discharge time is greater than the lowest time threshold, then the pin under test is determined to be in the first state. If the discharge time is greater than or equal to the highest time threshold, or the discharge time is less than or equal to the lowest time threshold, then the pin under test is determined to be in the second state.

6. The method according to claim 4, wherein when determining the state of the pin to be tested, the method further comprises: The equivalent impedance to ground of the pin under test is determined based on the discharge time, wherein the discharge time and the equivalent impedance to ground are correlated. If the equivalent impedance to ground is less than the highest impedance threshold and the equivalent impedance to ground is greater than the lowest impedance threshold, then the pin under test is determined to be in the first state. If the equivalent impedance to ground is greater than or equal to the highest impedance threshold, or the equivalent impedance to ground is less than or equal to the lowest impedance threshold, then the pin under test is determined to be in the second state.

7. The method according to claim 4, further comprising: The general-purpose input / output port is controlled to be in the first state, so that the first capacitor enters the charging mode until the voltage value of the first capacitor reaches the first voltage value; The general-purpose input / output port is controlled to be in the second state, so that the first capacitor enters the discharge mode; Accordingly, obtaining the electrical parameters of the pin under test includes: in discharge mode, obtaining the voltage value of the pin under test through the general-purpose input / output port.

8. The method according to claim 7, wherein controlling the general-purpose input / output port to be in a first state includes: Control the logic level at the general-purpose input / output port to the first level; Accordingly, determining the discharge time corresponding to the first capacitor based on the change of the electrical parameter from the first value to the second value includes: When the logic level of the general-purpose input / output port changes from the first level to the second level, the discharge time corresponding to the first capacitor is determined.

9. The method according to claim 8, wherein determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level comprises: When the first capacitor enters the discharge mode, the logic level of the general-purpose input / output port is detected at first preset time intervals; While maintaining the first logic level at the general-purpose input / output port, the first preset duration is accumulated; If a change in the logic level of the general-purpose input / output port to the second level is detected, the current accumulated preset duration is determined as the second preset duration. The discharge time corresponding to the first capacitor is determined based on the second preset duration.

10. The method according to claim 8, wherein determining the discharge time corresponding to the first capacitor when the logic level of the general-purpose input / output port changes from a first level to a second level comprises: When the first capacitor enters the discharge mode, the start timer is controlled to begin counting. If a change in the logic level of the general-purpose input / output port is detected, the timer is interrupted to stop timing, and the discharge time corresponding to the first capacitor is determined.