USB audio equipment class audio signal synchronization solution

This article introduces the audio signal synchronization problems that need to be solved when using USB_Audio_Class for voice device design, and gives the corresponding solutions and some source code.

introduction

The USB bus protocol has gone through the development process from USB1.1 to USB2.0 to the current USB OTG (USB On-The-Go). While USB continues to develop and improve, more and more USB products are on the market in large quantities. Nowadays, through the USB Hub device and multiple USB controllers, the PC can support hundreds of extended USB devices at the same time.

In the USB bus transmission, any USB data transmission must be initiated and controlled by the host, all USB peripherals can only establish a connection with the host, and any two peripherals or two hosts cannot communicate directly . At present, most of them play the role of host computers (PC).

When the USB protocol was drawn up, in order to facilitate developers of different devices to design based on USB, different device classes were defined to support different types of devices. USB products on the market today will find that they mainly apply the following device categories:

USB_DEVICE_CLASS_HUMANINTERFACE keyboard, mouse, etc.

USB_DEVICE_CLASS_STORAG ​​U disk, active hard disk, digital camera, etc.

USB_DEVICE_CLASS_PHYSICAL_INTERFACE force feedback joystick, steering wheel, etc.

USB_DEVICE_CLASS_POWER fan, LED desk lamp, mobile phone charging, etc.

USB_DEVICE_CLASS_PRINTER printer

From the market point of view, although USB_DE-VICE_CLASS_AUDIO is defined in the USB standard, few such devices are available. Most devices currently called USB speakers use USB_DEVICE_CLASS_POWER, and only use the USB interface as a power source. The signal still needs to be connected with a 3.5 mm stereo audio cable, which is relatively complicated. This does not reflect the advantages of simple connection and convenient operation of the USB device, and the use of analog signal transmission will cause certain signal distortion and affect the sound quality.

In order to design and implement a USB_DEVICE_CLASS_AUDIO device based entirely on the USB protocol, this article uses a USB cable to realize the input of audio signals at different endpoints in the device. The output includes related key control, and focuses on how to solve the special Signal synchronization problems caused by the bus topology.

1 USB_DEVICE_CLASS_AUDIO introduction

To simplify the development process of USB devices, USB has proposed the concept of device class. Among them, the audio device class (USB_DEVICE_CLASS_AU-DIO) is a type that has been rarely used so far.

USB_DEVICE_CLASS_AUDIO is a special category specifically defined for USB audio devices. It not only defines the standard of audio input / output endpoints, but also provides volume control, mixer configuration, left and right channel balance, and even includes support for Dolby sound decoding. Supported by the device, the function is quite powerful. Different developers can list their own device structure to the host according to different needs, and the host provides corresponding services according to the different device structures listed.

The USB_DEVICE_CLASS_AUDIO device adopts the Isochronous transfers mode in the USB transmission mode. The Isochronous trans-fers transfer mode is a transmission method specifically for streaming media features. According to the parameters enumerated by the device during link initialization, it is guaranteed to provide stable bandwidth to devices or endpoints using this mode. Due to the real-time requirements, it does not provide corresponding receive / reply and handshake protocols. This is well adapted to the characteristics of stable audio data flow and relatively insensitivity to errors.

2 Platform introduction and system architecture

The development platform uses ColdFire MCF52223 as the control MCU. The chip provides 32 KB SRAM, 256 KB Flash, with USB-OTG module, 76Dhrystone 2.1 MIPS at 80 MHz, and ML2308 onboard as an audio playback module. For details, please refer to its official website http: //com/chinese/coldfire/HHCF52223-R1.htm.

The main hardware module structure and software module structure are shown in Figure 1 and Figure 2 respectively.

3 Synchronization issues

Due to the particularity of the USB bus topology, all data transmission is initiated by the host (PC). After the device is plugged into the USB interface and the initialization and enumeration steps are completed, the host will allocate traffic according to the requirements of the device enumeration. The USB full-speed mode bus takes 1 ms as 1 frame. Due to the Isoch-ronous transfers mode, the audio format uses a sampling rate of 8 k / s and 8-bit quantization for the convenience of testing. Therefore, the amount of data per frame of mono is:

The MCF52223 receives and decodes the audio data in the USB data packet through the USB D driver, and then stores it in the internally developed buffer. ML2308 has a 64-byte buffer for each channel. When the buffer is full, half of the buffer, and the buffer is empty, it will send interrupt signals Full, Mid, and Empty to MCF52223. MCF52223 can write new data to ML2308 according to different interrupt signals jobs.

Therefore, the data at the write end of the device is transmitted according to the USB clock on the PC, and the data at the output end of the device is operated according to the ML2308 clock. The ML2308 clock comes from the on-board crystal oscillator. These two clocks inevitably have some errors, and according to the test, the USB bus clocks of different PCs are also slightly different. These differences will cause the audio data buffered in the device to be continuously exhausted, or continue to increase and eventually overflow. Therefore, there is a need for a method that is easy to implement and consumes less resources to synchronize input and output signals. Since this difference is uncertain, the algorithm requires a certain degree of adaptability.

  Offering Room Oil Diffuser, Hotel Scent Diffuser, Hotel Aroma Diffuser From China Manufacturer.

  Hotel Scent Diffuser is to spread the scent to the corners of the hotel. The fragrant hotel will let you experience the warm feeling, friends who are out of the house, tired and tired for a day, always want to find a warm harbor to take a break. But suffering from all the hotels is the same, there is no special characteristics and style, just choose the nearest one is the practice of most of us. 
  How can I attract customers to stay with? Hotel Aroma Diffuser is the most direct and effective way. After the hotel is fragrant, it will give us a special sense of favor. We don`t need to spend time thinking, going to see, checking, just passing through that place, smelling the familiar taste, we already have a sense of belonging, This feeling is the feeling of home. Hotel Diffuser helps the hotel to create a warm harbor for customers, allowing customers to park here, and the scent is the designated light on the parking lot.


Hotel Diffuser

Room Oil Diffuser,Hotel Scent Diffuser,Hotel Aroma Diffuser,Hotel Diffuser

Shenzhen Dituo Electronic Co.,Ltd. , https://www.sz-dituo.com

This entry was posted in on