LPC11U67 PININT confusion or Bug?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC11U67 PININT confusion or Bug?

746 次查看
lpcware
NXP Employee
NXP Employee
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!
标签 (1)
0 项奖励
回复
1 回复

617 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Wed May 04 12:55:53 MST 2016
I struggled with this too, but on an LPC1517.  The user manual is correct in describing the registers, but the LPCOpen function names are very misleading when using level triggered interrupts.

I am using an LPC1517 with 3 push-buttons wired to 3 separate pin interrupt inputs.  The input is normally high, it goes low when the button is pressed.

/* When using level sensitive interrupts, some LPCOpen function names are misleading: */
/* Next function sets level sensitive inputs (ISEL register) */
Chip_PININT_SetPinModeLevel(LPC_GPIO_PIN_INT, (SW_UP_PINTCH | SW_DOWN_PINTCH | SW_MODE_PINTCH) );
/* Next function enables level sensitive interrupts (HIGH or LOW) when level sensitive interrupts are used.
 * (by setting bits in IENR.) It does not define the level that triggers the interrupt.  */
Chip_PININT_EnableIntHigh(LPC_GPIO_PIN_INT, (SW_UP_PINTCH | SW_DOWN_PINTCH | SW_MODE_PINTCH) );
/* Next function sets a level sensitive interrupt to trigger when input is LOW. (Clears IENF bits.)  */
Chip_PININT_DisableIntLow(LPC_GPIO_PIN_INT, (SW_UP_PINTCH | SW_DOWN_PINTCH | SW_MODE_PINTCH) );




0 项奖励
回复