Pulse Width Modulation#

Introduction#

The Motor Control Pulse Width Modulation (MCPWM) controller is used to generate a periodic pulse waveform, essential for motor control and power control applications. The MCPWM controller functions as a timer to count up to a period count value. Both the time period and the duty cycle of the pulses are programmable.

PWM Frame FormatPWM Frame Format

Features of Pulse Width Modulation

  1. Supports up to eight PWM outputs with four duty cycle generators.

  2. Includes complementary and independent output modes.

  3. Provides dead time insertion in complementary mode.

  4. Allows manual override for PWM output pins, with programmable output pin polarity.

  5. Supports interrupt generation for various events.

  6. Includes two hardware fault input pins.

  7. Features a special event trigger for synchronizing analog-to-digital conversions.

Configuration#

The configurable parameters of Pulse Width Modulation include frequency, mode, timer counter, duty cycle, and output polarity. The APIs used to manage these parameters are:

  1. Set output polarity:sl_si91x_pwm_set_output_polarity

  2. Set time period and counter initial value:sl_si91x_pwm_set_time_period

  3. Set output mode:sl_si91x_pwm_set_output_mode

  4. Get time period:sl_si91x_pwm_get_time_period

  5. Select duty cycle for PWM:sl_si91x_pwm_set_duty_cycle

  6. Set base timer mode:sl_si91x_pwm_set_base_timer_mode

  7. Select number of base timers for four channels or one base timer for all channels:sl_si91x_pwm_control_base_timer

  • For more information on configuring available parameters, see the respective peripheral example readme document.

Usage#

The PWM driver generates a continuous ON/OFF digital signal with a 50% duty cycle at a frequency of 25 kHz, by default. Users can configure the duty cycle and frequency using the Universal Configurator (UC). Multiple instances of this component can be created as needed. By default, an instance of channel_0 is generated. The APIs used to set up PWM are:

  1. Initialize the PWM:sl_si91x_pwm_init

  2. Set configuration:sl_si91x_pwm_set_configuration

  3. Time period control:sl_si91x_pwm_control_period

  4. Duty cycle for PWM:sl_si91x_pwm_configure_duty_cycle

  5. Interrupt flags of PWM:sl_si91x_pwm_register_callback

  6. Start the PWM:sl_si91x_pwm_start

  7. Stop the PWM:sl_si91x_pwm_stop

  8. De-initialize the PWM:sl_si91x_pwm_deinit

Modules#

sl_pwm_version_t

sl_pwm_config_t

sl_pwm_init_t

sl_pwm_fault_init_t

Enumerations#

enum
SL_FAULTA
SL_FAULTB
SL_FAULT_LAST
}

Enum to control fault A and fault B.

enum
SL_DEAD_TIME_DISABLE
SL_DEAD_TIME_ENABLE
SL_DEAD_TIME_LAST
}

Enum to control dead time.

enum
SL_DUTY_CYCLE_DISABLE
SL_DUTY_CYCLE_ENABLE
SL_DUTY_CYCLE_LAST
}

Enum to control the duty cycle.

enum
SL_OVERRIDE_RESET
SL_OVERRIDE_SET
SL_OVERRIDE_LAST
}

Enum to control override.

enum
SL_OUTPUT_FAULT_RESET
SL_OUTPUT_FAULT_SET
SL_OUTPUT_FAULT_LAST
}

Enum to control output fault.

enum
SL_EVENT_DISABLE
SL_EVENT_ENABLE
SL_EVENT_LAST
}

Enum to control events.

enum
SL_CHANNEL_1
SL_CHANNEL_2
SL_CHANNEL_3
SL_CHANNEL_4
SL_CHANNEL_LAST
}

Enumeration for PWM channels (0-3).

enum
SL_BASE_TIMER_EACH_CHANNEL
SL_BASE_TIMER_ALL_CHANNEL
SL_BASE_TIMER_LAST
}

Enumeration for PWM timer.

enum
SL_POLARITYL_LOW
SL_POLARITYL_HIGH
SL_POLARITYL_LAST
}

Enumeration for PWM polarity low.

enum
SL_POLARITYH_LOW
SL_POLARITYH_HIGH
SL_POLARITYH_LAST
}

Enumeration for PWM polarity high.

enum
SL_MODE_INDEPENDENT
SL_MODE_COMPLEMENTARY
SL_MODE_LAST
}

Enumeration for PWM mode.

enum
SL_FREE_RUN_MODE = 0
SL_SINGLE_EVENT_MODE = 1
SL_DOWN_COUNT_MODE = 2
SL_UP_DOWN_MODE = 4
SL_UP_DOWN_DOUBLE_UPDATE = 5
SL_BASE_TIMER_MODE_LAST = 6
}

Enumeration for PWM base timer modes.

enum
SL_OUTPUT_LOW0
SL_OUTPUT_LOW1
SL_OUTPUT_LOW2
SL_OUTPUT_LOW3
SL_OUTPUT_HIGH0
SL_OUTPUT_HIGH1
SL_OUTPUT_HIGH2
SL_OUTPUT_HIGH3
SL_OUTPUT_LAST
}

Enumeration for PWM output complementary pairs.

enum
SL_SVT_COUNT_UP
SL_SVT_COUNT_DOWN
SL_SVT_COUNT_LAST
}

Enumeration for PWM special event trigger time base.

