AnsweredAssumed Answered

Edge Triggered Interrupt Functionality on EXTI15_10_IRQ

Question asked by roofie01 on Feb 9, 2016
Latest reply on Feb 10, 2016 by Clive One
Hello:

What I am trying to do seems pretty straightforward, but the results I am getting don't agree with that.

I have 17.5KHz clock that bursts about 7 times/second. I have the interrupt set for rising edge. When that clock begins to toggle, the interrupt handler is picking it up.
On a second pin I have set up as an input, I want to read that pin when the interrupt occurs.
However, the results in the array don't agree with what I am seeing on the scope. The data from the device at Pin14 stays the same (reading an ADC) so I expect each buffer to be the same, but they are not.
Should an interrupt set up this way only occur on the rising clock edge? And what is not valid about reading another pin during that interrupt? That's when the data should be read. If it works the way I understand it, there should be the same values in the buffer with every clock burst of 19.

Thanks for any help on this.


void EXTI15_10_IRQHandler(void)
{
  static uint8_t i;
  
  if (EXTI_GetITStatus(EXTI_Line13) != RESET )
  {
    /* Clear interrupt flag */
    EXTI_ClearITPendingBit(EXTI_Line13);       
    bits[i++] =  GPIO_GetInputPinValue(GPIOB, GPIO_Pin_14) );   
    if(i == 20) //clock finished, process data
  }
}

void Configure_PB13(void)
{
    GPIO_InitTypeDef GPIO_InitStruct;
    EXTI_InitTypeDef EXTI_InitStruct;
    NVIC_InitTypeDef NVIC_InitStruct;
    
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
    
    /* Set pin 13 & 14 as input */
    GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14;
    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;
    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
    GPIO_Init(GPIOB, &GPIO_InitStruct);
    
    /* using pin 13 */
    SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource13);
    
    /* PB13 connected to EXTI_Line13 */
    EXTI_InitStruct.EXTI_Line = EXTI_Line13;
    /* Enable interrupt */
    EXTI_InitStruct.EXTI_LineCmd = ENABLE;
    /* Interrupt mode */
    EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;
    /* Trigger on rising edge */
    EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising;

    /* Add to EXTI */
    EXTI_Init(&EXTI_InitStruct);
 
    /* Set IRQ vector to NVIC */
    /* PB13 is connected to EXTI_Line13, using EXTI15_10_IRQn vector */
    NVIC_InitStruct.NVIC_IRQChannel = EXTI15_10_IRQn;
    /* Set priority */
    NVIC_InitStruct.NVIC_IRQChannelPreemptionPriority = 0x00;
    /* Set sub priority */
    NVIC_InitStruct.NVIC_IRQChannelSubPriority = 0x01;
    /* Enable interrupt */
    NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;
    /* Add to NVIC */
    NVIC_Init(&NVIC_InitStruct);
}


Outcomes