Hello,
Currently Im working with the evaluation board TWR60n512 and Im trying to configure a GPIO interrupt using 26 pin of PORTE.
I can see that my interrupt is detected however when its happens the software is stopped.
Besides, the handler interrupt doesnt clear isfr register and isf flag
PORTE->PCR[26] &= PORT_PCR_MUX_MASK;
PORTE->PCR[26] |= PORT_PCR_MUX(1) | PORT_PCR_ISF_MASK | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK | PORT_PCR_IRQC(0x08);
PTE->PDDR &=~(1UL << 26);
NVIC_SetPriority(PORTE_IRQn, 26);
NVIC_ClearPendingIRQ(PORTE_IRQn);
NVIC_EnableIRQ(PORTE_IRQn);
void PORTE_IRQHandler (void)
{
NVIC_ClearPendingIRQ(PORTE_IRQn);
PORTE->PCR[26]|= PORT_PCR_ISF_MASK;
PORTE->ISFR = 0xffffffff;
}
Hi Edna
You are configuring PTE26 as level sensitive interrupt (logic state '0') so if you don't clear the input in the interrupt routine (eg. by commanding whatever external device that is applying the '0' to set it back to '1') the interrupt pending bit will always remain and the interrupt will keep entering.
If you prefer an edge interrupt instead program the PORT_PCR_IRQC() value accordingly.
A write to PORTE->ISFR is otherwise adequate to clear the interrupt.
NVIC_ClearPendingIRQ(PORTE_IRQn); and
PORTE->PCR[26]|= PORT_PCR_ISF_MASK;
can be removed.
Regards
Mark
Kinetis: µTasker Kinetis support
K60: µTasker Kinetis TWR-K60N512 support / µTasker Kinetis TWR-K60D100M support / µTasker Kinetis TWR-K60F120M support
For the complete "out-of-the-box" Kinetis experience and faster time to market