enum
SL_TIME_PERIOD_POSTSCALE_1_1
SL_TIME_PERIOD_POSTSCALE_1_2
SL_TIME_PERIOD_POSTSCALE_1_3
SL_TIME_PERIOD_POSTSCALE_1_4
SL_TIME_PERIOD_POSTSCALE_1_5
SL_TIME_PERIOD_POSTSCALE_1_6
SL_TIME_PERIOD_POSTSCALE_1_7
SL_TIME_PERIOD_POSTSCALE_1_8
SL_TIME_PERIOD_POSTSCALE_1_9
SL_TIME_PERIOD_POSTSCALE_1_10
SL_TIME_PERIOD_POSTSCALE_1_11
SL_TIME_PERIOD_POSTSCALE_1_12
SL_TIME_PERIOD_POSTSCALE_1_13
SL_TIME_PERIOD_POSTSCALE_1_14
SL_TIME_PERIOD_POSTSCALE_1_15
SL_TIME_PERIOD_POSTSCALE_1_16
SL_TIME_PERIOD_POSTSCALE_1_LAST
}

Enumeration for PWM time base output post scale bits.

enum
SL_TIME_PERIOD_PRESCALE_1
SL_TIME_PERIOD_PRESCALE_2
SL_TIME_PERIOD_PRESCALE_4
SL_TIME_PERIOD_PRESCALE_8
SL_TIME_PERIOD_PRESCALE_16
SL_TIME_PERIOD_PRESCALE_32
SL_TIME_PERIOD_PRESCALE_64
SL_TIME_PERIOD_PRESCALE_LAST
}

Enumeration for PWM input clock pre-scale select value.

enum
SL_VALUE_INACTIVE
SL_VALUE_ACTIVE
SL_VALUE_LAST
}

Enumeration for fault input override value.

enum
SL_OP_OVERRIDE_UNSYNC
SL_OP_OVERRIDE_SYNC
SL_OP_OVERRIDE_LAST
}

Enumeration for output override control.

enum
SL_OVERRIDE_VALUE0
SL_OVERRIDE_VALUE1
SL_OVERRIDE_VALUE_LAST
}

Enumeration for override value.

enum
SL_TRIGGER_DISABLE
SL_TRIGGER_ENABLE
SL_TRIGGER_LAST
}

PWM enable external triggering.

Typedefs#

typedef RSI_MCPWM_T

PWM structure.

typedef RSI_MCPWM_SVT_CONFIG_T

PWM Special Event trigger configuration parameters structure.

typedef RSI_MCPWM_DT_CONFIG_T

PWM DeadTime configuration parameters structure.

typedef RSI_MCPWM_CALLBACK_T

PWM Callback structure.

Functions#

void

To de-initialize the PWM peripheral.

To get the API version of the PWM module.

sl_status_t
sl_si91x_pwm_set_configuration(sl_pwm_config_t *pwm_config)

To set the PWM configuration parameters.

sl_status_t
sl_si91x_pwm_set_output_polarity(boolean_t polarity_low, boolean_t polarity_high)

To set output polarity for Motor Control Pulse Width Modulation (MCPWM).

sl_status_t
sl_si91x_pwm_start(sl_pwm_channel_t channel)

To start the Motor Control Pulse Width Modulation (MCPWM).

sl_status_t
sl_si91x_pwm_stop(sl_pwm_channel_t channel)

To stop the Motor Control Pulse Width Modulation (MCPWM) operation for the required channel.

sl_status_t
sl_si91x_pwm_control_base_timer(sl_pwm_timer_t base_timer)

To select the number of base timers for MCPWM.

sl_status_t
sl_si91x_pwm_set_time_period(sl_pwm_channel_t channel, uint32_t period, uint32_t init_val)

To set the time period and counter initial value for MCPWM.

sl_status_t
sl_si91x_pwm_trigger_special_event(sl_pwm_svt_t direction, sl_si91x_pwm_svt_config_t *pwm_config)

To configure the special event trigger generation for MCPWM.

sl_status_t
sl_si91x_pwm_configure_dead_time(sl_si91x_pwm_dt_config_t *dead_time, sl_pwm_channel_t channel)

To configure dead time insertion parameters for MCPWM.

sl_status_t
sl_si91x_pwm_reset_channel(sl_pwm_channel_t channel)

To reset the required channel of MCPWM.

sl_status_t
sl_si91x_pwm_reset_counter(sl_pwm_channel_t channel)

To reset the counter of the required channel of MCPWM.

sl_status_t
sl_si91x_pwm_control_period(sl_pwm_post_t post_scale, sl_pwm_pre_t pre_scale, sl_pwm_channel_t channel)

To set base time period control for MCPWM.

sl_status_t
sl_si91x_pwm_control_fault(sl_pwm_fault_t fault, sl_pwm_output_t pwm_output, sl_pwm_override_value_t value)

To control the fault A/B pin output value to be overridden when a fault condition occurs.

sl_status_t
sl_si91x_pwm_set_base_timer_mode(sl_pwm_base_timer_mode_t mode, sl_pwm_channel_t channel)

To set the mode of the base timer for the required channel.

sl_status_t
sl_si91x_pwm_set_output_mode(sl_pwm_mode_t mode, sl_pwm_channel_t channel)

To set the output mode for MCPWM.

sl_status_t
sl_si91x_pwm_register_callback(sl_si91x_pwm_callback_t *callback_event, uint16_t flag)

