★ 您好,欢迎大驾光临!!服务热线:0512-57750678  18021615678
Logo
网站首页 关于我们 产品中心 企业文化
新闻资讯 优势产品 在线留言 联系我们
您现在的位置:网站首页 >> 新闻资讯 >> STM32要使用JTMS(PA13)、 JTCK(PA14)作为普通I/O口

STM32要使用JTMS(PA13)、 JTCK(PA14)作为普通I/O口

在STM32要使用JTMS(PA13)、  JTCK(PA14)作为普通I/O口的时候,要在初始化前添加如下代码(顺序不能颠倒):

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable , ENABLE);


如:

void LED_Init(void)
{
 
 GPIO_InitTypeDef  GPIO_InitStructure;
     
    
    
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO, ENABLE);  
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable , ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;                
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;     
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_SetBits(GPIOA,GPIO_Pin_8);                       

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;           
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;      
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_13);                         
    
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;                 
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;          
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_14);        

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;              
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;       
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_6);            

 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);  

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;               
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;       
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
 GPIO_Init(GPIOD, &GPIO_InitStructure);    
 GPIO_SetBits(GPIOD,GPIO_Pin_2);                       

}


上一篇:STM32 OSC_IN和OSC_OUT的作用 和 各种接法
下一篇:小米澎湃S2处理器曝光 基于台积电16nm工艺
返回顶部

江苏豹发力电子科技有限公司 版权所有 未经授权禁止复制或镜像
CopyRight 2022   www.baofali.net  All rights reserved

电话:0512-57750678   E-mai:1989186555@qq.com  苏ICP备2022026117号-1