This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Interrupt priority query

I am currently using timer2 count a number of preset timeouts on an AC waveform for an AC regulator.

I have given timer2 the highest interrupt priority, but have found that occasionally timer1 (used for generally polling), which is at a lower priority level, interrupts timer2's routine.

I have run the debugger; timer2's priority is definitely greater than timer1.

I have been sure to clear the timeout flag before the pending flag is cleared at the end of each timer interrupt function.

Have I misunderstood? The impression I got from the manual is that a lower priority will only execute after the higher priority has exited its interrupt?

  • Sorry I didn't mention this. I am using the ARM712.

  • I don't know anything about the ARM specifically and I guess you've read the manuals, but some systems use low numbers for high priorities and vice versa, or low numbers for low priorities etc.
    Could be that timer1 has a higher priority even though the numbering scheme suggests otherwise.

    ...just a wild guess.

    Regards,
    Joost Leeuwesteijn

  • Thanks for the reply.

    No the ARM712 has 15 distinct priority levels spanning from 1 to 15. The manual specifically states that 15 is the highest priority and 1 is the lowest.

    From what I understand there is also a 0 priority level, this is the level of the standard (non-interrupt) routine. If you think logically this would confirm 15 is the highest, since I would think normal run time should have a lower priority than any interrupt?

  • Hi,
    Atleast In the LPC series using ARM7 have 15 as lowest priority.
    Also in general the ARM7 priority mechanism is to have lower the number higher the priority. Ref: ARM manual.

    Suvidh

  • I managed to solve the problem today.

    For those that are interested, the priority structure is 15 highest 1 lowest.

    The point that was messing me around is that a higher priority interrupt will win over lower priority but only after whatever interrupt is active is complete.

    A higher priority interrupt will not interrupt a lower priority until the lower priorities pending flag is cleared, signifying it has been serviced.

    In order to have a higher priority interrupt a lower priority while it is running you need to look at nested interrupts. Be aware that nested interrupts take up more resources.