0
\$\begingroup\$

I am a newbie and trying understand how high level interrupts are handled by a microcontroller. I am using a LPC1347 with Cortex M3 CPU. I understand how edge interrupts works but level interrupts has unexpected behaviours.

Until now I thought that a level interrupt is a notification that a device needs attention. As long as IRQ line is asserted we get an interrupt.

LPC1347 has different behaviours. Firstly I have to clear IRQ status which toggles the level type. For example if I set interrupt to high level and change the state of pin to high I get first interrupt, then I clear interrupt status and the interrupt type automatically toggles to the low so the next interrupt occurs when the state of pin toggles to the low. As a result I always have two interrupts; when the state of pin toggles from 0 to 1 and from 1 to 0.

Is this only a different concept of level interrupt handling or do I not understand it correctly?

\$\endgroup\$
0
\$\begingroup\$

You always have the possibility in the first interrupt routine to not reenable interrupts till you exit the service procedure. Then when you change the interrupt condition (within the service routine) clear out the pending interrupt status that pops up.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ But what if high level persists (for example) for several seconds? Then when I change the interrupt condition and clear out the pending status and exit the ISR the state of pin is still high and the interrupt condition is still low so new interrupt will fire when the state of pin will go low. \$\endgroup\$ – Mati33 Sep 25 '17 at 14:16
  • \$\begingroup\$ The solution then is to stop using level based interrupts. If you want to detect signal changes then use the edge triggered type interrupt. You cannot really have it both ways!! \$\endgroup\$ – Michael Karas Sep 25 '17 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.