MTB CAT1 Peripheral driver library
PDM_PCM_v2 (PDM-PCM Converter v2)

General Description

Note
IP Supported: PDM
Device Categories: CAT1B and CAT1D. Please refer Device Catalog.

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:

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

pdm_pcm_sampling_rate.png

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.

Changelog

VersionChangesReason for Change
1.10 Minor documentation updates. Documentation enhancement.
1.0 Initial version

API Reference

 Macros
 
 Functions
 
 Data Structures
 
 Enumerated Types