禁用JTAG了,PB4还是不听我指挥

[复制链接]
2661|1
 楼主| aozima 发表于 2009-8-14 23:35 | 显示全部楼层 |阅读模式
代码如下:
  1. #define KEY_ROW1_0    GPIO_ResetBits(GPIOB,GPIO_Pin_4)
  2. #define KEY_ROW1_1    GPIO_SetBits(GPIOB,GPIO_Pin_4)

  3.     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

  4.     /* Disable the JTAG inte**ce and enable the SWJ inte**ce */
  5.     GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);

  6.     GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6;
  7.     GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
  8.     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  9.     GPIO_Init(GPIOB,&GPIO_InitStructure);

  10.     KEY_ROW1_1;   //PB4电压3.3V
  11.     KEY_ROW1_0;   //PB4电压还是3.3V 没反应
  12.     KEY_ROW1_1;
 楼主| aozima 发表于 2009-8-14 23:51 | 显示全部楼层
原因找到,原来还要先打开 RCC_APB2Periph_AFIO 的时钟
您需要登录后才可以回帖 登录 | 注册

本版积分规则

55

主题

2040

帖子

23

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