R
R
Roman Popov2019-10-15 09:03:38
Microcontrollers
Roman Popov, 2019-10-15 09:03:38

Re-initializing GPIO?

Recently I started to pick STM32, so the question is most likely stupid.
I need to use the UART pins first as normal GPIOs (input and output), and then in the middle of the code as UART.
How to do it right? First, initialize the pins as GPIO, and then re-initialize as UART inside the code? Or if the UART is initialized, then you can somehow just access the pins directly, like regular GPIOs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfg21, 2019-10-15
@Roman_Popov

initialization is the placement of the correct bytes at the correct addresses :)
you can do it whenever you want and as much as you like.
and already the values ​​of individual bits control the corresponding parameters of the hardware modules.
Each port pin has a switch that "connects" the pin to the corresponding pins of other controller modules.
the output, "disconnected" from the uart, will not depend on its operation in any way. it will do the work that is described in the GPIO control bytes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question