Hi,
I have push buttons connected to ground on pins PIO0_1, PIO0_3 and PIO0_11. I want to use GROUP INTs on all three pins. If I use only 1 and 3 - it works! But if I include 11 - it doesn't.
Any help or ideas are appreciated! (tried software polling - everything is OK, they work, no hardware problems)
Regards,
L. B.
===========================================================================
#include "board.h"
#include "uart.h"
void GINT0_IRQHandler(void)
{
Chip_GPIOGP_ClearIntStatus(LPC_GPIO_GROUP_INT0, 0);
DEBUGOUT("INT\n\r");
}
int main(void)
{
SystemCoreClockUpdate();
Board_Init();
init_uart();
DEBUGOUT("Starting ...\n\r");
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 1, IOCON_FUNC0 | IOCON_MODE_PULLUP);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 3, IOCON_FUNC0 | IOCON_MODE_PULLUP);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, IOCON_FUNC1 | IOCON_MODE_PULLUP);
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 1);
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 3);
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 11);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GROUP0INT);
Chip_GPIOGP_SelectLowLevel(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 1);
Chip_GPIOGP_SelectLowLevel(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 3);
Chip_GPIOGP_SelectLowLevel(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 11);
Chip_GPIOGP_EnableGroupPins(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 1);
Chip_GPIOGP_EnableGroupPins(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 3);
Chip_GPIOGP_EnableGroupPins(LPC_GPIO_GROUP_INT0, 0, 0, 1 << 11);
Chip_GPIOGP_SelectOrMode(LPC_GPIO_GROUP_INT0, 0);
Chip_GPIOGP_SelectEdgeMode(LPC_GPIO_GROUP_INT0, 0);
NVIC_EnableIRQ(GINT0_IRQn);
while (1) { }
return 0;
}
已解决! 转到解答。
It appears that pins with both analog and digital function cannot use only this:
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, IOCON_FUNC1 | IOCON_MODE_PULLUP);
they must enable the digital circuitry explicitly like this:
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGMODE_EN);
This solved the problem for me! Hope it will help others too!
Cheerz,
L. B.
It appears that pins with both analog and digital function cannot use only this:
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, IOCON_FUNC1 | IOCON_MODE_PULLUP);
they must enable the digital circuitry explicitly like this:
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, IOCON_FUNC1 | IOCON_MODE_PULLUP | IOCON_DIGMODE_EN);
This solved the problem for me! Hope it will help others too!
Cheerz,
L. B.
