GPIOA->MODER &= 0xFFF0FFFF; //PA8,PA9 set to be reuse pattern
GPIOA->MODER |= 0x000A0000;
GPIOA->AFR[1] &= 0xFFFFFF00;
GPIOA->AFR[1] |= 0x00000011;
TIM1->ARR = 0xFFFF;
TIM1->PSC = 0;
TIM1->CCMR1 &= 0xFCFC; //CC1 pass set to be input, IC1 map on TI1 上,CC2 pass set to be input, IC2 map on TI2
TIM1->CCMR1 |= 0x0101;
TIM1->CCER &= 0xFFDD;
TIM1->CCMR1 &= 0x0F0F; //no flagging
TIM1->SMCR &= 0xFFF8;
TIM1->SMCR |= 0x0003;
TIM1->CR1 |= 1<<0; //enable counter[/code]
As the codes we can see,TIM8 can counte as normal but TIM1 has no ** count and the DIR changes from up to now. I don’t know if is the USART1_TX of PA9 wrong? Or the reason occurred by hardware–STM32F407 ? Well, this is the datasheet of STM32F407 ,you can see more details about the hardware.
Appreciate a lot !
Regards~
I’m afraid I have no interest in Arduino for ST parts, but I do use STM32 parts extensively. Sometimes I use the ST provided peripheral interface libraries, which for setting up a timer for encoder input works for me as follows: