LPC Open PININT assignment bug 11U68

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

LPC Open PININT assignment bug 11U68

452 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brownm on Mon Aug 11 02:33:40 MST 2014
Hi there

Page 52 of the user manual UM10732 states the following with regard to the assignment of PINSEL registers.
Pin Interrupt Select registers 0 to 7
The pin interrupt select register is an input mux for the pin interrupt and allows to select
any pin (except PIO2_8 to PIO2_23) as an external interrupt. A total of eight pin interrupt
are supported. Each of the eight PINTSEL registers selects one GPIO pin from the
following pins as external pin interrupt:
• Port 0: PIO0_0 to PIO0_23 (Pin number INTPIN = 0 to 23)
• Port 1: PIO1_0 to PIO1_31 (Pin number INTPIN = 24 to 55)
• Port 2: PIO2_0 to PIO2_7 (Pin number INTPIN = 56 to 63)
The selected pin of each PINTSEL register is connected to the corresponding pin interrupt
in the NVIC. The pin interrupt must be enabled using interrupt slots # 0 to 7 (see Table 6).
To enable each pin interrupt and configure its edge or level sensitivity, use the GPIO pin
interrupt registers (see Table 106).


syscon_11u6x.c
Has the following function in error.

/* 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);           <------------------ BADNESS HERE
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) ((port - 1) * 24 + pin);           <------------------SHOULD BE 24?????
}
}

Regards

Marshall
Labels (1)
0 Kudos
Reply
2 Replies

340 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brownm on Mon Aug 11 16:34:42 MST 2014
Thanks for this

My code was also flawed!

Regards
Marshall
0 Kudos
Reply

340 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Mon Aug 11 10:29:26 MST 2014
Indeed: http://www.lpcware.com/content/forum/bug-lpcopen-206-lpc11u67
0 Kudos
Reply