2012-07-16 03:02 AM
Hello,
Can someone please explain to me how the alternate function mapping works? I found the alternate mapping table in the datasheet but how to read it. What is the default location of peripherals.
For example by default the micro is in configured at AF0, for example what would the location of SPI1 be in that case?
For my application I need 5pin jtag, TIM2 ch1/ch2 as 32 bit encoder counter and TIM5 ch1 as PWM output.
Also when I only use channel 1 of a timer, can I use the pins for the other channels for gpio or other peripherals like jtag or spi?
Thanks
2012-07-16 04:39 AM
Think of it as two rotary switches. First select AF Mode for the pin, then select the Peripheral for the pin. You can mix and match. If the first switch is NOT AF Mode the pin will be a GPIO (IN, OUT, ANALOGUE).
So yes, you can get a single timer channel out. You could get USART Rx and TX out if different GPIO banks. You can escape any pins, in any order, as described in the AF mux table.2012-07-16 05:57 AM
clive1,
Thanks for your answer. I understand now, so I just use the function GPIO_PinAFConfig to map a pin to aperipheral.
Thanks