cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051C8 TIMER1 PWM NOT WORKING?

shose
Associate II

HI

stm32f051 config with stmcubemx

but, timer1 and timer2 and timer3and16and17 not working for pwm generation

only timer15 good work

why????

11 REPLIES 11

You enable only the "inverted" of the complementary channels (TIMx_CHyN), look up the CCER register's description in RM:

0690X00000DXUgPQAX.jpg

TIM2 and TIM3 don't have complementary channels, that's why CCER there is completely zero.

However, in the GPIO AF, you have chosen the "direct" channels (without N at the end) - in all timers, except TIM15 - which you say does work.

0690X00000DXUgUQAX.jpg

You enable the "inverted" channels probably using HAL_TIMEx_PWMN_Start(); functions. You have to find some Cube/HAL function, probably similarly sounding, which enables the "direct" channel. I don't use Cube/HAL.

JW

shose
Associate II

HI

Thank you all

especially JW

The problem was solved

HAL_TIMEx_PWMN_Start() function is false

HAL_TIM_PWM_Start() function is true