[STM32L1] STM32L151C8使用SWJ调试,该如何配置引脚

[复制链接]
2541|4
 楼主| huangbaohong 发表于 2013-9-13 13:55 | 显示全部楼层 |阅读模式
我配置成这样,但还是不行,麻烦大家帮我看看应该如何配置啊?
GPIO_PinAFConfig(GPIOA,GPIO_PinSource13, GPIO_AF_SWJ);
  GPIO_PinAFConfig(GPIOA,GPIO_PinSource14, GPIO_AF_SWJ);
  GPIO_InitStructure.GPIO_Pin = SWDIO;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
  // PA.14用作SWD调试
  GPIO_InitStructure.GPIO_Pin = SWCLK;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
rtgchym 发表于 2013-9-13 15:25 | 显示全部楼层
SWJ调试用到的引脚默认就是用于SWJ调试的,硬件接上就可以了,不用这么设置,如果你想把这些引脚当IO口来用的时候才需要配置
zeluo 发表于 2013-9-13 18:45 | 显示全部楼层
还是看你的功能需要   根据需求来设置吧  
戈卫东 发表于 2013-9-13 19:29 | 显示全部楼层
GPIO_InitStructure.GPIO_Pin = SWDIO; ///////这样可以么?
 楼主| huangbaohong 发表于 2013-12-31 17:42 | 显示全部楼层
谢谢大家,现在懂了!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

7

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部