lpcware

LPC11U67 PININT confusion or Bug?

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Belias on Thu Jun 26 05:07:33 MST 2014
I am new to the LPC11U67, and currently I'm getting the interrupts to work as level interrupts (for high input level).

I used the LPCOpen example codes as a reference, but there is only the example for edge interrupts.

So my first attempt was:
Chip_SYSCTL_SetPinInterrupt(ACC_PINT_CHANNEL, ACC_INT2_PORT, ACC_INT2_PIN);
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_SetPinModeLevel(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_EnableIntHigh(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));


which did not work. Then while reading the Datasheet i figured out, that Chip_PININT_ClearIntStatus inverts the level which the interrupt should respond to.

Ok next try:
Chip_SYSCTL_SetPinInterrupt(ACC_PINT_CHANNEL, ACC_INT2_PORT, ACC_INT2_PIN);
Chip_PININT_SetPinModeLevel(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_EnableIntHigh(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));

(clearing a level interrupt does not make sense anyways, so i thought it would be fine now)
But this did not work either.

Experimenting led me to this solution. No other solution did work for me:
Chip_SYSCTL_SetPinInterrupt(ACC_PINT_CHANNEL, ACC_INT2_PORT, ACC_INT2_PIN);
Chip_PININT_ClearIntStatus(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_SetPinModeLevel(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_EnableIntHigh(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));
Chip_PININT_EnableIntLow(LPC_PININT, PININTCH(ACC_PINT_CHANNEL));


I can not tell why this works, and it seems totaly non intuitive to me. (I also tried just to Enable Low, and invert with the clear method afterwards and everything that looked reasonable for me, but nothing worked except this)

What am I understanding wrong here? Or is this a Bug in either LPCOpen or the hardware itself?

Help is very much appreciated! Thanks!

Outcomes