Pulse Code Modulation (PCM) Initialization and Configuration#

This section explains how to initialize and configure the Pulse Code Modulation (PCM) peripheral on SiWx917 devices using Simplicity Studio, the WiSeConnect software development kit (SDK), and the Universal Configurator (UC).

You will learn how to:

  • Create a PCM-enabled project

  • Add and configure PCM components

  • Set sample rate, bit depth, and clocking modes

  • Assign pins for FSYNC, BCLK, DIN, and DOUT

  • Initialize PCM in code and validate transfers using blocking or DMA modes

PCM operates in the high-performance (HP) domain and is intended for synchronous, low-latency audio applications such as voice paths, telephony interfaces, or external DSP communication.

Step 1. Create or Open a Project#

  1. Launch Simplicity Studio and connect a supported SiWx917 evaluation board.
    Board auto detectionBoard auto detection
    Figure: Board detection in Simplicity Studio

  2. Create a new project or open an existing one based on one of the following WiSeConnect PCM examples:

    • sl_si91x_pcm_primary

    • sl_si91x_pcm_secondary

    • sl_si91x_pcm_loopback

  3. Select an example and click Create to import it. PCM example searchPCM example search
    Figure: Search example PCM projects

  4. Review the included readme.md for wiring and board-specific notes. PCM driver primary examplePCM driver primary example

Typical directory structure

  • autogen/ – Auto-generated files (configuration headers, linker scripts)

  • config/ – Platform-specific configuration headers

  • resources/ – Images and documentation assets

  • simplicity_sdk/ – Gecko SDK platform and third-party libraries

    • platform/ – HAL, CMSIS-RTOS, and common libraries

  • wiseconnect3_sdk_4.0.0/ – WiSeConnect SDK components and resources

    • components/ – Wi-Fi, BLE, Si91x MCU subsystem

  • sl_si91x_pcm_primary.slcp – Project configuration file

  • sl_si91x_pcm_primary.slps – Project set file

  • sl_si91x_pcm_primary.pintool – Pin configuration for PCM pins

  • app.c, app.h, main.c – Application sources

  • readme.md – Example documentation and usage

Step 2. Add the PCM Component#

  1. Open the project’s .slcp file.

  2. Select Software Components.

  3. Search for PCM, or navigate to WiSeConnect SDK → Device → Si91x → MCU → Peripherals → PCM.

  4. Install the PCM component.

  5. To add more instances, click Add New Instance (for example, PCM0).

PCM component in Simplicity StudioPCM component in Simplicity Studio

Step 3. Configure PCM with Universal Configurator (UC)#

Click Install, then Configure to set up the PCM instance.

PCM component configurationPCM component configuration

UC Parameters#

PCM UC configurePCM UC configure

Parameter

Description

Options / Range

PCM resolution

Bits per audio sample

16, 24, 32

PCM sampling rate

Audio sample rate (kHz)

8, 11.025, 16, 22.05, 24

Selected module

PCM hardware instance

PCM0

DIN0

Data input pin

GPIO_XX (selectable)

DOUT0

Data output pin

GPIO_XX (selectable)

BCLK

Bit clock pin

GPIO_XX (selectable)

FSYNC

Frame-sync pin

GPIO_XX (selectable)

Pin selection

  • Choose pins from the drop-down list:
    Pins for PCMPins for PCM

  • Or use the Pin Tool:
    Pins for PCMPins for PCM

Step 4. (Optional) Configure in Code#

You can refine the generated configuration in application code, such as:

  • PCM mode

  • resolution and sampling rate

  • transfer type

Refer to the PCM API Reference for configuration structure and enumeration definitions.

Terminology Note:
In signal names, use DIN (data in) and DOUT (data out).

Step 5. Generate Initialization Code#

When you add or modify PCM components, Simplicity Studio generates the driver and configuration files.

  • In the UC configuration UI, select View Source to review the generated files.

PCM autogen init codePCM autogen init code

Step 6. Initialize PCM in Your Application#

Driver locations

/wiseconnect3_sdk_<version>/components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pcm.h
/wiseconnect3_sdk_<version>/components/device/silabs/si91x/mcu/drivers/unified_api/src/sl_si91x_pcm.c

Example

sl_status_t status;
sl_i2s_handle_t pcm_handle;     // Handle type as defined by the SDK
uint32_t pcm_sampling_frequency = SL_I2S_SAMPLING_RATE_16000;
uint32_t pcm_resolution         = SL_I2S_RESOLUTION_16;
uint16_t mode                   = SL_I2S_MASTER;

void callback_event(uint32_t event);

status = sl_si91x_pcm_init(PCM_INSTANCE, &pcm_handle);
if (status != SL_STATUS_OK) {
  DEBUGOUT("PCM Initialization fail\r\n");
  // handle error
} else {
  DEBUGOUT("PCM Initialization success\r\n");
}

status = sl_si91x_pcm_register_event_callback(pcm_handle, callback_event);
if (status != SL_STATUS_OK) {
  DEBUGOUT("PCM user callback register fail\r\n");
  // handle error
} else {
  DEBUGOUT("PCM user callback register success\r\n");
}

status = sl_si91x_pcm_set_configuration(pcm_handle, pcm_sampling_frequency, pcm_resolution, mode);
if (status != SL_STATUS_OK) {
  DEBUGOUT("PCM configuration set fail\r\n");
  // handle error
} else {
  DEBUGOUT("PCM configuration set success\r\n");
}

Step 7. Build, Flash, and Test#

Step-by-step

  1. Build your project in Simplicity Studio. PCM build projectPCM build project

  2. Flash the firmware to your Si91x device.
    PCM flash devicePCM flash device
    PCM program filePCM program file

  3. Verify PCM operation using the serial console or debugger.

    • Connected devices viewConnected devicesConnected devices

    • Connect devices
      Connect devicesConnect devices

    • Launch console
      Launch consoleLaunch console

    • View current launch settings
      Console settingsConsole settings

How to view logs

  1. Open the console and select the serial1 tab.

  2. Place the cursor in the text entry field at the bottom.

  3. Press Enter to activate the console.

Primary log example
Primary logsPrimary logs

Secondary log example
Secondary logsSecondary logs

Note:
You can also use terminal programs such as Tera Term or PuTTY instead of the VCOM console.

Reference#

Related example projects