cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 Development Board Pin/IO Alternate Function & Remap

Posted on March 05, 2010 at 21:52

STM32F103 Development Board Pin/IO Alternate Function & Remap

4 REPLIES 4
Posted on May 17, 2011 at 13:42

When you enable a peripheral in RCC, such as USART1, and you want to configure it to be a UART only using the TX, RX pins, can you use the other CTS, RTS, and CK pins for other peripherals and/or GPIO?

Yes, you can certainly choose to assign the pins to the alternate function, or have them as generic IO. Pins remap in blocks, either the whole group, or a subset (partial). For the USART, or whatever, to drive an output the mode needs to be GPIO_Mode_AF_PP or OD, otherwise the GPIO pin driver controls the output. For input, the peripheral or the GPIO can read the pin state.

I would recommend checking the errata documents for potential problems. One for example is the RTS (PA.12) pin of a USART1 clashing with a disabled CAN  controller. You have to park the CAN off somewhere else (GPIO_ReMap2_CAN). In most cases disabled peripherals will not conflict.

-Clive

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2011 at 13:42

Thanks Clive,

This is just about exactly what I was looking for. 

The only thing that I am not sure about, is when you remap a ''block'' to a new set of I/O pins, does it override the original ''alternate functions'' of those pins? 

For example on the 103, if I am using FSMC, but I don't need address lines above A8, can I remap TIM4_CH1 (group), over the FSMC_A17 (PD12) pin, or will there be a conflict with both of them enabled? 

Thank you again for your help.

supercoolman
Associate II
Posted on May 17, 2011 at 13:42

I think user manual says that pins re-mapping are predetermined. you can only select mapping options, not the pins to re-map to on your free will.

Tomas DRESLER
Senior II
Posted on May 17, 2011 at 13:42

Yep, the AF on specific pin is a logic combination of all active peripherals, mapped to that output, and some even not activated :)

1. ''activated'' means ''clock is enabled to''

2. logic combination - usually OR, but you need to test => some peripherals like timers may force the recessive value into the AF and enable your desired peripheral to take over the output

3. read errata sheet, the limiting combinatios are listed

4. GPIO mode is available on all pins, regardless of the peripheral connected to it (with a ''functional'' exception -> it may influence input of any connected peripheral, if such is enabled), and probably USB, that has its own analogue connection to the D+/D- pins.