Detection method, device, apparatus, storage medium and program product

CN123030433APending Publication Date: 2026-11-03KTMICRO ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610884451.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-18
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing methods for detecting whether an audio device is disconnected from a USB host are time-consuming, resulting in a lengthy detection process and the need for additional large-capacity capacitors to ensure the smooth completion of the power-down process.

Method used

By having the processor of the audio device retrieve frame data from a preset storage area in response to the received frame start interrupt signal, and determine whether two consecutively obtained frame data are the same, the communication connection status between the USB controller and the USB host can be quickly determined, avoiding the need for additional large-capacity capacitors.

Benefits of technology

It enables rapid detection of whether the USB controller and the USB host are disconnected, shortens the detection time, reduces capacitor costs and circuit design complexity, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030433A_ABST
    Figure CN123030433A_ABST
Patent Text Reader

Abstract

The application provides a detection method, device, equipment, storage medium and program product. The detection method comprises the following steps: in response to receiving a first frame start interrupt signal, obtaining frame data from a preset storage area; the first frame start interrupt signal is sent by a USB controller in response to receiving a preset number of frame start signals within a first preset time length; the frame data of the preset storage area is increased by n when the USB controller receives the preset number of frame start signals within the first preset time length; and it is judged whether the frame data obtained twice continuously is the same. If the frame data obtained twice continuously is the same, it indicates that the USB controller and the USB host are disconnected from the communication connection; and if the frame data obtained twice continuously is not the same, it indicates that the USB controller and the USB host are not disconnected from the communication connection. In this way, whether the USB controller and the USB host are disconnected from the communication connection can be determined quickly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of audio equipment technology, and more specifically, to a detection method, apparatus, device, storage medium, and program product. Background Technology

[0002] Existing methods for detecting whether an audio device is disconnected from a USB (Universal Serial Bus) host typically rely on the frame start interrupt signal generated by the USB controller in the audio device. The specific detection logic is as follows: monitor the interval of the frame start interrupt signal to identify signal loss; if no new frame start interrupt signal is detected for more than 1.5 times the normal frame start interrupt interval, it is determined that the audio device is disconnected from the USB host.

[0003] However, this detection mechanism based on the loss of the frame start interrupt signal has a significant time-consuming problem. Because the USB controller continues to generate and send frame start interrupt signals for a set period even when no frame start signal is received, the entire detection process takes at least 4.5ms. To support this time-consuming detection mechanism and the subsequent safe power-down process, a large-capacity capacitor must be configured to store sufficient power to ensure the smooth completion of the power-down process. Summary of the Invention

[0004] The purpose of this application is to provide a detection method, apparatus, device, storage medium, and program product to solve the problem that the detection of whether the audio device and the USB host are disconnected takes a long time in the related technology.

[0005] This application provides a detection method applied to a processor of an audio device. The audio device includes a processor, a Universal Serial Bus (USB) controller, a digital-to-analog converter (DAC) module, and a speaker module. The USB controller is used to connect to an external USB host. The DAC module is used to perform digital-to-analog conversion on the audio data output by the processor, so that the speaker module can play the converted audio data. The method includes: In response to receiving a first frame start interrupt signal, frame data is retrieved from a preset storage area; the first frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; the frame start signal is sent by the USB host at intervals of the second preset time period; the first preset time period is equal to the second preset time period multiplied by the preset number; the frame data in the preset storage area increments by n each time the USB controller receives the preset number of frame start signals within the first preset time period; Determine whether the frame data obtained in two consecutive transactions are the same; Wherein: if the frame data obtained twice consecutively is the same, it indicates that the USB controller has disconnected from the USB host; if the frame data obtained twice consecutively is different, it indicates that the USB controller has not disconnected from the USB host.

