Recently, a blogger made a temperature measurement and control module using STM32F103C8T6, using PB3, PB4, PA15 and other pins to control peripherals. It was found that no matter how to configure, these three pins cannot be set to zero. Later, it was discovered that PB3, PB4, PA13, PA14, and PA15, including these three pins, are special IO ports used as debug interfaces for JTAG/SWD emulators. Among them, PA13 and PA14 are used as SWIO and SWCLK for SWD debugging respectively; PB3, PB4, PA13, PA14, and PA15 are used together for JTAG. The Chinese and English descriptions of these five pins are shown in the figure below, which is from the STM32F1 reference manual:
These five IO pins are very special. Normally, they are used as debug pins for the SWJ emulator. If they are to be used as normal IO ports, special configuration is required. Take the PA13 pin as an example. The description of this pin in the STM32F1 data sheet is as follows:
Compared with other common IO, the main function of PA13 is JTMS-SWDIO. On the contrary, the function of common IO port is in remap in Alternate functions. In other words, if PA13 is to be used as a common IO port, it must use the remap in its alternate function. Therefore, the following two steps are required:
1. Enable the multiplexed clock in the clock configuration: RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO,ENABLE);
2. Remap the PA13 pin: GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
Step 1 is relatively easy to understand, so here we will focus on the remapping operation of step 2. The Chinese and English descriptions of the remapping operation of the five SWJ pins in the STM32F1 reference manual are shown in the figure below:
As can be seen from the above figure, there are three ways of remapping. They are described as follows:
1.GPIO_Remap_SWJ_JTAGDisable: /*!< JTAG-DP Disabled and SW-DP Enabled */ That is, PB3, PB4, PA15 can be used as normal IO, and PA13&14 can be used for SWD debugging
2.GPIO_Remap_SWJ_Disable: /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */ All 5 pins are normal pins, but can no longer be debugged with JTAG&SWD emulator, only st-link can be used for debugging
3.GPIO_Remap_SWJ_NoJTRST: /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */PB4 can be a normal IO port, JTAG & SWD are used normally, but JTAG is not reset
If you use all five pins as normal IO ports, the remapping configuration in the above step 2 should be written as GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); If you use PB3, PB4, PA15 as normal IO, and PA13&14 for SWD debugging, the remapping configuration should be written as GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); Similarly, you can configure only PB4 as a normal IO port.
Previous article:STM32 uses PB3 and other IO as normal IO
Next article:STM32 MCU releases PB3/PB4/PA15 as common IO port
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- STM32 Network SMI Interface
- CC3200-LAUNCHXL Development Board
- Common indicators and important characteristics of operational amplifiers
- How about my ADS1220 circuit?
- Qinheng CH579M-R1 development board free evaluation activity is coming soon, tell us what you think of this board~
- MPS Bonus Sharing | Which problem gives you the most headaches in inductor applications?
- HuaDa HC32A460 Series Introduction (Part 3)
- Let's take a look at the 3D SmithChart made by experts
- RVB2601 development environment setup and the first program
- 15 "Wanli" Raspberry Pi car - photoelectric encoder learning (forward and reverse judgment)