PWM

TIM PWM GENERATION BLOCK

This block supports PWM signal generation by Timer peripheral on STM microcontrollers.

Contents

Inputs

  • CHx [%] – duty of the PWM signal on channel x to be generated
  • Period [sec] – period of the PWM signals

Outputs

None

Block parameters

  • Timer – number of timer peripheral
  • Timer clock (MHz) – timer base clock
  • Prescaler – timer clock prescale (timer clock is base/prescaler)
  • PWM Period (sec) – period of the PWM signals to be generated
  • Enable channel: Channel x – options for timer output channels activation (disabled/positive polarity/negative polarity/both polarity)

CubeMX settings

  • Timers->TIMx->Clock Source->Internal clock
  • Timers->TIMx->NVIC Settings Tab->TIMx global interrupt/TIMx update interrupt
  • Timers->TIMx->Channelx->PWM Generation y for enabled channels where y is chosen mode (CHx/CHxN/CHx CHxN)