Skip to main content
Associate
April 15, 2025
Question

I want to generate a pwm pulses for up down mode

  • April 15, 2025
  • 2 replies
  • 528 views

Hi everyone

 

I am new to STM32CubeIDE and I'm trying to generate PWM pulses with a fixed duty cycle and frequency using the up-down counting mode. However, I couldn't find an option in the Timer configuration to specify the output action based on whether the counter is counting up or down. The available options seem to work only for up-count or down-count modes, but not for up-down mode. I’ve attached an image showing the current configuration. Could you please help me resolve this issue?Screenshot 2025-04-15 125720.png

 

Thankyou in advance

2 replies

ST Employee
April 15, 2025

Hello,

what microcontroller are you using?

Associate
April 15, 2025

NUCLEO-G474RE

ST Employee
April 15, 2025

I have configured TIM2 to generate PWM on LED pin with frequency 1 Hz and 50%duty cycle. In CubeMX it looks like this (timer clock is 16 MHz in my MCU) where I chose Center aligned mode 2 and other setting are the same as for up or down counter mode:

Screenshot (17).png

Associate
April 15, 2025

Thank you for your response

 

I want to generate PWM pulses in up down count mode used to generate a triangular carrier.