AnsweredAssumed Answered

Problem in external interrupt on PORTB

Question asked by Vikas Singh on Nov 7, 2017
Latest reply on Nov 10, 2017 by waclawek.jan

I am using STM32F0308 Dicovery Board. I want to use external interrupt on PIN11 of PORTB. Problem is that I am not able to invoke the PORTB. Microcontroller is still uses PIN11 of PORTA. I know that pins of ports are clubbed together but I am specifying PORTB still micro is using PORTA.

I think there is some problem in this code line

SYSCFG->EXTICR[3] = SYSCFG_EXTICR3_EXTI11_PB;  

 

Here is code

 

#include"stm32f0xx.h"
volatile int portBPin10Counter;
void EXTI4_15_IRQHandler(void)
{
  if(EXTI->PR & EXTI_PR_PR11)
  {
     EXTI->PR |= EXTI_PR_PR11;
     portBPin10Counter++;
  }
  }
int main(void)
{
RCC->AHBENR |=RCC_AHBENR_GPIOBEN;
GPIOB->MODER &= ~GPIO_MODER_MODER11;
GPIOB->PUPDR &= ~GPIO_PUPDR_PUPDR11;
SYSCFG->EXTICR[3] =SYSCFG_EXTICR3_EXTI11_PB;
EXTI->RTSR |= EXTI_RTSR_TR11;
EXTI->IMR |= EXTI_IMR_MR11;
NVIC_EnableIRQ(EXTI4_15_IRQn);
NVIC_SetPriority(EXTI4_15_IRQn,1);
    while(1)
    {
    }
}

Outcomes