Hi, NxP!
I was trying to use pin interrupts in the LPC11E6x and they worked for Port 0 but not for Port 1.
After (re)checking my code several times, I decided to check the NxP's LPCOpen package I'm using. It's the lpcopen_3_03_keil_iar_lpcxpresso_11e68.
In the syscon_11u6x.c file I found the following code :
/* Setup a pin source for the pin interrupts (0-7) */
void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin)
{
if (port == 0) {
/* Pins P0.1 to P0.23 only */
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) pin;
} else {
/* P1.1 to P1.31 and P2.0 to P2.7 */
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) ((port - 1) * 32 + pin + 24);
}
}
Shuldn't it be like the following?
/* Setup a pin source for the pin interrupts (0-7) */
void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin)
{
/* P0.0 to P0.23 and P1.0 to P1.31 */
if ( (port == 0) || (port == 1) ) {
/* Pins P0.1 to P0.23 only */
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) ((port * 24) + pin);
}
else {
/* P2.0 to P2.7 */
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) (56 + pin);
}
}
After these changes, all is working well.
If I'm right, I must admit that NxP's documentation is the best I ever see, as it allows you to quickly flag and to correct these errors easily.
Thanks in advance.