Configurable Timer (CT) Initialization and Configuration#

The SiWx917 Software Development Kit (SDK) provides a unified Configurable Timer (CT) driver with flexible configuration options, multiple timer instances, and integration with power management features.

This section explains how to initialize and configure the CT peripheral using Simplicity Studio and the WiSeConnect SDK.

It covers automatic setup through the Universal Configurator (UC) system as well as manual configuration for advanced use cases.

For general SDK information, see Developing with the WiSeConnect™ v3.x SDK.

Startup Sequence#

CT initialization follows a structured, fail-safe startup sequence that ensures reliable operation.

  1. System setup: Initializes device power and clock systems.

  2. Peripheral enable: Activates the CT module in the MCU’s HP domain.

  3. Configuration load: Applies UC or user-defined settings.

  4. Interrupt / Direct Memory Access (DMA) configuration: Enables event-driven operations.

  5. Validation: Confirms timer readiness before runtime use.

If any step fails, initialization halts immediately to prevent undefined states. This design guarantees predictable and deterministic timer behavior.

Step-by-step Configurable Timer Initialization and Configuration in Simplicity Studio#

This section walks through creating, configuring, and validating CT peripherals in Simplicity Studio.

Step 1. Create or Open Your Project#

  1. Launch Simplicity Studio.

  2. Create a new project for your SiWx917 device or open an existing one.

  3. To explore reference implementations, select a Configurable Timer example project from the WiSeConnect SDK.

  4. Connect your SiWx917 evaluation board. Simplicity Studio automatically detects it.

    Board Auto DetectionBoard Auto Detection
    Figure: Automatic board detection in Simplicity Studio

  5. From Example Projects and Demos, choose a Configurable Timer example.

    Example SelectionExample Selection
    Figure: Selecting a Configurable Timer example project

  6. Click Create to import the project into your workspace.

  7. After you configure project details (name, location, SDK source), Simplicity Studio generates a directory structure. Most examples open a readme.md file by default.

    Config Timer OCU Non DMAConfig Timer OCU Non DMA

Typical Project Structure#

Folder/File

Description

autogen/

Auto-generated configuration headers and linker scripts

config/

Platform-specific configuration headers

resources/

Images and documentation files

platform/

HAL, CMSIS RTOS, and common libraries

simplicity_sdk_/

Simplicity SDK platform layer and third-party libraries

wiseconnect3_sdk_/

WiSeConnect SDK components and libraries

app.c / app.h

Application logic files

config_timer_ocu_non_dma_example.c / .h

Example source and header files

main.c

Application entry point

readme.md

Example documentation

sl_si91x_ct_ocu_non_dma.slcp

Project configuration file

sl_si91x_ct_ocu_non_dma.pintool

Pin Tool configuration for CT

sl_si91x_ct_ocu_non_dma.slps

Project solution set file

Step 2. Add the Configurable Timer Component#

  1. Open the .slcp configuration file.

  2. In the Software Components tab, search for Config Timer.

  3. Ensure the component is installed and available in your project.

Step 3. Configure Config Timer with the Universal Configurator (UC)#

  1. After installation, in the Software Components view, click Configure to open the UC graphical interface.

  2. Set up timer parameters:

    • Counter Direction: Select Up, Down, or Up-Down for Counter0 and Counter1.

    • Periodic Mode: Enable or disable periodic operation.

    • Sync Trigger: Enable synchronization if using multiple counters.

    • Selected Module: Choose the Subsystem Configurable Timer (SCT).

    • Input/Output Pins (IN0/OUT0/OUT1): Assign purpose input/output (GPIO) pins for signals.

Config Timer Component ConfigurationConfig Timer Component Configuration

Valid pin options:

Signal

Available Pins

IN0

GPIO_25, ULP_GPIO_0 / GPIO_64, ULP_GPIO_4 / GPIO_68

OUT0

GPIO_29, ULP_GPIO_4 / GPIO_68

OUT1

GPIO_30, ULP_GPIO_5 / GPIO_69

You can assign pins in two ways:

  • Dropdown Menu: Choose pins directly.
    Pin Selection via DropdownPin Selection via Dropdown

  • Pin Tool: Use Simplicity Studio’s graphical Pin Tool.
    Pin Selection via Pin ToolPin Selection via Pin Tool

For a detailed list of configuration fields, see sl_si91x_config_timer.h.

Step 4. Generate Initialization Code#

Once configuration is complete:

  • Simplicity Studio automatically generates CT driver and configuration source files.

  • Click View Source in the UC interface to verify generated code.

