USB device insertion detection circuit and method and USB chip

By using switch modules, detection modules and HUB modules in the USB device insertion detection circuit, detecting the device's access signal and resetting the USB link, the problem of probability of non-recognition after insertion of the USB device is solved, and the device's recognition stability is improved and user experience.

CN119473971APending Publication Date: 2025-02-18XIAN QINGSONG PHOTOELECTRIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310980241.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-04
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

After the USB device is inserted into the USB interface, the probability of not recognizing it, which will affect the user experience and make it difficult to reproduce and analyze.

Method used

提供一种USB设备插入检测电路,包括开关模块、检测模块和HUB模块,通过检测模块根据设备接入信号控制输入端口切换,获取设备识别状态信息,并在未识别到设备时通过预设路径重置USB链路以重新识别设备。

Benefits of technology

It improves the stability and reliability of USB devices being recognized, solves the problem of probability non-recognition, enhances user experience, and improves the usability of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473971A_ABST
    Figure CN119473971A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electronics, and discloses a USB equipment insertion detection circuit and method and a USB chip. The detection circuit comprises a switch module, a detection module and a HUB module, and the switch module comprises an input port, a first output port and a second output port. The detection module is used for controlling the input port to be switched from the connection with the second output port to the connection with the first output port according to an equipment access signal, and acquiring equipment identification state information from the HUB module; and when the inserted device is not identified according to the device identification state information, resetting the USB link through a preset path to re-identify the inserted device. According to the method and the device, the problem of probabilistic non-recognition after the device is inserted into the USB interface is solved, the stability and the reliability of recognizing the device are improved, the practicability is realized, and the use experience of a user is also improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and in particular to a USB device insertion detection circuit, method and USB chip. Background Art

[0002] At present, after a USB device is inserted into the USB interface of a product, the USB may not be recognized probabilistically. This kind of probabilistic non-recognition problem is difficult to reproduce and analyze, so it is difficult to solve this kind of probabilistic non-recognition problem well, which affects the user experience. Therefore, the problem of stable recognition of USB devices needs to be solved urgently. Summary of the invention

[0003] The implementation method of the present application mainly solves the technical problem of probabilistic USB non-recognition after the USB device is inserted into the USB interface, thereby improving the stability of USB device recognition.

[0004] In order to solve the above technical problems, a technical solution adopted in the embodiment of the present application is: providing a USB device insertion detection circuit, including: a switch module, a detection module and a HUB module, the switch module including an input port, a first output port and a second output port, the first output port is connected to the HUB module, the second output port is respectively connected to the input port and the detection module, and the detection module is also connected to the HUB module; when the input port detects a device access signal, the detection module is used to: control the input port to switch from connection with the second output port to connection with the first output port according to the device access signal, so as to provide a conduction voltage for the HUB module, and obtain device identification status information from the HUB module; when the inserted device is not identified according to the device identification status information, reset the USB link through a preset path to re-identify the inserted device. Among them, the detection module determines that an external device has been inserted according to the device access signal, and the detection module further obtains the device identification status information from the HUB module to determine the insertion status of the external device. If the inserted device is not identified according to the device identification status information, the USB link is reset through a preset path to re-identify the inserted device. Therefore, the embodiment of the present application can solve the problem of probabilistic USB non-recognition after the USB device is inserted into the USB interface, improves the stability and reliability of USB device identification, and has certain practicality.

[0005] In some embodiments, a control module is further included, and the control module is connected to the detection module and the HUB module respectively; when the detection module receives the device access signal, the detection module is also used to: send device access information to the control module according to the device access signal, so that the control module detects the inserted device according to the device access information; receive the device not inserted signal returned by the control module, and in response to the device not inserted signal, reset the USB link through a preset path to re-identify the inserted device. The control module is used to detect the device insertion status, and the detection module and the control module work together to achieve real-time monitoring and control of the USB device status, thereby improving the recognition rate and stability of the USB device.

