Page 1 of 1

IRQ1 low-level trigger

Posted: Mon Aug 06, 2012 11:38 pm
by zhangjie5168
I wanna set the pin IRQ1 of the MOD5282 low-level trigger,but i don't know whether it can do and how to do it.
I am looking forward to receiving your answer.

Thank you so much!

Re: IRQ1 low-level trigger

Posted: Tue Aug 07, 2012 12:15 am
by roland.ames
It can be done.

Have a look at the Freescale Manual for the MCF5282, provided in the docs folder.
You should look at the chapter describing the Edge Port Module, as this covers IRQ inputs.
Specifically the EPPAR , which configures each of IRQ1 - IRQ7 independently.
IRQ1 can be configured as a level-sensitive interrupt input, active low.

Re: IRQ1 low-level trigger

Posted: Tue Aug 07, 2012 6:23 am
by Ridgeglider

Re: IRQ1 low-level trigger

Posted: Thu Sep 13, 2012 7:41 pm
by zhangjie5168
roland.ames wrote:It can be done.

Have a look at the Freescale Manual for the MCF5282, provided in the docs folder.
You should look at the chapter describing the Edge Port Module, as this covers IRQ inputs.
Specifically the EPPAR , which configures each of IRQ1 - IRQ7 independently.
IRQ1 can be configured as a level-sensitive interrupt input, active low.
this is my program:
INTERRUPT(out_irq1_pin_isr, 0x2600 )
{
sim.eport.epfr=0x02; /* Clear the interrupt edge 0 0 0 0 0 0 1 0 */
OSSemPost(&IrqPostSem);
}
{
sim.eport.eppar= 0x0000; /* 00 00 00 00 00 00 00 00 see table
11-13 in UM
00 Pin IRQx level-sensitive
01 Pin IRQx rising edge triggered
10 Pin IRQx falling edge triggered
11 Pin IRQx both falling edge and rising edge triggered*/

sim.eport.epddr= 0x0 ; /* All edge port pins as inputs */
sim.eport.epier = 0x0002; /* Enable IRQ1 only 0 0 0 0 0 0 1 0 */

SetIntc( 0,/* The first interrupt controller */
( long)&out_irq1_pin_isr, /* Our interrupt function */
1, /* The vector number from the users manual table 10-13 */
1, /* Set this to priority 1 but any value from 1 to 6 would
be valid.*/
1 /* The priority within the gross levels; see chapter 10, any
value from 0 to 7 is ok */
);

}

in this program,I set the IRQ1 as level-sensitive,in my board,when I set the IRQ1 as low level(logic 0),the program can enter the "INTERRUPT(out_irq5_pin_isr, 0x2600 )",and when I set the IRQ1 as high level(logic 1) ,the program didn't jump out the "INTERRUPT(out_irq5_pin_isr, 0x2600 )",so what wrong in the program?

Additional,I am Chinese user,and my English is poor,please understanding
thank you very much!

Re: IRQ1 low-level trigger

Posted: Thu Sep 13, 2012 8:39 pm
by roland.ames
First you must decide whether you want level-sensitive or edge-sensitive triggering.
The demo you have copied is for an edge-sensitive interrupt.
I had originally assumed you were interested in level-sensitive interrupts.

Perhaps if you gave me some idea of the device you want to connect to the IRQ line, I could help.

In general, if it is a simple push-button, you would need edge-sensitive triggering.
If the device continues to drive the IRQ line low until some action is taken by the processor, then level-sensitive triggering could be used.

Also the interrupt routine should always return immediately, it will not wait until the IRQ line goes inactive before returning.
In the demo the interrupt routine posts to a semaphore then returns. The main task will have to pend on the semaphore and take whatever action is required. The processor should not be spending a lot of time in the interrupt routine.

The interrupt routine is triggered by the state of the IRQ pin, and executed immediately. If it is level-sensitive, it will be executed repeatedly while the IRQ pin is low.

Re: IRQ1 low-level trigger

Posted: Thu Sep 13, 2012 9:50 pm
by zhangjie5168
[img]C:\Documents%20and%20Settings\HICOM\桌面[/img]

The schematic IRQ1_test is my test circuit for IRQ1 level-sensitive triggering.
and I set "sim.eport.eppar= 0x0000;"//set the IRQ1 level-sensitive.

The interrupt routine is triggered by the state of the IRQ pin, and executed immediately. If it is level-sensitive, it will be executed repeatedly while the IRQ pin is low. However,when I release the button
(IRQ1 pin is high),the interruput routine executed forever.

Re: IRQ1 low-level trigger

Posted: Fri Sep 14, 2012 12:29 am
by v8dave
The issue you have is to do with key bounce. The switch you are using is most likely generating contact bounce for approx 10-20ms after you press or release it.

This will cause the interrupt to re-trigger if you don't have a way to ignore them.

To handle this you will need to use a timer to ignore any interrupts within this time period or if you can, use a key debounce IC with your switch.

Dave...