GPIO Interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

GPIO Interrupt

1,877件の閲覧回数
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 返信

695件の閲覧回数
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 件の賞賛
返信