Question
Interrupt with F3-Discovery
Posted on August 22, 2013 at 21:40
Hello guys,
Im new to the ST-Family and i have a question about interrupting with a button.I wanted to make the button on the board as a hardware interrupt, which would trigger some LED-Blinking.However doesnt work at all. I have read the manual and it says to perform a hardware interupt i must:1.Configure the mask bits of the 23 interrupt lines(EXTI_IMR)2. Configure the trigger selection bits of the interrupt lines ( EXTI_RTSR and EXTI_FTSR)3. Configure the enable and mask bits that control the NVIC IRQ channel mapped to the external interrupt controller(EXTI) so that an interrupt coming from one of the 23 line can be correctly acknowledged.Here is part of my code:void button_init(){ RCC->AHBENR |= BIT18; GPIOA->OSPEEDR |= (BIT1 | BIT2); GPIOA->PUPDR |= (BIT1 | BIT2);}int flag=0;int main(){ SystemCoreClockUpdate(); /* Get Core Clock Frequency */ if (SysTick_Config(SystemCoreClock / 1000)) { /* SysTick 1 msec interrupts */ while (1); /* Capture error */ } LED_Init(); button_init(); //BUtton on PA0 EXTI->IMR |= BIT1; // Enable not maskable interrupt on BIT1 EXTI->RTSR |= BIT1; // Rising Edge SYSCFG->EXTICR[0] &= ~BIT1; // 0000 for interrupt for PA[0] while(1){}}void EXTI0_IRQHandler(void){ if(EXTI->PR & 1UL) { EXTI->PR |= 1UL; // Clear with Setting to BIT1 LED_On(3);} }}However, it doesnt work.Any help will be appreciated, and thanks in advance.Cheers #interrupt-f3-problem-help