STM32F103 PB3 PB4 usage

Publisher:雅致人生Latest update time:2018-09-06 Source: eefocusKeywords:STM32F103 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Today, I debugged PB3, which is a common IO. After debugging for a long time, I thought it was a PCB problem. I couldn't find the problem after searching for a long time. Sometimes people are numb and their thinking is limited. I habitually thought that I could use it after configuring the IO. I didn't notice that PB3 is a JTAG shared IO, which is in JTAG state by default. I need to disable JTAG before I can use it.

DelayMS(2000); //It is recommended to delay, otherwise it will cause the jtag and sw to be unable to connect to the CPU, which is troublesome to handle.
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); //This sentence must be executed
//GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE); //Select GPIO_Remap_SWJ_Disable or GPIO_Remap_SWJ_JTAGDisable as needed
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);  
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_InitStructure .GPIO_Speed ​​= GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructur


PB4 is the same


Keywords:STM32F103 Reference address:STM32F103 PB3 PB4 usage

Previous article:STM32 PC13 PC14 PC15 driver LED configuration
Next article:The STM32F10x series MCU configures PB3 and PB4 as normal IO ports

Recommended ReadingLatest update time:2024-11-16 12:45

STM32f103 timer configuration and interrupt processing function
// IAR 7.1 timer interrupt time depends on the system external clock #include "stm32_timer.h" uint8_t tick = 0; void stm32_timer_init(void) {     uint16_t PrescalerValue = 0;     NVIC_InitTypeDef NVIC_InitStructure;     TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;     /* Compute the prescaler value */     Prescaler
[Microcontroller]
STM32 timer TIM2 PWM output PB3
After a long time of searching and reading many articles, I finally solved it by using PB3.  Pin Configuration void GPIO_TimPWM(void) {  GPIO_InitTypeDef GPIO_InitStructure;        RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);      GPIO_PinRemapConfig(GPIO_FullRemap_TIM2, ENABLE);    
[Microcontroller]
【stm32f103】USART TX transmission implementation (register version)
This lecture mainly implements the implementation of usart TX, which is mainly divided into several parts of application 1. Implementation of USART 1 Tx polling (with printf implementation) 2. Implementation of USART1 Tx DMA 3. Implementation of USART1 TX DMA interrupt Without further ado, let’s begin 1. Har
[Microcontroller]
【stm32f103】USART TX transmission implementation (register version)
Detailed explanation of 11 timers of STM32F103
The STM32F103 series of microcontrollers has a total of 11 timers, including: 2 advanced timers 4 ordinary timers 2 basic timers 2 watchdog timers 1 system tick timer excluding the watchdog timer and the system tick timer. List of eight timers; 8 timers are divided into 3 groups; TIM1 and TIM8 are advanced timers,
[Microcontroller]
STM32F103C8T6 implements serial port IAP method to upgrade firmware
First download the official STM32F10X IAP Bootloader source code, STM32F10x_AN2557_FW_V3.3.0. Source code package address: http://download.csdn.net/download/yunyin_link/10151170 Use Keil4 to open the project code STM32F10x_AN2557_FW_V3.3.0\Project\IAP\MDK-ARM\IAP.uvproj Step 1: Because we are using STM32F103C8T6
[Microcontroller]
STM32F103C8T6 implements serial port IAP method to upgrade firmware
The systick time of stm32F103 is inaccurate. Finally found the reason
The main function has defined SysTick_Config(72000000/1000); but the flashing time of the PIO pin in the interrupt void SysTick_Handler(void) always feels wrong. Finally, I observed the systick register in the SDK and found that ctrl has always been 0x00000003. The default is system clock/8 as the systick clock. I hav
[Microcontroller]
The systick time of stm32F103 is inaccurate. Finally found the reason
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号