The use of Gpio_pinremapconfig functions in the STM32 library

Source: Internet
Author: User

Why is it impossible for beginners to control output when using PB3 and PB4?

The following is an analysis of this issue.

First, after the STM32F10X series MCU is reset, the PA13/14/15 & PB3/4 is configured as a JTAG feature by default. Sometimes in order to make full use of the resources of the MCU I/O port, these
The port is set to a normal I/O port. Here's how:
In Gpio_configuration (); Configure the GPIO ports used:


Gpio_pinremapconfig (gpio_remap_swj_disable, ENABLE);
Change the mapping of a specified pin gpio_remap_swj_disable SWJ completely disabled (JTAG+SW-DP)
Gpio_pinremapconfig (gpio_remap_swj_jtagdisable, ENABLE);
Change the mapping of the specified pin gpio_remap_swj_jtagdisable, JTAG-DP disable + SW-DP enable

Gpio_initstructure.gpio_pin = Gpio_pin_3 | Gpio_pin_4;
Gpio_initstructure.gpio_speed = Gpio_speed_50mhz;
Gpio_initstructure.gpio_mode = gpio_mode_out_pp;
Gpio_init (Gpiob, &gpio_initstructure);

Gpio_initstructure.gpio_pin = Gpio_pin_11 | Gpio_pin_12 | gpio_pin_13;
Gpio_initstructure.gpio_speed = Gpio_speed_50mhz;
Gpio_initstructure.gpio_mode = gpio_mode_out_pp;
Gpio_init (Gpioa, &gpio_initstructure);

Note: Do not forget to turn on the Afio clock in rcc_configuration (),
Afio Clock
Rcc_apb2periphclockcmd (Rcc_apb2periph_afio, ENABLE);

The use of Gpio_pinremapconfig functions in the STM32 library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.