AnsweredAssumed Answered

How to handle GPIO interrupts using StdPeriph_Lib

Question asked by Randy Nelson on Nov 22, 2017
Latest reply on Nov 27, 2017 by Clive One

Working with STM32F303K8 at the lowest level where I'm writing to the registers directly. Try to follow generic statements in STM documents to handle a high2low transition on a GPIO PB4 input pin. These are the instructions I feel I need to do for the docs.


//EXTI registers. Only set ones that are needed.
SYSCFG_EXTICR2 |= BIT0; //select source pin PB4 for the EXTI4 external interrupt
EXTI_IMR1 |= BIT4; //assumming MR4 is EXTI4. Set to not mask
EXTI_EMR1 |= BIT4; //assumming MR4 is EXTI4. Unmask event
EXTI_FTSR1 |= BIT4; //assumming TR4 is EXTI4. Failing edge


If this code all I need and correct?


I also need an interrupt handler. Again from examples and online searches this is my handler.


void EXTI4_IRQHandler(void) {

   if((EXTI_PR1 & BIT4) != 0) {
        EXTI_PR1 |= BIT4 ; //clears interrupt

   } //determines if set
  GPIOB_ODR |= BIT3; //toggle test points for scope
  GPIOB_ODR &= ~BIT3; 


When running and PB4 going high2low at ~1K rate the handler does not appear to be hit. Even putting a breakpoint at the "if(EXTI.." does not get hit.


Any suggestions or directions to get a low level GPIO handler working.