AnsweredAssumed Answered

Quadrature encoder on STM32F429 discovery?

Question asked by ace1903 on Oct 15, 2014
Latest reply on Oct 15, 2014 by ace1903
Hi,

I have working code on STM32F407 discovery board and would like to port it to discovery board based on STM32F429.
If I set GPIO_Mode_IN on STM32F429 I can see nice shaped signals from encoder on input pins PA1 and PA5. When I set GPIO_Mode_AF pins seems to be driven low from STM32F429 side.
AF is set to TIM2 with:   
   GPIO_PinAFConfig(GPIOA,GPIO_Pin_5,GPIO_AF_TIM2);
   GPIO_PinAFConfig(GPIOA,GPIO_Pin_1,GPIO_AF_TIM2);

Code for timer setting is same for both STM32F407 and STM32F429:

    TIM_TimeBaseStructure.TIM_Prescaler = 0x00; 

    TIM_TimeBaseStructure.TIM_Period = 65536; //max resolution

    TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV4;//divide by clock by one

    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;// count up 

    TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);

    TIM_EncoderInterfaceConfig(TIM2, TIM_EncoderMode_TI12,  TIM_ICPolarity_Falling, TIM_ICPolarity_Rising);

    TIM_ICStructInit(&TIM_ICInitStructure);

    TIM_ICInitStructure.TIM_ICFilter = 0;//ICx_FILTER;
    TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
    TIM_ICInit(TIM2, &TIM_ICInitStructure);

    TIM2->CNT = 0;
    TIM_Cmd(TIM2, ENABLE);//enable encoder

Any ideas what can be wrong or differences between 32F407 and 32F429 that can trigger this problem?

Regards,
Aleksandar

Outcomes