PSoC 6 MCU: USB Audio Recorder
Document Number: 002-25786 Rev. **
2
6. Open an audio recorder software tool in the PC. If you do not have one, download the open-source software
Make sure to select the correct microphone in the software tool.
7. Start a recording session. Play a sound, or speak over the microphones in the kit.
8. Stop the recording session and play it to confirm that the audio was recorded correctly.
Debugging
You can debug the example to step through the code. Use a
Debug
community to learn how to start a debug session with ModusToolbox IDE.
Design and Implementation
The PDM-to-PCM hardware block can sample one or two PDM digital microphones. In this application, the hardware block is
configured to sample stereo audio at 48 ksps with 16-bit resolution. The sample audio data is eventually transferred to the USB
data endpoint buffer.
shows the overall transfers performed by the application.
Figure 2. Overall Transfers
PDM/PCM
RX FIFO
SRAM
PCM
Buffer
USB Data
Endpoint
Buffer
DMA
Transfers
DMA
Transfers
The first DMA transfer reads from the PDM/PCM RX FIFO and writes to a buffer in the SRAM. This buffer is populated with 16-
bit interleaved data (left and right channels). The second DMA transfer reads from this buffer and writes to the USB Data Endpoint
buffer. The second DMA transfer is handled automatically by the USBFS driver, while the first DMA transfer is part of the
application layer.
The USB descriptor implements the Audio Device Class with three endpoints:
▪
Audio Control Endpoint:
controls the access to the audio streams
▪
Audio IN Endpoint:
sends data to the USB host
▪
Audio OUT Endpoint:
receives data from the USB host (not used in this application)
Only the first two endpoints are used in this application; however, all the hooks in the firmware are placed to enable the Audio
OUT Endpoint.
shows the flowchart on how the PDM/PCM data is streamed over USB.