STM32F407VGT6 PWM input does not work

Make it to the Right and Larger Audience

STM32F407VGT6 PWM input does not work
1 Voices |1 Posts |300+ | Discussion Rooom: ARM

This topic contains 0 replies, has 1 voice, and was last updated by 4 years, 5 months ago.

  • Author
    Senior Engineer

    TIM3_CH3(PB0) is PWM output and it works fine
    TIM3_CH1(PB4) is PWM input and it doesn’t work


    Here is configuration.

    GPIO_InitTypeDef GPIO_InitStructure;
    TIM_ICInitTypeDef  TIM_ICInitStructure;
    RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOB, ENABLE);
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
    GPIO_Init(GPIOB, &GPIO_InitStructure);

    TIM_ICInitStructure.TIM_Channel = TIM_Channel_1;     
    TIM_ICInitStructure.TIM_ICPolarity =TIM_ICPolarity_Rising;
    TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
    TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
      TIM_ICInitStructure.TIM_ICFilter = 0x0;
      TIM_PWMIConfig(TIM3, &TIM_ICInitStructure);
      TIM_SelectInputTrigger(TIM3, TIM_TS_TI1FP1);
      TIM_SelectSlaveMode(TIM3, TIM_SlaveMode_Reset);
      TIM_SelectMasterSlaveMode(TIM3, TIM_MasterSlaveMode_Enable);
      TIM_Cmd(TIM3, ENABLE);

    Only CCR2 contains correct PWM pulse width and CCR1 PWM pulse width is always zero.

    Any idea?

You must be logged in to reply to this topic.

Contact Us

Thanks for helping us better serve the community. You can make a suggestion, report a bug, a misconduct, or any other issue. We'll get back to you using your private message ASAP.



Forgot your details?