To handle all interrupt flags of MCPWM.

sl_status_t

To unregister the PWM event.

sl_status_t
sl_si91x_pwm_read_counter(uint16_t *counter_value, sl_pwm_channel_t channel)

To read the counter current value for the required MCPWM channel.

sl_status_t
sl_si91x_pwm_get_counter_direction(uint8_t *counter_direction, sl_pwm_channel_t channel)

To get the time period counter direction status of the required MCPWM channel.

sl_status_t
sl_si91x_pwm_control_dead_time(sl_pwm_dead_time_t dead_time, uint32_t flag)

To control dead time insertion at the rise edge or fall edge of any four channels.

sl_status_t
sl_si91x_pwm_get_interrupt_status(uint32_t flag, uint16_t *intr_status)

To get the interrupt status of interrupt flags of MCPWM.

sl_status_t
sl_si91x_pwm_configure_duty_cycle(sl_pwm_duty_cycle_t duty_cycle, uint32_t value, sl_pwm_channel_t channel)

To control duty cycle parameters for the required MCPWM.

sl_status_t
sl_si91x_pwm_output_override(sl_pwm_override_t override, sl_pwm_output_t pwm_output)

To control the output override operation of Motor Control Pulse Width Modulation (MCPWM).

sl_status_t
sl_si91x_pwm_control_override(sl_pwm_override_t override, sl_pwm_output_override_t value)

To control the override control parameter and synchronize output with PWM time period.

sl_status_t
sl_si91x_pwm_control_override_value(sl_pwm_override_t override, sl_pwm_output_t pwm_output, sl_pwm_override_value_t value)

To control the override value for the required output of MCPWM.

sl_status_t
sl_si91x_pwm_control_output_fault(sl_pwm_output_fault_t output_fault, uint32_t value)

To control output fault in the PWM module.

sl_status_t

To control the special event trigger.

sl_status_t
sl_si91x_pwm_select_dead_time(sl_pwm_dead_time_t dead_time, uint32_t value)

To control the dead time for the required channel.

sl_status_t
sl_si91x_pwm_set_duty_cycle(uint32_t duty_cycle, sl_pwm_channel_t channel)

To select the duty cycle for the required MCPWM channel.

sl_status_t
sl_si91x_pwm_get_duty_cycle(sl_pwm_channel_t channel, uint32_t *duty_cycle)

To get the duty cycle for the required MCPWM channel.

sl_status_t
sl_si91x_pwm_enable_external_trigger(sl_pwm_trigger_t enable)

To enable an external trigger for the MCPWM.

sl_status_t
sl_si91x_pwm_get_time_period(sl_pwm_channel_t channel, uint16_t *time_period)

To get the time period for the required MCPWM channel.

sl_status_t
sl_si91x_pwm_init(sl_pwm_init_t *pwm_init)

To initialize PWM pins and clock.

sl_status_t
sl_si91x_pwm_fault_init(sl_pwm_fault_init_t *pwm_fault)

To initialize PWM event pins.

sl_status_t
sl_si91x_pwm_reset_channel_disable(sl_pwm_channel_t channel)

To disable the reset for the required channel of MCPWM.

sl_status_t
sl_si91x_pwm_reset_counter_disable(sl_pwm_channel_t channel)

To disable the counter reset for the required channel of MCPWM.

Enumeration Documentation#

sl_pwm_fault_t#

sl_pwm_fault_t

Enum to control fault A and fault B.

This enumeration defines the possible fault conditions for the PWM module. It includes fault A and fault B, which can be used to handle specific fault scenarios.

Enumerator
SL_FAULTA

PWM fault A.

SL_FAULTB

PWM fault B.

SL_FAULT_LAST

Last member of the enum for validation purposes.


Definition at line 77 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_dead_time_t#

sl_pwm_dead_time_t

Enum to control dead time.

This enumeration defines the possible states for controlling the dead time in the PWM module. It includes options to enable or disable the dead time.

Enumerator
SL_DEAD_TIME_DISABLE

PWM dead time disable.

SL_DEAD_TIME_ENABLE

PWM dead time enable.

SL_DEAD_TIME_LAST

Last member of the enum for validation.


Definition at line 90 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_duty_cycle_t#

sl_pwm_duty_cycle_t

Enum to control the duty cycle.

This enumeration defines the possible states for controlling the duty cycle in the PWM module. It includes options to enable or disable the duty cycle.

Enumerator
SL_DUTY_CYCLE_DISABLE

PWM duty cycle disable.

SL_DUTY_CYCLE_ENABLE

PWM duty cycle enable.

SL_DUTY_CYCLE_LAST

Last member of the enum for validation.


Definition at line 103 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_override_t#

sl_pwm_override_t

Enum to control override.

This enumeration defines the possible states for controlling the override in the PWM module. It includes options to reset or set the override.

Enumerator
SL_OVERRIDE_RESET

PWM override reset.

SL_OVERRIDE_SET

PWM override set.

SL_OVERRIDE_LAST

Last member of the enum for validation.


Definition at line 116 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_output_fault_t#

sl_pwm_output_fault_t

Enum to control output fault.

This enumeration defines the possible states for controlling the output fault in the PWM module. It includes options to reset or set the output fault.

Enumerator
SL_OUTPUT_FAULT_RESET

PWM output fault reset.

