Due to project needs, I need to remap Usart3 ports PB10 and PB11 to PC10 and PC11, according to the official information, this is a partial re-image:
, first turn on the Apio clock:
Rcc_apb2periphclockcmd (RCC_APB2PERIPH_GPIOC | rcc_apb2periph_afio,enable); Then you need to set the port Gpio_initstructure.gpio_pin = gpio_pin_10; Gpio_initstructure.gpio_mode = gpio_mode_af_pp; Gpio_initstructure.gpio_speed = Gpio_speed_50mhz; Gpio_init (GPIOC, &gpio_initstructure); Gpio_initstructure.gpio_pin = Gpio_pin_11; Gpio_initstructure.gpio_mode = gpio_mode_in_floating; Gpio_init (GPIOC, &gpio_initstructure); Turn on port remapping Gpio_pinremapconfig (gpio_partialremap_usart3,enable) when you need to use a remap port; Gpio_partialremap_usart3 for USART3 multiplexing function partial mapping//gpio_fullremap_usart3 full mapping//when no mapping is needed, when used, resets the mapping to the bit, Gpio_ Afiodeinit (); Just open it again when you want to use it.
Deep parsing of Stm32 port remapping