Multiple GPIO interrupts

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

Multiple GPIO interrupts

ソリューションへジャンプ
4,052件の閲覧回数
albt
Contributor II

Hi everyone,

I am a bit lost with the GPIO interrupts configuration, I hope you can guide me. (I actually use the KL02Z32VFM4 processor and IAR as a Software Tool)

I would like to activate two different input pins with different interrupt routines, specifically PTB3 and PTB4 pins.

At this moment I have one of the interrupt pins working (PTB3) with its own interrupt routine. I use the PORTB_IRQHandler, but I do not know how to configure the processor to distinguish between the two interrupt port pins.

Are there different IRQHandlers to differentiate between these two GPIO pins? Do I have to check the specific inturrupted pin in the same IRQHandler routine? What is the proper way of doing it?

Thanks a lot for your help.

ラベル(1)
1 解決策
2,529件の閲覧回数
lucianomoretti
Contributor IV

My understanding is there is only one interrupt for the port and then in the Port ISR you have to read the Interrupt Status Flag Register for the port to figure out what pin caused the interrupt.

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
2,529件の閲覧回数
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Andres L. Bleda

Yes, as mentioned Luciano you have to differenciate the pin by the interrupt status Flag, for example for the PORTB that you mentioned

void PORTB_IRQHandler(void){

    if (PORTB_ISFR & (1<<3)){

        PORTB_ISFR |= (1<<3);

        /* your code here */

    }

    if (PORTB_ISFR & (1<<4)){

        PORTB_ISFR |= (1<<4);

        /* your code here */

    }

}

Hope this helps
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,530件の閲覧回数
lucianomoretti
Contributor IV

My understanding is there is only one interrupt for the port and then in the Port ISR you have to read the Interrupt Status Flag Register for the port to figure out what pin caused the interrupt.

0 件の賞賛
返信
2,528件の閲覧回数
mjbcswitzerland
Specialist V

Hi

I have attached the port interface from the uTasker project which shows how to handle individual interrupts (or DMA) on each GPIO.

For an overview of the interface see: http://www.utasker.com/kinetis/LLWU.html (which also shows how LLWU ports can be defined if required)

This works on all K, KL, KE, etc. parts (with some restrictions in case some devices don't support specific capabilities).

You can also take a complete IAR project and simulate the behaviour (for cheking or analysis of detailed operation) in its KL simulator if highest developent efficiency is of concern: http://www.utasker.com/kinetis/FRDM-KL02Z.html

Regards

Mark