dev_composite_hid_audio_unified
Overview
The USB Composite HID and Audio Unified application is a simple demonstration program based on the MCUXpresso SDK. It is enumerated as a playback and recording device. Users can record the sound from this device via the “Sound Recorder” in the Windows Accessories and play music with the device.
System Requirement
Hardware requirements
Mini/micro USB cable
USB A to micro AB cable
Specific hardware which has codec presented
Personal Computer
Software requirements
The project files for the lite version example are in:
<MCUXpresso_SDK_Install>/boards//usb_examples/usb_device_composite_hid_audio_unified_lite/ / .
The project files for a non-lite version example are in:
<MCUXpresso_SDK_Install>/boards//usb_examples/usb_device_composite_hid_audio_unified/ / .
The
is Bare Metal or FreeRTOS OS.
Getting Started
Hardware Settings
Set the hardware jumpers (Tower system/base module) to default settings.
Prepare the example
Connect a USB cable between the PC host and the debugger USB port on the board to provide power supply (the example is self-powered).
Download the program to the target board via IDE.
Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
Connect a USB cable between the PC host and the USB device port on the board.
Demo start log is printed, note that the button name can be different for multiple boards.
For detailed instructions, see the appropriate board User’s Guide.
Run the example in Windows
The mentioned steps can be different for Playback and Recording settings as per different Windows OS version.
For the Audio recorder, a USB AUDIO+HID DEMO device is enumerated in the Device Manager.
Open the COM port in a terminal tool, such as the Putty.
Right click on the sound control icon in the Start bar (near the clock) and select “Recording devices”.
In the opened window, select the “Microphone” device with the description “USB Audio + HID Demo” and click on the “Properties” button.
In the new window, go to “Levels” tab, move the slide until 100%, and click on “OK”.
Ensure that the selected “Microphone-USB AUDIO+HID DEMO” is display as Default device if no other microphone device supported by the Windows system. If it’s not mention as default device then click on the “Set default” option to make “Microphone-AUDIO+HID DEMO” as a default device.
Use the board specific hardware to record. For the boards which have SGTL board, plug in the line cable into slot J9 on SGTL board and connect the other end into PC or mobile phone.
Open the “Sound Recorder” application and record audio about 5-10 seconds.
After recording, open the recorder file with any media player and verify it by listening on the speaker of Laptop/PC.
In the opened window, select the “Speakers” device with the description “USB Audio + HID Demo” and click on the “Properties” button.
In the new window, go to “Levels” tab, move the slide until 100%, and click on “OK”.
Ensure that the selected “Speakers-USB AUDIO+HID DEMO” is display as Default device if no other speaker device supported by the Windows system. If it’s not mention as default device then click on the “Set default” option to make “Speakers-USB AUDIO+HID DEMO” as a default device.
Connect the earphone/headphone at Audio Line Out port of target board. Open the Window Media Player application, select, and play your favorite song. Check that recorded audio is audible in the connected earphone/headphone at Audio Line Out port of target board.
Use the mute/unmute button shown in the debug console’s print information to mute/unmute speaker, it only control the speaker.
note
On some platforms, the recorder may have noise since the audio clock and USB SOF are not synchronized, this problem only happens on Windows but not on Mac OSX since the latter uses unified engine.
USB audio class 2.0 is enabled by default.
Based on the USB spec, the feedback endpoint data length should be 3 bytes if the device is full speed. In this case, device can work on Mac OS. However, device can not work on Win 10 and feedback data length must be set 4. There is a workaround to fix this issue, please open the macro USB_DEVICE_WORKAROUND_AUDIO_20_WINDOWS when meets the following conditions:
- USB device is full speed and USB audio class 2.0 is enabled.
- USB device uses feedback endpoint.
- USB host is Windows 10.When device functionality is changed, such as USB auido class 2.0 or UAC 5.1, please uninstall the previous PC driver to make sure the device with changed functionality can run normally.
For the dev_composite_hid_audio_unified_lite_bm.bin, if it uses feedback endpoint, it can not work on Windows 10 if the speed mode is full speed, please run it on Linux or Mac OS.
For IP3511HS in high speed mode, microframe can not be obtained and only for frame, the used feedback solution requires us to have to use larger latency and buffer size to avoid buffer overflow or underflow. Sync mode can use low latency (<1ms) even if on IP3511HS.
If you’re having audio problems on Windows 10, please disable signal enhancement if it is enabled and have a try again.
Supported Boards
MIMXRT1170-EVKB
LPCXpresso55S69
EVK-MIMXRT1064
LPCXpresso55S16
MIMXRT1060-EVKB
EVK-MIMXRT1010
MIMXRT1040-EVK
MIMXRT1024-EVK
LPCXpresso55S28
MCX-N5XX-EVK
MIMXRT1060-EVKC
MIMXRT1160-EVK
EVK-MIMXRT1020
MIMXRT700-EVK
EVKB-IMXRT1050
EVK-MIMXRT1015