# PDM_PCM (PDM-PCM Converter)¶

group group_pdm_pcm

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.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.

Features:

• Supports FIFO buffer for Incoming Data

• Supports Software Mute Mode

• Programmable Gain Settings

• Programmable Word Length

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_t structure.

For example, set dataStreamingEnable to true, configure rxFifoTriggerLevel, dmaTriggerEnable (depending on whether DMA is going to be used), provide clock settings (clkDiv, mclkDiv and ckoDiv), set sincDecRate to the appropriate decimation rate, wordLen, and wordBitExtension. No other parameters are necessary for this example.

To initialize the PDM-PCM block, call the Cy_PDM_PCM_Init function, providing the filled cy_stc_pdm_pcm_config_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_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.