How to code GPIO interrupt

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

How to code GPIO interrupt

跳至解决方案
5,355 次查看
drkart
Contributor II

Hi,

Ive been trying for days to use a gpio as an interrupt, specifically, PIO4_7. I’ve tried using it following the gint and pint examples from the sdk with no luck. I have the evaluation board for the LPC54628. I’ve also tried following generic cortex m4 examples online.

Can someone help explain the general steps to enable any gpio as an interrupt?

thank you!

标签 (2)
1 解答
4,322 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Kimble, 

Sorry for the misunderstood. Using pin 7 on port 4 as an interrupt is not possible. Please refer the user manual (UM10912.pdf) chapter 12, you will find the following information:

pastedImage_1.png

All the eight pins that can be selected as a pin interrupt mus be from port 0 or 1. That's the reason why in the examples we provide with the SDK we only use pins of those two ports. 

Hope it helps!

Victor.

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

在原帖中查看解决方案

8 回复数
4,322 次查看
florentfortin
Contributor I

picturemessage_4l535ii1.kgw.png

Please update the LPC546xx datasheet too...
This description let us know we can get interruption from all ports, instead of only port0 and port 1!

0 项奖励
4,322 次查看
karimboallal
Contributor I

Hello,

I'm using an LPC54606 and I had the same problem.

I would like to use a Pint on PIO4_25 and I thought that it was possible bescause it's not totaly clear in User Manual.

Indeed when we look at the "Pin interrupt select registers" (table 262 pages 202 and 203), in the description it's not wrote that it is exclusively reserved for PIO0_0 to PIO1_31, espacially as 6 bits would have been enough to count from 0 to 63. And even more when it is writen in the datasheet  (on page 67) that: "all GPIO pins can be selected to create an edge or level-sensitive GPIO interrupt request".

I don't know where I can talk about this but: I have also find a "misprint" in the User Manual (on page 313) about the reference table for clearing the timer reset. Indeed the table 234 is for CTIMER 3 and 4 not for CTIMER0 and 1. And the table 130 is for CTIMER0, 1 and 2 not for CTIMER3 and 4.

Best Regards,

Karim.

0 项奖励
4,322 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Karim,

The user manual was recently updated, please download the newest version.

Regarding table 262 from the user manual please noticed that in the description it's written that it is exclusively reserved for PIO0_0 to PIO1_31.

pastedImage_1.png

I already reported the issue regarding the following statement on the datasheet.

all GPIO pins can be selected to create an edge or level-sensitive GPIO interrupt request.

 

Regards,

Victor.

0 项奖励
4,322 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Kimble,

Please keep in mind that PIO4_7 is mapped to JP13 and depending how JP13 is connected is the functionality of the pin. See image below.

pastedImage_1.png

For your case you need to connect JP13 to 1 and 2, this way you can configure this pin as a GPIO interrupt, otherwise, the interrupt will never be triggered. Did you keep this in mind while making your project? 

Let me know the results! 

Victor.

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

0 项奖励
4,322 次查看
drkart
Contributor II

Hi Victor,

I had checked that already, in fact it was jumpered that  way (1->2) from the factory.

Do you know the 4-5 steps that i would do to enable with pin as an interrupt ? Like i mention in the original post, following the examples from NXP i can only get pins on ports 0 and 1 to work (which is how the examples seem to be set up). I cannot get any pin that is not on those ports to work.

I think it is a coding issue, but I don't know where and i have been going through as much documentation and trying everything i can to get it to work, still no luck :smileysad:

Thank you!

Dustin

0 项奖励
4,323 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Kimble, 

Sorry for the misunderstood. Using pin 7 on port 4 as an interrupt is not possible. Please refer the user manual (UM10912.pdf) chapter 12, you will find the following information:

pastedImage_1.png

All the eight pins that can be selected as a pin interrupt mus be from port 0 or 1. That's the reason why in the examples we provide with the SDK we only use pins of those two ports. 

Hope it helps!

Victor.

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

4,322 次查看
drkart
Contributor II

Victor,

Thanks for clearing that up and providing that user manual, it helps me a lot! The manual I have been referring to is from january 2018 doesn't have as much clarification... but it looks like this is because I've been using the board user manual.

Is there a way to "re-route" pins to different ports (I was playing with the mcu pin config tool, that's why i ask)?

(this way i can use those header connections)

Thanks again!

4,322 次查看
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Kimble! 

There are separate manuals for the development board and for the MCU. For all the technical information you should reference the MCU user manual (the one I posted before) the board user manual as you probably notice is only for the configurations of the board (connections, jumpers, etc.). You can find all the information regarding this MCU in the following link: 

Regarding the question you make. It's not possible to "re-route" pins to different ports. The MCU pin config tool is for something completely different. In the following link:

In the section Features you can see what you can do with this tool. In documentation you will find all the technical information regarding this tool.   

Hope it helps!

Victor.

0 项奖励