SL_OUTPUT_FAULT_SET

PWM output fault set.

SL_OUTPUT_FAULT_LAST

Last member of the enum for validation.


Definition at line 129 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_event_t#

sl_pwm_event_t

Enum to control events.

This enumeration defines the possible states for controlling events in the PWM module. It includes options to enable or disable events.

Enumerator
SL_EVENT_DISABLE

PWM event disable.

SL_EVENT_ENABLE

PWM event enable.

SL_EVENT_LAST

Last member of the enum for validation.


Definition at line 142 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_channel_t#

sl_pwm_channel_t

Enumeration for PWM channels (0-3).

This enumeration defines the available PWM channels. It includes channels 0 through 3.

Enumerator
SL_CHANNEL_1

PWM channel 0.

SL_CHANNEL_2

PWM channel 1.

SL_CHANNEL_3

PWM channel 2.

SL_CHANNEL_4

PWM channel 3.

SL_CHANNEL_LAST

Last member of the enum for validation.


Definition at line 155 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_timer_t#

sl_pwm_timer_t

Enumeration for PWM timer.

This enumeration defines the possible timer configurations for the PWM module. It includes options for using a separate timer for each channel or a single timer for all channels.

Enumerator
SL_BASE_TIMER_EACH_CHANNEL

PWM timer for each channel.

SL_BASE_TIMER_ALL_CHANNEL

PWM timer for all channels.

SL_BASE_TIMER_LAST

Last member of the enum for validation.


Definition at line 170 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_polarity_low_t#

sl_pwm_polarity_low_t

Enumeration for PWM polarity low.

This enumeration defines the possible states for controlling the polarity of the low side in the PWM module. It includes options for setting the polarity to low or high.

Enumerator
SL_POLARITYL_LOW

PWM output polarity for low side (L0-L3) - low.

SL_POLARITYL_HIGH

PWM output polarity for low side (H0-H3) - high.

SL_POLARITYL_LAST

Last member of the enum for validation.


Definition at line 183 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_polarity_high_t#

sl_pwm_polarity_high_t

Enumeration for PWM polarity high.

This enumeration defines the possible states for controlling the polarity of the high side in the PWM module. It includes options for setting the polarity to low or high.

Enumerator
SL_POLARITYH_LOW

PWM output polarity for high side (L0-L3) - low.

SL_POLARITYH_HIGH

PWM output polarity for high side (H0-H3) - high.

SL_POLARITYH_LAST

Last member of the enum for validation.


Definition at line 196 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_mode_t#

sl_pwm_mode_t

Enumeration for PWM mode.

This enumeration defines the possible modes for the PWM module. It includes options for independent and complementary modes.

Enumerator
SL_MODE_INDEPENDENT

PWM independent mode.

SL_MODE_COMPLEMENTARY

PWM complementary mode.

SL_MODE_LAST

Last member of the enum for validation.


Definition at line 209 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_base_timer_mode_t#

sl_pwm_base_timer_mode_t

Enumeration for PWM base timer modes.

This enumeration defines the possible modes for the PWM base timer. It includes options for free run, single event, down count, up/down, and up/down double update modes.

Enumerator
SL_FREE_RUN_MODE

PWM free run mode.

SL_SINGLE_EVENT_MODE

PWM single event mode.

SL_DOWN_COUNT_MODE

PWM down count mode.

SL_UP_DOWN_MODE

PWM up/down mode.

SL_UP_DOWN_DOUBLE_UPDATE

PWM up/down double update mode.

SL_BASE_TIMER_MODE_LAST

Last member of the enum for validation.


Definition at line 222 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_output_t#

sl_pwm_output_t

Enumeration for PWM output complementary pairs.

This enumeration defines the possible PWM output pairs. It includes options for low and high outputs.

Enumerator
SL_OUTPUT_LOW0

PWM output L0.

SL_OUTPUT_LOW1

PWM output L1.

SL_OUTPUT_LOW2

PWM output L2.

SL_OUTPUT_LOW3

PWM output L3.

SL_OUTPUT_HIGH0

PWM output H0.

SL_OUTPUT_HIGH1

PWM output H1.

SL_OUTPUT_HIGH2

PWM output H2.

SL_OUTPUT_HIGH3

PWM output H3.

SL_OUTPUT_LAST

Last member of the enum for validation.


Definition at line 238 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_svt_t#

sl_pwm_svt_t

Enumeration for PWM special event trigger time base.

This enumeration defines the possible states for the special event trigger in the PWM module. It includes options for triggering when the time base is counting up or down.

Enumerator
SL_SVT_COUNT_UP

Special event trigger occurs when the time base is counting up.

SL_SVT_COUNT_DOWN

Special event trigger occurs when the time base is counting down.

SL_SVT_COUNT_LAST

Last member of the enum for validation.


Definition at line 257 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_post_t#

sl_pwm_post_t

Enumeration for PWM time base output post scale bits.

This enumeration defines the possible post scale values for the PWM time base output. It includes options ranging from 1:1 to 1:16 post scale.

Enumerator
SL_TIME_PERIOD_POSTSCALE_1_1

1:1 post scale

SL_TIME_PERIOD_POSTSCALE_1_2

1:2 post scale

SL_TIME_PERIOD_POSTSCALE_1_3

1:3 post scale

SL_TIME_PERIOD_POSTSCALE_1_4

1:4 post scale

SL_TIME_PERIOD_POSTSCALE_1_5

1:5 post scale

SL_TIME_PERIOD_POSTSCALE_1_6

1:6 post scale

SL_TIME_PERIOD_POSTSCALE_1_7

1:7 post scale

SL_TIME_PERIOD_POSTSCALE_1_8

1:8 post scale

SL_TIME_PERIOD_POSTSCALE_1_9

1:9 post scale

SL_TIME_PERIOD_POSTSCALE_1_10

1:10 post scale

SL_TIME_PERIOD_POSTSCALE_1_11

1:11 post scale

SL_TIME_PERIOD_POSTSCALE_1_12

1:12 post scale

SL_TIME_PERIOD_POSTSCALE_1_13

1:13 post scale

SL_TIME_PERIOD_POSTSCALE_1_14

1:14 post scale

SL_TIME_PERIOD_POSTSCALE_1_15

1:15 post scale

SL_TIME_PERIOD_POSTSCALE_1_16

1:16 post scale

SL_TIME_PERIOD_POSTSCALE_1_LAST

Last member of the enum for validation.


Definition at line 270 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_pre_t#

sl_pwm_pre_t

Enumeration for PWM input clock pre-scale select value.

This enumeration defines the possible pre-scale values for the PWM input clock. It includes options ranging from 1x to 64x input clock periods.

Enumerator
SL_TIME_PERIOD_PRESCALE_1

1x input clock period

SL_TIME_PERIOD_PRESCALE_2

2x input clock period

SL_TIME_PERIOD_PRESCALE_4

4x input clock period

SL_TIME_PERIOD_PRESCALE_8

8x input clock period

SL_TIME_PERIOD_PRESCALE_16

16x input clock period

SL_TIME_PERIOD_PRESCALE_32

32x input clock period

SL_TIME_PERIOD_PRESCALE_64

64x input clock period

SL_TIME_PERIOD_PRESCALE_LAST

Last member of the enum for validation.


Definition at line 297 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_fault_input_t#

sl_pwm_fault_input_t

Enumeration for fault input override value.

This enumeration defines the possible override values for the PWM output pin when an external fault input A/B event occurs.

Enumerator
SL_VALUE_INACTIVE

PWM output pin is driven inactive on an external fault input A/B event.

SL_VALUE_ACTIVE

PWM output pin is driven active on an external fault input A/B event.

SL_VALUE_LAST

Last member of the enum for validation.


Definition at line 315 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_output_override_t#

sl_pwm_output_override_t

Enumeration for output override control.

This enumeration defines the possible states for the output override control in the PWM module. It includes options for unsynchronized and synchronized output override, depending on the operating mode.

Enumerator
SL_OP_OVERRIDE_UNSYNC

No effect.

SL_OP_OVERRIDE_SYNC

Output override is in sync with the PWM time period, depending on the operating mode.

SL_OP_OVERRIDE_LAST

Last member of the enum for validation.


Definition at line 328 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_override_value_t#

sl_pwm_override_value_t

Enumeration for override value.

This enumeration defines the possible override values for the PWM module.

Enumerator
SL_OVERRIDE_VALUE0

Override value 0.

SL_OVERRIDE_VALUE1

Override value 1.

SL_OVERRIDE_VALUE_LAST

Last member of enum for validation.


Definition at line 340 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_pwm_trigger_t#

sl_pwm_trigger_t

PWM enable external triggering.

This enumeration defines the possible states for enabling or disabling external triggering in the PWM module. It includes options for disabling and enabling external triggering, as well as a last member for validation.

Enumerator
SL_TRIGGER_DISABLE

Disables external triggering.

SL_TRIGGER_ENABLE

Enables external triggering.

SL_TRIGGER_LAST

Last member of the enum for validation.


Definition at line 353 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

Typedef Documentation#

sl_si91x_mcpwm_t#

typedef RSI_MCPWM_T sl_si91x_mcpwm_t

PWM structure.


Definition at line 54 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_svt_config_t#

typedef RSI_MCPWM_SVT_CONFIG_T sl_si91x_pwm_svt_config_t

PWM Special Event trigger configuration parameters structure.


Definition at line 56 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_dt_config_t#

typedef RSI_MCPWM_DT_CONFIG_T sl_si91x_pwm_dt_config_t

PWM DeadTime configuration parameters structure.


Definition at line 57 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_callback_t#

typedef RSI_MCPWM_CALLBACK_T sl_si91x_pwm_callback_t

PWM Callback structure.


Definition at line 58 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

Function Documentation#

sl_si91x_pwm_deinit#

void sl_si91x_pwm_deinit (void )

To de-initialize the PWM peripheral.

Parameters
N/A

This API is used to de-initialize the PWM peripheral and disable the PWM module clock.


Definition at line 441 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_get_version#

sl_pwm_version_t sl_si91x_pwm_get_version (void )

To get the API version of the PWM module.

Parameters
N/A

This API retrieves the version information of the PWM module, which includes the release, SQA, and DEV version numbers.

Returns


Definition at line 452 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_configuration#

sl_status_t sl_si91x_pwm_set_configuration (sl_pwm_config_t * pwm_config)

To set the PWM configuration parameters.

Parameters
[in]pwm_config

Pointer to configuration parameters of type sl_pwm_config_t.

This API configures the output polarity and sets the time period, output mode, duty cycle, base timer mode, and base timer selection for each channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 473 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_output_polarity#