[0006] In some embodiments, resetting the USB link through a preset path includes: the detection module sends a control signal to an external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and then power on again to re-identify the inserted device; or, the detection module controls the input port to be connected to the second output port and then switches the switch to connect the input port to the first output port to re-identify the inserted device; or, the detection module sends a reset control signal to the HUB module to re-identify the inserted device. In this embodiment, a method for resetting the USB link is provided, so that the USB link can be reset, which can effectively solve the abnormal problem of USB devices and improve the reliability and stability of USB devices; in addition, by resetting the USB link, the communication cache between devices can be cleared and the communication connection can be re-established, thereby improving the compatibility and interoperability between devices; finally, the problem of USB devices can be quickly solved to improve the availability and user experience of the device.

[0007] In some embodiments, the detection module is further used to: when the device removal status information is obtained from the HUB module, control the input port to switch to connect with the second output port. When the USB device is unplugged, by controlling the input port to be connected with the second output port, the connection between the device and the host can be interrupted in time to avoid data loss and improve the reliability of data transmission. In addition, the information that the device is unplugged can be sent to the host in time to improve the device response speed and enhance the user experience.

[0008] In some embodiments, when the device is unplugged, the control module is used to send device removal status information to the detection module, and the detection module is used to control the input port to switch to connect with the second output port according to the device removal status information. The device unplugging situation is responded to in a timely manner, thereby avoiding data loss and improving the reliability of data transmission.

[0009] In some embodiments, a logic OR gate module is further included, and the second output port is connected to the detection module through the logic OR gate module; the device access signal includes a DP signal and a DM signal, and the logic OR gate module is used to receive the DP signal and the DM signal input by the second output port, and output a combined signal to the detection module according to the DP signal and the DM signal; the detection module is used to identify the insertion status of the device according to the combined signal. Among them, by using the logic OR gate module, the DP signal and the DM signal of the second output port can be combined and processed, and a combined signal can be output. The detection module can identify the insertion status of the device according to the combined signal, thereby improving the recognition accuracy of the device insertion status and avoiding misjudgment and missed judgment due to signal instability.

[0010] In order to solve the above technical problems, another technical solution adopted by the embodiment of the present application is: to provide a USB device insertion detection method, which is applied to the USB device insertion detection circuit as described above, and the method includes: when the input port detects a device access signal, according to the device access signal, controlling the input port to switch from the connection with the second output port to the connection with the first output port, so as to provide a conduction voltage for the HUB module, and obtain device identification status information from the HUB module; when the inserted device is not identified according to the device identification status information, resetting the USB link through a preset path to re-identify the inserted device. The embodiment of the present application can solve the problem of USB probabilistic non-recognition after the USB device is inserted into the USB interface, improve the stability and reliability of USB device identification, and has certain practicality.

[0011] In some embodiments, the USB device insertion detection circuit further includes a control module, and the control module is connected to the detection module and the HUB module respectively; the method further includes: when the detection module receives the device access signal, the detection module sends device access information to the control module according to the device access signal, so that the control module detects the inserted device according to the device access information; the detection module receives the device not inserted signal returned by the control module, and in response to the device not inserted signal, resets the USB link through a preset path to re-identify the inserted device. The control module is used to detect the device insertion status, and the detection module and the control module work together to realize real-time monitoring and control of the USB device status, thereby improving the recognition rate and stability of the USB device.

[0012] In some embodiments, resetting the USB link through a preset path includes: the detection module sends a control signal to an external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and then power on again to re-identify the inserted device; or, the detection module controls the input port to be connected to the second output port and then switches the switch to connect the input port to the first output port to re-identify the inserted device; or, the detection module sends a reset control signal to the HUB module to re-identify the inserted device. In this embodiment, a method for resetting the USB link is provided, so that the USB link can be reset, which can effectively solve the abnormal problem of USB devices and improve the reliability and stability of USB devices; in addition, by resetting the USB link, the communication cache between devices can be cleared and the communication connection can be re-established, thereby improving the compatibility and interoperability between devices; finally, the problem of USB devices can be quickly solved to improve the availability and user experience of the device.

[0013] To solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: to provide a USB chip, comprising: the USB device insertion detection circuit as described above, and a USB interface, wherein the USB interface is connected to the switch module, and the USB interface is used to support the insertion and removal of external devices.

[0014] Different from the related art, the embodiment of the present application provides a USB device insertion detection circuit, method and USB chip. The detection module determines that an external device is inserted according to the device access signal, and the detection module further obtains the device identification status information from the HUB module to determine the insertion status of the external device. If the inserted device is not identified according to the device identification status information, the USB link is reset through a preset path to re-identify the inserted device. Therefore, the embodiment of the present application can solve the problem of USB probabilistic non-recognition after the USB device is inserted into the USB interface, improve the stability and reliability of USB device identification, have certain practicality, and also improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.

