AnsweredAssumed Answered

Problem with the interrupt priority of the EPORT pin

Question asked by Elco Elettronica on Apr 28, 2010
Latest reply on May 3, 2010 by Juraj Vanco

Hi Everybody.

 

I'm using an MCF52259 with the MQX 3.5.1, and in my application I'm trying to use the pins 1,3, and 5 of the edge port module in way to read a signal provided by an encoder.

 

My problem is that the interrupt of the pin 3 has a bigger priority respesct the interrupt of the pin 1...but I don't know why.

 

I've disabled the initalization of the gpio by the mqx (by setting to 0 the define "BSPCFG_ENABLE_GPIODEV" in user_config.h file), and I've initialized the pin in this way:


    //Get the base address
    mcf5225_ptr    =    _PSP_GET_IPSBAR();
    mcf5225_gpio_ptr    =    &mcf5225_ptr->GPIO;
    mcf5225_EPORT_ptr    =    &mcf5225_ptr->EPORT[0];
    

    //Set the pin of the NQ port to work as interrupt pin
    mcf5225_gpio_ptr->PNQPAR    =    (mcf5225_gpio_ptr->PNQPAR | 0x4444);
    //Set the pin of the NQ port to work as input
    mcf5225_gpio_ptr->DDRNQ        =    0x00;
   

    //Set the pin IRQ1,IRQ3, and IRQ5 to generate an interrupt on both, rising and falling, edge
    mcf5225_EPORT_ptr->EPPAR    |=    0x00CC;

    //Set the pin IRQ1,IRQ3, and IRQ5 to work as input
    mcf5225_EPORT_ptr->EPDDR    &=    ~0x2A;

    //Enable the interrupt generation for pin IRQ1 and IRQ3

    //the IRQ5 interrupt it's enabled later...
    mcf5225_EPORT_ptr->EPIER    |=  0x0A;

   //Set the irq function for IRQ1 pin interrupt  

       if(_int_install_isr(MCF5225_INT_EPORT0_EPF1, Encoder_Channel_A_ISR, NULL)==NULL)
       {
           return ERROR_INIT_IRQ_1;
       }
       
   //Set the irq function for IRQ3 pin interrupt
       if(_int_install_isr(MCF5225_INT_EPORT0_EPF3, Encoder_Channel_B_ISR, NULL)==NULL)
       {
           return ERROR_INIT_IRQ_3;
       }
       
   //Set the irq function for IRQ5 pin interrupt
       if(_int_install_isr(MCF5225_INT_EPORT0_EPF5, Encoder_Channel_Z_ISR, NULL)==NULL)
       {
           return ERROR_INIT_IRQ_5;
       }

     //Unmask the IRQ1,IRQ3, and IRQ5 interrupt
       _mcf5225_int_unmask(MCF5225_INT_EPORT0_EPF1);
       _mcf5225_int_unmask(MCF5225_INT_EPORT0_EPF3);
       _mcf5225_int_unmask(MCF5225_INT_EPORT0_EPF5);

 

I have not set the level and the priority of this interrupt because in the "reference manuale" it's write that for the IRQ pin the level and the priority are set by the hardware(it's correct?).

 

How can I fix this problem?

 

Stefano

 

Outcomes