cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407: Can TIM2 be configured for encoder AND TIM5 input capture on same pins?

dhaselwood
Associate II

It isn't clear if more than one peripheral, e.g. TIM2 and TIM5 can be configured to use the same pin, assuming of course than both don't try to use the pin in an output mode. If this is possible, then I should be able to capture encoder time transitions with one timer and have the other doing the signed counting. Some years back I think I wrestled with this issue with the F103, and found it was possible, but the alternate function setup is different with the F4.

3 REPLIES 3
TDK
Guru

On the F4, a pin can only be mapping to one alternate function at a time, so this won’t work. Check out the GPIO registers to see the limitation.

If you feel a post has answered your question, please click "Accept as Solution".

>It isn't clear if more than one peripheral, e.g. TIM2 and TIM5 can be configured to use the same pin, 

It*is* clear: no. The attached peripheral is uniquely determined by GPIO_AFR. The 'F1 GPIO structure is different and is the exception in STM32.

You can use Master-Slave connection between the timers to"forward" CH1.

JW

dhaselwood
Associate II

TDK and JW,

Thanks for the response. I'll look into the "forwarding" of CH1. I am wrestling with a pin availability so when I saw that PA0,1 were the same for TIM2 and TIM5 it made me wonder if maybe there was a chance that one could do input captures and shaft encoding with the same pin.