sl_status_t sl_si91x_pwm_set_output_polarity (boolean_t polarity_low, boolean_t polarity_high)

To set output polarity for Motor Control Pulse Width Modulation (MCPWM).

Parameters
[in]polarity_low

Output polarity for the low side (L3, L2, L1, L0).

[in]polarity_high

Output polarity for the high side (H3, H2, H1, H0).

Setting polarity to positive sets the digital pulse ON for the duty cycle and OFF for the remainder of the period. Setting polarity to negative is the vice-versa of positive polarity set.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 495 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_start#

sl_status_t sl_si91x_pwm_start (sl_pwm_channel_t channel)

To start the Motor Control Pulse Width Modulation (MCPWM).

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

Operation for the required channel is based on the duty cycle set, polarity, and all other configurations done for respective channels.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 520 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_stop#

sl_status_t sl_si91x_pwm_stop (sl_pwm_channel_t channel)

To stop the Motor Control Pulse Width Modulation (MCPWM) operation for the required channel.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to stop the Motor Control Pulse Width Modulation (MCPWM) operation for the required channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 545 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_base_timer#

sl_status_t sl_si91x_pwm_control_base_timer (sl_pwm_timer_t base_timer)

To select the number of base timers for MCPWM.

Parameters
[in]base_timer

PWM base timer of type sl_pwm_timer_t.

This API is used to select the number of base timers as four base timers for four channels or one base timer for all channels of Motor Control Pulse Width Modulation (MCPWM). One base timer is used when a single timer is to be selected for all channels. Instead of only one base timer, there is also one base timer for each channel selection, where separate base timers are used for separate channels.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 570 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_time_period#

sl_status_t sl_si91x_pwm_set_time_period (sl_pwm_channel_t channel, uint32_t period, uint32_t init_val)

To set the time period and counter initial value for MCPWM.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

[in]period

Time period value in the range of 0 - 65535.

[in]init_val

Update the base time counter initial value, in the range of 0 - 65535.

This API is used to set the time period and counter initial value for the required Motor Control Pulse Width Modulation (MCPWM) channel. It updates the base timer period and base timer counter initial values for the required channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 595 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_trigger_special_event#

sl_status_t sl_si91x_pwm_trigger_special_event (sl_pwm_svt_t direction, sl_si91x_pwm_svt_config_t * pwm_config)

To configure the special event trigger generation for MCPWM.

Parameters
[in]direction

Special event trigger for time base direction of type sl_pwm_svt_t.

[in]pwm_config

Pointer to the structure of type sl_si91x_pwm_svt_config_t.

This API is used to configure special event trigger generation for the required Motor Control Pulse Width Modulation (MCPWM) channel, which allows the A/D converter to be synchronized to the PWM time base.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 621 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_configure_dead_time#

sl_status_t sl_si91x_pwm_configure_dead_time (sl_si91x_pwm_dt_config_t * dead_time, sl_pwm_channel_t channel)

To configure dead time insertion parameters for MCPWM.

Parameters
[in]dead_time

Pointer to the structure of type sl_si91x_pwm_dt_config_t.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to configure dead time insertion parameters for Motor Control Pulse Width Modulation (MCPWM). Dead time is a small amount of time inserted between the switching edges of PWM signals.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 647 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_reset_channel#

sl_status_t sl_si91x_pwm_reset_channel (sl_pwm_channel_t channel)

To reset the required channel of MCPWM.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

The API is used to reset the required channel of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 671 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_reset_counter#

sl_status_t sl_si91x_pwm_reset_counter (sl_pwm_channel_t channel)

To reset the counter of the required channel of MCPWM.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to reset the counter of the required channel of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 695 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_period#

sl_status_t sl_si91x_pwm_control_period (sl_pwm_post_t post_scale, sl_pwm_pre_t pre_scale, sl_pwm_channel_t channel)

To set base time period control for MCPWM.

Parameters
[in]post_scale

Time base output post scale bits of type sl_pwm_post_t.

[in]pre_scale

Base timer input clock pre scale select value of type sl_pwm_pre_t.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

The API is used to set base time period control for the required Motor Control Pulse Width Modulation (MCPWM) channel. This sets the base timer output post scalar bits and base timer input clock prescalar value.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 720 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_fault#

sl_status_t sl_si91x_pwm_control_fault (sl_pwm_fault_t fault, sl_pwm_output_t pwm_output, sl_pwm_override_value_t value)

To control the fault A/B pin output value to be overridden when a fault condition occurs.

Parameters
[in]fault

Enum of type sl_pwm_fault_t.

[in]pwm_output

Enum of type sl_pwm_output_t.

[in]value

Fault input A/B PWM output override value of type sl_pwm_override_value_t.

The API is used to control the output value of the Fault A/B pins to override their default behavior when a fault condition occurs. When asserted, these pins can optionally drive each PWM I/O pin to a specified state.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 747 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_base_timer_mode#

sl_status_t sl_si91x_pwm_set_base_timer_mode (sl_pwm_base_timer_mode_t mode, sl_pwm_channel_t channel)

To set the mode of the base timer for the required channel.

Parameters
[in]mode

Base timer operating mode of type sl_pwm_base_timer_mode_t.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to set the mode of the base timer for the specified channel. It supports various modes, such as free-running mode, single-event mode, down count mode, up/down mode, and up/down mode with interrupts for double PWM updates.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 771 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_output_mode#

