ZRJ8951 发表于 2021-2-2 17:38

雅特力AT32 调试接口SWD怎么关闭,我要用PA13脚

雅特力AT32 调试接口SWD怎么关闭,我要用PA13脚,试了几次都不行。

void GPIO_Configuration(void)
{
        //PA6,PA7,
GPIO_InitType GPIO_InitStructure;

GPIO_PinAFConfig(GPIOA, GPIO_PinsSource6, GPIO_AF_5);
GPIO_PinAFConfig(GPIOA, GPIO_PinsSource7, GPIO_AF_5);
GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0);
       
/* GPIOA Configuration:TMR16 Channel1,TMR17 Channel1*/
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_6|GPIO_Pins_7|GPIO_Pins_13;
        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
        GPIO_InitStructure.GPIO_OutType = GPIO_OutType_PP;
        GPIO_InitStructure.GPIO_Pull = GPIO_Pull_NOPULL;
        GPIO_Init(GPIOA, &GPIO_InitStructure);
// IR_OUT PB9,PA13
//GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0);
/* GPIOB Configuration:IRTMR Output */
// GPIO_InitStructure.GPIO_Pins = GPIO_Pins_13;
// GPIO_Init(GPIOA, &GPIO_InitStructure);
}



muyichuan2012 发表于 2021-2-2 18:00

可以看一下这个帖子
https://bbs.21ic.com/icview-3045792-1-3.html?_dsign=e203e2dd

ZRJ8951 发表于 2021-2-2 19:11

muyichuan2012 发表于 2021-2-2 18:00
可以看一下这个帖子
https://bbs.21ic.com/icview-3045792-1-3.html?_dsign=e203e2dd

1.RCC_APB2PERIPH_AFIO
2.GPIO_Remap_SWJ_JTAGDisable
3.GPIO_PinsRemapConfig() //禁用JTAG功能使能 SWD 功能, PA15 PB3 PB4用作普通IO
1,2,3在at32f421的库里没有。拷贝加入也不行。

muyichuan2012 发表于 2021-2-3 09:11

你说的是421型号啊,对于421型号,请查看BSP以下example:AT32F4xx_StdPeriph_Lib_V1.x.x\Project\AT_START_F421\Examples\GPIO\JTAG_Remap

tanleitanlei 发表于 2021-2-3 15:08

使用pa13作为ir_out需要配置成GPIO_AF_1,配置成这个后,jtag口自动关闭了

ZRJ8951 发表于 2021-2-3 15:14

tanleitanlei 发表于 2021-2-3 15:08
使用pa13作为ir_out需要配置成GPIO_AF_1,配置成这个后,jtag口自动关闭了

/**
* @briefAF 0 selection
*/
#define GPIO_AF_0            ((uint8_t)0x00) /* WKUP, EVENTOUT, TIM15, SPI1, TIM17,
                                                MCO, SWDAT, SWCLK, TIM14, BOOT,
                                                USART1, CEC, IR_OUT, SPI2 */

        GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0); //IR_OUT
        GPIO_InitStructure.GPIO_Pins = GPIO_Pins_13;
GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
        GPIO_InitStructure.GPIO_OutType = GPIO_OutType_PP;
        GPIO_InitStructure.GPIO_Pull = GPIO_Pull_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
        是这里错了吗。

muyichuan2012 发表于 2021-2-3 15:18

本帖最后由 muyichuan2012 于 2021-2-3 15:22 编辑

GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0);
修改为
GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_1);


这里也要修改一下:
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
要修改为
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

ZRJ8951 发表于 2021-2-3 15:30

muyichuan2012 发表于 2021-2-3 15:18
GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0);
修改为
GPIO_PinAFConfig(GPIOA, GPIO_PinsSou ...

GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_1); //IR_OUT
        GPIO_InitStructure.GPIO_Pins = GPIO_Pins_13;
GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
        GPIO_InitStructure.GPIO_OutType = GPIO_OutType_PP;
        GPIO_InitStructure.GPIO_Pull = GPIO_Pull_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);


ZRJ8951 发表于 2021-2-3 16:38

muyichuan2012 发表于 2021-2-3 15:18
GPIO_PinAFConfig(GPIOA, GPIO_PinsSource13,GPIO_AF_0);
修改为
GPIO_PinAFConfig(GPIOA, GPIO_PinsSou ...

问您下,高脉冲达100us, rf_out就无输出。是什么原因。
页: [1]
查看完整版本: 雅特力AT32 调试接口SWD怎么关闭,我要用PA13脚