0
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_2);
TIM3->CCR1 =25000;

enter image description here

I'm trying to set 2 pins to the same PWM signal at the same time. However, it doesn't work. Only 1 pin (channel 1) has PWM output and the 2nd pin (channe 2) has empty output.

glts
  • 21,808
  • 12
  • 73
  • 94
Nick Sun
  • 11
  • 1
  • 1

2 Answers2

4

Every channel has its own register CCR

You only set one, the second one has the default value - 0 - and the duty ratio of the generated PWM signal is zero or 100% depending on the other registers settings.

add:

TIM3->CCR2 = /*your value here*/;

and it should work

0___________
  • 60,014
  • 4
  • 34
  • 74
0

try with these commands
__HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_1, value); __HAL_TIM_SET_COMPARE(&htim3, TIM_CHANNEL_2, value);