[0016] Figure 1 is a structural block diagram of a USB device insertion detection circuit provided in an embodiment of the present application;

[0017] Figure 2It is a circuit structure diagram of a USB device insertion detection circuit provided in an embodiment of the present application;

[0018] Figure 3 is a structural schematic diagram of a USB device insertion detection circuit provided by another embodiment of the present application;

[0019] Figure 4 This is a structural block diagram of a USB chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0021] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device schematic diagram or the order in the flow chart.

[0022] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0023] Currently, USB device connections include direct connection between Host and Device, or connection between Host and Device through HUB. Direct connection between Host and Device means that Host and Device are directly connected via USB cable without USB HUB in between. This connection method is usually used when there is only one USB device, such as a printer or a mobile hard disk. Host and Device are connected through HUB, that is, Host and Device are connected through a USB HUB. USB HUB is a device that can expand a USB interface into multiple USB interfaces, so that multiple USB devices can be connected. This connection method is usually used when multiple USB devices are connected, such as USB mouse, keyboard, printer, and mobile hard disk. Neither of the current two communication methods involves insertion detection mechanism.

[0024] Due to the wide variety of USB devices on the client side and their uneven quality, even if the impedance, power supply and other parameters of the product hardware circuit design are very reasonably designed, it is impossible to avoid the USB probabilistic non-recognition when the USB device is inserted into the USB interface of the product after the product arrives at the client. The USB interface is a high-speed, complex digital interface, and its correctness depends on the correctness of each device, including the main control chip, USB physical layer, USB power management, etc., so there are problems such as long links and many devices. At the same time, due to the wide variety of USB devices on the client side and their uneven quality, the USB probabilistic non-recognition phenomenon occurs, which makes it difficult to preserve the phenomenon and analyze the problem. Due to the probabilistic, difficult to reproduce and difficult to solve, such problems often cause user complaints and affect user experience. Therefore, it is of great significance to clarify such probabilistic problems, monitor the recognition of USB devices after insertion, and reset the USB link when such probabilistic problems occur, so that the device can be re-recognized, which is of great significance to improving the stability and reliability of the product.

[0025] Among them, for the probabilistic problems that occur after the USB device is inserted, monitoring the USB device recognition status is a very important step. Once it is found that the USB device cannot be correctly identified, resetting the USB link in time can effectively solve the problem and avoid affecting the user experience and the reliability of the product. In practical applications, the monitoring and link reset functions of the USB device can be implemented through software design. When the USB device cannot be correctly identified, the software can automatically try to reset the USB link to allow the device to be recognized again. In addition, other technical means can also be used, such as adding a USB power management circuit to the hardware design, to optimize the recognition and stability of the USB device. Improving the compatibility and reliability of the product with various USB devices, improving the user experience, and enhancing the competitiveness of the product are problems that need to be solved in the embodiments of the present application.

[0026] In an optional embodiment of the present application, please refer to Figure 1 , Figure 1 1 is a block diagram of a USB device insertion detection circuit provided by an embodiment of the present application. The USB device insertion detection circuit 10 includes: a switch module 11, a detection module 12, a HUB module 13 and a control module 14. The switch module 11 includes an input port 111, a first output port 112 and a second output port 113, the first output port 112 is connected to the HUB module 13, the second output port 113 is respectively connected to the input port 111 and the detection module 12, the detection module 12 is also connected to the HUB module 13, and the control module 14 is respectively connected to the detection module 12 and the HUB module 13.

[0027] In an embodiment of the present application, the detection module 12 determines whether a USB device is currently inserted. If a USB device is inserted, a subsequent identification judgment is performed on the identification result to obtain the identification status of the USB device after insertion, such as whether the identification is successful, whether there is a problem, etc. Once a change in the insertion status of the USB device is detected, the system can process it according to the corresponding processing strategy. For example, if the inserted device cannot be correctly identified, the USB link can be automatically reset to allow the device to be identified again. If there are other problems with the USB device, the user or developer can be prompted to check and handle it through corresponding error prompts or log records. Through these processing strategies, the compatibility and reliability of the system for USB devices can be improved, and the stability and security of the system can be guaranteed.

