GPIO interupts

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

GPIO interupts

541 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Mon Feb 09 08:06:05 MST 2015
Could I have some clarification how the GPIO interrupts work on the LPC11E37.

I have 8 interrupts - PINTSEL determines which pin activates which interrupt.

Then for each interrupt I have PIN INTERRUPT MODE register (PMODE) which determines if each interrupt is level or edge sensitive.

Then I have a "Pin interrupt level (rising edge) interrupt enable register", a "Pin interrupt active level (falling edge) interrupt enable register", a "Pin interrupt rising edge register", a "Pin interrupt falling edge register" and finally a "Pin interrupt status register".

The manual says that the bits in the interrupt enable registers enable the interrupt (which makes sense), but do I also have to have bits set in the ISEL register before the interrupt will actually work?

If I didn't want interrupts, but just wanted to poll in software to find whether there had been a rising edge or not, presumably I would look in the "pin interrupt rising edge register", but would I have to set bits in the "Pin interrupt level (rising edge) interrupt enable register" to make it work?
Labels (1)
0 Kudos
4 Replies

470 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Mon Feb 09 17:45:25 MST 2015
Ian,

Note that you can indeed just poll the IRQ status register, as long as you've not enabled the PININT in the NVIC, you will not get an actual interrupt from the PININT peripheral.

Regards,
Wouter
0 Kudos

470 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Mon Feb 09 16:25:07 MST 2015
Hi, lanB,
You can find the definition of Chip_GPIO_SetPinModeEdge in the lib_lpc_chip_xxx project.
You can debug into this function or search within the workspace to find its definition. Once you find this function's definition, things will be easier.
regards,
0 Kudos

470 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Mon Feb 09 14:09:23 MST 2015
I looked at the LPC OPEN reference and all I could find was that functions with names like "Chip_GPIO_SetPinModeEdge" get called a lot, but I couldn't find what they actually do.

Polling in software to find an edge is not a trivial process.
1. Read old port value from memory. Read GPIO port.
2. ExOR (or AND or BICS, depending if I want both edges, falling or rising) old value with new value.
3. Store new value back to memory for next time.
4. Mask the bits I am interested in.

All this takes time, and I would like to accomplish it in fewer instructions, hence if I can read from one register to find if there was an edge since the last poll, then it would be preferable.
0 Kudos

470 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Mon Feb 09 08:32:49 MST 2015
Hi IanB,

We actually have a grouped GPIO interrupt example for the LPC11xxx series that would be a great reference for your questions:

http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc11xx-packages-0

Also, if you did not want interrupts and want to poll in software, is there a reason why you can not just poll the value of any GPIO pin for a certain edge?
0 Kudos