[0006] In the above implementation, even when the USB host stops sending the frame start signal, the USB controller continues to send a frame start interrupt signal for a period of time, and the frame data in the preset storage area only increments based on the received frame start signal. Therefore, once the USB host stops sending the frame start signal, the processor will still respond to the received frame start interrupt signal and retrieve frame data from the preset storage area. If the frame data obtained twice consecutively is the same, it can be determined that the frame data in the preset storage area has not incremented, and it can be inferred that the USB controller has not received the frame start signal sent by the USB host, that is, it can be determined that the USB controller and the USB host have lost communication. This allows for rapid detection of whether the USB controller and the USB host have lost communication, reserving sufficient time for subsequent orderly power-down operations and ensuring the integrity of the power-down process from the source. Furthermore, thanks to the significantly reduced detection time, no additional large-capacity capacitors are needed to support the complete detection and power-down operations. This not only reduces the cost of hardware materials such as capacitors but also saves PCB board layout space and reduces the complexity of circuit design.

[0007] Optionally, when the USB host is running in high-speed mode, the preset number of times is equal to 8, and the second preset duration is equal to 0.125 milliseconds.

[0008] In the above implementation process, by limiting the USB host to run in high-speed mode, the preset number of times is 8, and the second preset duration is 0.125 milliseconds (i.e., 125 microseconds). Thus, the first preset duration is 1 millisecond (8 × 0.125ms), thereby forming a timing structure of 1 frame per millisecond, which meets the technical requirements of the USB communication protocol for the relationship between microframes and frame levels in high-speed mode.

[0009] Optionally, when the USB host is running in low-speed mode, the preset number of times is equal to 1, and the second preset duration is equal to 1 millisecond.

[0010] In the above implementation process, by limiting the USB host to run in low-speed mode, the preset number of times is equal to 1, and the second preset duration is equal to 1 millisecond. Thus, the first preset duration is 1 millisecond (1 × 1ms), thereby forming a timing structure of 1 frame per millisecond, which meets the requirements of the USB communication protocol.

[0011] Optionally, after determining that the USB controller has disconnected its communication connection with the USB host, the method further includes: In response to the USB controller disconnecting from the USB host, the digital-to-analog converter module is enabled, causing the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down rate until the DC bias voltage equals 0. Turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0012] In the above implementation process, by determining that the USB controller has disconnected its communication connection with the USB host, the digital-to-analog converter (DAC) is enabled, and the DC bias voltage of the DAC decreases at a preset power-down rate until the DC bias voltage equals 0; the output of the DAC and the power supply of the DAC are then turned off. This effectively suppresses the generation of popping sounds.

[0013] Optionally, after turning off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module, the method further includes: Upon receiving a second frame start interrupt signal, frame data is retrieved from a preset storage area; the second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period. If the frame data obtained in two consecutive transactions are different, restore the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0014] In the above implementation process, after shutting down the output and power of the digital-to-analog converter (DAC), upon receiving a frame start interrupt signal, frame data is retrieved again from the preset storage area. If the two retrieved frame data are different, it can be determined that the frame data in the preset storage area has incremented. Correspondingly, it can be inferred that the USB controller has received the frame start signal sent by the USB host again, that is, it can be determined that the USB controller and the USB host have restored their communication connection. Therefore, the output and power of the DAC can be restored. Thus, in the event that the USB controller and the USB host lose communication due to accidental touch, the audio output function can be restarted promptly after communication is restored, improving the user experience.

[0015] Optionally, frame data can be obtained from a preset storage area, including: A frame count acquisition command is sent to the USB controller, triggering the USB controller to acquire frame data from a preset register and provide feedback.

[0016] In the above implementation, by sending a frame count acquisition command to the USB controller, the USB controller can be triggered to acquire frame data from a preset register and provide feedback, thereby achieving the acquisition of frame data.

[0017] Secondly, this application provides a detection device applied to a processor of an audio device. The audio device includes a processor, a Universal Serial Bus (USB) controller, a digital-to-analog converter (DAC) module, and a speaker module. The USB controller is used to connect to an external USB host. The DAC module is used to perform digital-to-analog conversion on the audio data output by the processor, so that the speaker module can play the converted audio data. The device includes: The acquisition module is configured to acquire frame data from a preset storage area in response to receiving a first frame start interrupt signal; the first frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; the frame start signal is sent by the USB host at intervals of a second preset time period; the first preset time period is equal to the second preset time period multiplied by the preset number; the frame data in the preset storage area is incremented by n each time the USB controller receives the preset number of frame start signals within the first preset time period; The judgment module is configured to determine whether the frame data obtained in two consecutive transactions are the same; Wherein: if the frame data obtained twice consecutively is the same, it indicates that the USB controller has disconnected from the USB host; if the frame data obtained twice consecutively is different, it indicates that the USB controller has not disconnected from the USB host.

