Main Content

PWM

Generate pulse width modulated waveforms

Since R2022b

  • PWM block

Libraries:
SoC Blockset Support Package for Infineon AURIX Microcontrollers / AURIX TC4x

Description

The block input controls the duty cycle of the square waveform for the corresponding channel. An input value of 0 produces a 0 percent duty cycle and an input value of 100 produces a 100 percent duty cycle. It accepts N x 1 values of duty cycles corresponding to the N channels selected.

Ports

Input

expand all

The value sent to the block input determines the duty cycle of the square wave that the board outputs on the specified PWM pin specified in PWM Peripheral Configuration.

Data Types: Float

The freq port determines the frequency of PWM signal for the selected channels. When you enable the frequency port, the port accepts a scalar input value and sets it as the frequency of the timer unit.

Dependencies

To enable this port, select the Enable frequency input parameter.

The phase port accepts an input value in the range of 0 to 2pi and sets the phase for the corresponding channel. It accepts N x 1 values corresponding to the N channels selected.

Dependencies

To enable this port, select the Enable phase input parameter.

Data Types: single | double

The dtm_rise port accepts the rising dead time values in seconds. The timer unit selected in the PWM peripheral app should have DTM sub module for this feature. It accepts N x 1 values corresponding to the N channels selected.

Dependencies

To enable this port, select the Enable dead time properties input parameter.

Data Types: Float | int8 | uint8 | int16 | uint16 | int32 | uint32

The dtm_fall port accepts the falling dead time values in seconds. The timer unit selected in the PWM peripheral app should have DTM sub module for this feature. It accepts N x 1 values corresponding to the N channels selected.

Dependencies

To enable this port, select the Enable dead time properties input parameter.

Data Types: Float | int8 | uint8 | int16 | uint16 | int32 | uint32

Output

expand all

The block outputs the status of the PWM module as one of these values:

  • 255—Unknown state

  • 0— Initialized

  • 1— Running

  • 2— Stopped

  • 3— Error

Dependencies

To view this port, select the Enable status output parameter.

Data Types: uint8

The port outputs the PWM bus object in the SoC Blockset™ simulation message format during simulation. The PWM bus object contains the information received by the block at the input ports.

Dependencies

To view this port, select the Enable simulation port parameter and set the port type to SoC Data (Message based).

The port outputs the PWM bus object during simulation. The PWM bus object contains the information received by the block at the input ports.

Dependencies

To view this port, select the Enable simulation port parameter and set the port type to Signal.

Parameters

expand all

Basic

Select this parameter to set the PWM frequency.

When you select the Enable frequency input parameter, the block configures an input port, freq.

Select this parameter to set the phase of selected channel.

When you select the Enable phase input parameter, the block configures an input port, phase.

When you select the Enable status output parameter, the block configures Status output port.

Select this parameter to enable peripheral simulation capability.

Note

If you do not have a SoC Blockset license, the Enable simulation port parameter is visible but you cannot enable it.

Select this parameter to configure either the SoC Blockset compatible or the Simulink® signal based simulation ports to enable peripheral simulation capability.

Dependencies

To view this parameter, select the Enable simulation port parameter.

Advanced

Select the required number of PWM channels to send the duty cycles. The number of channels determines the size of the input ports phase, dtm_rise, and dtm_fall.

The number of channels selected depends on the timer module selection in PWM peripheral configuration app.

  • TOM—16 channels are available

  • ATOM—8 channels are available

Select this parameter to determine the PWM dead time value in seconds.

For more information on dead time module, see Dead-Time Module Properties.

Note

Enabling the dead time properties parameter in the block configures the dtm_rise and dtm_fall input ports. To use the dead time functionality, go to PWM Peripheral Configuration in the Hardware Mapping window and configure the corresponding dead time parameters in Module and Channel tabs.

Version History

Introduced in R2022b