sl_status_t sl_si91x_pwm_set_output_mode (sl_pwm_mode_t mode, sl_pwm_channel_t channel)

To set the output mode for MCPWM.

Parameters
[in]mode

PWM output mode of type sl_pwm_mode_t.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to set the output mode for the Motor Control Pulse Width Modulation (MCPWM). There are two modes that can be configured: independent mode or complementary mode.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 794 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_register_callback#

sl_status_t sl_si91x_pwm_register_callback (sl_si91x_pwm_callback_t * callback_event, uint16_t flag)

To handle all interrupt flags of MCPWM.

Parameters
[in]callback_event

Structure of type sl_si91x_pwm_callback_t.

[in]flag

It is the logical OR of different interrupts generated on multiple channels (in the range of 0 - 65535).

This API is used to handle all interrupt flags of Motor Control Pulse Width Modulation (MCPWM). It manages the IRQ handler, timer interrupt, and callback events for different events.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 818 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_unregister_callback#

sl_status_t sl_si91x_pwm_unregister_callback (uint16_t flag)

To unregister the PWM event.

Parameters
[in]flag

It is the logical OR of different interrupts generated on multiple channels (in the range of 0 - 65535).

This API is used to unregister the PWM event, disabling the callback for the specified interrupt flags.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 842 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_read_counter#

sl_status_t sl_si91x_pwm_read_counter (uint16_t * counter_value, sl_pwm_channel_t channel)

To read the counter current value for the required MCPWM channel.

Parameters
[out]counter_value

Pointer to store the counter value.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to read the counter current value for the required Motor Control Pulse Width Modulation (MCPWM) channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 868 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_get_counter_direction#

sl_status_t sl_si91x_pwm_get_counter_direction (uint8_t * counter_direction, sl_pwm_channel_t channel)

To get the time period counter direction status of the required MCPWM channel.

Parameters
[out]counter_direction

Pointer to the counter direction (up/down) of type uint8_t.

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to get the time period counter direction status of the required Motor Control Pulse Width Modulation (MCPWM) channel, indicating whether the counter is counting up or down.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 895 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_dead_time#

sl_status_t sl_si91x_pwm_control_dead_time (sl_pwm_dead_time_t dead_time, uint32_t flag)

To control dead time insertion at the rise edge or fall edge of any four channels.

Parameters
[in]dead_time

Enum of type sl_pwm_dead_time_t.

[in]flag

ORing of the following values (in the range of 0 - 65535):

  • DT_EN_CH0

  • DT_EN_CH1

  • DT_EN_CH2

  • DT_EN_CH3

This API is used to control dead time insertion at the rise edge or fall edge of any four channels. Dead time applies only to PWM output pairs that are in complementary mode.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 923 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_get_interrupt_status#

sl_status_t sl_si91x_pwm_get_interrupt_status (uint32_t flag, uint16_t * intr_status)

To get the interrupt status of interrupt flags of MCPWM.

Parameters
[in]flag

Flag value (0 - 65535).

[out]intr_status

Pointer to interrupt status.

The API is used to get the interrupt status of interrupt flags of Motor Control Pulse Width Modulation (MCPWM). Events which are raised can be identified by checking the status.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 978 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_configure_duty_cycle#

sl_status_t sl_si91x_pwm_configure_duty_cycle (sl_pwm_duty_cycle_t duty_cycle, uint32_t value, sl_pwm_channel_t channel)

To control duty cycle parameters for the required MCPWM.

Parameters
[in]duty_cycle

Enum of type sl_pwm_duty_cycle_t.

[in]value

This can be a logical OR of the following parameters (Range 0 - 127):

  • IMDT_DUTYCYCLE_UPDATE_EN: Enable to update the duty cycle immediately

  • DUTYCYCLE_UPDATE_DISABLE: Duty cycle register updation disable

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API controls the duty cycle (0% to 100% and vice versa) parameters by enabling or disabling the specified channel for the required Motor Control Pulse Width Modulation (MCPWM) channel. It can also enable (or prevent) duty cycle updating.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1005 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_output_override#

sl_status_t sl_si91x_pwm_output_override (sl_pwm_override_t override, sl_pwm_output_t pwm_output)

To control the output override operation of Motor Control Pulse Width Modulation (MCPWM).

Parameters
[in]override

Enum of type sl_pwm_override_t.

[in]pwm_output

PWM output override of type sl_pwm_output_t.

This API is used to control MCPWM's output override operation. It enables you to enable or disable PWM output override.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1029 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_override#

sl_status_t sl_si91x_pwm_control_override (sl_pwm_override_t override, sl_pwm_output_override_t value)

To control the override control parameter and synchronize output with PWM time period.

Parameters
[in]override

Enum of type sl_pwm_override_t.

[in]value

Output override to be in sync with PWM time period of type sl_pwm_output_override_t.

This API is used for controlling the override control parameters and synchronizing the output with the PWM time period, depending on the operating mode.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1053 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_override_value#

sl_status_t sl_si91x_pwm_control_override_value (sl_pwm_override_t override, sl_pwm_output_t pwm_output, sl_pwm_override_value_t value)

To control the override value for the required output of MCPWM.

Parameters
[in]override

Enum of type sl_pwm_override_t.

[in]pwm_output

