cancel
Showing results for 
Search instead for 
Did you mean: 

Can't generate PWM with CH1 for TIM2 on STM32L0

Gz
Senior

Dear ST;

I can't generate PWM with CH1 for TIM2 on STM32L0 but I can generate PWM with CH3 for TIM2 on STM32L0.

3 REPLIES 3
Houssem CHAABANI
Senior II

Hi @Gz​ ,

You can generate PWM with CH1 for TIM2 by select PWM Generation CH1 under Timers -> TIM2.

0693W000006HA7yQAG.pngHope that this help you!

Hi @Houssem CHAABANI​ ;

I found problem. I generate PWM CH1 to compare with PWM CH3.

    PWM Channel 1
    */
    GPIO_InitStruct.Pin = GPIO_PIN_0;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
    PWM Channel 3
    */
    GPIO_InitStruct.Pin = GPIO_PIN_1;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    GPIO_InitStruct.Alternate = GPIO_AF2_TIM2;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

The PWM Channel 1 not included " GPIO_InitStruct.Alternate = GPIO_AF2_TIM2;"

Thank you,

Best regards.

Hi @Gz​ ,

Thank you for your feedback.

This was reported internally and it will be fixed as soon as possible.

In meanwhile you can add the missing configuration manually in your code.

Thanks!