Help me with External Interrupt setting in MCF 5485

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

Help me with External Interrupt setting in MCF 5485

1,618 Views
Manju
Contributor I
Dear all,
I'm good in internal interrupts like timer,SLT.
But i dunno how to start with external interrupt...
Will you tell me the steps i have to follow to set external interrupt in MCF5485
..How i ve to call that function in MCF5485...

Thanks
~MD
Labels (1)
0 Kudos
4 Replies

529 Views
SimonMarsden_de
Contributor II
Hello Manju

It's not very different to configuring an SLT interrupt.

To get an external interrupt you need to configure the EdgePort module. You can specify which of the pins IRQ1 through IRQ7 should be used as interrupt inputs, and what causes the interrupt to fire - e.g. a transition from logic 0 to logic 1.

For example to configure IRQ1 as rising-edge triggered:

    MCF_EPORT_EPPAR = MCF_EPORT_EPPAR_EPPA1(0x1);
    MCF_EPORT_EPDDR = 0;
    MCF_EPORT_EPIER = MCF_EPORT_EPIER_EPIE1;

Unlike the SLT, the interrupt level and priority of the IRQ interrupts is fixed. IRQ1 is level 1, IRQ2 is level 2 and so on. So there's no need to configure an Interrupt Control Register (ICR). However, you do still need to unmask the interrupt in IMRL:

MCF_INTC_IMRL &= ~MCF_INTC_IMRL_MASK1;


Hope this helps


Simon
0 Kudos

529 Views
Manju
Contributor I
Thanks Simon,
I wrote some function with respective to your guidance.Tell me is it works?is it correct???

__declspec(interrupt) void External_Int_handler()
{
// uint8 timer_count;
     
     Key_Pressed();
}

/*------------------------------------------------------------------------------*
    Setup the interrupt handler.
 *------------------------------------------------------------------------------*/

void External_setup_handler(unsigned short vec_index)
{
       /* For Sdram target */
       unsigned long **autovector = (unsigned long **)0x0;    // The Vector Base Address
      
       *(autovector + vec_index) = (unsigned long *) & External_Int_handler;
}

/*------------------------------------------------------------------------------*
    Set External Interrupt Values
 *------------------------------------------------------------------------------*/
void Start_External_interrupt()
{
      //#################################################
   
    MCF_EPORT_EPPAR = MCF_EPORT_EPPAR_EPPA1(0x1);
    MCF_EPORT_EPDDR = 0;
    MCF_EPORT_EPIER = MCF_EPORT_EPIER_EPIE1;
   
    if(Output_Value & 0x04)
    {
        External_setup_handler(0x41);     // SLT0 0x76 is the index in the vector table where
    }
    else
    {
        nop();
    }
    //#################################################
}


This is my program for external interrupt.i'm not surewhat is the vector index for external interrupt.....
please check my concept and tell me if any errors...

Waiting to know abt my program.

By



Message Edited by Manju on 2009-02-10 10:41 AM

Message Edited by Manju on 2009-02-10 10:42 AM
0 Kudos

529 Views
SimonMarsden_de
Contributor II

Hello Manju

Looks roughly right. You have the correct vector (65, or 0x41) for IRQ1.

Did you remember to unmask the interrupt?

MCF_INTC_IMRL &= ~MCF_INTC_IMRL_MASK1;

The setting for what causes the IRQ to trigger (e.g. leading edge transition) which you're programming in MCF_EPORT_EPPAR will depend on your hardware/application - my code was just an example.

Best thing is to try the code and see it if works :smileywink:


Simon
0 Kudos

529 Views
Manju
Contributor I
Thank you so much for verifying my code Simon,

I will definitely check and verify the code.......

Thanks a lot yr.....
0 Kudos