IRQ1 low-level trigger

Discussion to talk about software related topics only.
Post Reply
zhangjie5168
Posts: 6
Joined: Sun Aug 05, 2012 8:27 pm
Location: tianjin China

IRQ1 low-level trigger

Post 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!
roland.ames

Re: IRQ1 low-level trigger

Post 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.
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: IRQ1 low-level trigger

Post by Ridgeglider »

zhangjie5168
Posts: 6
Joined: Sun Aug 05, 2012 8:27 pm
Location: tianjin China

Re: IRQ1 low-level trigger

Post 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!
Last edited by zhangjie5168 on Thu Sep 13, 2012 10:18 pm, edited 2 times in total.
roland.ames

Re: IRQ1 low-level trigger

Post 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.
zhangjie5168
Posts: 6
Joined: Sun Aug 05, 2012 8:27 pm
Location: tianjin China

Re: IRQ1 low-level trigger

Post 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.
Attachments
IRQ1_test.jpg
IRQ1_test.jpg (56.27 KiB) Viewed 4760 times
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: IRQ1 low-level trigger

Post 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...
Post Reply