Skip to main content
thannara123
Associate III
October 28, 2023
Solved

4 cahannel PWM making (2 ch + complimentory )

  • October 28, 2023
  • 3 replies
  • 1893 views

Hai ,

am trying to make a pwm signal to drive an H bridge driver  ,My board is Nucleo-F070RB

I am using the following function 

HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start_IT(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start_IT(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start_IT(&htim1, TIM_CHANNEL_2);

 

But not getting any wave  

This topic has been closed for replies.
Best answer by waclawek.jan
 htim1.Init.Period = 40;
[...]
 sConfigOC.Pulse = 222;
[...]
 sConfigOC.Pulse = 123;
[...]

If TIMx_CCRx > TIMx_ARR, you won't see any pulses.

Generally, whatever the problem is, start with reading out and checking/posting relevant TIM and GPIO registers content.

JW

3 replies

waclawek.jan
waclawek.janBest answer
Super User
October 28, 2023
 htim1.Init.Period = 40;
[...]
 sConfigOC.Pulse = 222;
[...]
 sConfigOC.Pulse = 123;
[...]

If TIMx_CCRx > TIMx_ARR, you won't see any pulses.

Generally, whatever the problem is, start with reading out and checking/posting relevant TIM and GPIO registers content.

JW

thannara123
Associate III
October 28, 2023

Thankyou Very much .

I am using channel pin as folows

PA7 TIM1_CH1N
PA8 TIM1_CH1
PA9 TIM1_CH2
PB0 TIM1_CH2N

 

But not getting signal on PB0 TIM1_CH2N.

__HAL_RCC_GPIOB_CLK_ENABLE(); clock is already enabled 

 

 

waclawek.jan
Super User
October 28, 2023

What hardware is this, a "known good" board like Nucleo or Disco, or your own? Make sure you are measuring the signal on PB0, i.e. if this is your board, that there is no bad solder joint or short on this pin. You can test it by setting it to GPIO output and toggling "manually" (like blinking a LED).

And, if this won't help, read out and check/post the GPIOB and TIM registers content.

JW