Skip to main content
GS1
Senior III
July 25, 2021
Solved

STM32CubeMX (V. 6.3.0.) doesn't create code for PWM output on CH3N of Timer1 or 8

  • July 25, 2021
  • 1 reply
  • 1689 views

I have a project which uses CH3N of Timer 1 (not CH3) and activated it as PWM. In Cube everything seems to be activated correctly.

When looking on the output signal, nothing is output unless I activate the CH3N output by Keil debugger or via code as follows:

// To activate PWM on CH3N: Set Register: TIM1_CCER  Bit CC3NE = 1;

   uint32_t tmpccer;

   /* Get the TIMx CCER register value */

   tmpccer = TIM1->CCER;

   tmpccer |= TIM_CCER_CC3NE;

   TIM1->CCER = tmpccer;

There is no parameter option to enable CH3N. Only CH3 is available.

BR

GS

This topic has been closed for replies.
Best answer by TDK

For the complementary channels, you use HAL_TIMEx_PWMN_Start instead of HAL_TIM_PWM_Start.

1 reply

TDK
July 25, 2021

> There is no parameter option to enable CH3N. Only CH3 is available.

What do you mean by this? HAL_TIMEx_PWMN_Start takes channel 3 as a parameter.

"If you feel a post has answered your question, please click ""Accept as Solution""."
GS1
GS1Author
Senior III
July 26, 2021

On STM32H74A3 there is Channel 3 and alternatively 3N available. But there is only a parameter TIM_CHANNEL_3 and not TIM_CHANNEL_3N available for HAL_TIM_PWM_Start. Therefore I had to implement the start (enable) for Channel 3N manually.

This was only a hint for the developers of CubeMX that there is a missing gap. I could finally solve the problem as described.

TDK
TDKBest answer
July 26, 2021

For the complementary channels, you use HAL_TIMEx_PWMN_Start instead of HAL_TIM_PWM_Start.

"If you feel a post has answered your question, please click ""Accept as Solution""."