AnsweredAssumed Answered

imx6q GPIO interrupt

Question asked by Salvatore Uras on Feb 11, 2014
Latest reply on May 20, 2014 by Tong Chunyang

Hello everyone.

 

We are trying to use a GPIO to generate an interrupt - in an OS-less program based on the platform SDK code, so bare metal and no linux below.

 

The following code should produce on our board a printf in response to a button press, and we have successfully tested the event and its handling in polling mode before.

Unfortunately, our interrupt routine never gets called.

Anybody can see what's wrong in our sample code below?

 

Thanks in advance,

 

Gabriele Hofmann & Salvatore Uras

 


void myIO_interrupt_handler(void)

{

      printf("myIO interrupt\n");

      myIO_irq_served = TRUE;

}




int myIO_irq_test(void)

{

      uint32_t *gpio7_base;


      gpio7_base = (uint32_t *)0x20b4000;

      printf("Start myIO IRQ test:\n");

      gpio7_iomux_config();

      gpio_set_direction(GPIO_PORT7, 4, GPIO_GDIR_INPUT);

      *(gpio7_base + 0xc) = (uint32_t)0x300; // GPIO7 ICR1 falling edge for IO4

      *(gpio7_base + 0x14) = (uint32_t)0x10; // GPIO7 IMR enabling mask for IO4


      /* register the IRQ sub-routine */

     register_interrupt_routine(IMX_INT_GPIO7_INT15_0, myIO_interrupt_handler);


     /* enable the IRQ */

      enable_interrupt(IMX_INT_GPIO7_INT15_0, CPU_0, 0);


      while (myIO_irq_served == FALSE);


      return TEST_PASSED;

}

 

Outcomes