[0028] The detection module 12 can read the HUB status pin through the HUB module 13 to monitor the identification status of the USB device after insertion. Specifically, after the system is powered on, the input port 111 and the second output port 113 are in a conductive state to provide a conductive voltage to the detection module, and at this time, the input port 111 and the first output port 112 are in a disconnected state; when the input port 111 detects a device access signal, the detection module 12 is used to control the input port 111 to switch from the connection with the second output port 113 to the connection with the first output port 112 according to the device access signal to provide a conductive voltage to the HUB module, and at this time, the input port 111 and the second output port 113 are in a disconnected state, and obtain the device identification status information from the HUB module 13; when the inserted device is not identified according to the device identification status information, the USB link is reset through a preset path to re-identify the inserted device. In an embodiment of the present application, when a device is connected to the USB interface of the product, the input port 111 obtains a device access signal, and transmits the device access signal to the detection module 12 through the second output port 113. The detection module 12 can control the input port 111 and the first output port 112 to be connected according to the device access signal, provide a conduction voltage for the HUB module 13, and obtain device identification status information from the HUB module 13.

[0029] The switch module 11 can be a selection circuit. After the system is powered on, the default input port 111 is connected to the second output port 113. When the detection module 12 receives a device access signal, the switch module 11 can be controlled according to the device access signal to connect the input port 111 to the first output port 112, thereby transmitting the device access signal to the HUB module 13 for subsequent device identification and processing. The selection circuit is a multi-way switch circuit, and its working principle is similar to that of a mechanical switch. It can select and switch between multiple input ports and output ports to achieve signal transmission and conversion. In the USB interface, the selection circuit is usually used to control the connection and disconnection of USB devices, as well as the transmission and processing of USB signals. Through the selection circuit, the input and output of the USB interface can be flexibly controlled to improve the compatibility and reliability of the system with USB devices.

[0030] Among them, the device access signal refers to the signal generated when a USB device is plugged into a USB interface. In a USB interface, the device access signal is usually an electrical signal, and its parameters such as voltage and current meet the requirements specified in the USB interface standard. Specifically, the device access signal may include a power signal, a data signal, a plug-in detection signal, etc. In actual applications, the specific form and parameters of the device access signal can be designed and implemented according to specific circumstances based on factors such as device type, USB interface version, and power management scheme.

[0031] Among them, the detection module 12 is a module for detecting the plug-in and unplugging status of the USB interface and the device access signal. It identifies and processes the connected device by detecting the plug-in and unplugging status and receiving the device access signal, thereby realizing automatic identification and configuration of the USB device. The detection module 12 may include two aspects of hardware circuits and software algorithms, which are used to realize the processing and analysis of the device access signal. The detection module may be a GPIO detection controller. GPIO (general input / output) is a general digital input and output interface that can be used to detect and control various types of external devices. By using the GPIO detection controller, the plug-in and unplugging status of the USB interface and the receiving device access signal can be easily detected, and these signals are passed to the control chip or processor for processing. In addition to the GPIO detection controller, the detection module 12 can also use other types of hardware circuits and software algorithms to realize the detection of the USB interface and the analysis of the device access signal. For example, a special USB interface controller can be used to realize the detection of the USB interface and the analysis of the device access signal, or a hardware circuit such as a microcontroller or FPGA can be used to realize the automatic identification and configuration of the USB interface. In addition, various types of software algorithms, such as USB protocol stacks, device drivers, etc., can also be used to realize the automatic identification and configuration of the USB interface.

[0032] The HUB module 13 is a USB interface device that can expand one USB interface into multiple USB interfaces, thereby realizing simultaneous connection and use of multiple USB devices. The HUB module 13 can identify and process the connected device according to the received device access signal, and feed back the identification result to the detection module 12 for corresponding processing and configuration.