[0018] Optionally, a control module is also included, configured to enable the digital-to-analog converter module in response to the USB controller disconnecting from the USB host, causing the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down rate until the DC bias voltage equals 0; and to turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0019] Optionally, a recovery module is also included, configured to retrieve frame data from a preset storage area upon receiving a second frame start interrupt signal; the second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; if the frame data obtained in two consecutive transactions are different, the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module are restored.

[0020] Thirdly, this application provides an electronic device including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the detection method of the first aspect described above.

[0021] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the detection method described in the first aspect.

[0022] Fifthly, this application provides a computer program product, which includes a computer program that, when executed by a processor, implements the detection method described in the first aspect. Attached Figure Description

[0023] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a schematic diagram of the structure of an audio device provided in an embodiment of this application; Figure 2 A schematic flowchart of a detection method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a detection device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0026] Example 1: Combination Figure 1 As shown in the figure, this application provides an audio device, including a processor, a USB controller, a digital-to-analog converter module, and a speaker module. The USB controller is used to connect to an external USB host, and the digital-to-analog converter module is used to perform digital-to-analog conversion on the audio data output by the processor, so that the speaker module can play the digital-to-analog converted audio data.

[0027] In this embodiment of the application, the USB host can be a device with a USB interface, such as a mobile phone or tablet computer.

[0028] To address the issue of lengthy detection times in related technologies regarding whether an audio device is disconnected from a USB host, this application provides a detection method. See also... Figure 2 As shown, Figure 2 This is a flowchart illustrating the detection method provided in the embodiments of this application, including: In step S201, the USB host sends a frame start signal to the USB controller.

[0029] In the USB protocol, the Start of Frame (SOF) signal is typically referred to as the SOF packet. It is periodically broadcast by the USB host to all connected devices for time synchronization.

[0030] The frequency at which SOF packets are sent depends on the current USB bus transfer rate: When the USB bus is running in full-speed or low-speed mode, the USB host can send an SOF packet every 1ms. The time interval between two adjacent SOF packets constitutes a logical frame.

[0031] When the USB bus is operating in High-Speed ​​mode, to meet the higher bandwidth requirements, the 1-millisecond frame is further subdivided into eight 125μs (microsecond) microframes. The USB host can send an SOF packet every 125 microseconds. These eight microframes share the same frame number.

[0032] In step S202, the USB controller can increment the frame data by n in a preset storage area in response to receiving a preset number of frame start signals within a first preset time period.

[0033] In this embodiment of the application, the upper limit of frame data can be set to 2047. When the frame data in the preset storage area is 2047, if a frame start signal is received again, the frame data can be reset to 0.

[0034] In step S203, the USB controller sends a frame start interrupt signal to the processor.

[0035] In step S204, the processor may, in response to receiving a frame start interrupt signal, retrieve frame data from a preset storage area.

[0036] In one optional implementation of this application, the processor may send a frame count acquisition instruction to the USB controller, triggering the USB controller to acquire frame data from a preset register and provide feedback.

[0037] In this embodiment, the USB controller typically increments the frame data in a preset storage area by 'n' every time it receives a preset number of frame start signals within a first preset duration, and sends a frame start interrupt signal to the processor. However, if the USB controller does not receive a frame start signal at a certain moment, it will still send a frame start interrupt signal every second preset duration until a third preset duration is reached, at which point the USB controller enters a suspend state. The first preset duration is equal to the second preset duration multiplied by the preset number of times. For example, the second preset duration can be 1 millisecond, and the preset number of times can be 1, so the first preset duration is also 1 millisecond. n can be 1. The third preset duration can be 3 milliseconds.

[0038] Correspondingly, the USB host can send a frame start signal to the USB controller every 1 millisecond. In response to receiving the frame start signal, the USB controller increments the frame data in a preset storage area by 1 and sends a frame start interrupt signal to the processor, causing the processor to retrieve the frame data from the preset storage area. That is, when the USB host and USB controller are connected and there is no fault, the USB controller can receive the frame start signal every 1 millisecond, increment the frame data in the preset storage area by 1 every 1 millisecond, and send a frame start interrupt signal to the processor.

[0039] Up to time T, the USB controller has received x frame start signals, and the frame data in the preset storage area is x. At times T+1ms and T+2ms, the USB controller does not receive any frame start signals. However, the USB controller still generates frame start interrupt signals at T+1ms and T+2ms, causing the processor to retrieve frame data from the preset storage area. Correspondingly, the frame data obtained by the processor at times T, T+1ms, and T+2ms are all the same. If no frame start signal is received by time T+3ms, the USB controller will enter a suspend state at T+3ms. Therefore, in this case, the method provided in this embodiment, which determines whether the USB host and audio device are disconnected by comparing whether two consecutively obtained frame data are the same, only requires 2 milliseconds to determine whether the USB host and audio device are disconnected.

[0040] For example, the second preset duration can be 125 microseconds, and the preset number of times can be 8, then the first preset duration is also 1 millisecond. n can be 1. The third preset duration can be 3 milliseconds.

[0041] Correspondingly, the USB host can send a frame start signal to the USB controller every 0.125 milliseconds. When the USB host and USB controller are connected and there is no fault, the USB controller can increment the frame data in a preset storage area by 1 every 1 millisecond after receiving 8 frame start signals with the same frame number; and send a frame start interrupt signal to the processor, causing the processor to retrieve the frame data from the preset storage area.

[0042] The frame data in the preset storage area is x, up to the frame start signal received at time T. After time T, the USB controller does not receive the frame start signal. However, the USB controller still generates frame start interrupt signals at T+1ms and T+2ms, causing the processor to retrieve frame data from the preset storage area. Correspondingly, the frame data obtained by the processor at time T, T+1ms, and T+2ms are all the same. If the frame start signal is still not received at T+3ms, the USB controller will enter a suspend state at T+3ms. Similarly, in this case, the method provided in this application, which determines whether the USB host and audio device are disconnected by comparing whether two consecutively obtained frame data are the same, only requires 2 milliseconds to determine whether the USB host and audio device are disconnected.

[0043] In step S205, the processor determines whether the frame data obtained in two consecutive transactions are the same.

[0044] Step S206: If the frame data obtained in two consecutive steps are the same, the processor enables the digital-to-analog converter module and causes the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down speed until the DC bias voltage is equal to 0.

[0045] In existing technologies, to optimize the conversion accuracy of the digital-to-analog converter (DAC) output, a DC bias excitation, i.e., a DC bias voltage, is usually added to the DAC module. However, under this architecture, regardless of whether the audio device is in playback mode or silent standby mode, if the processor suddenly loses power, the output level of the DAC module will undergo a momentary change, which can easily generate obvious impact noise, i.e., a piercing popping sound, which seriously affects the user experience.

[0046] In this application, by enabling the digital-to-analog converter module, the DC bias voltage of the digital-to-analog converter module decreases at a preset power-down speed, so that the DC bias voltage can decay at a smooth and gradual rate, effectively avoiding extreme nonlinear distortion and transient pulse energy surges during power-off, thereby alleviating popping sounds to a certain extent and improving the user experience.

[0047] Step S207: Turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0048] The detection method provided in this application embodiment ensures that even when the USB host stops sending the frame start signal, the USB controller continues to send a frame start interrupt signal for a period of time, and the frame data in the preset storage area only increments based on the received frame start signal. Therefore, once the USB host stops sending the frame start signal, the processor will still respond to the received frame start interrupt signal and retrieve frame data from the preset storage area. If the frame data obtained twice consecutively is the same, it can be determined that the frame data in the preset storage area has not incremented, and it can be inferred that the USB controller has not received the frame start signal sent by the USB host, that is, it can be determined that the USB controller and the USB host have disconnected their communication connection. This allows for rapid detection of whether the USB controller and the USB host have disconnected their communication connection, reserving sufficient time for subsequent orderly power-down operations and ensuring the integrity of the power-down process from the source. Furthermore, thanks to the significant reduction in detection time, no additional large-capacity capacitors are required to support the complete detection and power-down operations. This not only reduces the cost of hardware materials such as capacitors but also saves PCB board layout space and reduces the complexity of circuit design.

