How to handle GPIO interrupts using StdPeriph_Lib
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.
//interrupts
//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 edgeIf 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.
Thanks,
Randy
#gpio-interrupts-using-stdperiph_lib Note: this post was migrated and contained many threaded conversations, some content may be missing.