cancel
Showing results for 
Search instead for 
Did you mean: 

Enternal Interrupt Not Triggering

gsaldanha
Associate
Posted on January 10, 2013 at 22:59

I would like to be interrupted every time

an external input

occurs

-

line is take

n high on each

data tran

sfer to another chip

.

I can see the external input on the scope

but I don't get a

n interrupt. Am I not setup correctly?

I'm using a STM32F4.

void
TriggerConfig(
void
)
{
/* PA.02 (INPUT) */
/* Enable System Clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Enable HW Peripheral Clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* GPIO configuration : PA.02 */
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect GPIO to EXT */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource2);
/* External Trigger */
EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line = EXTI_Line2;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable the global Interrupt */
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void
EXTI2_IRQHandler(
void
) 
{
if
(EXTI_GetITStatus(EXTI_Line2) != RESET)
{
printf
(
''Gottcha!''
);
}
/* Clear the interrupt */
EXTI_ClearITPendingBit(EXTI_Line2);
NVIC_ClearPendingIRQ(EXTI2_IRQn);
}

1 REPLY 1
Posted on January 11, 2013 at 00:40

Doesn't look unreasonable.

Are you perhaps using C++? That might given name mangling issues with the IRQ handler and fail to be the routine in the vector table. Perhaps review the .MAP file.

What debugging have you done, if you break execution after the external signal where is the CPU executing?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..