MIMXRT1050 interrupt not triggered

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MIMXRT1050 interrupt not triggered

1,767 Views
massimopalmieri
Contributor II

Hello. I am using MIMXRT1050 EVK board and i am experiencing a strange problem.

I try to compile and debug the SDK example "flexcan_interrupt_tranfer" to test the CAN peripheral, but the interrupt does not set: all the flags seem to be setted but the irq isn't triggered.

The same thing happens when i try the "igpio_input_interrupt" example project.

If i use a "non-interrupt" version, the program runs well but the "interrupt" version does not work. What do i miss?

Is there some enable interrupt i lose?

0 Kudos
6 Replies

1,461 Views
massimopalmieri
Contributor II

I don't understand why the interrupt is not serviced!

At the beginning, the state of NVIC registers is:

Immagine1.png

If I push the button, the interrupt is flagged but not serviced!!!

Immagine2.png

The ISR is not executed! Can someone tell me what is the problem?

Why the interrupt is not triggered although it is enabled?

0 Kudos

1,461 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please check the #define of the IRQ number and the IRQ Handler. Make sure they are pointing to the correct interrupt.

For example:

#define Example_GPIO                   GPIO2
#define Example_GPIO_PIN               5
#define Example_gpio_irq                    GPIO2_Combined_0_15_IRQn   // should match the name of IRQ number in MIMXRT1052.h
#define Example_gpio_irq_handler      GPIO2_Combined_0_15_IRQHandler   // should match the name under  __Vectors in startup_MIMXRT1052.S

void Example_gpio_irq_handler(void)

{

   //clear the interrupt status
  GPIO_PortClearInterruptFlags(Example_GPIO, 1U << Example_GPIO_PIN);

  PRINTF("\r\n interrupt occur!");
                    
      /* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
      exception return operation might vector to incorrect interrupt */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
    __DSB();
#endif

}

main(void)

{

....

....

...

EnableIRQ(Example_gpio_irq);
GPIO_PortEnableInterrupts(Example_GPIO, 1U<<Example_GPIO_PIN);

...

...

...

}

0 Kudos

1,461 Views
massimopalmieri
Contributor II

thank oyu for your reply.

Yes, i have tested the gpio and the interrupt number and they are corrected.

I try to do so: in the main cycle i have replaced the flag test with the direct gpio pin test:

    EnableIRQ(EXAMPLE_SW_IRQ);
    GPIO_PinInit(EXAMPLE_SW_GPIO, EXAMPLE_SW_GPIO_PIN, &sw_config);

    /* Enable GPIO pin interrupt */  
    GPIO_PortEnableInterrupts(EXAMPLE_SW_GPIO, 1U << EXAMPLE_SW_GPIO_PIN);

    while(1)
    {
//        if(g_InputSignal)
//        {
//            delay();
//            if(1 == GPIO_PinRead(EXAMPLE_SW_GPIO, EXAMPLE_SW_GPIO_PIN))
//            {
//                PRINTF("%s is turned on.\r\n", EXAMPLE_SW_NAME);
//            }
//            /* Reset state of switch. */
//            g_InputSignal = false;
//        }
        delay();
        if(0 == GPIO_PinRead(EXAMPLE_SW_GPIO, EXAMPLE_SW_GPIO_PIN))
        {
            PRINTF("%s is turned on.\r\n", EXAMPLE_SW_NAME);
        }
        /* Reset state of switch. */
        g_InputSignal = false;
    }

where:

#define EXAMPLE_SW_GPIO               GPIO5
#define EXAMPLE_SW_GPIO_PIN       (0U)
#define EXAMPLE_SW_IRQ                GPIO5_Combined_0_15_IRQn
#define EXAMPLE_GPIO_IRQHandler    GPIO5_Combined_0_15_IRQHandler
#define EXAMPLE_SW_NAME          "SW8"

In this way, the program run correctly and i see on the serial link the right output when i press the button.

If i re-enable the interrupt, nothing happens...

0 Kudos

1,461 Views
jimmychan
NXP TechSupport
NXP TechSupport

If you read '0' then print out the message. So, you are testing the falling edge interrupt? not rising edge?

0 Kudos

1,461 Views
massimopalmieri
Contributor II

Yes, but because the input is normally high... I also changed the gpio initialization:

    gpio_pin_config_t sw_config = {
        kGPIO_DigitalInput, 0,
//        kGPIO_IntRisingEdge
        kGPIO_IntFallingEdge
    };

but the result is the same.

I think there is something in the code that i missed, but i don't know what!!!

I'm using the MCUXpresso IDE v10.2.1_795 to compile the project: might be the compiler?

0 Kudos

1,461 Views
massimopalmieri
Contributor II

Now I tried with the IAR EWB version of the same example and it's working!!!

There is something in the compilation that doesn't work: it's like the interrupts are disabled, but even if i insert an enable ( __enable_irq(); )

before the main while(), the result is the same...

0 Kudos