Switching detection circuit and chip
Patent Information
- Application Number
- CN202610728530.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-25
- Publication Date
- 2026-10-09
AI Technical Summary
[0005]本申请提供一种开关检测电路及芯片,用以解决目前开关检测电路检测灵活性较低,且端口利用率不高的问题
[0042]本申请提供的开关检测电路,通过在每个端口组的第一端口与第二端口之间连接一个外部开关,以在每个端口组开通时,使第一端口输出拉电流,第二端口输出灌电流,并基于第一端口的端口电压,确定对应的外部开关的开关状态。由此,通过一个端口组即可检测两个及以上的外部开关的开关状态,检测灵活性高,能够提高端口的利用率,从而减少开关检测电路的端口数量,降低开关检测电路的结构复杂度和成本。
Smart Images

Figure CN122882955A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of integrated circuit technology, and in particular to a switch detection circuit and chip. Background Technology
[0002] The car cabin contains numerous control switches, such as light control switches and door / window control switches. These switches require a host MCU (Microcontroller Unit) to detect their status and issue the correct commands. Directly using the MCU to detect the switches would increase the number of its I / O ports.
[0003] Currently, the main approach is to use multiple detection ports of the switch detection circuit to detect the switching status of each switch and transmit the switching status of each switch to the MCU, thereby reducing the MCU's I / O port requirements and simplifying the design.
[0004] However, in this application, a single port can only detect the switching state of one switch, resulting in low detection flexibility and low port utilization. Furthermore, when the number of switches is large, the number of ports in the switch detection circuit needs to be increased, which undoubtedly increases the structural complexity and cost of the switch detection circuit. Summary of the Invention
[0005] This application provides a switch detection circuit and chip to solve the problems of low detection flexibility and low port utilization in current switch detection circuits.
[0006] To achieve the above objectives, this application adopts the following technical solution:
[0007] In a first aspect, this application provides a switch detection circuit, which includes a detection module, a current sourcing output module, a current sinking output module, a switch module, multiple first ports, and multiple second ports;
[0008] One of the current sourcing output module and the current sinking output module is connected to the detection module; the current sourcing output module and the current sinking output module are respectively connected to the switch module; the detection module is connected to the switch module; each of the first ports and each of the second ports are respectively connected to the switch module.
[0009] For each of the first ports, an external switch is connected between the first port and each of the second ports; the first ports and second ports connected to the same external switch constitute a port group;
[0010] The detection module is used to control multiple port groups to turn on sequentially according to a specified turn-on sequence through the switch module, and when each port group is turned on, to determine the switching state of the external switch corresponding to the port group based on the port voltage of the first port in the port group; when each port group is turned on, the first port in the port group outputs a source current and the second port in the port group outputs a sink current.
[0011] In one possible implementation, the detection module includes a comparison submodule and a control submodule connected to the comparison submodule;
[0012] One of the current output module and the current sinking module is connected to the comparison submodule; the comparison submodule and the control submodule are respectively connected to the switching module;
[0013] The comparison submodule is used to determine the voltage comparison signal corresponding to the port group based on the port voltage of the first port in the port group and a preset voltage threshold when each port group is turned on.
[0014] The control submodule is used to control multiple port groups to turn on sequentially according to the specified turn-on sequence through the switch module, and to determine the switching state of the external switch corresponding to the port group based on the voltage comparison signal corresponding to the port group when each port group is turned on.
[0015] In one possible implementation, the sourcing current output module is connected to the comparison submodule, and the sink current is greater than the sourcing current;
[0016] The comparison submodule is configured to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port in the port group is greater than the preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port in the port group is less than the preset voltage threshold.
[0017] The control submodule is configured to determine the switching state of the external switch corresponding to each port group as open if the voltage comparison signal corresponding to the port group is high, and determine the switching state of the external switch corresponding to the port group as closed if the voltage comparison signal corresponding to the port group is low.
[0018] In one possible implementation, the sink current output module is connected to the comparison submodule, and the pull current is greater than the sink current;
[0019] The comparison submodule is configured to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port in the port group is greater than the preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port in the port group is less than the preset voltage threshold.
[0020] The control submodule is configured to, for each port group, determine that the external switch corresponding to the port group is closed if the voltage comparison signal corresponding to the port group is high, and determine that the external switch corresponding to the port group is open if the voltage comparison signal corresponding to the port group is low.
[0021] In one possible implementation, the switch module includes a first switch submodule and a second switch submodule;
[0022] Each of the first ports is connected to the first switch submodule, and each of the second ports is connected to the second switch submodule; the first switch submodule is connected to the current output module, and the second switch submodule is connected to the current sinking output module; the first switch submodule and the second switch submodule are respectively connected to the control submodule.
[0023] When the current output module is connected to the comparison submodule, the comparison submodule is connected to the first switch submodule; when the current sink output module is connected to the comparison submodule, the comparison submodule is connected to the second switch submodule.
[0024] The control submodule is used to control multiple port groups to be turned on sequentially according to the specified turn-on sequence through the first switch submodule and the second switch submodule.
[0025] In one possible implementation, the first switch submodule includes a first multiplexer and a plurality of internal switches; the second switch submodule includes a second multiplexer and a plurality of internal switches.
[0026] The first multiplexer and the second multiplexer are respectively connected to the control submodule; each of the first ports is connected to the current sourcing output module through an internal switch and the first multiplexer; each of the second ports is connected to the current sinking output module through an internal switch and the second multiplexer.
[0027] When the current output module is connected to the comparison submodule, the comparison submodule is connected to the first multiplexer; when the current sinking output module is connected to the comparison submodule, the comparison submodule is connected to the second multiplexer.
[0028] The control submodule is used to sequentially control the multiple internal switches to close or open according to the specified activation sequence via the first multiplexer, and sequentially control the multiple internal switches to close or open via the second multiplexer, so that the multiple port groups are activated sequentially.
[0029] In one possible implementation, the switch detection circuit further includes at least one third port;
[0030] When the current output module is connected to the comparison submodule, each of the third ports is connected to the first switch submodule, and each of the third ports is grounded through an external switch;
[0031] When the sinking current output module is connected to the comparison submodule, each of the third ports is connected to the second switch submodule, and each of the third ports is connected to a preset power supply through an external switch;
[0032] The control submodule is also used to control at least one of the third ports to be turned on sequentially through the first switch submodule or the second switch submodule according to the specified turn-on sequence.
[0033] The comparison submodule is further configured to determine the voltage comparison signal corresponding to the third port based on the port voltage of the third port and the preset voltage threshold when each third port is turned on;
[0034] The control submodule is also used to determine the switching state of the external switch connected to the third port based on the port voltage of the third port when each third port is turned on.
[0035] In one possible implementation, the sourcing current output module is connected to the comparison submodule, and the sink current is greater than the sourcing current;
[0036] The comparison submodule is used to determine that the voltage comparison signal corresponding to the third port is a high-level signal if the port voltage of the third port is greater than the preset voltage threshold when each third port is turned on, and to determine that the voltage comparison signal corresponding to the third port is a low-level signal if the port voltage of the third port is less than the preset voltage threshold.
[0037] The control submodule is configured to determine that the external switch connected to the third port is open when the voltage comparison signal corresponding to each third port is high, and to determine that the external switch connected to the third port is closed when the voltage comparison signal corresponding to each third port is low.
[0038] In one possible implementation, the sink current output module is connected to the comparison submodule, and the pull current is greater than the sink current;
[0039] The comparison submodule is used to determine that the voltage comparison signal corresponding to the third port is a high-level signal if the port voltage of the third port is greater than the preset voltage threshold when each third port is turned on, and to determine that the voltage comparison signal corresponding to the third port is a low-level signal if the port voltage of the third port is less than the preset voltage threshold.
[0040] The control submodule is configured to determine that the external switch connected to the third port is closed when the voltage comparison signal corresponding to each third port is high, and to determine that the external switch connected to the third port is open when the voltage comparison signal corresponding to each third port is low.
[0041] Secondly, this application provides a chip that includes the switch detection circuit described in any one of the first aspects above.
[0042] The switch detection circuit provided in this application connects an external switch between the first and second ports of each port group. When each port group is turned on, the first port outputs a source current and the second port outputs a sink current. Based on the port voltage of the first port, the switching state of the corresponding external switch is determined. Therefore, the switching states of two or more external switches can be detected through a single port group, offering high detection flexibility, improving port utilization, reducing the number of ports in the switch detection circuit, and lowering its structural complexity and cost. Attached Figure Description
[0043] Figure 1 This is a block diagram illustrating a switch detection circuit according to an exemplary embodiment;
[0044] Figure 2 This is a block diagram illustrating another switch detection circuit according to an exemplary embodiment;
[0045] Figure 3 This is a block diagram illustrating another switch detection circuit according to an exemplary embodiment;
[0046] Figure 4 This is a block diagram illustrating yet another switch detection circuit according to an exemplary embodiment;
[0047] Figure 5 This is a schematic diagram of a switch detection circuit according to an exemplary embodiment;
[0048] Figure 6This is a schematic diagram of another switch detection circuit according to an exemplary embodiment;
[0049] Figure 7 This is a block diagram illustrating a chip according to an exemplary embodiment. 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. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0051] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, the use of "based on" or "according to" implies openness and inclusiveness, because processes, steps, calculations, or other actions "based on" or "according to" one or more of the stated conditions or values may in practice be based on additional conditions or beyond the stated values.
[0052] refer to Figure 1 and Figure 2 The switch detection circuit 10 includes a detection module 11, a current-source output module 12, a current-sinking output module 13, a switch module 14, multiple first ports 15, and multiple second ports 16. It should be noted that... Figure 1 and Figure 2 K1-K16 or K1-K12 are used to represent different external switches for illustrative purposes only, and the specific number of external switches is not limited.
[0053] One of the current sourcing output module 12 and the current sinking output module 13 is connected to the detection module 11. The current sourcing output module 12 and the current sinking output module 13 are respectively connected to the switch module 14. The detection module 11 is connected to the switch module 14. Each first port 15 and each second port 16 are respectively connected to the switch module 14.
[0054] For each first port 15, an external switch is connected between the first port 15 and each second port 16. The first ports 15 and second ports 16 connected to the same external switch constitute a port group.
[0055] The detection module 11 is used to control multiple port groups to turn on sequentially according to a specified turn-on sequence via the switch module 14, and to determine the switching state of the external switch corresponding to each port group based on the port voltage of the first port 15 in that port group when each port group is turned on. When each port group is turned on, the first port 15 in that port group outputs a source current, and the second port 16 in that port group outputs a sink current.
[0056] Specifically, the switch detection circuit 10 is provided with m first ports 15 and n second ports 16. Where m and n are both natural numbers greater than or equal to 2.
[0057] The first port 15 is connected to the current sourcing output module 12 via the switch module 14, and the second port 16 is connected to the current sinking output module 13 via the switch module 14. The detection module 11 can control the opening of the first port 15 and the second port 16 via the switch module 14. When the first port 15 is opened, it is connected to the current sourcing output module 12, so that the current sourcing output module 12 outputs through the first port 15. When the second port 16 is opened, it is connected to the current sinking output module 13, so that the current sinking output module 13 outputs through the second port 16.
[0058] When an external switch to be tested is connected between a first port 15 and a second port 16, if both ports 15 and 16 are simultaneously turned on, the first port 15 will output a source current, and the second port 16 will output a sink current. Based on the magnitude of the source and sink currents, and the switching state of the external switch (which includes both closed and open states), different port voltages will be generated at the first port 15. Conversely, the switching state of the external switch can be determined by observing the different port voltages generated at the first port 15 and the magnitudes of the source and sink currents. The detection module 11 can be connected to the source current output module 12 (e.g., ...). Figure 1 (As shown), it can also be connected to the sinking current output module 13 (such as...) Figure 2 As shown in the figure, the results of judging the switching status of the external switch will also differ depending on the connection method of the detection module 11.
[0059] For example, arranging and combining m first ports 15 and n second ports 16 will form multiple m×n port groups, each port group including one first port 15 and one second port 16. An external switch can be connected between the first port 15 and the second port 16 in each port group.
[0060] Upon receiving a detection command, the detection module 11 will control multiple port groups to turn on sequentially via the switch module 14 according to the specified turn-on sequence (i.e., the detection order of different external switches). Controlling the turn-on of each port group means controlling the first port 15 and the second port 16 within each group to turn on simultaneously, causing the first port 15 to output current and the second port 16 to output current sinking. Furthermore, each port group will turn off after a certain period of time before the next port group turns on; two port groups cannot be turned on simultaneously.
[0061] When each port group is turned on, the detection module 11 determines the switching state of the external switch corresponding to that port group based on the port voltage of the first port 15 in that port group, the connection method of the detection module 11, and the magnitude of the source and sink currents. The external switch corresponding to each port group is the external switch connecting the first port 15 and the second port 16 in that port group.
[0062] In this way, the switching status of up to m×n external switches can be detected simultaneously. Compared to detecting the switching status of one switch per port (i.e., a maximum of m + n ports can be detected), this improves port utilization and allows for the detection of more external switches with the same number of ports. For example, when m = 4 and n = 4, there are a total of 8 ports. Existing technology can detect the switching status of a maximum of 8 external switches, while this disclosure can detect the switching status of 16 external switches.
[0063] After determining the switching state of each external switch, the detection module 11 can send the switching state of each external switch to the MCU 20, so that the MCU 20 can issue corresponding control commands based on the switching state of each external switch.
[0064] In some embodiments, the current sourcing output module 12 is a current sourcing current source, and the current sinking output module 13 is a current sinking current source.
[0065] The switch detection circuit provided in this application connects an external switch between the first and second ports of each port group. When each port group is turned on, the first port outputs a source current and the second port outputs a sink current. Based on the port voltage of the first port, the switching state of the corresponding external switch is determined. Therefore, the switching states of two or more external switches can be detected through a single port group, offering high detection flexibility, improving port utilization, reducing the number of ports in the switch detection circuit, and lowering its structural complexity and cost.
[0066] Optionally, refer to Figure 1 and Figure 2The detection module 11 may include a comparison submodule 111 and a control submodule 112 connected to the comparison submodule 111.
[0067] One of the current-pull output module 12 and the current-sink output module 13 is connected to the comparator submodule 111. The comparator submodule 111 and the control submodule 112 are respectively connected to the switch module 14.
[0068] The comparison submodule 111 is used to determine the voltage comparison signal corresponding to the port group based on the port voltage of the first port 15 in the port group and a preset voltage threshold when each port group is turned on.
[0069] The control submodule 112 is used to control multiple port groups to turn on sequentially according to a specified turn-on sequence through the switch module 14, and to determine the switching state of the external switch corresponding to the port group based on the voltage comparison signal corresponding to the port group when each port group is turned on.
[0070] In some embodiments, the comparison submodule 111 is a comparator.
[0071] In some embodiments, the control submodule 112 is a logic control module.
[0072] In one possible implementation, refer to Figure 1 The current output module 12 is connected to the comparator submodule 111, and the sink current is greater than the sourcing current.
[0073] The comparison submodule 111 is used to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port 15 in the port group is greater than a preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port 15 in the port group is less than the preset voltage threshold.
[0074] The control submodule 112 is used to determine the switching state of the external switch corresponding to the port group as open if the voltage comparison signal corresponding to the port group is high, and to determine the switching state of the external switch corresponding to the port group as closed if the voltage comparison signal corresponding to the port group is low.
[0075] Specifically, after receiving a detection command, the control submodule 112 will control multiple port groups to turn on sequentially according to a specified turn-on sequence via the switch module 14. When each port group is turned on, the comparison submodule 111 can detect the port voltage of each first port 15 and compare it with a preset voltage threshold. Provided the sink current is greater than the source current, if the port voltage of the first port 15 in the port group is greater than the preset voltage threshold, the comparison submodule 111 will output a high-level signal as the voltage comparison signal corresponding to that port group and send it to the control submodule 112. If the port voltage of the first port 15 in the port group is less than the preset voltage threshold, the comparison submodule 111 will output a low-level signal as the voltage comparison signal corresponding to that port group and send it to the control submodule 112.
[0076] The control submodule 112 controls multiple port groups to be turned on sequentially according to a specified turn-on sequence. When the comparison submodule 111 outputs a voltage comparison signal, the control submodule 112 can determine which port group the voltage comparison signal corresponds to based on the current turn-on time. If the voltage comparison signal corresponding to the port group is a high-level signal, the switch state of the external switch corresponding to the port group is determined to be open. If the voltage comparison signal corresponding to the port group is a low-level signal, the switch state of the external switch corresponding to the port group is determined to be closed.
[0077] In another possible implementation, refer to Figure 2 The sink current output module 13 is connected to the comparator submodule 111, and the pull current is greater than the sink current.
[0078] The comparison submodule 111 is used to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port 15 in the port group is greater than a preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port 15 in the port group is less than the preset voltage threshold.
[0079] The control submodule 112 is used to determine the switching state of the external switch corresponding to the port group as closed if the voltage comparison signal corresponding to the port group is high, and to determine the switching state of the external switch corresponding to the port group as open if the voltage comparison signal corresponding to the port group is low.
[0080] Specifically, when the sink current output module 13 is connected to the comparison submodule 111 and the pull current is greater than the sink current, when the comparison submodule 111 outputs a voltage comparison signal, the control submodule 112 can determine which port group the voltage comparison signal corresponds to based on the current turn-on time. If the voltage comparison signal corresponding to the port group is a high-level signal, the switch state of the external switch corresponding to the port group is determined to be closed. If the voltage comparison signal corresponding to the port group is a low-level signal, the switch state of the external switch corresponding to the port group is determined to be open.
[0081] Optionally, in some embodiments, reference is made to Figure 3 and Figure 4 As shown, the switch module 14 includes a first switch submodule 141 and a second switch submodule 142.
[0082] Each first port 15 is connected to the first switch submodule 141, and each second port 16 is connected to the second switch submodule 142. The first switch submodule 141 is connected to the current output module 12, and the second switch submodule 142 is connected to the current sinking module 13. The first switch submodule 141 and the second switch submodule 142 are connected to the control submodule 112.
[0083] When the current output module 12 is connected to the comparator submodule 111, the comparator submodule 111 is connected to the first switch submodule 141. When the current sink output module 13 is connected to the comparator submodule 111, the comparator submodule 111 is connected to the second switch submodule 142.
[0084] The control submodule 112 is used to control multiple port groups to be turned on sequentially according to a specified turn-on sequence through the first switch submodule 141 and the second switch submodule 142.
[0085] Specifically, the switch module 14 can be composed of a first switch submodule 141 and a second switch submodule 142. The first port 15 is connected to the current output module 12 through the first switch submodule 141, and the second port 16 is connected to the current sinking module 13 through the second switch submodule 142.
[0086] The control submodule 112 can, according to a specified turn-on sequence, control the first port 15 in a port group to be turned on through the first switch submodule 141 so that the first port 15 is connected to the current output module 12, and control the second port 16 in the port group to be turned on through the second switch submodule 142 so that the second port 16 is connected to the current sinking module 13.
[0087] In one possible implementation, the first switch submodule 141 includes a first multiplexer 1411 and a plurality of internal switches. The second switch submodule 142 includes a second multiplexer 1421 and a plurality of internal switches. It should be noted that... Figure 3 and Figure 4 S1-S8 or S1-S7 are used to represent different internal switches for illustrative purposes only, and the specific number of internal switches is not limited.
[0088] The first multiplexer 1411 and the second multiplexer 1421 are respectively connected to the control submodule 112. Each first port 15 is connected to the current output module 12 via an internal switch and the first multiplexer 1411. Each second port 16 is connected to the current sinking module 13 via an internal switch and the second multiplexer 1421.
[0089] When the current output module 12 is connected to the comparator submodule 111, the comparator submodule 111 is connected to the first multiplexer 1411, such as... Figure 3 As shown.
[0090] When the current sinking output module 13 is connected to the comparator submodule 111, the comparator submodule 111 is connected to the second multiplexer 1421, such as... Figure 4 As shown.
[0091] The control submodule 112 is used to control multiple internal switches to close or open sequentially through the first multiplexer 1411 and the second multiplexer 1421 according to a specified opening sequence, so that multiple port groups are opened sequentially.
[0092] Specifically, the control submodule 112 can, according to a specified activation sequence, control the internal switch corresponding to the first port 15 in the port group to be activated through the first multiplexer 1411 to close, thereby connecting the first port 15 in the port group to the current output module 12, and control the internal switch corresponding to the second port 16 in the port group to close, thereby connecting the second port 16 in the port group to the current sinking module 13.
[0093] After the port group has been turned on for a preset time, the control submodule 112 can control the internal switch corresponding to the first port 15 in the port group to be turned off through the first multiplexer 1411, so that the first port 15 in the port group is disconnected from the current output module 12, and control the internal switch corresponding to the second port 16 in the port group to be turned off through the second multiplexer 1421, so that the second port 16 in the port group is disconnected from the current sinking module 13.
[0094] In another possible implementation, the first switch submodule 141 may consist of only a plurality of internal switches, each internal switch being disposed between the first port 15 and the current sourcing output module 12. Similarly, the second switch submodule 142 may consist of only a plurality of internal switches, each internal switch being disposed between the second port 16 and the current sinking output module 13. The control submodule 112 can control whether the first port 15 is connected to the current sourcing output module 12, and whether the second port 16 is connected to the current sinking output module 13, by controlling the closing or opening of each switch.
[0095] Alternatively, in one possible implementation, refer to Figure 5 and Figure 6 The switch detection circuit 10 also includes at least one third port 17.
[0096] When the current output module 12 is connected to the comparator submodule 111, each third port 17 is connected to the first switch submodule 141, and each third port 17 is grounded through an external switch.
[0097] When the sink current output module 13 is connected to the comparator submodule 111, each third port 17 is connected to the second switch submodule 142, and each third port 17 is connected to the preset power supply 30 through an external switch.
[0098] The control submodule 112 is also used to control at least one third port 17 to be turned on sequentially through the first switch submodule 141 or the second switch submodule 142 according to a specified turn-on sequence.
[0099] The comparison submodule 111 is also used to determine the voltage comparison signal corresponding to the third port 17 based on the port voltage of the third port 17 and a preset voltage threshold when each third port 17 is turned on.
[0100] The control submodule 112 is also used to determine the switching state of the external switch connected to the third port 17 based on the port voltage of the third port 17 when each third port 17 is turned on.
[0101] Specifically, the switch detection circuit 10 may further include p third ports 17, each of which can individually detect the switching state of an external switch. Here, p is a natural number greater than or equal to 1.
[0102] By using the cooperation of the first port 15, the second port 16, and the third port 17, the switch status of up to m×n + p external switches can be detected simultaneously. This allows for flexible selection of the connection method between the external switches and the ports based on the number of external switches and the number of the first port 15, the second port 16, and the third port 17, thereby further improving the detection flexibility of the external switches and the utilization rate of the ports.
[0103] For example, when the number of external switches is 13, and m = 3, n = 4, p = 1, the following can be used: Figure 5 The connection method shown is as follows. For example, when the number of external switches is 13, and m = 4, n = 3, p = 1, the following connection method can be used: Figure 6 The connection method shown is as follows. For example, when the number of external switches is 13, and m = 4, n = 4, p = 0, the following connection method can also be used: Figure 1 The connection method shown (at this time, 3 external switches K1-K16 need to be removed).
[0104] It should be noted that when the current output module 12 is connected to the comparator submodule 111, the third port 17 is equivalent to the first port 15. It can be considered that p first ports 15 are selected from the first ports 15 to serve as the third port 17. For example, regarding... Figure 5 It can be assumed that there are a total of 4 first ports 15, and one of them is selected as the third port 17.
[0105] When the sink current output module 13 is connected to the comparator submodule 111, the third port 17 is equivalent to the second port 16. It can be considered that p second ports 16 are selected from the second ports 16 to serve as the third port 17. For example, regarding... Figure 6 There can be considered to be a total of 4 second ports 16, and one of the second ports 16 was selected as the third port 17.
[0106] In one possible implementation, refer to Figure 5 The current output module 12 is connected to the comparator submodule 111, and the sink current is greater than the sourcing current.
[0107] The comparison submodule 111 is used to determine that the voltage comparison signal corresponding to the third port 17 is a high-level signal if the port voltage of the third port 17 is greater than a preset voltage threshold when each third port 17 is turned on, and to determine that the voltage comparison signal corresponding to the third port 17 is a low-level signal if the port voltage of the third port 17 is less than the preset voltage threshold.
[0108] The control submodule 112 is used to determine that the switch state of the external switch connected to the third port 17 is open when the voltage comparison signal corresponding to each third port 17 is a high-level signal, and to determine that the switch state of the external switch connected to the third port 17 is closed when the voltage comparison signal corresponding to each third port 17 is a low-level signal.
[0109] The following describes in detail the switching detection principle of the switch detection circuit 10, using the comparison submodule 111 as a comparator, the control submodule 112 as a logic control module, the current sourcing output module 12 as a current sourcing source, and the current sinking output module 13 as a current sinking source as an example. The first terminal of the current sourcing source is connected to the power supply VDD, the first terminal of the current sinking source is connected to the second multiplexer 1412, and the second terminal of the current sinking source is grounded. The non-inverting input of the comparator is connected to the second terminal of the current sourcing source and the first multiplexer 1411, the inverting input of the comparator is connected to the reference voltage source Vref (used to provide a preset voltage threshold), and the output of the comparator is connected to the logic control module.
[0110] like Figure 5 As shown, after receiving the detection command, the detection module 11 will control the port group or the third port 17 to be turned on in sequence according to the specified activation sequence.
[0111] When detecting the switch state of K1, the control submodule 112 can control S1 to conduct via the first multiplexer 1411 and control S5 to conduct via the second multiplexer 1421, so that the port group corresponding to K1 (i.e., the port group composed of the first port 15 connected to S1 and the second port 16 connected to S5) is turned on. The first port 15 connected to S1 outputs a source current, and the second port 16 connected to S5 outputs a sink current. The comparison submodule 111 detects the port voltage of the first port 15 connected to S1. If the sink current is greater than the source current, and the port voltage is greater than a preset voltage threshold, the comparison submodule 111 outputs a high-level signal to the control submodule 112, which determines that the switch state of K1 is open. If the port voltage is less than the preset voltage threshold, the comparison submodule 111 outputs a low-level signal to the control submodule 112, which determines that the switch state of K1 is closed. Then, K2-K12 are detected in the same way.
[0112] When detecting the switch state of K13, the control submodule 112 can control S4 to conduct via the first multiplexer 1411, thereby opening the first port 15 connected to S4. The first port 15 connected to S4 outputs a current, and the comparison submodule 111 detects the port voltage of the first port 15 connected to S4. If the port voltage is greater than a preset voltage threshold, the comparison submodule 111 outputs a high-level signal to the control submodule 112, which determines that the switch state of K13 is open. If the port voltage is less than the preset voltage threshold, the comparison submodule 111 outputs a low-level signal to the control submodule 112, which determines that the switch state of K13 is closed.
[0113] Alternatively, in one possible implementation, refer to Figure 6 As shown, the sink current output module 13 is connected to the comparator submodule 111, and the pull current is greater than the sink current.
[0114] The comparison submodule 111 is used to determine that the voltage comparison signal corresponding to the third port 17 is a high-level signal if the port voltage of the third port 17 is greater than a preset voltage threshold when each third port 17 is turned on, and to determine that the voltage comparison signal corresponding to the third port 17 is a low-level signal if the port voltage of the third port 17 is less than the preset voltage threshold.
[0115] The control submodule 112 is used to determine that the switch state of the external switch connected to the third port 17 is closed when the voltage comparison signal corresponding to each third port 17 is a high-level signal, and to determine that the switch state of the external switch connected to the third port 17 is open when the voltage comparison signal corresponding to each third port 17 is a low-level signal.
[0116] The following describes in detail the switching detection principle of the switch detection circuit 10, using the comparison submodule 111 as a comparator, the control submodule 112 as a logic control module, the current sourcing output module 12 as a current sourcing source, and the current sinking output module 13 as a current sinking source as an example. Specifically, the first terminal of the current sourcing source is connected to the power supply VDD, the second terminal of the current sourcing source is connected to the first multiplexer 1411, and the second terminal of the current sinking source is grounded. The non-inverting input of the comparator is connected to the first terminal of the current sinking source and the second multiplexer 1412, the inverting input of the comparator is connected to the reference voltage source Vref, and the output of the comparator is connected to the logic control module.
[0117] like Figure 6 As shown, after receiving the detection command, the detection module 11 will control the port group or the third port 17 to be turned on in sequence according to the specified activation sequence.
[0118] When detecting the switch state of K1, the control submodule 112 can control S1 to conduct via the first multiplexer 1411 and control S5 to conduct via the second multiplexer 1421, thereby opening the port group corresponding to K1. The first port 15 connected to S1 outputs a source current, and the second port 16 connected to S5 outputs a sink current. The comparator submodule 111 detects the port voltage of the first port 15 connected to S1. If the source current is greater than the sink current, and the port voltage is greater than a preset voltage threshold, the comparator submodule 111 outputs a high-level signal to the control submodule 112, which determines that the switch state of K1 is open. If the port voltage is less than the preset voltage threshold, the comparator submodule 111 outputs a low-level signal to the control submodule 112, which determines that the switch state of K1 is closed. Then, K2-K12 are detected sequentially in the same manner.
[0119] When detecting the switch state of K13, the control submodule 112 can control S8 to conduct via the second multiplexer 1421, thereby opening the first port 15 connected to S8. The first port 15 connected to S8 outputs a sinking current, and the comparator submodule 111 detects the port voltage of the first port 15 connected to S8. If the port voltage is greater than a preset voltage threshold, the comparator submodule 111 outputs a high-level signal to the control submodule 112, which determines that the switch state of K13 is closed. If the port voltage is less than the preset voltage threshold, the comparator submodule 111 outputs a low-level signal to the control submodule 112, which determines that the switch state of K13 is open.
[0120] This application also provides a chip 40, such as Figure 7 As shown, the chip 40 may include Figures 1-6 Any one of the switch detection circuits 10.
[0121] The aforementioned chip 40 can be any chip involving switch detection function, such as a many-to-one interface chip.
[0122] Regarding the chip 40 in the above embodiments, the specific manner in which the switch detection circuit 10 performs its operation has been described in detail in the embodiments relating to the circuit, and will not be elaborated upon here.
[0123] 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 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 switch detection circuit, characterized in that, The switch detection circuit includes a detection module, a current output module, a current sinking output module, a switch module, multiple first ports, and multiple second ports; One of the current sourcing output module and the current sinking output module is connected to the detection module; the current sourcing output module and the current sinking output module are respectively connected to the switch module; the detection module is connected to the switch module; each of the first ports and each of the second ports are respectively connected to the switch module. For each of the first ports, an external switch is connected between the first port and each of the second ports; the first ports and second ports connected to the same external switch constitute a port group; The detection module is used to control multiple port groups to turn on sequentially according to a specified turn-on sequence through the switch module, and to determine the switching state of the external switch corresponding to the port group based on the port voltage of the first port in the port group when each port group is turned on. When each of the port groups is turned on, the first port in the port group outputs a sourcing current, and the second port in the port group outputs a sinking current.
2. The switch detection circuit according to claim 1, characterized in that, The detection module includes a comparison submodule and a control submodule connected to the comparison submodule; One of the current output module and the current sinking module is connected to the comparison submodule; The comparison submodule and the control submodule are respectively connected to the switch module; The comparison submodule is used to determine the voltage comparison signal corresponding to the port group based on the port voltage of the first port in the port group and a preset voltage threshold when each port group is turned on. The control submodule is used to control multiple port groups to turn on sequentially according to the specified turn-on sequence through the switch module, and to determine the switching state of the external switch corresponding to the port group based on the voltage comparison signal corresponding to the port group when each port group is turned on.
3. The switch detection circuit according to claim 2, characterized in that, The current sourcing output module is connected to the comparison submodule, and the sink current is greater than the current sourcing current; The comparison submodule is configured to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port in the port group is greater than the preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port in the port group is less than the preset voltage threshold. The control submodule is configured to determine the switching state of the external switch corresponding to each port group as open if the voltage comparison signal corresponding to the port group is high, and determine the switching state of the external switch corresponding to the port group as closed if the voltage comparison signal corresponding to the port group is low.
4. The switch detection circuit according to claim 2, characterized in that, The sink current output module is connected to the comparison submodule, and the pull current is greater than the sink current; The comparison submodule is configured to determine that the voltage comparison signal corresponding to the port group is a high-level signal if the port voltage of the first port in the port group is greater than the preset voltage threshold when each port group is turned on, and to determine that the voltage comparison signal corresponding to the port group is a low-level signal if the port voltage of the first port in the port group is less than the preset voltage threshold. The control submodule is configured to, for each port group, determine that the external switch corresponding to the port group is closed if the voltage comparison signal corresponding to the port group is high, and determine that the external switch corresponding to the port group is open if the voltage comparison signal corresponding to the port group is low.
5. The switch detection circuit according to claim 2, characterized in that, The switching module includes a first switching submodule and a second switching submodule; Each of the first ports is connected to the first switch submodule, and each of the second ports is connected to the second switch submodule; the first switch submodule is connected to the current output module, and the second switch submodule is connected to the current sinking output module; the first switch submodule and the second switch submodule are respectively connected to the control submodule. When the current output module is connected to the comparison submodule, the comparison submodule is connected to the first switch submodule; When the sink current output module is connected to the comparison submodule, the comparison submodule is connected to the second switch submodule; The control submodule is used to control multiple port groups to be turned on sequentially according to the specified turn-on sequence through the first switch submodule and the second switch submodule.
6. The switch detection circuit according to claim 5, characterized in that, The first switch submodule includes a first multiplexer and multiple internal switches; the second switch submodule includes a second multiplexer and multiple internal switches. The first multiplexer and the second multiplexer are respectively connected to the control submodule; each of the first ports is connected to the current sourcing output module through an internal switch and the first multiplexer; each of the second ports is connected to the current sinking output module through an internal switch and the second multiplexer. When the current output module is connected to the comparison submodule, the comparison submodule is connected to the first multiplexer; when the current sinking output module is connected to the comparison submodule, the comparison submodule is connected to the second multiplexer. The control submodule is used to sequentially control the multiple internal switches to close or open according to the specified activation sequence via the first multiplexer, and sequentially control the multiple internal switches to close or open via the second multiplexer, so that the multiple port groups are activated sequentially.
7. The switch detection circuit according to claim 5, characterized in that, The switch detection circuit also includes at least one third port; When the current output module is connected to the comparison submodule, each of the third ports is connected to the first switch submodule, and each of the third ports is grounded through an external switch; When the sinking current output module is connected to the comparison submodule, each of the third ports is connected to the second switch submodule, and each of the third ports is connected to a preset power supply through an external switch; The control submodule is also used to control at least one of the third ports to be turned on sequentially through the first switch submodule or the second switch submodule according to the specified turn-on sequence. The comparison submodule is further configured to determine the voltage comparison signal corresponding to the third port based on the port voltage of the third port and the preset voltage threshold when each third port is turned on; The control submodule is also used to determine the switching state of the external switch connected to the third port based on the port voltage of the third port when each third port is turned on.
8. The switch detection circuit according to claim 7, characterized in that, The current sourcing output module is connected to the comparison submodule, and the sink current is greater than the current sourcing current; The comparison submodule is used to determine that the voltage comparison signal corresponding to the third port is a high-level signal if the port voltage of the third port is greater than the preset voltage threshold when each third port is turned on, and to determine that the voltage comparison signal corresponding to the third port is a low-level signal if the port voltage of the third port is less than the preset voltage threshold. The control submodule is configured to determine that the external switch connected to the third port is open when the voltage comparison signal corresponding to each third port is high, and to determine that the external switch connected to the third port is closed when the voltage comparison signal corresponding to each third port is low.
9. The switch detection circuit according to claim 7, characterized in that, The sink current output module is connected to the comparison submodule, and the pull current is greater than the sink current; The comparison submodule is used to determine that the voltage comparison signal corresponding to the third port is a high-level signal if the port voltage of the third port is greater than the preset voltage threshold when each third port is turned on, and to determine that the voltage comparison signal corresponding to the third port is a low-level signal if the port voltage of the third port is less than the preset voltage threshold. The control submodule is configured to determine that the external switch connected to the third port is closed when the voltage comparison signal corresponding to each third port is high, and to determine that the external switch connected to the third port is open when the voltage comparison signal corresponding to each third port is low.
10. A chip, characterized in that, Includes the switch detection circuit as described in any one of claims 1-9.