Configuring EXTI
Posted: Mon Nov 16, 2015 4:51 pm
Hello to all, im looking for a small bit of tuition in order to overcome a problem of mine.
Im currently using an STM32F407 Discovery board, and presently attempting to set PIN4 of PORTC to trigger an interrupt routine when either a rising or falling edge is detected. I've been through the reference manual and as far as I can see I have everything setup correctly, yet the interrupt isn't triggered when I apply +3V to the pin.
My code setting up the EXTI on PORTC Pin4, and interrupt routine is as follows, my thinking is that this should be a very simple problem fix for someone in the know. Unfortunately I am not able to use the libraries as I am need to become intimately familiar with the device (college). Thank you very much for any help offered.
Im currently using an STM32F407 Discovery board, and presently attempting to set PIN4 of PORTC to trigger an interrupt routine when either a rising or falling edge is detected. I've been through the reference manual and as far as I can see I have everything setup correctly, yet the interrupt isn't triggered when I apply +3V to the pin.
My code setting up the EXTI on PORTC Pin4, and interrupt routine is as follows, my thinking is that this should be a very simple problem fix for someone in the know. Unfortunately I am not able to use the libraries as I am need to become intimately familiar with the device (college). Thank you very much for any help offered.
Code: Select all
RCC->AHB1ENR |=(1<<2); //Enable PORTC Clock
GPIOC->OSPEEDR |=(1<<9); //Enable high speed for pin 4
GPIOC->PUPDR |=(1<<9); //Pull down resistor for pin 4
SYSCFG->EXTICR[2] |=(0x02); //Enable EXTI on PORTC Pin4
EXTI->IMR |=(1<<4);
EXTI->RTSR |=(1<<4);
EXTI->FTSR |=(1<<4);
NVIC_EnableIRQ(EXTI4_IRQn);
void EXTI4_IRQHandler(void)
{
while(1)
{
printf("sucess!!");
}
EXTI->PR|=0x010;
}