cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt don't work

amr
Associate
Posted on November 30, 2013 at 18:50

I am try to interrupt the STM32F100C8T6B on External interrupt on PortB.2 from Accelometer Board (the interrupt is low level while the bus is pulled up with 4.7K ohm on 3.3V) .

the case that I was polling on the low level on the Accelometer interrupt pin and it was work , when I wanted to make it using EXTI on MC , It didn't work 

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB , ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

GPIO_Init(GPIOB, &GPIO_InitStructure);

GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource2);

EXTI_InitTypeDef EXTI_InitStructure;

EXTI_InitStructure.EXTI_Line = EXTI_Line2 ;

EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;

EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;

EXTI_InitStructure.EXTI_LineCmd = ENABLE;

EXTI_Init(&EXTI_InitStructure);

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);

NVIC_InitTypeDef NVIC_InitStructure;

NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

and It has never entered the ISR while I am sure that the interrupt happen 

can anyone help me 
1 REPLY 1
Posted on November 30, 2013 at 23:57

You need to enable the AFIO clock (SYSCLK in other STM32 series) for the EXTI peripheral block.

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