Skip to main content
Vkato.1
Visitor II
Aug 25, 2020 1:30 PM UTC
Solved

hi sir How to check which GPOI pin is associated with I2C1 or USART1? question no2=> if USART use GPIO pin PA9 as USART_TX pin , then if i code to turn on LED on PA9 on different project will it work ?

i am using STM32F103c8 MCU

This topic has been closed for replies.
TDK
TDKBest answer
Aug 25, 2020 11:49 PM UTC

CubeMX will give pins for each peripheral. You can also check the datasheet.

PA9 cannot be a GPIO pin and USART_TX at the same time, but your program can switch between the two functions as needed.

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

3 replies

KnarfB
Super User
Aug 25, 2020 2:11 PM UTC

Its hard to answer without knowing the software you are using. At runtime you can look at the registers to find out how a pin is configured. See the "reference manual" for you chip family MODER register and more.

2nd: the pin function can be reconfigured on-the-fly by the code running. So, yes you can switch as you need, supposedly the pin is connected to suitable external components.

TDK
Aug 25, 2020 11:48 PM UTC

The STM32F1 family doesn't have a MODER register. Remapping is handled on a peripheral basis.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
TDKBest answer
Aug 25, 2020 11:49 PM UTC

CubeMX will give pins for each peripheral. You can also check the datasheet.

PA9 cannot be a GPIO pin and USART_TX at the same time, but your program can switch between the two functions as needed.

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