background image

 

PSoC 6 MCU: USB Audio Recorder 

www.cypress.com

 

Document Number: 002-25786 Rev. ** 

6.  Open an audio recorder software tool in the PC. If you do not have one, download the open-source software 

Audacity

. 

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

 configuration. See 

KBA224621

 in the Cypress 

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. 

Figure 2

 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. 

Figure 3 

shows the flowchart on how the PDM/PCM data is streamed over USB. 

Summary of Contents for CE225786

Page 1: ...e PDM data line One microphone samples in the falling edge and the other in the rising edge This code example uses FreeRTOS Visit the FreeRTOS website for documentation and API references of FreeRTOS...

Page 2: ...red to the USB data endpoint buffer Figure 2 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...

Page 3: ...er an entire audio frame per trigger It triggers when there is enough data in the PDM PCM FIFO Once it completes a transfer it disables itself it is enabled again only when the Audio IN Endpoint Callb...

Page 4: ...Table 1 lists the ModusToolbox resources used in this example and how they are used in the design For pin usage and configuration open the Pins tab of the design modus file Table 1 ModusToolbox Resou...

Page 5: ...PSoC 6 MCU USB Audio Recorder www cypress com Document Number 002 25786 Rev 5 Figure 5 USBFS Configuration...

Page 6: ...hows the configuration settings for DMA_PCM Figure 6 DMA_PCM Configuration Figure 8 and Figure 8 show the platform system clock configuration Note that the FLL and PLL are used in this application The...

Page 7: ...ings Figure 9 High Frequency Clocks Configuration KIT_UART uses the default configuration for UART The following middleware libraries are used in this project FreeRTOS v10 0 1 Retarget I O USB Device...

Page 8: ...PSoC 6 MCU devices and how to build your first PSoC project AN215656 PSoC 6 MCU Dual Core CPU System Design Describes the dual CPU architecture in the PSoC 6 MCU and shows how to build a simple dual C...

Page 9: ...com Document Number 002 25786 Rev 9 Document History Document Title CE225786 PSoC 6 MCU USB Audio Recorder Document Number 002 25786 Revision ECN Orig of Change Submission Date Description of Change...

Page 10: ...of the Software is prohibited TO THE EXTENT PERMITTED BY APPLICABLE LAW CYPRESS MAKES NO WARRANTY OF ANY KIND EXPRESS OR IMPLIED WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE I...

Reviews: