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