[0033] In this embodiment, the detection module 12 can identify whether the device of the corresponding port has been connected by reading the device identification status of the HUB module 13, thereby realizing the detection and identification of the USB device. If the detection module 12 has identified that the USB device is connected to the corresponding port, and the device has been identified by the HUB module 13 and displays the device identification status, then the detection module 12 may not need to perform any operation, because at this time the USB device has been successfully identified and connected, and data transmission and use can be performed normally. However, if the detection module 12 fails to read the device identification status of the USB HUB, or reads an abnormal status, then it is necessary to check the detection module 12 to confirm whether it is working properly, and it may be necessary to take corresponding measures, such as reconnecting the device or restarting the system, to solve the connection problem of the USB device.

[0034] The detection module 12 is further configured to control the input port 111 to be connected to the second output port 113 when the device removal status information is obtained from the HUB module 13. When the USB device is unplugged, the connection between the device and the host can be interrupted in time by controlling the input port 111 to be connected to the second output port 113, thereby avoiding data loss and improving the reliability of data transmission. In addition, the information that the device is unplugged can be sent to the host in time, thereby improving the device response speed and enhancing the user experience.

[0035] Among them, the resetting of the USB link through the preset path includes: the detection module 12 sends a control signal to the external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and power on again, so as to re-identify the inserted device. It also includes the detection module 12 controlling the input port 111 and the second output port 113 to be connected and then switching the switch to make the input port 111 and the first output port 112 connected, so as to re-identify the inserted device. It also includes the detection module 12 sending a reset control signal to the HUB module 13 to re-identify the inserted device. The above methods are all used to re-identify the inserted USB device, and the corresponding method can be selected according to the specific situation. For example, if the USB device fails or the communication is abnormal, the current limiting circuit can be controlled to power off and power on again to restore the normal use of the USB device; if the USB device is not successfully identified after being inserted, the USB device can be re-identified by switching the switch; if the USB device has communication abnormalities or deadlocks, etc., the USB device can be re-identified by sending a reset control signal.

[0036] The above embodiment mainly confirms the identification status of the USB HUB after insertion by reading the status information of the HUB. This implementation is suitable for the WINDOWS platform. When the hardware identification information cannot be read through the system software level, the identification status of the USB HUB after insertion can be confirmed by reading the status of the HUB. This implementation is applicable to various types of application products, including but not limited to desktop computers, laptops, tablet computers, printers and scanners, digital cameras and camcorders, etc.

[0037] In an optional embodiment of the present application, Figure 2 As shown, Figure 2 This is an embodiment of confirming the identification status of the USB HUB after insertion by reading the status information of the HUB. Figure 2 As shown, the switch module 11 is a USB Switch, which includes two output ports 1 and 2. Port 1 can be switched to port 2, and port 2 can also be switched to port 1. The detection module 12 is a GPIO detection controller, and the HUB module 13 is a HUB. It also includes a logic OR gate module, which is connected to port 2 and the GPIO detection controller respectively. In an embodiment of the present application, the device access signal is a DP signal and a DM signal. The logic OR gate module is used to receive the DP signal and the DM signal input from port 2, and output a combined signal to the GPIO detection controller according to the DP signal and the DM signal. The GPIO detection controller is used to identify the insertion status of the device according to the combined signal. Specifically, as Figure 2As shown, after the system is turned on, the USB Switch is located at the 2-port position, and the USB link is mounted to the detection link. When a device is connected to the product USB port, according to the USB2.0 identification principle, DP or DM will be pulled high by the device to enter the identification state, and after passing through the OR gate, it is given to the GPIO detection controller and triggered: the USB Switch switches to the 1-port position, and the USB link is mounted to the communication link; the GPIO detection controller reads the device identification status of the USB HUB through ①. If the device corresponding to the port is identified, the GPIO detection controller does not act; if the device corresponding to the port is not identified after the timeout, the GPIO detection controller can reset the USB link through the A, B, and C paths to allow the device to re-identify. Among them, A. Power off the device and then power it on again, so that the device can be restarted and re-identified; B. Switch the Switch to port 2 and then switch back to port 1 to re-identify the device; C. Reset the HUB on the link to re-identify the device. The above three methods can be selected according to the specific application scenario. Among them, when the device is unplugged and the GPIO detection controller is activated, the device corresponding to the port under the USB HUB is removed by ① reading, and the GPIO detection controller switches the USB Switch to the 2 port position and waits for the next recognition.

