Skip to main content
Laurie1
Associate II
July 28, 2021
Solved

A Mistake Found in HAL Library

  • July 28, 2021
  • 3 replies
  • 1465 views

Function "PWM Generation CH2N" can not work, channel CH2N don't output PWM signal. But after I changed "tmpccer &= ~TIM_CCER_CC2NE;" to "tmpccer |= TIM_CCER_CC2NE;" (in file stm32h7xx_hal_tim.c), it works well.

Hoping developers of HAL library will fix this mistake soon.

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

The complementary timer channels are started with HAL_TIMEx_PWMN_Start. No bug here.

3 replies

TDK
TDKBest answer
Super User
July 28, 2021

The complementary timer channels are started with HAL_TIMEx_PWMN_Start. No bug here.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Laurie1
Laurie1Author
Associate II
July 28, 2021

Thank you very much! I found that founction in file "stm32h7xx_hal_tim_ex.h" and solve my problem :)

Laurie1
Laurie1Author
Associate II
July 28, 2021

I called "HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);", did you mean that?

Could you please tell me which chip do you use? Thank you.

TDK
Super User
July 28, 2021

Nope, I mean HAL_TIMEx_PWMN_Start.

https://github.com/STMicroelectronics/STM32CubeH7/blob/ccb11556044540590ca6e45056e6b65cdca2deb2/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c#L1074

To start channel 2N:

HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);

I use many different chips.

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