Port Multiplexing is the focus, as long as the use of stm32 is used to peripherals, peripherals are shared with the Gpio pin (multiplexing), that is, some pins can be purely as input and output, but also as a certain function of peripheral (such as ADC, serial port and so on) pin port.
This is an advantage of stm32, which saves the number of pins.
Port multiplexing and remap pin correspondence can be queried on the chip manual, the Stm32 Mini board corresponds to the STM32F103RCT6.
?
?
Re-use specific steps
Multiplexing port initialization has several steps:
1) GPIO port clock Enable. To use to port multiplexing, of course, make the clock of the port available.
Rcc_apb2periphclockcmd (Rcc_apb2periph_gpioa, ENABLE); "This function has been touched in the LED section, in the stm32f10x_rcc.c file."
2) multiplexed peripheral clock Enable. For example, you want to reuse port PA9,PA10 as a serial port, so you have to enable the serial clock.
Rcc_apb2periphclockcmd (Rcc_apb2periph_usart1, ENABLE); "Also in stm32f10x_rcc.c this file, just judge the first difference in validity"
3) port mode configuration. When the IO multiplexing bit is built into the peripheral function pin, the GPIO port mode must be set, as
The mode of GPIO under the Multiplexing function is how to correspond, this can view the manual "STM32 Chinese Reference Manual V10"
P110 table "GPIO Configuration for 8.1.11 peripherals".
Port remapping with less, generally understand, mainly for the convenience of PCB cabling, some ports mapped to other ports.
Port Multiplexing and Port remapping