[0038] In the embodiment of the present application, by reading the status information of the HUB, the connection status, power supply status, transmission rate and other information of the USB HUB can be detected to ensure the normal operation of the USB HUB, which helps to improve the stability and reliability of the system and avoid the abnormality or crash of the system due to problems such as USB HUB failure or incompatibility. By reading the status information of the HUB, the USB device connected to the USB HUB can be automatically identified and configured for subsequent use and management, which helps to improve the efficiency of the system and the user experience, and avoids the tediousness and inconvenience caused by manual identification and configuration of USB devices. By reading the status information of the HUB, the type, specifications and parameters of the USB HUB can be detected to ensure the compatibility of the USB HUB with the host and the USB device. At the same time, according to the parameters and specifications of the HUB, the appropriate USB device and configuration scheme can be selected to improve the scalability and compatibility of the system.

[0039] See also Figure 1 In addition to the above method of confirming the identification status of the USB HUB after insertion by reading the status information of the HUB, the host controller can also be used to monitor the identification status of the USB device after insertion.

[0040] like Figure 1As shown, the input port 111 is connected to the second output port 113 by default. When the input port 111 detects a device access signal, the device access signal is transmitted to the detection module 12 through the second output port 113. At this time, the detection module 12 is used to control the input port 111 to be connected to the first output port 112 according to the device access signal to provide a conduction voltage for the control module 14. In addition, the detection module 12 also sends device access information to the control module 14 according to the device access signal, so that the control module 14 detects the inserted device according to the device access information. The detection module 12 is also used to receive a device not inserted signal returned by the control module 14, and in response to the device not inserted signal, reset the USB link through a preset path to re-identify the inserted device.

[0041] Among them, the control module 14 can be a control module that realizes automatic identification and configuration of USB devices, which usually includes two parts: hardware circuit and software program, and can realize functions such as automatic identification of USB devices, automatic configuration of USB devices, abnormal handling of USB devices, and compatibility testing of USB devices. The control module 14 can include hardware circuits and software programs such as USB controller chip, USB driver, USB interface circuit, system bus interface circuit, and control logic circuit. In the process of realizing automatic identification and configuration of USB devices, the control module 14 interacts with the detection module 12, various USB devices, and the operating system to complete the automatic identification and configuration of USB devices.

[0042] When the device is unplugged, the control module 14 is used to send device removal status information to the detection module 12, and the detection module 12 is used to control the input port 111 and the second output port 113 to be connected according to the device removal status information.

[0043] The detailed process of resetting the USB link through the preset path in this embodiment can refer to the above embodiment.

[0044] The embodiment of the present application mainly monitors the identification status of the USB device after insertion through the Host controller. This implementation is suitable for use in Android-type SOCs. Since the bottom layer can read the identification information of the USN hardware, the HUB in the link can be omitted. This implementation is applicable to various types of application products, including but not limited to smart phones, tablet computers, smart TVs and other smart devices. Specifically, the implementation of the present application can realize automatic identification and configuration of the inserted USB device by integrating the USB controller chip and related drivers in the Android-type SOC. When the USB device is inserted, the USB controller chip can automatically identify the type and parameters of the USB device by reading the identification information of the USB device, and automatically configure the driver and parameters of the USB device according to the type and parameters of the USB device to realize the normal use of the USB device. This implementation has high reliability and stability, as well as high compatibility and scalability, and can support various types of USB devices and application scenarios. In addition, since the HUB in the USB link is omitted, the cost and complexity of the system can be reduced, and the performance and reliability of the system can be improved.

