Application Timer RTC1 with Critical sections

Hello Nordic-Support Team,

i have a question regarding the Application Timer as said in your documentation here:

https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__app__timer.html

I am using an instance of the application timer as the timebase of an own Timer module which distributes different timings to other Software Modules.

Said timer uses a linked list for handling the different timers, thus a Critical Section Enter and Leave is required for the operation on the linked list.

Is there a possibilty to enable/disable the interrupt source of the Application Timer (RTC1)?

I just found the global macros "___enable_irq()" and "___disable_irq()", but i dont want to shutdown all interrupts in the controller since my concern is just the RTC1- Interrupt.

Thanks four help!

Kind regards,

Jan Schmale

Parents
  • Hi Jan, 
    I'm sorry that I don't fully understand your set up. 
    Could you explain why you want to 

    Is there a possibilty to enable/disable the interrupt source of the Application Timer (RTC1)?

    What exactly is your challenge with the timer ? 

  • Hi Hung,

    no worries, first of all the Application Timer is running fine.

    I dont want to go into detail, since this would not help at all, instead let me reframe my question.

    Is there a possibilty to disable/mask out the RTC1-timer Interrupt? Just the RTC1-Timer, since I dont want to disable the global interrupts.

    I know that i can "Pause" and "Resume" the application timer via the API, but this would result in a shift of the timebase, which I would like to avoid.

  • Ok, I see what you meant.
    You can call NRFX_IRQ_DISABLE(RTC1_IRQn) to disable the interrupt from IRQ1. 

    However, I don't think it's a good idea since it may mess up the compare event handling. As you can see in the IRQ handler: 

    Not having the CC counter handling correctly the app_timer may not work correctly after you enable the RTC1 interrupt again. 
    Have you considered using the app timer with the scheduler ? The RTC interrupt may still come but the timeout handler will come on main context. 
    Another option is to consider put the RTC interrupt at lower priority than the code you plan to execute. 

Reply
  • Ok, I see what you meant.
    You can call NRFX_IRQ_DISABLE(RTC1_IRQn) to disable the interrupt from IRQ1. 

    However, I don't think it's a good idea since it may mess up the compare event handling. As you can see in the IRQ handler: 

    Not having the CC counter handling correctly the app_timer may not work correctly after you enable the RTC1 interrupt again. 
    Have you considered using the app timer with the scheduler ? The RTC interrupt may still come but the timeout handler will come on main context. 
    Another option is to consider put the RTC interrupt at lower priority than the code you plan to execute. 

Children
No Data
Related