AnsweredAssumed Answered

Clear Status Flags during ISR

Question asked by whata on May 22, 2017
Latest reply on May 22, 2017 by Mark Butcher

Hi, 

 

I'm using a MKL26Z128VLH4  (I'm using KSDK 2.2 and MCUXpresso 10.0) in a application where I have multiple peripherals working in a interrupt based fashion and I have a copuple of questions: 

 

1. When multiple peripherals operating in interrupt mode is it necessary to set-up interrupt priorities by using NVIC?

NVIC_SetPriority ()

2. After looking at the examples for various peripherals I see that in several peripherals the source of the interrupt is not cleared during the ISR, such as UART example \boards\frdmkl26z\driver_examples\uart\interrupt. Is that kind of usage correct? I thought that interrupt source needs to be cleared prior to exiting the ISR to avoid having false re-entry. Or is reading back the status register somehow automatically clears pending interrupt source flags? 

 

So, for instance, during the PIT interrupt is the following piece of code correct? Or should I do a read on status before clearing the flag? I'm a bit confused on general guidelines for correctly exiting the ISRs.

 

/*!
* @brief Interrupt handler for timer
*/

void PIT_IRQHandler (void) {
     PIT_ClearStatusFlags (PIT, kPIT_Chnl_1, kPIT_TimerFlag);
     PIT_StopTimer (PIT, kPIT_Chnl_1);
}

Outcomes