Skip to main content
sima2
Associate III
February 13, 2018
Solved

Is calling EXTI_GetITStatus() sometimes unnecessary?

  • February 13, 2018
  • 1 reply
  • 2279 views
Posted on February 13, 2018 at 16:02

I wonder if I can delete the call to EXTI_GetITStatus() in the following example code?

TheEXTI0_IRQHandler is not used for any other external interrupts. So thecall to

EXTI_GetITStatus() seems unnecessary?

/**
 * @brief ISR for EXTI0 detects a rising edge.
 *
 * This ISR is run when PE0 receives an rising edge. It will increment the counter variable.
 */
void EXTI0_IRQHandler(void)
{
 if (EXTI_GetITStatus(EXTI_Line0) != RESET) // Make sure it is an External interrupt line 0 interrupt 
 {
 counter++;
 EXTI_ClearITPendingBit(EXTI_Line0); // Clear the pending bit
 }
}�?�?�?�?�?�?�?�?�?�?�?�?�?

#stm32
    This topic has been closed for replies.
    Best answer by Tesla DeLorean
    Posted on February 13, 2018 at 17:38

    I would not delete it, and I'd move the counter++ the other side of the clearing code.

    The CM3/4 have a pipeline/tail-chaining/write-buffer issue with clearing interrupt sources on off-core buses, due to extended latency of this completing. The interrupt can remain pending as you exit the IRQ handler, and then briefly re-enter, validation allows you to ignore this spurious entry. This is a long described hazard.

    1 reply

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    February 13, 2018
    Posted on February 13, 2018 at 17:38

    I would not delete it, and I'd move the counter++ the other side of the clearing code.

    The CM3/4 have a pipeline/tail-chaining/write-buffer issue with clearing interrupt sources on off-core buses, due to extended latency of this completing. The interrupt can remain pending as you exit the IRQ handler, and then briefly re-enter, validation allows you to ignore this spurious entry. This is a long described hazard.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    sima2
    sima2Author
    Associate III
    February 14, 2018
    Posted on February 14, 2018 at 10:11

    Just for curiosity. Do you have more information about this, some reference?

    Tesla DeLorean
    Guru
    February 14, 2018
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..