如题,,, EXTI_InitTypeDef EXTI_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE); GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource3); EXTI_InitStructure.EXTI_Line=EXTI_Line3; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x01; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); 同样的代码在其他IO口就可以正常触发中断,板子自己做的,也测到中断信号了,也尝试关闭跟踪了,但是在PB3就是无法触发中断。。。求大佬指点迷津 |
void sEXIT_Configuration(void)
{
LL_GPIO_InitTypeDef GPIO_InitStructure;
RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;
GPIO_InitStructure.Mode = LL_GPIO_MODE_INPUT;
GPIO_InitStructure.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStructure.Speed = LL_GPIO_SPEED_FREQ_HIGH;
GPIO_InitStructure.Pull = LL_GPIO_PULL_UP;
GPIO_InitStructure.Pin = LL_GPIO_PIN_3;
LL_GPIO_Init(GPIOB, &GPIO_InitStructure);
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN;
LL_GPIO_AF_SetEXTISource(LL_GPIO_AF_EXTI_PORTB, LL_GPIO_AF_EXTI_LINE3);
LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_3);
LL_EXTI_EnableFallingTrig_0_31(LL_EXTI_LINE_3);
NVIC_SetPriority(EXTI3_IRQn, 0);
NVIC_EnableIRQ(EXTI3_IRQn);
}
void EXTI0_IRQHandler(void)
{
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_0) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
}
}
void EXTI1_IRQHandler(void)
{
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_1) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_1);
}
}
void EXTI2_IRQHandler(void)
{
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_2) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_2);
}
}
void EXTI3_IRQHandler(void)
{
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_3) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_3);
}
}
void EXTI4_IRQHandler(void)
{
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_4) != RESET)
{
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_4);
}
}
这样不也关闭了SWD?
请问我的代码有问题吗
从理论上排除一下,看看是不是配置的问题。