[0045] In an optional embodiment of the present application, Figure 3 As shown, Figure 3 The host controller monitors the identification status of the USB device after it is inserted, which is an embodiment. Figure 3 As shown, the switch module 11 is a USB Switch, which includes two output ports 1 and 2. Port 1 can be switched to port 2, and port 2 can also be switched to port 1. The detection module 12 is a GPIO detection controller, the HUB module 13 is a HUB, and the USB Host controller is a control module 14. It also includes a logic OR gate module, which is connected to port 2 and the GPIO detection controller respectively. In an embodiment of the present application, the device access signal is a DP signal and a DM signal. The logic OR gate module is used to receive the DP signal and the DM signal input from port 2, and output a combined signal to the GPIO detection controller according to the DP signal and the DM signal. The GPIO detection controller is used to identify the insertion status of the device according to the combined signal. Specifically, as Figure 3As shown, after the system is turned on, the USB Switch is located at the 2-port position, and the USB link is mounted to the detection link. When a device is connected to the product USB port, according to the USB2.0 identification principle, DP or DM will be pulled high by the device to enter the identification state, and after passing through the OR gate, it will be sent to the GPIO detection controller and triggered: the USB Switch switches to the 1-port position, and the USB link is mounted to the communication link; the device access information is sent to the USB Host controller through the ① path, and the USB Host controller will monitor whether there is a device that is successfully identified: if a new device is identified, the GPIO detection controller is notified through the path ② that the USB device is successfully identified, and the GPIO detection controller does not act; if the new device is not identified after the timeout, the GPIO detection controller is notified through the path ② that the inserted USB device is not effectively identified. At this time, the GPIO detection controller can reset the USB link through the A, B, and C paths to allow the device to be re-identified. Among them, A. Power off the device and then power it on again, so that the device can be restarted and re-identified; B. Switch the Switch to the 2-port and then switch back to the 1-port to allow the device to be re-identified; C. Reset the HUB on the link to allow the device to be re-identified. The above three methods can be selected according to the specific application scenario. Among them, when the device is unplugged and the GPIO detection controller is activated, the device corresponding to the port under the USB HUB is removed by ① reading, and the GPIO detection controller switches the USBSwitch to the 2 port position, waiting for the next recognition.

[0046] In the embodiment of the present application, the host controller can automatically identify the inserted USB device through a hardware circuit or software program connected to the USB interface, obtain the basic information and parameters of the USB device, and provide basic data for the subsequent USB device configuration, which helps to improve the efficiency of the system and the user experience, and avoids the tediousness and inconvenience caused by manual identification and configuration of USB devices. In addition, by realizing automatic identification and configuration of USB devices, system anomalies or crashes caused by problems such as incompatible or improper configuration of USB devices can be avoided. At the same time, abnormal conditions of USB devices can be detected and processed, such as deadlock of USB devices, communication anomalies, device failures, etc., to ensure the stability and reliability of the system.

[0047] The present application also provides a USB device insertion detection method, which can be applied to the USB device insertion detection circuit of the above embodiment. The method includes:

[0048] When the input port detects a device access signal, the input port is controlled to switch from being connected to the second output port to being connected to the first output port according to the device access signal, so as to provide a conduction voltage to the HUB module and obtain device identification status information from the HUB module;

[0049] When the inserted device is not identified according to the device identification state information, the detection module resets the USB link through a preset path to re-identify the inserted device.

[0050] Optionally, the USB device insertion detection circuit further includes a control module, and the control module is connected to the detection module and the HUB module respectively; the method further includes:

[0051] When the detection module receives the device access signal, the detection module sends device access information to the control module according to the device access signal, so that the control module detects the inserted device according to the device access information;

[0052] The detection module receives a device not inserted signal returned by the control module, and in response to the device not inserted signal, resets the USB link through a preset path to re-identify the inserted device.

[0053] Optionally, resetting the USB link through a preset path includes:

[0054] The detection module sends a control signal to an external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and then power on again, so as to re-identify the inserted device;

[0055] Alternatively, the detection module controls the input port to be connected to the second output port and then switches the switch to connect the input port to the first output port, so as to re-identify the inserted device;

[0056] Alternatively, the detection module sends a reset control signal to the HUB module to re-identify the inserted device.

[0057] The USB device insertion detection method of the embodiment of the present application has the same beneficial effects and inventive concepts as the above-mentioned USB device insertion detection circuit embodiment, and the above-mentioned embodiment may be referred to for details.

[0058] See also Figure 4 The embodiment of the present application also provides a USB chip, which includes: the USB device insertion detection circuit 10 in the above embodiment, and a USB interface 20, wherein the USB interface 20 is connected to the switch module 11, and the USB interface 20 is used to support the insertion and removal of external devices. The external device can specifically be a USB device. The USB chip provided in the embodiment of the present application can solve the problem of USB probabilistic non-recognition after the USB device is inserted into the USB interface, improves the stability and reliability of USB device recognition, has certain practicality, and also improves the user experience.

