AnsweredAssumed Answered

EXTI line 13 always pending? (STM32F103VG) Solved!

Question asked by Peter Lissenburg on Jan 10, 2014
Hello all, hopefully someone can see the error of my ways?
I have a some hardware with a couple of rf modules IO lines connected to Port D pins 10, 11, 12, 13.
All is well except for pin 13 which is always providing a positive edge trigger to the EXTI interupt (15_10). I have checked the hardware line with a cro and logic analyzer and find no cause for this.
Also single stepping through the  EXTI_ClearITPendingBit(x); // x = 0x00002000  function in the ISR does not show the EXTI->PR being cleared, although that may be a poor test.
In the code below, the pending bit is being set at the point it is enabled.
I may have to assume the RF module is causing this via EMR, but that's not happen before.
Any ideas much appreciated
Pete L.

PS, I have confirmed that the EXTI->PR reg is being cleared. And have also disconnected power to the 2 RF modules, and still EXTI->PR pin 13 (0x00002000) is being triggered!
Just don't know what to look at next...

The call to GPIO_EXTILineConfig below should NOT have been made with bit masks of the pins required to be setup, but rather with bit numbers ie 10. And then another call with 11 and gain for 12 and 13.
Found it because of another EXTI int being caused by pins on Port A. As the pin selection was still 00000000 which is port A.
Hope that helps someone in the future.

void ExtI_init(void)
EXTI_InitTypeDef EXTI_initStruct;
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStruct;

  // Config the G0 amd G2 as inputs, with interrupt
  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13;
//  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12;
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOD, &GPIO_InitStruct);

  GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, (GPIO_PinSource10| GPIO_PinSource11 | GPIO_PinSource12 | GPIO_PinSource13));
//  GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, (GPIO_PinSource10| GPIO_PinSource11 | GPIO_PinSource12));

  /*  Turn on the EXTI    */
  EXTI_initStruct.EXTI_Line = EXTI_Line10 | EXTI_Line11 | EXTI_Line12 | EXTI_Line13;
//  EXTI_initStruct.EXTI_Line = EXTI_Line10 | EXTI_Line11 | EXTI_Line12;
  EXTI_initStruct.EXTI_LineCmd = ENABLE;
  EXTI_initStruct.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_initStruct.EXTI_Trigger = EXTI_Trigger_Rising;

  EXTI_Init(&EXTI_initStruct);               // pending bit set here

  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;