Autogenerated CodeAutogenerated Code
Figure: Auto-generated initialization code for CT

Generated files include:

  • sl_si91x_config_timer_init.c – Initialization source

  • sl_si91x_config_timer_config.h – Configuration header

Step 5. Initialize Config Timer in Your Application#

Use the WiSeConnect SDK APIs to initialize the timer. Driver source and header files are located in:

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

Example initialization code:

// Initializing Configurable Timer instance
sl_status_t status = sl_si91x_config_timer_init();
DEBUGINIT();
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_init : Initialization failed, Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully initialized Configurable Timer\n");
}

// Configuring CT parameters from UC values
status = sl_si91x_config_timer_set_configuration(&ct_config);
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_set_configuration : Invalid Parameters, Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully configured CT parameters\n");
}

// Getting the match value for the timer
status = sl_si91x_config_timer_get_match_value(TIME_PERIOD_VALUE, &match_value);
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_get_match_value : Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully obtained CT match value\n");
}

// Setting up interrupt for match event
if (CT_COUNTER_USED == SL_COUNTER_0) {
  ct_interrupt_flags.is_counter0_hit_peak_interrupt_enabled = true;
} else {
  ct_interrupt_flags.is_counter1_hit_peak_interrupt_enabled = true;
}

// Registering callback for timer events
status = sl_si91x_config_timer_register_callback(on_config_timer_callback, callback_flag_data, &ct_interrupt_flags);
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_register_callback : Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully registered CT callback\n");
}

// Setting match value for the selected counter
status = sl_si91x_config_timer_set_match_count(SL_COUNTER_16BIT, CT_COUNTER_USED, match_value);
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_set_match_count : Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully set CT match count\n");
}

// Starting the selected counter with software trigger
status = sl_si91x_config_timer_start_on_software_trigger(CT_COUNTER_USED);
if (status != SL_STATUS_OK) {
  DEBUGOUT("sl_si91x_config_timer_start_on_software_trigger : Error Code : %lu\n", status);
} else {
  DEBUGOUT("Successfully started CT on software trigger\n");
}

Step 6. Customize for Advanced Use Cases#

You can modify the generated configuration or initialization code to extend functionality beyond the default setup.
This includes:

  • Adding custom callback functions for timer events

  • Enabling or adjusting Direct Memory Access (DMA) settings for advanced data handling

  • Changing match values, synchronization behavior, or trigger conditions dynamically

  • Integrating CT with other peripherals for coordinated operation

For complete examples and implementation details, see
configurable-timer-usage-scenarios.md.

Step 7. Build, Flash, and Test#

After configuration, build and validate your project using Simplicity Studio.

You can test your application output using the Virtual COM (VCOM) console built into Simplicity Studio, or external serial tools such as Tera Term or PuTTY.

Step-by-Step: Build, Flash, and Test#

  1. Build the project.

    Compile your project in Simplicity Studio to generate the firmware image.
    Build ProjectBuild Project
    Figure: Building the Configurable Timer project in Simplicity Studio

  2. Flash the firmware to your SiWx917 device.

    Once the build completes, flash the firmware image to your SiWx917 evaluation board.
    Flash DeviceFlash Device
    Program DeviceProgram Device
    Figure: Programming the SiWx917 device with CT firmware

  3. Verify Configurable Timer operation.

    Use the VCOM console or a serial terminal to observe log output and confirm correct timer operation.

    • Access connected devices
      Connected DevicesConnected Devices

    • Connect to your target board
      Connect DeviceConnect Device

    • Launch the console
      Launch ConsoleLaunch Console

    • View or modify console settings
      Console SettingsConsole Settings

    To view logs:

    1. Open the console and select the serial1 tab.

    2. Click inside the console entry field.

    3. Press Enter to activate serial logging.

    Example Output

    Console LogsConsole Logs
    Figure: Example Configurable Timer log output showing initialization and runtime status

Tip: The log output confirms whether initialization, configuration, and event callbacks are working correctly. If no output appears, check that your board is connected, powered, and flashed with the correct build configuration.

References#

Related Example Projects#

Explore the WiSeConnect SDK Peripheral Examples for complete CT demonstrations:
WiSeConnect SDK Config Timer Peripheral Examples

Example

Description

SiWx917 – Config Timer Basic and OCU (Non-DMA)

Demonstrates basic PWM and Output Compare Unit (OCU) operation without DMA.

SiWx917 – Config Timer ICU and OCU (With DMA)

Shows Input Capture Unit (ICU) and OCU configurations using DMA for advanced timing applications.