[0059] The USB chip provided in the embodiments of the present application can be applied to various types of products, including but not limited to: mobile devices such as smart phones, tablets and laptops; TV entertainment devices such as smart TVs, set-top boxes and game consoles; electronic product production equipment and industrial automation equipment, which usually need to connect to various types of USB devices, such as programmers, sensors, monitoring equipment, etc.; home smart devices and Internet of Things devices, which usually need to connect to various types of USB devices, such as smart home devices, smart door locks, smart appliances, etc.

[0060] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A USB device insertion detection circuit, characterized in that: include: A switch module, a detection module and a HUB module, wherein the switch module comprises an input port, a first output port and a second output port, wherein the first output port is connected to the HUB module, and the second output port is respectively connected to the input port and the detection module, and the detection module is also connected to the HUB module; When the input port detects a device access signal, the detection module is used to: According to the device access signal, the input port is controlled to switch from being connected to the second output port to being connected to the first output port, so as to provide a conduction voltage to the HUB module and obtain device identification status information from the HUB module; When the inserted device is not identified according to the device identification status information, the USB link is reset through a preset path to re-identify the inserted device.

2. The USB device insertion detection circuit according to claim 1, characterized in that: It also includes a control module, which is connected to the detection module and the HUB module respectively; When the detection module receives the device access signal, the detection module is further configured to: sending device access information to the control module according to the device access signal, so that the control module detects the inserted device according to the device access information; A device not inserted signal returned by the control module is received, and in response to the device not inserted signal, a USB link is reset through a preset path to re-identify the inserted device.

3. The USB device insertion detection circuit according to claim 1 or 2, characterized in that: Resetting the USB link through a preset path includes: The detection module sends a control signal to an external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and then power on again, so as to re-identify the inserted device; Alternatively, the detection module controls the input port to be connected to the second output port and then switches the switch to connect the input port to the first output port, so as to re-identify the inserted device; Alternatively, the detection module sends a reset control signal to the HUB module to re-identify the inserted device.

4. The USB device insertion detection circuit according to claim 1, characterized in that: The detection module is also used for: When the device removal status information is obtained from the HUB module, the input port is controlled to switch to be connected to the second output port.

5. The USB device insertion detection circuit according to claim 2, characterized in that: When the device is unplugged, the control module is used to send device removal status information to the detection module, and the detection module is used to control the input port to switch to connect with the second output port according to the device removal status information.

6. The USB device insertion detection circuit according to claim 1, characterized in that: It also includes a logic OR gate module, and the second output port is connected to the detection module through the logic OR gate module; The device access signal includes a DP signal and a DM signal. The logic OR gate module is used to receive the DP signal and the DM signal input by the second output port, and output a combined signal to the detection module according to the DP signal and the DM signal; the detection module is used to identify the insertion status of the device according to the combined signal.

7. A USB device insertion detection method, characterized in that: Applied to the USB device insertion detection circuit according to any one of claims 1 to 6, the method comprising: When the input port detects a device access signal, the input port is controlled to switch from being connected to the second output port to being connected to the first output port according to the device access signal, so as to provide a conduction voltage to the HUB module and obtain device identification status information from the HUB module; When the inserted device is not identified according to the device identification status information, the USB link is reset through a preset path to re-identify the inserted device.

8. The USB device insertion detection method according to claim 7, characterized in that: The USB device insertion detection circuit also includes a control module, and the control module is connected to the detection module and the HUB module respectively; The method further comprises: When the detection module receives the device access signal, the detection module sends device access information to the control module according to the device access signal, so that the control module detects the inserted device according to the device access information; The detection module receives a device not inserted signal returned by the control module, and in response to the device not inserted signal, resets the USB link through a preset path to re-identify the inserted device.

9. The USB device insertion detection method according to claim 7 or 8, characterized in that: Resetting the USB link through a preset path includes: The detection module sends a control signal to an external current limiting circuit to control the USB interface connected to the current limiting circuit to power off and then power on again, so as to re-identify the inserted device; Alternatively, the detection module controls the input port to be connected to the second output port and then switches the switch to connect the input port to the first output port, so as to re-identify the inserted device; Alternatively, the detection module sends a reset control signal to the HUB module to re-identify the inserted device.

10. A USB chip, characterized in that: include: The USB device insertion detection circuit according to any one of claims 1 to 6, and a USB interface, wherein the USB interface is connected to the switch module, and the USB interface is used to support the insertion and removal of external devices.