2019-02-11 05:26 AM
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
2019-02-11 05:35 AM
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.
2019-02-11 07:43 AM
EXTI->PR |= EXTI_PR_PR0 ;
Why PR0?
JW
2019-02-11 11:17 PM
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.