Not able to configure P4_6 pin as input interrupt on mcxn947

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

Not able to configure P4_6 pin as input interrupt on mcxn947

跳至解决方案
554 次查看
sstcor
Contributor II

#define CINT_GPIO GPIO4
#define CINT_PORT PORT4
#define CINT_PIN 6U
#define CINT_IRQ GPIO40_IRQn
#define CINT_IRQ_HANDLER GPIO40_IRQHandler

CLOCK_EnableClock(kCLOCK_Gpio4);
CLOCK_EnableClock(kCLOCK_Port4);
GPIO_SetPinInterruptConfig(CINT_GPIO, CINT_PIN, kGPIO_InterruptFallingEdge);
NVIC_EnableIRQ(CINT_IRQ);
gpio_pin_config_t sw1_config =
{
kGPIO_DigitalInput,
0,
};
/* Sets the input pin configuration */
GPIO_PinInit(CINT_GPIO, CINT_PIN, &sw1_config);
PRINTF("Init CINT\r\n");

void CINT_IRQ_HANDLER(void)
{
GPIO_GpioClearInterruptFlags(CINT_GPIO, 1U << CINT_PIN);
g_touch = true;
SDK_ISR_EXIT_BARRIER;
}

 

Does GPIO00_IRQn maps to port 0 pins 0-15 and GPIO01_IRQn to 16-31?

标签 (2)
0 项奖励
回复
1 解答
534 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @sstcor,

That is correct. Each GPIO has two interrupt vectors; one for each half of the 32 pins per port.

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
535 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @sstcor,

That is correct. Each GPIO has two interrupt vectors; one for each half of the 32 pins per port.

 

0 项奖励
回复
530 次查看
sstcor
Contributor II
Hi @EdwinHz,
Thanks for confirming.
I'm having an issue setting up the P4_6 pin as an input interrupt. The same code works fine when I configure it for Port 0 pins, but it doesn't seem to work for P4_6.
Can all pins on the MCXN947 be configured as GPIO input interrupts?
Any assistance would be appreciated.
0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2134392%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ENot%20able%20to%20configure%20P4_6%20pin%20as%20input%20interrupt%20on%20mcxn947%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2134392%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3E%23define%20CINT_GPIO%20GPIO4%3CBR%20%2F%3E%23define%20CINT_PORT%20PORT4%3CBR%20%2F%3E%23define%20CINT_PIN%206U%3CBR%20%2F%3E%23define%20CINT_IRQ%20GPIO40_IRQn%3CBR%20%2F%3E%23define%20CINT_IRQ_HANDLER%20GPIO40_IRQHandler%3C%2FP%3E%3CP%3ECLOCK_EnableClock(kCLOCK_Gpio4)%3B%3CBR%20%2F%3ECLOCK_EnableClock(kCLOCK_Port4)%3B%3CBR%20%2F%3EGPIO_SetPinInterruptConfig(CINT_GPIO%2C%20CINT_PIN%2C%20kGPIO_InterruptFallingEdge)%3B%3CBR%20%2F%3ENVIC_EnableIRQ(CINT_IRQ)%3B%3CBR%20%2F%3Egpio_pin_config_t%20sw1_config%20%3D%3CBR%20%2F%3E%7B%3CBR%20%2F%3EkGPIO_DigitalInput%2C%3CBR%20%2F%3E0%2C%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%2F*%20Sets%20the%20input%20pin%20configuration%20*%2F%3CBR%20%2F%3EGPIO_PinInit(CINT_GPIO%2C%20CINT_PIN%2C%20%26amp%3Bsw1_config)%3B%3CBR%20%2F%3EPRINTF(%22Init%20CINT%5Cr%5Cn%22)%3B%3C%2FP%3E%3CP%3Evoid%20CINT_IRQ_HANDLER(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3EGPIO_GpioClearInterruptFlags(CINT_GPIO%2C%201U%20%26lt%3B%26lt%3B%20CINT_PIN)%3B%3CBR%20%2F%3Eg_touch%20%3D%20true%3B%3CBR%20%2F%3ESDK_ISR_EXIT_BARRIER%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EDoes%20GPIO00_IRQn%20maps%20to%20port%200%20pins%200-15%20and%20GPIO01_IRQn%20to%2016-31%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2134392%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EFRDM-Training%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMCXN%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2135201%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Not%20able%20to%20configure%20P4_6%20pin%20as%20input%20interrupt%20on%20mcxn947%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2135201%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E6%82%A8%E5%A5%BD%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186731%22%20target%3D%22_blank%22%3E%40EdwinHz%3C%2FA%3E%EF%BC%8C%3CBR%20%2F%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E7%A1%AE%E8%AE%A4%E3%80%82%3CBR%20%2F%3E%E6%88%91%E5%9C%A8%E5%B0%86%20P4_6%20%E5%BC%95%E8%84%9A%E8%AE%BE%E7%BD%AE%E4%B8%BA%E8%BE%93%E5%85%A5%E4%B8%AD%E6%96%AD%E6%97%B6%E9%81%87%E5%88%B0%E4%BA%86%E9%97%AE%E9%A2%98%E3%80%82%E5%BD%93%E6%88%91%E4%B8%BA%E7%AB%AF%E5%8F%A3%200%20%E5%BC%95%E8%84%9A%E8%BF%9B%E8%A1%8C%E9%85%8D%E7%BD%AE%E6%97%B6%EF%BC%8C%E5%90%8C%E6%A0%B7%E7%9A%84%E4%BB%A3%E7%A0%81%E5%B7%A5%E4%BD%9C%E6%AD%A3%E5%B8%B8%EF%BC%8C%E4%BD%86%E5%AF%B9%E4%BA%8E%20P4_6%20%E4%BC%BC%E4%B9%8E%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%E3%80%82%3CBR%20%2F%3EMCXN947%20%E7%9A%84%E6%89%80%E6%9C%89%E5%BC%95%E8%84%9A%E9%83%BD%E8%83%BD%E9%85%8D%E7%BD%AE%E4%B8%BA%20GPIO%20%E8%BE%93%E5%85%A5%E4%B8%AD%E6%96%AD%E5%90%97%EF%BC%9F%3CBR%20%2F%3E%E5%A6%82%E8%83%BD%E6%8F%90%E4%BE%9B%E4%BB%BB%E4%BD%95%E5%B8%AE%E5%8A%A9%EF%BC%8C%E5%B0%86%E4%B8%8D%E8%83%9C%E6%84%9F%E6%BF%80%E3%80%82%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2135198%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Not%20able%20to%20configure%20P4_6%20pin%20as%20input%20interrupt%20on%20mcxn947%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2135198%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%97%A8%EF%BC%8C%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248726%22%20target%3D%22_blank%22%3E%40sstcor%3C%2FA%3E%E3%80%81%3C%2FP%3E%0A%3CP%3E%E6%B2%A1%E9%94%99%E3%80%82%E6%AF%8F%E4%B8%AA%20GPIO%20%E6%9C%89%E4%B8%A4%E4%B8%AA%E4%B8%AD%E6%96%AD%E5%90%91%E9%87%8F%EF%BC%9B%E6%AF%8F%E4%B8%AA%E7%AB%AF%E5%8F%A3%E7%9A%84%2032%20%E4%B8%AA%E5%BC%95%E8%84%9A%E5%90%84%E5%8D%A0%E4%B8%80%E5%8D%8A%E3%80%82%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E