AnsweredAssumed Answered

STM32VLDiscovery EXTI

Question asked by hprado on Sep 8, 2013
Latest reply on Sep 8, 2013 by hprado
My question is probably simple. Can I configure external interrupts triggered by PA10, PA11, PA12 and PA13?

Studing the EXTI example I understood something like this:

PA0 is connected to EXTI_Line0 and about the handler: EXTI0_IRQHandler(). So...

For PA10,11,12 and 13 how should it be?

I was trying the following to configure the pins as IT sources:

void GPIO_IT_Setup()
{
  EXTI_InitTypeDef EXTI_InitStructure;
  GPIO_InitTypeDef GPIO_InitStructure;
  NVIC_InitTypeDef NVIC_InitStructure;
   
  // Configure IT sources
  GPIO_InitStructure.GPIO_Pin =   GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_IPD;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
 
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
   
  // Connect sources to EXTI Lines
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource10);
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource11);
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource12);
  GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource13);
 
  // Configure Button EXTI lines
  EXTI_InitStructure.EXTI_Line = EXTI_Line10 | EXTI_Line11 | EXTI_Line12 | EXTI_Line13;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; 
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
   
  // Enable  EXTI Interrupts
  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
 
  NVIC_Init(&NVIC_InitStructure);
}

And the following to configure the handlers:

void EXTI10_IRQnHandler(void)
{
  if (EXTI_GetITStatus(EXTI_Line10) != RESET)
  {
    // Random code
    EXTI_ClearITPendingBit(EXTI_Line10);
  }
}
void EXTI11_IRQnHandler(void)
{
  if (EXTI_GetITStatus(EXTI_Line11) != RESET)
  {
    // Random code
    EXTI_ClearITPendingBit(EXTI_Line11);
  }
}
void EXTI12_IRQnHandler(void)
{
  if (EXTI_GetITStatus(EXTI_Line12) != RESET)
  {
    // Random code
    EXTI_ClearITPendingBit(EXTI_Line12);
  }
}
void EXTI13_IRQnHandler(void)
{
  if (EXTI_GetITStatus(EXTI_Line13) != RESET)
  {
    // Random code
    EXTI_ClearITPendingBit(EXTI_Line13);
  }
}


But obviously didn't work.
I would love if someone could help me with this.


Thanks since now!

Outcomes