cancel
Showing results for 
Search instead for 
Did you mean: 

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

GS1
Senior III

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

1 ACCEPTED SOLUTION

Accepted Solutions

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".

View solution in original post

4 REPLIES 4
TDK
Guru

> 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
Senior III

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.

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".
GS1
Senior III

Ahhh - I did not know that there is a separate function available!

Thank you for this hint! I will try right away.