STM32JTAG口用作普通IO的配置
使用Jlink向STM32烧录程序时,需要使用6个芯片的引脚(以STM32F103C8T6为例),分别是PB4/JNTRST、PB3/JTDO、PA13/JTMS、PA14/JTCK、PA15/JTDI、NRST。标准的20针JLink接口如下图所示。
当芯片IO口资源比较紧张时,可选择SW模式烧录程序。SWD只需用到PA13/JTMS、PA14/JTCK两根线,NREST可以接可不接,而剩下的PB4/JNTRST、PB3/JTDO和PA15/JTDI就可以当做普通IO使用。但是这三个口当做普通IO使用时需要先配置。配置方法:
void GPIOInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
/* Disable JLink, enable SW */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA " RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
/* Push-pill output, it can be other output types */
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
/* Push-pill output, it can be other output types */
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
GPIO_Remap_SWJ_JTAGDisable已在“stm32f10x_gpio.h”文件中进行了宏定义:
#define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x00300200)
/*!< JTAG-DP Disabled and SW-DP Enabled */
注意!!!这三个引脚默认的是JLink的复用功能,如果程序中还有其他GPIO口的配置,那这三个引脚的GPIO初始化一定要放在其他所有GPIO配置之后,否则依然无法作为普通IO使用。
如果非要把这三个引脚的配置放在其他GPIO配置之前,那么在程序中每次使用这些引脚前,需要再添加一句 GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); 例如:
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
GPIO_ResetBits(GPIOB, GPIO_Pin_4); // PB4 is set to 0;
STM32JTAG口用作普通IO的配置的更多相关文章
- 14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率:
14.6.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB 主线程IO 速率: 主线程 在InnoDB 是一个线程 执行各种任务在后台. ...
- 14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量
14.6.7 Configuring the Number of Background InnoDB IO Threads 配置InnoDB IO Threads的数量 InnoDB 使用后台线程来服 ...
- 14.4.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB Master Thread I/O Rate
14.4.8 Configuring the InnoDB Master Thread IO Rate 配置InnoDB Master Thread I/O Rate 主的master thread ...
- 14.4.7 Configuring the Number of Background InnoDB IO Threads 配置 后台InnoDB IO Threads的数量
14.4.7 Configuring the Number of Background InnoDB IO Threads 配置 后台InnoDB IO Threads的数量 InnoDB 使用bac ...
- 迅为iTOP-4418/6818开发板-驱动-IO初始化配置介绍和例程
对于所有的处理器,pad 一般可以分为两大类:IO(输入输出).Power(VDD 和GDD).类似摄像头 IO.以太网 IO.PWM 的 IO 等等,都可以统称为 IO.一个 IO,有可能能够被配置 ...
- IO 相关配置参数
INNODB I/O相关配置 记录日志为顺序I/O,刷新日志到数据文件为随机操作.顺序操作性能快于随机IO. innodb_log_file_size innodb_log_files_in_grou ...
- kafka-node+socket.io 测试配置
1.安装需要插件 npm install express npm install socket.io npm install kafka-node 2.kafkatest.js文件 var exp ...
- io.h配置 ubuntu
https://www.cnblogs.com/liuyangak/articles/3239238.html https://blog.csdn.net/jiao_mrswang/article/d ...
- STM32F030如何正确配置IO口的复用功能
本文所使用的单片机型号为STM32F030C8T6. 在030系列的单片机中,PA2引脚除了作为普通的IO引脚用作输入输出功能以外,还可以作为内部外设串口1,串口2,定时器15通道1这三个外设的功能引 ...
随机推荐
- 微软发布Azure Stack第一个技术预览版
为了提升商业灵敏度和加快创新步伐,各个企业都在迅速地转向云服务.在微软,我们已经见到微软智能云Azure的飞速发展和使用,每月我们都有近十万的新增订阅量.然而,我们也了解到还有很多企业在完全移到公有云 ...
- SQL Server ->> 深入探讨SQL Server 2016新特性之 --- Row-Level Security(行级别安全控制)
SQL Server 2016 CPT3中包含了一个新特性叫Row Level Security(RLS),允许数据库管理员根据业务需要依据客户端执行脚本的一些特性控制客户端能够访问的数据行,比如,我 ...
- tp.c
calculate throughput /* gput.c: out.tr¤ò²òÀϤ·¤Æ¥¹¥ë¡¼¥×¥Ã¥ÈÆÃÀ¤ò·×»»¤¹¤ë * out.et¤ò²òÀϤ·¤ÆºÆÁ÷¥¿¥ ...
- java通过jxls框架实现导入导出excel
//使用jxls报表生成工具,把java实体类导出生成 Excel文件或导入 Excel 插入数据库 02 03//读取04 05public class ReadExcel {06 private ...
- console和windows子系统
https://blog.csdn.net/ilvu999/article/details/8050292
- 一个理解PHP面向对象编程(OOP)的实例
<?php //定义一个“人”类作为父类 class Person{ //声明一个新变量公共变量$name,可被任何包中的类访问 public $name;//人的名字 public $sex; ...
- 使用matlab对图像进行傅里叶变换
原图: (0) 代码: I=imread('1.jpg'); I=rgb2gray(I); I=im2double(I); F=fft2(I); F=fftshift(F); F=abs(F); T= ...
- 函数响应式编程(FRP)思想-Callback风格
序 ReactiveCocoa是IOS广为使用的技术框架,而ReactiveCocoa的核心思想就FRP.FRP不同于JAVA的object-oriented和AOP,FRP能让你的代码像数学一样简洁 ...
- Software Architecture
Software Architecture Architecture serves as a blueprint for a system. It provides an abstraction to ...
- CAShapeLayer使用
UIView *showView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; [self.view addSubv ...