PWM output override of type sl_pwm_output_t.

[in]value

Override value of type sl_pwm_override_value_t.

This API is used to control the override value for the required output of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1077 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_output_fault#

sl_status_t sl_si91x_pwm_control_output_fault (sl_pwm_output_fault_t output_fault, uint32_t value)

To control output fault in the PWM module.

Parameters
[in]output_fault

Enum of type sl_pwm_output_fault_t.

[in]value

This can be a logical OR of the below parameters (in the range of 0 - 65535):

  • FLT_A_MODE: If bit is one, use cycle-by-cycle mode. If bit is zero, use latched mode.

  • FLT_B_MODE: if bit is one, use cycle-by-cycle mode. If bit is zero, use latched mode.

  • OP_POLARITY_H: Output polarity for high (H3, H2, H1, H0) side signals. If bit is 0, use active low mode. If bit is 1, use active high mode.

  • OP_POLARITY_L: Output polarity for low (L3, L2, L1, L0) side signals. If bit is 0, use active low mode. If bit is 1, use active high mode.

  • FLT_A_ENABLE: Enable fault A.

  • FLT_B_ENABLE: Enable fault B.

  • COMPLEMENT_MODE: PWM I/O pair mode. If the bit is 1, the PWM I/O pin pair is in the complementary output mode. If the bit is 0, the PWM I/O pin pair is in the independent output mode.

This API is used to control output fault in PWM override control parameters for the required PWM output.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1115 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_control_special_event_trigger#

sl_status_t sl_si91x_pwm_control_special_event_trigger (sl_pwm_event_t event)

To control the special event trigger.

Parameters
[in]event

Enum of type sl_pwm_event_t.

This API controls the generation of a special event trigger for the required channel of the Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1137 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_select_dead_time#

sl_status_t sl_si91x_pwm_select_dead_time (sl_pwm_dead_time_t dead_time, uint32_t value)

To control the dead time for the required channel.

Parameters
[in]dead_time

Enum of type sl_pwm_dead_time_t.

[in]value

This can be a logical OR of the below parameters (in the range of 0 - 4095):

  • DEADTIME_SELECT_ACTIVE: Deadtime select bits for PWM going active. Possible values are as follows: If bit is zero, use counter A. If bit is one, use counter B.

  • DEADTIME_SELECT_INACTIVE: Deadtime select bits for PWM going inactive. Possible values are as follows: If bit is zero, use counter A. If bit is 1, use counter B.

This API is used to control dead time parameters for the required channel of the Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1163 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_set_duty_cycle#

sl_status_t sl_si91x_pwm_set_duty_cycle (uint32_t duty_cycle, sl_pwm_channel_t channel)

To select the duty cycle for the required MCPWM channel.

Parameters
[in]duty_cycle

Duty cycle value (0 - 65535).

[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to select the duty cycle for the required Motor Control Pulse Width Modulation (MCPWM) channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1185 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_get_duty_cycle#

sl_status_t sl_si91x_pwm_get_duty_cycle (sl_pwm_channel_t channel, uint32_t * duty_cycle)

To get the duty cycle for the required MCPWM channel.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

[out]duty_cycle

Pointer to the duty cycle value.

This API is used to get the duty cycle for the required Motor Control Pulse Width Modulation (MCPWM) channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1207 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_enable_external_trigger#

sl_status_t sl_si91x_pwm_enable_external_trigger (sl_pwm_trigger_t enable)

To enable an external trigger for the MCPWM.

Parameters
[in]enable

Controlling external trigger of type sl_pwm_trigger_t.

This API is used to enable the use of an external trigger for the base time counter increment or decrement of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1230 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_get_time_period#

sl_status_t sl_si91x_pwm_get_time_period (sl_pwm_channel_t channel, uint16_t * time_period)

To get the time period for the required MCPWM channel.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

[out]time_period

Pointer to read the time period.

This API is used to get the time period for the required Motor Control Pulse Width Modulation (MCPWM) channel.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1252 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_init#

sl_status_t sl_si91x_pwm_init (sl_pwm_init_t * pwm_init)

To initialize PWM pins and clock.

Parameters
[in]pwm_init

Pointer to the structure of type sl_pwm_init_t.

This API initializes the PWM pins and clock for the Motor Control Pulse Width Modulation (MCPWM) module.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1268 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_fault_init#

sl_status_t sl_si91x_pwm_fault_init (sl_pwm_fault_init_t * pwm_fault)

To initialize PWM event pins.

Parameters
[in]pwm_fault

Pointer to the structure of type sl_pwm_fault_init_t.

This API initializes the PWM event pins for the Motor Control Pulse Width Modulation (MCPWM) module.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1284 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_reset_channel_disable#

sl_status_t sl_si91x_pwm_reset_channel_disable (sl_pwm_channel_t channel)

To disable the reset for the required channel of MCPWM.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to disable the reset for the required channel of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1308 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h

sl_si91x_pwm_reset_counter_disable#

sl_status_t sl_si91x_pwm_reset_counter_disable (sl_pwm_channel_t channel)

To disable the counter reset for the required channel of MCPWM.

Parameters
[in]channel

Channel number (0 to 3) of type sl_pwm_channel_t.

This API is used to disable the counter reset for the required channel of Motor Control Pulse Width Modulation (MCPWM).

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - The parameter is an invalid argument.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 1332 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_pwm.h