cancel
Showing results for 
Search instead for 
Did you mean: 

I am using STM32F051R6 series microcontroller for my project, i am unable to configure PC1 for port interrupt .

Amal Babu
Associate III

hi,

I am using STM32F051R6 series micro controller for my project, i am unable to configure PC1 for port interrupt . I am sharing my configuration below

#include "stm32f0xx.h"         // Device header

#include "RTE_Components.h"       // Component selection

#define BIT(X) (1<<X)

void enable_ext_int() ;

volatile int temp = 0 ;

int main()

{

 enable_ext_int() ;

GPIOC->MODER &= ~(BIT(2) | BIT(3)) ;

while(1);

}

void enable_ext_int()

{

RCC->AHBENR |= RCC_AHBENR_GPIOCEN;

SYSCFG->EXTICR[0] = BIT(5);

EXTI->IMR = BIT(1); 

 EXTI->FTSR = BIT(1);  

NVIC_EnableIRQ(EXTI0_1_IRQn);

}

void EXTI0_1_IRQHandler()

{

if( (GPIOC->IDR & BIT(1)))

EXTI->PR |= EXTI_PR_PR0 ;

}

}

i have already configured port interrupt for PB5,PB13,PA11 and it was worked well,but when i am trying to configure PC1, it doesn't seem to work,please share possible reasons ASAP

3 REPLIES 3

Check that you don't have a hardware limitation, try Pin 1 on another bank.

Make sure you enable the SYSCFG clock

Review register settings for the clocks, pins and peripherals

Check the flag in the EXTI, not the pin, the pin could be transient.

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

EXTI->PR |= EXTI_PR_PR0 ;

Why PR0?

JW

That was a mistake,but i don't think that was the actual problem because when i insert a break point on 'if ' statement with in the ISR the program counter doesn't seem to reach the break point.