PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

API Reference
PDM_PCM_v2 (PDM-PCM Converter)
PDL API Reference

## General Description

Note
  IP Supported: PDM

The pulse-density modulation to pulse-code modulation (PDM-PCM) driver provides an API to manage PDM-PCM conversion. A PDM-PCM converter is used to convert 1-bit digital audio streaming data to PCM data.

The functions and other declarations used in this driver are in cy_pdm_pcm_v2.h. You can include cy_pdl.h (ModusToolbox only) to get access to all functions and declarations in the PDL.

Features:

- Supports up to 8 PDM receivers
- Supports Stereo/Mono dual mode PDM (pulse-density-modulated) to PCM (pulse-code-modulated) conversion
- Half rate sampling to reduce system power consumption
- CIC filter, FIR filter, DC block filter signal processing path
- Programmable interface clock
- Programmable FIR filter coefficients
- Programmable CIC and FIR filter decimation
- Programmable DC blocking coefficient
- Programmable PCM word size (8, 10, 12, 14, 16, 18, 20, 24, 32 bits)
- Programmable sampling delay, to cope with different master-slavemaster roundtrip delays
- 64 entry RX FIFO with interrupt and trigger support
- Debug/freeze trigger support
- Receiver activate trigger support
- Test mode support, the IP includes a programmable PDM pattern generator

Pulse-density modulation, or PDM, represents an analog signal with a binary signal. In a PDM signal, specific amplitude values are not encoded into codewords of pulses of different weight as they would be in pulse-code modulation (PCM); rather, the relative density of the pulses corresponds to the analog signal's amplitude. The output of a 1-bit DAC is the same as the PDM encoding of the signal.

Pulse-code modulation (PCM) is the method used to digitally represent sampled analog signals. It is the standard form of digital audio in computers, compact discs, digital telephony, and other digital audio applications. In a PCM stream, the amplitude of the analog signal is sampled regularly at uniform intervals, and each sample is quantized to the nearest value within a range of digital steps.

# Configuration Considerations

To set up a PDM-PCM, provide the configuration parameters in the cy_stc_pdm_pcm_config_v2_t structure.

Input frequency from source clock and the sampling rate Fs, is expressed as follows:
CLK_IF_SRSS_FREQ = (CLOCK_CTL.CLOCK_DIV + 1) * M * Fs
where M is the oversampling rate at the PDM source

To initialize the PDM-PCM channels, call Cy_PDM_PCM_Channel_Init function, providing the filled cy_stc_pdm_pcm_channel_config_t structure To initialize the PDM-PCM block, call the Cy_PDM_PCM_Init function, providing the filled cy_stc_pdm_pcm_config_v2_t structure.

If you use a DMA, the DMA channel should be previously configured. PDM-PCM interrupts (if applicable) can be enabled by calling Cy_PDM_PCM_SetInterruptMask.

For example, if the trigger interrupt is used during operation, the ISR should call the Cy_PDM_PCM_ReadFifo as many times as required for your FIFO payload. Then call Cy_PDM_PCM_Channel_ClearInterrupt with appropriate parameters.

If a DMA is used and the DMA channel is properly configured, no CPU activity (or application code) is needed for PDM-PCM operation.

## API Reference
| Macros
| Functions
| Data Structures
| Enumerated Types