[0049] After step S207, the processor can retrieve frame data from the preset storage area again upon receiving the second frame start interrupt signal. The second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period. If the frame data obtained in two consecutive transactions are different, the processor can restore the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0050] Example 2: Based on the same inventive concept, this application also provides a detection device 300 in its embodiments. Please refer to... Figure 3 As shown, Figure 3 It shows the use of Figure 2 The detection device of the method shown. It should be understood that the specific functions of device 300 can be found in the description above; to avoid repetition, detailed descriptions are appropriately omitted here. Device 300 includes at least one software function module that can be stored in memory or embedded in the operating system of device 300 in the form of software or firmware. Specifically: See Figure 3 As shown, the device 300 is applied in the processor of an audio device and includes: an acquisition module 301 and a judgment module 302. Wherein: The acquisition module 301 is configured to acquire frame data from a preset storage area in response to receiving a first frame start interrupt signal; the first frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; the frame start signal is sent by the USB host at intervals of the second preset time period; the first preset time period is equal to the second preset time period multiplied by the preset number; the frame data in the preset storage area increments by n each time the USB controller receives a preset number of frame start signals within the first preset time period; The judgment module 302 is configured to determine whether the frame data obtained in two consecutive transactions are the same; Wherein: if the frame data obtained in two consecutive transactions is the same, it indicates that the USB controller has disconnected from the USB host; if the frame data obtained in two consecutive transactions is different, it indicates that the USB controller has not disconnected from the USB host.

[0051] In one feasible embodiment of this application, the device 300 may further include a control module configured to enable the digital-to-analog converter module in response to the USB controller disconnecting from the USB host, causing the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down rate until the DC bias voltage equals 0; and to turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

[0052] In one feasible embodiment of this application, the device 300 may further include a recovery module configured to retrieve frame data from a preset storage area upon receiving a second frame start interrupt signal; the second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; if the frame data obtained in two consecutive transactions are different, the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module shall be restored.

[0053] In one feasible embodiment of this application, the acquisition module 301 can also be configured to send a frame count acquisition instruction to the USB controller, triggering the USB controller to acquire frame data from a preset register and provide feedback.

[0054] It should be understood that, for the sake of brevity, some of the content described in Embodiment 1 will not be repeated in this embodiment.

[0055] Example 3: Based on the same inventive concept, this embodiment provides an electronic device, see [link to relevant documentation]. Figure 4 As shown, it includes a processor 401 and a memory 402. Wherein: The processor 401 is used to execute one or more programs stored in the memory 402 to implement the above detection method.

[0056] It is understandable that processor 401 can be a processor core or processor chip, or other circuitry capable of program configuration and execution. Memory 402 can be RAM (Random Access Memory), ROM (Read-Only Memory), flash memory, etc., but this is not a limitation.

[0057] It's understandable. Figure 4 The structure shown is for illustrative purposes only; the electronic device may also include components that are more advanced than those shown. Figure 4 The more or fewer components shown, or having the same Figure 4 Different configurations are shown. For example, it may also have an internal communication bus for communication between the processor 401 and the memory 402; or it may have an external communication interface, such as a USB (Universal Serial Bus) interface, a CAN (Controller Area Network) bus interface, etc.; or it may have an information display component such as a display screen, but this is not a limitation.

[0058] For example, the electronic device could be a USB headset.

[0059] Based on the same inventive concept, this embodiment also provides a computer-readable storage medium, such as a floppy disk, optical disk, hard disk, flash memory, USB flash drive, SD (Secure Digital Memory Card), MMC (Multimedia Card), etc., in which one or more programs implementing the above steps are stored. These one or more programs can be executed by one or more processors to implement the above detection method. Further details will not be elaborated here.

[0060] Based on the same inventive concept, this embodiment also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described detection method.

