This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Serving lower priority interrupt

I have a basic question regarding the interrupt priority. I want to know if the lower priority is triggered while the higher priority interrupt is served, is the lower priority one ignored or is it pended to be served after the higher priority interrupt is handled?

Actually, the question is related to the RTC counter in my firmware that has the least priority and since it is only a 24-bit counter and I need to have a 32 bit counter, I want to accumulate its counter value in the overflow event. However, I do not want to miss this event. Since it has the minimum priority, can overflow interrupt be ignored if it occurs while any higher priority interrupt is served?

If this is the case, then what will be the solution to have a 32-bit counter? Because Soft device has reserved the highest priority and I cannot disable it. 

Should I switch to use the timers instead of the 24-bit RTC counter?

Parents
  • Hi,

    I want to know if the lower priority is triggered while the higher priority interrupt is served, is the lower priority one ignored or is it pended to be served after the higher priority interrupt is handled?

    The lower priority interrupt is pending and will be serviced when the higher priority interrupts have been serviced. However, there is no queuing of interrupts with the same IRQ number, so if more than one interrupt occurs, the later will be lost. This is part of the reason why it is always good practice to keep interrupt routines as short as possible.

    Actually, the question is related to the RTC counter in my firmware that has the least priority and since it is only a 24-bit counter and I need to have a 32 bit counter, I want to accumulate its counter value in the overflow event. However, I do not want to miss this event. Since it has the minimum priority, can overflow interrupt be ignored if it occurs while any higher priority interrupt is served?

     I do not see a practical problem here, particularly since the RTC counter is so slow. You should have plenty of time to service the RTC interrupt almost regardless of what else is happening in the system.

    If this is the case, then what will be the solution to have a 32-bit counter? Because Soft device has reserved the highest priority and I cannot disable it. 

     Soft device interrupts are short in time, and should not cause any problem. You can refer to Interrupt model and processor availability in the SoftDevice specification for details.

    Should I switch to use the timers instead of the 24-bit RTC counter?

     If you care about current consumption, then the answer is definitely no. And in any case, I do not understand how what you are concerned about could be a practical problem. If it is, then you have a serious problem with your interrupt routines and should fix that instead.

  • Hi again Einar,

    I did not want to start a new thread and that's why I m asking the question here that is maybe not completely relevant. Can you also please clarify if the RTC counter supports the input capture mode in NRF52840? Because I could not find any capture task like TIMER->TASKS_CAPTURE[x] for RTCs.

  • Hi,

    No, the RTC does not support capturing the counter value like the TIMER. You can always just read the counter register from SW though (after all, the RTC runs of the very slow 32.768 kHz LFCLK).

Reply Children
No Data
Related