Skip to Content
Block descriptionsTIMTIM PWM Generation

TIM PWM Generation Block Description

This block enables PWM signal generation using timers in STM microcontrollers.



TIM PWM Generation block

Table of Contents

Inputs

Input NameTypeDescription
CH* [%]uint8The duty cycle percentage of the PWM signal for the given channel. The value must be within the range of 0 to 100, where 0 represents no signal output and 100 represents full PWM signal duty cycle.
Period [sec]uint16Conditional input
The PWM signal period value in microseconds. The availability of this input port depends on the Enable input period parameter.

CH* [%] – PWM channel inputs, where * denotes the specific channel number (e.g., CH1 [%], CH2 [%], etc.).

Outputs

This block has no outputs.

Block Parameters

ParameterDescription
TimerThe timer number designated to generate hardware interrupts.
Timer clock (MHz)The core operational frequency of the timer clock in MHz.
PrescalerThe hardware prescaler value for the timer.
Enable input periodEnables an input port that allows dynamically setting the PWM signal period.
PWM Period (sec)Conditional Parameter
The fixed period value for the timer counter. This parameter is only accessible when the Enable input period option is disabled.
Show timer counterConditional Parameter
Displays comprehensive internal details of the timer counter registers. This parameter is only accessible when the Enable input period option is disabled.
Enable channelConfigures the operational mode for individual PWM channels:
Disable – channel is turned off.
CH* – channel is enabled with standard/positive polarity.
CH*N – channel is enabled with complementary/negative polarity.
CH* CH*N – channel is enabled with both standard and complementary outputs active.


TIM PWM parameters info



TIM PWM parameters

CubeMX Configuration for a Given MCU Model

No.NamePathSettingDescriptionScreenshot
1Clock SourcePinout & Configuration > TIM* > Mode > Clock SourceInternal ClockSelects the active operational clock source for the timer.CubeMX clock source
2Global interrupt / Update interruptPinout & Configuration > TIM* > NVIC Settings > Global interrupt / Update interruptEnabledEnables hardware interrupts for the timer. Depending on the timer type, a Global or Update interrupt channel is available; one of these options must be enabled.CubeMX global interrupt
CubeMX update interrupt
3Channel* ConfigurationPinout & Configuration > TIM* > Mode > Channel*CH*
CH*N
CH* CH*N
Selects the generation method of the PWM signal for the specific channel. This setting must explicitly match the selection made in the Enable channel block parameter.CubeMX channel configuration

CH* – the PWM channel identifier where * denotes the channel index number (e.g., CH1, CH2, etc.).

See Also

Last updated on