43.6. UAC2 Speaker and Microphone
43.6.1. Overview
This example project shows USB hid generic transfers
PC transmits a HID report to MCU, and then MC send it back to PC
43.6.2. Board Setting
Connect a USB port on PC to the PWR DEBUG port on the development board with a USB Type-C cable
Connect a USB port on PC to one of USB port on the development board with a USB Type-C cable
Connect a speaker to the DAO interface on the development board
43.6.3. Project Configuration
File CMakeLists.txt:
When BOARD_DEVICE_RHPORT_NUM is defined as 0, it means to use USB0.
When BOARD_DEVICE_RHPORT_NUM is defined as 1, it means to use USB1.
The property of USB device can be configured by “tusb_config.h” or “CMakeListx.txt”
43.6.4. Running the example
When the project runs correctly
Confirm the audio settings:
Set “TinyUSB headset” as the default play device
Set “TinyUSB headset” as the default recording device
Play
Start a music player on PC and choose a music song, and then click “Play” button
MCU plays music by speaker as receiving audio data from PC.
Recording
Stop the music player on PC
Start a recording tool and click “Record” button, and at the same time play a music song by another player device(e.g. mobile phone)
Click “Stop” button after recording for a while
Click “Play” button
MCU Plays audio by speaker on DAO interface