• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Configuring a pin as interrupt ARM Cortex M3 STM32F1xx

Thread starter #1
I'm trying to configure Pin PD3 as external interrupt, here is my configuration, but it seems its not working.

void Configure_PD3(void) {
GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOD,ENABLE); // enables clock to portD
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_10MHz;
/*Configure GPIO pin : PD3 */
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(GPIOD, &GPIO_InitStruct);
/* PD3 is connected to EXTI_Line3 */
EXTI_InitStruct.EXTI_Line = EXTI_Line3;
/* Enable interrupt */
EXTI_InitStruct.EXTI_LineCmd = ENABLE;
/* Interrupt mode */
EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
/* Triggers on rising and falling edge */
EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
/* Add to EXTI */
EXTI_Init(&EXTI_InitStruct);

/* EXTI interrupt init*/
NVIC_SetPriority(EXTI3_IRQn, 0);
NVIC_EnableIRQ(EXTI3_IRQn);
}

void EXTI3_IRQHandler(void)
{
int i = 0;

}

void main() {

// Don't put any variables on the stack here, as FreeRTOS seems to reuse this space.
// This might be valid as this thread will be dead after vTaskStartScheduler().

hardware_init();

Configure_PD3();
}
 

large_ghostman

Well-Known Member
Most Helpful Member
#2
Which chip is this?
 

Latest threads

EE World Online Articles

Loading

 
Top