Skip to main content
Laurie1
Associate II
Jul 28, 2021 12:36 PM UTC
Solved

A Mistake Found in HAL Library

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.
TDK
TDKBest answer
Jul 28, 2021 1:26 PM UTC

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

4 replies

TDK
TDKBest answer
Jul 28, 2021 1:26 PM UTC

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
Jul 28, 2021 1:52 PM UTC

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

Laurie1
Laurie1Author
Associate II
Jul 28, 2021 1:41 PM UTC

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
Jul 28, 2021 1:52 PM UTC

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