cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI IR Semms not to execute correctly (Too many if statements???)

felix23
Associate II
Posted on November 01, 2014 at 18:32

Hi Guys,

I have written a handler for an external IR beeing executed on a STM32F107 controller. It looks like this:

void EXTI9_5_IRQHandler(void)

{

    //TEST

    GPIOE->BSRR = GPIO_Pin_9;    //set PE9   works fine

    GPIOE->BRR = GPIO_Pin_9;    //clear PE9  works fine

    

    if( (EXTI->IMR & EXTI_IMR_MR8) && (EXTI->PR & EXTI_PR_PR8))

    {

        EXTI_ClearITPendingBit(EXTI_Line8);

        GPIOE->BSRR = GPIO_Pin_9;    //TEST does not work

        if (GPIOA->ODR & GPIO_Pin_8)    //PA8 is set

        {

            if (GPIOE->ODR & GPIO_Pin_8)

            {

                SetLED1();

            }

            else

            {

                GPIOE->BSRR = GPIO_Pin_9;    //set PE9   doesn't work

            }

        }

        else

        {

            GPIOE->BRR = GPIO_Pin_9;    //clear PE9    GPIO_ResetBits()

        }

    }

}

I use Keil µVision 5.11.1.0 Lite version. I wonder, why I cannot set PE9 by the command

GPIOE->BRR = GPIO_Pin_9; in the code above. I a afraid, that it is some kind of compiler problem and it is simply removing the important part of the code. I decide, wether the code is working by looking at the GPIOE Peripherals view in Debug mode.

Thanks for your hints

1 REPLY 1
Posted on November 01, 2014 at 23:21

I a afraid, that it is some kind of compiler problem and it is simply removing the important part of the code.

Because that would be infinitely more probable than a failure in your logic?

Suggest you review what the registers actually contain as it enters.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..