GPIO Interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

GPIO Interrupt

1,841 次查看
ednasalazar
Contributor II

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;

}

标记 (4)
0 项奖励
回复
1 回复

659 次查看
mjbcswitzerland
Specialist V

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

0 项奖励
回复