AnsweredAssumed Answered

ISR for EPORT IRQ not working in MQX on MCF52255

Question asked by Angelo Quattrociocchi on Jan 23, 2013
Latest reply on Apr 18, 2013 by Angelo Quattrociocchi

I'm trying to set up a simple pin interrupt on IRQ7 in MQX, but I would like to avoid using the GPIO interrupt method (GPIO_IOCTL_ENABLE_IRQ).  I've added the code below based on the MQX user guide, section 3.10.8, but modified to use the IRQ pin.  As I understand it this is the EPORT vector, and I also set some of the EPORT registers for this pin.  It installs the ISR OK, but apparently it never gets called because the tick count doesn't change.  If I set the pin as GPIO I can read the signal no problem so I don't believe there is a hardware issue.  Is there a problem with this code?

 

Thank you

 

 

typedef struct {

      pointer OLD_ISR_DATA;

      void (_CODE_PTR_ OLD_ISR)(pointer);

      _mqx_uint TICK_COUNT;

} MY_ISR_STRUCT, _PTR_ MY_ISR_STRUCT_PTR;



void pin_isr(pointer user_isr_ptr)

{

      MY_ISR_STRUCT_PTR isr_ptr;

     isr_ptr = (MY_ISR_STRUCT_PTR)user_isr_ptr;

      isr_ptr->TICK_COUNT++;

      /* Chain to previous notifier */

      (*isr_ptr->OLD_ISR)(isr_ptr->OLD_ISR_DATA);

}


void sensor_task(uint_32 initial_data)

{

 

      MY_ISR_STRUCT_PTR isr_ptr;

     isr_ptr = _mem_alloc_zero(sizeof(MY_ISR_STRUCT));

     isr_ptr->TICK_COUNT = 0;

     isr_ptr->OLD_ISR_DATA = _int_get_isr_data(MCF5225_INT_EPORT0_EPF7);

     isr_ptr->OLD_ISR = _int_get_isr(MCF5225_INT_EPORT0_EPF7);

      if (_int_install_isr(MCF5225_INT_EPORT0_EPF7, pin_isr, isr_ptr) == 0)

          printf ("Failed to install ISR\n");

 


     MCF_GPIO_PNQPAR |= 0x4000; //set IRQ7 pin PAR to primary function (IRQ)

     MCF_EPORT_EPPAR |= 0x4000; //set IRQ7 to rising edge triggered (see RM sec 17.4.1)

     MCF_EPORT_EPDDR &= 0x7F; //set IRQ7 pin as input (this is the reset condition)

     MCF_EPORT_EPIER |= 0x80; //enable IRQ7

 


     while (1) {

           _time_delay_ticks(1000);

          printf("\nTick count = %d\n", isr_ptr->TICK_COUNT);

     }

}


 


Outcomes