Abstract:
This invention discloses a data processing circuit and a data processing method. The data processing method controls data transmission between a USB control unit and a USB interface, and includes the steps of: detecting a voltage of a configuration channel pin of the USB interface to generate a detection signal; determining whether the USB control unit and the USB interface are connected according to the detection signal; and performing an audio signal processing procedure when the USB control unit and the USB interface are not connected.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
       [0001]    The present invention relates to a data processing circuit and a data processing method for a Universal Serial Bus (USB) device, and more particularly, to a data processing circuit and a data processing method for USB T e-C or USB 3.1. 
       2. Description of Related Art 
       [0002]      FIG. 1  shows a pin diagram of a USB Type-C connector, which is a reversible design. According to definitions in the USB 3.1 specifications, in addition to transmitting data signals, pins A 6 /B 6  and A 7 /B 7  may also be used to transmit audio signals. Pins A 5 /B 5  are configuration channel pins. By detecting the potentials at the pins A 5 /B 5 , a USB host may learn whether a USB device currently connected is an audio device. However, the impedance of the USB device needs to be detected before audio signals can be transmitted. Further, in order to enhance user experiences, pops also need to be prevented. Therefore, there is a need for a solution capable of de-popping and impedance detection for USB Type-C. 
       SUMMARY OF THE INVENTION 
       [0003]    In view of the issues of the prior art, an object of the present invention is to provide a data processing circuit and a data processing method, so as to provide a solution capable of de-popping and/or impedance detection for USB Type-C audio devices. 
         [0004]    A data processing circuit is disclosed. The data processing circuit is coupled to a Universal Serial Bus (USB) control unit and a USB interface and includes a detecting unit, a first switch unit, and an audio processing unit. The detecting unit, which is coupled to a configuration channel pin of the USB interface, detects a voltage of the configuration channel pin to generate a detection signal. The first switch unit is coupled to the USB control unit and the USB interface and has a conduction state that is associated with the detection signal. The audio processing unit, which is coupled to the detecting unit, selectively performs an audio signal process. When the first switch unit is conducted, the USB control unit and the USB interface are connected, and the audio processing unit does not perform the audio signal process; when the first switch unit is not conducted, the USB control unit and the USB interface are not connected, and the audio processing unit performs the audio signal process. 
         [0005]    A data processing method is also disclosed. The data processing method controls data transmission between a Universal Serial Bus (USB) control unit and a USB interface. This method includes steps of: detecting a voltage of a configuration channel pin of the USB interface to generate a detection signal; determining whether the USB control unit and the USB interface are connected according to the detection signal; and performing an audio signal process when the USB control unit and the USB interface are not connected. 
         [0006]    The data processing circuit and data processing method of the present invention are capable of automatically detecting whether a USB device is an audio device, and selectively perform DC offset correction and impedance detection when the USB device is an audio device. Compared to conventional technologies, the data processing circuit and data processing method of the present invention are applicable to a USB Type-C audio device, and provide a solution for de-popping and/or impedance detection for the USB T e-C audio device. 
         [0007]    These and other objectives of the present invention no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiments with reference to the various figures and drawings. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0008]      FIG. 1  shows a pin diagram of a USB Type-C connector, which is a reversible design. 
           [0009]      FIG. 2  shows a functional block diagram of a data processing circuit according to an embodiment of the present invention. 
           [0010]      FIG. 3  shows a detailed functional block diagram of the audio processing unit according to an embodiment of the present invention. 
           [0011]      FIG. 4  shows a flowchart of a data processing method according to an embodiment of the present invention. 
           [0012]      FIG. 5  shows a flowchart of DC offset correction. 
           [0013]      FIG. 6  shows a detailed functional block diagram of the audio processing unit according to another embodiment of the present invention. 
           [0014]      FIG. 7  shows a flowchart of a data processing method according to an embodiment of the present invention. 
           [0015]      FIG. 8  shows a flowchart of an impedance detection process. 
           [0016]      FIG. 9  shows a detailed functional block diagram of the audio processing unit according to another embodiment of the present invention. 
           [0017]      FIG. 10  shows a flowchart of a data processing method corresponding to  FIG. 9  according to an embodiment of the present invention. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0018]    The following description is written by referring to terms of this technical field. If any term is defined in this specification, such term should be explained accordingly. In addition, the connection between objects or events in the below-described embodiments can be direct or indirect provided that these embodiments are practicable under such connection. Said “indirect” means that an intermediate object or a physical space exists between the objects, or an intermediate event or a time interval exists between the events. 
         [0019]      FIG. 2  shows a functional block diagram of a data processing circuit according to an embodiment of the present invention. Referring to  FIG. 2 , a data processing circuit  20  is coupled between a Universal Serial Bus (USB) host  10  and a USB interface  30 . A USB control unit  110  of the USB host  10  controls data transmission between the USB host  10  and a USB device (connected to the USB interface  30 , not shown). An audio control unit  120  controls an audio decoding operation of the USB host  10 . 
         [0020]    The data processing circuit  20  is connected to the USB host  10  and the USB interface  30  via pads  210  and  220 , respectively. More specifically, the pad  210  and the pad  220  connect the differential signal pair pins A 6 /B 6  and A 7 /B 7  in  FIG. 1 . The data processing circuit  20  controls whether to conduct the differential signal pair pins A 6 /B 6  and A 7 /B 7  between the USB host  10  and the USB device to control data transmission between the two. The data processing circuit  20  further includes an audio processing unit  240 , which supports functions of audio decoding, de-popping and/or impedance detection. The audio processing unit  240  communicates with the audio control unit  120  of the USB host  10  via a High-Definition Audio (HAD) interface, an inter-integrated circuit sound (I 2 S) interface, or other types of interfaces capable of audio transmission. In one embodiment, the audio control unit  120  transmits audio data in a Pulse Code Modulation (PCM) format to the audio processing unit  240 . The audio processing unit  240  converts the audio data to analog audio signals, and outputs the analog audio signals via the pad  220  (i.e., the differential signal pair pins A 6 /B 6  and A 7 /B 7 ) to the USB device (e.g., earphones) coupled to the USB interface  30 . The data processing circuit  20  further includes an audio device detecting unit  230 . The audio device detecting unit  230  is connected to a configuration channel pin on the USB interface  30 , and detects a voltage change on the configuration channel pin to determine whether the USB device connected to the USB interface  30  is an audio device, e.g., earphones or sound amplifiers. When the USB device is an audio device, the configuration channel pins A 5  and B 5  are both at a low potential. The audio device detecting unit  230  generates a detection signal JD according to the determination result. The data processing circuit  20  operates in an audio mode or a non-audio mode according to the detection signal JD. 
         [0021]      FIG. 3  shows a detailed functional block diagram of the audio processing unit  240  according to an embodiment of the present invention. As shown in  FIG. 3 , the audio processing unit  240  includes an audio control unit  241 , a digital-to-analog converter (DAC)  242 , an amplification circuit  243 , an analog-to-digital converter (ADC)  244 , a direct-current (DC) offset compensating unit  245 , and switch units  254  and  256 . The audio control unit  241  controls an audio decoding operation. For instance, the above operation of converting the audio data from a PCM format to a Pulse Density Modulation (PDM) format is a part of the audio decoding operation. The DAC  242  converts the audio data generated by the audio control unit  241  from a digital domain to an analog domain. The audio data in the analog domain is amplified by the amplification circuit  243  to obtain an amplified audio signal, which is then outputted to the USB interface  30  via the pad  220 . When the DAC  242  contains a DC offset, popping occurs in the audio signal. One main purpose of the DC offset compensating unit  245  is to detect the DC offset in the circuit and to compensate the DC offset in the DAC  242  to prevent popping. 
         [0022]      FIG. 4  shows a flowchart of a data processing method according to an embodiment of the present invention. When the USB device is plugged to the USB interface  30 , the audio device detecting unit  230  detects whether the USB device is an audio device (step S 410 ). When the USB device is not an audio device (e.g., represented by a detection signal JD=0), the USB device and the USB host  10  transmit data via the pad  210  and the pad  220 , and so the data processing circuit  20  operates in a non-audio mode (step S 420 ). At this point, the switch unit  252  is conducted to establish a data transmission path for the USB host  10  and the USB interface  30  to transmit data. Next, the audio device detecting unit  230  detects whether plugging/unplugging of a device occurs at the USB interface occurs (step S 430 ), e.g., detecting whether a potential change on the configuration channel pin occurs. If not, it means that the current USB device is not replaced, and so the data processing circuit  20  continues operating in the non-audio mode (step S 420 ). If the audio device detecting unit  230  detects plugging/unplugging of a device, it is determined whether the new device is an audio device (step S 410 ). When the new device is an audio device (e.g., represented by a detection signal JD=1), it is determined whether an audio signal process is to be performed. In this embodiment, the audio signal process is a DC offset correction process. When the determination of step S 440  is affirmative, the DC offset correction process is performed (step S 450 ), and the data processing circuit  20  enters an audio mode after the DC offset correction process is completed (step S 460 ). When the determination result of step S 440  is negative, the data processing circuit  20  skips the DC offset correction process, and directly enters the audio mode (step S 460 ). In the audio mode, the switch unit  252  is not conducted, such that the USB interface  30  cannot receive any data signal from the USB control unit  110 . At this point, the USB  30  may receive the audio signal outputted from the audio processing unit  240 . Next, the audio device detecting unit  230  detects whether plugging/unplugging of a device occurs at the USB interface  30  occurs (step S 470 ). If not, it means that the current USB device is not replaced, and so the data processing circuit  20  continues operating in the audio mode (step S 460 ). When the audio device detecting unit  230  detects plugging/unplugging of a device, it is again determined whether the new device is an audio device (step S 410 ). 
         [0023]      FIG. 5  shows a flowchart of DC offset correction. A DC offset of the ADC  244  is first detected (step S 510 ), including a step of switch unit switching (step S 512 ) and a step of DC offset detection (S 514 ). In step S 512 , the switch unit  252 , the switch unit  254  and the switch unit  256  are controlled to be non-conducted. In step S 514 , the DC offset compensating unit  245  detects the DC offset of the ADC  244 . After the detection for the DC offset of the ADC  244  is completed, the DC offset of the DAC  242  is detected (step S 520 ), including a step of switch unit switching (step S 522 ), a step of detecting a sum of the DC offsets of the DAC  242  and the ADC  244  (step S 524 ), and a step of calculating the DC offset of the DAC  242  (step S 526 ). In step S 522 , the switch unit  252  is controlled to be non-conducted, and the switch unit  254  and the switch unit  256  are controlled to be conducted. In step S 524 , the DC offset compensating unit  245  detects the sum of the DC offsets of the DAC  242  and the ADC  244 . In step S 526 , the DC offset of the ADC  244  detected in step S 514  is subtracted from the sum of the DC offsets detected in step S 524  to obtain the DC offset of the DAC  242 . Finally, the DC offset of the DAC  242  is stored (step S 530 ). 
         [0024]    It should be noted that, the amplification circuit  243  includes multi-stage cascaded amplifiers, and an input end of the ADC  244  is coupled to an input end of the last-stage amplifier, i.e., the output signal of the second-last-stage amplifier is concurrently fed into the last-stage amplifier of the amplification circuit  243  and the ADC  244 . In step S 522 , the last-stage amplifier of the amplification circuit  243  is disabled to prevent interfering the DC offset detection in step S 524 . 
         [0025]      FIG. 6  shows a detailed functional block diagram of the audio processing unit  240  according to another embodiment of the present invention. As shown in  FIG. 6 , the audio processing unit  240  includes the audio control unit  241 , the DAC  242 , the amplification circuit  243 , the ADC  244 , a test signal generating unit  246 , an impedance detecting unit  247 , an impedance unit  248 , a multiplexer  249 , and switch units  254 ,  256  and  258 . The test signal generating unit  246  generates a test signal, e.g., a low-frequency sinusoidal side tone signal, whose frequency may be lower than a hearing range of the human ear, for example The test signal is converted from the digital domain to the analog domain by the DAC  242 . The impedance unit  248  is aimed to provide an impedance value, and may be implemented by a passive element, for example but not limited to, a resistor, an inductor and/or a capacitor. The impedance detecting unit  247  learns the impedance of the audio device coupled to the USB interface  30  according to a digital code outputted from the ADC  244 . More specifically, the test signal is voltage divided by the impedance unit  248  and the audio device, and the voltage received at the input end of the ADC  244  is the divided voltage of the test signal on the audio device. That is to say, the voltage that the ADC  244  receives gets larger as the impedance of the audio device is larger, and the digital code generated also becomes larger. Conversely, the voltage that the ADC  244  receives gets smaller as the impedance of the audio device is smaller, and the digital code generated also becomes smaller. The impedance detecting unit  247  may learn the impedance of the audio device according to the value of the digital code. 
         [0026]      FIG. 7  shows a flowchart of a data processing method according to an embodiment of the present invention. As shown in the process in  FIG. 7 , when it is confirmed that a device plugged into the USB interface  30  is an audio device (the determination result of step S 410  is affirmative), it is determined next whether an audio signal process is to be performed. In this embodiment, the audio signal process is an impedance detection process. When the determination result of step S 740  is affirmative, the impedance detection is performed (step S 750 ), and the data processing circuit  20  enters an audio mode after the detection is completed (step S 760 ). When the determination result of step S 740  is negative, the data processing circuit  20  skips the impedance detection process and directly enters the audio mode (step S 760 ). In the audio mode, the switch unit  252  is not conducted, such that the USB interface  30  cannot receive the data signal from the USB control unit  110  but receives the audio signal outputted from the audio processing unit  240 . Next, the audio device detecting unit  230  detects whether plugging/unplugging of a device occurs at the USB interface  30  (step S 770 ). If not, it means that the current USB device is not replaced, and so the data processing circuit  20  continues operating in the audio mode (step S 760 ). When the audio device detecting unit  230  detects plugging/unplugging of a device, it is determined whether the new device is an audio device (step S 410 ). 
         [0027]      FIG. 8  shows a flowchart of an impedance detection process. The switch units  252  and  254  are controlled to be non-conducted, the switch units  256  and  258  are controlled to be conducted, and the multiplexer  249  is controlled to select the output of the impedance unit  248  as its output (step S 810 ). The test signal generating unit  246  starts to output a test signal (step S 820 ). When an audio device is coupled to the USB interface  30 , for the test signal, the impedance of the audio device forms a serial connection with the impedance unit  248 . Thus, the input voltage of the ADC  244  is in fact a divided voltage of the test signal on the audio device, and this divided voltage is directly proportional to the impedance of the audio device. That is to say, the impedance detecting unit  247  may learn the value of the impedance of the audio device according to the value of the divided voltage (step S 830 ). After the value of the impedance is learned, the test signal is terminated (step S 840 ). 
         [0028]      FIG. 9  shows a detailed functional block diagram of the audio processing unit  240  according to another embodiment of the present invention. As shown in  FIG. 9 , the audio processing unit  240  includes the audio control unit  241 , the DAC  242 , the amplification circuit  243 , the ADC  244 , the DC offset compensating unit  245 , the test signal generating unit  246 , the impedance detecting unit  247 , the impedance unit  248 , the multiplexer  249 , and the switch units  254 ,  256  and  258 . Functions of these components are described in the foregoing embodiments, and shall be omitted herein.  FIG. 10  shows a flowchart of a data processing method corresponding to  FIG. 9  according to an embodiment of the present invention. In the process in  FIG. 10 , when it is confirmed that a device plugged into the USB interface  30  is an audio device (the determination result of step S 410  is affirmative), it is determined whether an audio signal process is to be performed. In this embodiment, the audio signal process is a DC offset correction process and an impedance detection process. In the process in  FIG. 10 , the DC offset correction process is selectively performed (steps S 1040  and S 1050 ), the impedance detection process is then selectively performed (steps S 1060  and S 1070 ), an audio mode is next entered (step S 1080 ), and it is detected whether plugging/unplugging of a device occurs (step S 1090 ). In an alternative embodiment, the process in  FIG. 10  may also first selectively perform the impedance detection process and then selectively perform the DC offset correction process. 
         [0029]    The data processing circuit  20  may be a stand-alone circuit or chip, or may be integrated in the USB host  10 . When the data processing circuit  20  is a stand-alone circuit or chip, whether the switch units  252 ,  254 ,  256  and  258  are conducted, and whether the last-stage amplifier of the amplification circuit  243  is enabled, may be controlled by a control unit (not shown) of the data processing circuit  20  according to the detection signal JD, or may be controlled by the USB host  10  in a way of issuing a parameter to the data processing circuit  20  (e.g., through changing a register value of a register, which is not shown, of the data processing circuit  20 ) according to the detection signal JD . When the data processing circuit  20  is integrated in the USB host  10 , whether the switch units  252 ,  254 ,  256  and  258  are conducted, and whether the last-stage amplifier of the amplification circuit  243  is enabled, may be controlled directly by the USB host  10 . 
         [0030]    Please note that there is no step sequence limitation for the method inventions as long as the execution of each step is applicable. Furthermore, the shape, size, and ratio of any element and the step sequence of any flow chart in the disclosed figures are exemplary for understanding, not for limiting the scope of this invention. 
         [0031]    The aforementioned descriptions represent merely the preferred embodiments of the present invention, without any intention to limit the scope of the present invention thereto. Various equivalent changes, alterations, or modifications based on the claims of the present invention are all consequently viewed as being embraced by the scope of the present invention.