[0061] For example, a computer program product may be an installation package or a program package.

[0062] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0063] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0064] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0065] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0066] In this article, "multiple" refers to two or more.

[0067] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A detection method, characterized in that, A processor for use in an audio device, the audio device including a processor, a Universal Serial Bus (USB) controller, a digital-to-analog converter (DAC) module, and a speaker module, wherein the USB controller is used to connect to an external USB host, and the DAC module is used to perform digital-to-analog conversion on the audio data output by the processor, so that the speaker module can play the DAC-converted audio data; the method includes: In response to receiving a first frame start interrupt signal, frame data is retrieved from a preset storage area; the first frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; the frame start signal is sent by the USB host at intervals of the second preset time period; the first preset time period is equal to the second preset time period multiplied by the preset number; the frame data in the preset storage area increments by n each time the USB controller receives the preset number of frame start signals within the first preset time period; Determine whether the frame data obtained in two consecutive transactions are the same; Wherein: if the frame data obtained twice consecutively is the same, it indicates that the USB controller has disconnected from the USB host; if the frame data obtained twice consecutively is different, it indicates that the USB controller has not disconnected from the USB host.

2. The method according to claim 1, characterized in that, When the USB host is running in high-speed mode, the preset number of times is equal to 8, and the second preset duration is equal to 0.125 milliseconds.

3. The method according to claim 1, characterized in that, When the USB host is running in low-speed mode, the preset number of times is equal to 1, and the second preset duration is equal to 1 millisecond.

4. The method according to claim 1, characterized in that, The method further includes: In response to the USB controller disconnecting from the USB host, the digital-to-analog converter module is enabled, causing the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down rate until the DC bias voltage equals 0. Turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

5. The method according to any one of claims 1 to 4, characterized in that, After shutting down the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module, the following is also included: Upon receiving a second frame start interrupt signal, frame data is retrieved from a preset storage area; the second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period. If the frame data obtained in two consecutive transactions are different, restore the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

6. The method according to claim 1, characterized in that, Frame data is obtained from a preset storage area, including: A frame count acquisition command is sent to the USB controller, triggering the USB controller to acquire frame data from a preset register and provide feedback.

7. A detection device, characterized in that, A processor for use in an audio device, the audio device including a processor, a Universal Serial Bus (USB) controller, a digital-to-analog converter (DAC) module, and a speaker module, wherein the USB controller is used to connect to an external USB host, and the DAC module is used to perform digital-to-analog conversion on the audio data output by the processor, so that the speaker module can play the converted audio data; the device includes: The acquisition module is configured to acquire frame data from a preset storage area in response to receiving a first frame start interrupt signal; the first frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; the frame start signal is sent by the USB host at intervals of a second preset time period; the first preset time period is equal to the second preset time period multiplied by the preset number; the frame data in the preset storage area is incremented by n each time the USB controller receives the preset number of frame start signals within the first preset time period; The judgment module is configured to determine whether the frame data obtained in two consecutive transactions are the same; Wherein: if the frame data obtained twice consecutively is the same, it indicates that the USB controller has disconnected from the USB host; if the frame data obtained twice consecutively is different, it indicates that the USB controller has not disconnected from the USB host.

8. The apparatus according to claim 7, characterized in that, It also includes a control module configured to enable the digital-to-analog converter module in response to the USB controller disconnecting from the USB host, causing the DC bias voltage of the digital-to-analog converter module to decrease at a preset power-down rate until the DC bias voltage equals 0; and to turn off the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module.

9. The apparatus according to claim 7, characterized in that, It also includes a recovery module configured to retrieve frame data from a preset storage area upon receiving a second frame start interrupt signal; the second frame start interrupt signal is a frame start interrupt signal sent by the USB controller at intervals of the first preset time period in response to receiving a preset number of frame start signals within a first preset time period; if the frame data obtained in two consecutive transactions are different, the output of the digital-to-analog converter module and the power supply of the digital-to-analog converter module are restored.

10. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the detection method according to any one of claims 1 to 6.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the detection method according to any one of claims 1 to 6.

12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the detection method according to any one of claims 1 to 6.