cancel
Showing results for 
Search instead for 
Did you mean: 

configure gpio for external interrupt

hariprasad
Associate III
Posted on November 14, 2014 at 14:53

Hi I am using STM32F205 for my project (SN8000 EVK from  Murata).

The SN8000 EVK uses Wiced SDK but it supports all the library

functions, so the basic configurations will work(It uses vector tables in the vector_table_GCC.s file , I used one of the interrupts for DMA operation and is working fine, so the IRQ handler mapping is correct).

I want to configure the PA2 pin for external interrupt.Below given is my code.

void EXTI2_irq(void) {

    /* Make sure that interrupt flag is set */

    if (EXTI_GetITStatus(EXTI_Line2) != RESET) {

        /* Clear interrupt flag */

        EXTI_ClearITPendingBit(EXTI_Line2);

    }

}

void Configure_PA2(void) {

    GPIO_InitTypeDef GPIO_InitStruct;

    EXTI_InitTypeDef EXTI_InitStruct;

    NVIC_InitTypeDef NVIC_InitStruct;

    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;

    GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;

    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_2;

    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;

    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;

    GPIO_Init(GPIOA, &GPIO_InitStruct);

    SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource2);

    EXTI_InitStruct.EXTI_Line = EXTI_Line2;

    EXTI_InitStruct.EXTI_LineCmd = ENABLE;

    EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;

    EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;

    EXTI_Init(&EXTI_InitStruct);

    NVIC_InitStruct.NVIC_IRQChannel = EXTI2_IRQn;

    NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x00;

    NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0x00;

    NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;

    NVIC_Init(&NVIC_InitStruct);

}

void application_start( )

{

    Configure_PA2();

    while(1);

}

I tried to simulate HIGH -> LOW -> HIGH using MSP430 in-order to act as interrupt.

But I not able to see that the break point in the ISR is getting hit. 

What might be the issue?

#stm32 #stm32f4 #gpio #stm32f2 #interrupt #exti
1 REPLY 1
Posted on November 14, 2014 at 21:22

Looks reasonable enough, classically it would be EXTI2_IRQHandler(), but you claim to have that covered.

If it's C++ consider name mangling. Review the .MAP and .LST files

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..