How to code GPIO interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to code GPIO interrupt

Jump to solution
6,894 Views
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!

Labels (2)
1 Solution
5,861 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

8 Replies
5,861 Views
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 Kudos
Reply
5,861 Views
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 Kudos
Reply
5,861 Views
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 Kudos
Reply
5,861 Views
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 Kudos
Reply
5,861 Views
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 Kudos
Reply
5,862 Views
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!
-----------------------------------------------------------------------------------------------------------------------

5,861 Views
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!

5,861 Views
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 Kudos
Reply