LPC11E6x Pin Interrupts not working

cancel
Showing results for 
Search instead for 
Did you mean: 

LPC11E6x Pin Interrupts not working

247 Views
danielribeiro
Contributor II

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.

0 Kudos
3 Replies

152 Views
danielribeiro
Contributor II

Hi, Alice!

Have you checked this issue?

0 Kudos

152 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Daniel,

Sorry I haven't find difference between the two functions you shown,

no matter PORT is 0 , 1 or 2, they are the same.

If I'm wrong, could you please tell me the different result.

0 Kudos

152 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Daniel Ribeiro,

Thanks for your sharing, I will check it!

BR

Alice

0 Kudos