Not able to configure P4_6 pin as input interrupt on mcxn947

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not able to configure P4_6 pin as input interrupt on mcxn947

Jump to solution
541 Views
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?

Labels (2)
0 Kudos
Reply
1 Solution
521 Views
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.

 

View solution in original post

0 Kudos
Reply
2 Replies
522 Views
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 Kudos
Reply
517 Views
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 Kudos
Reply
%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%20%3CBR%20%2F%3E%23define%20CINT_PORT%20PORT4%20%3CBR%20%2F%3E%23define%20CINT_PIN%206U%20%3CBR%20%2F%3E%23define%20CINT_IRQ%20GPIO40_IRQn%20%3CBR%20%2F%3E%23define%20CINT_IRQ_HANDLER%20GPIO40_IRQHandler%3C%2FP%3E%3CP%3ECLOCK_EnableClock(kCLOCK_Gpio4)%3B%20%3CBR%20%2F%3ECLOCK_EnableClock(kCLOCK_Port4)%3B%20%3CBR%20%2F%3EGPIO_SetPinInterruptConfig(CINT_GPIO%2C%20CINT_PIN%2C%20kGPIO_%20InterruptFallingEdge)%3B%20%3CBR%20%2F%3ENVIC_EnableIRQ(CINT_IRQ)%3B%20%3CBR%20%2F%3Egpio_pin_config_t%20sw1_config%20%3D%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3EkGPIO_DigitalInput%2C%20%3CBR%20%2F%3E0%2C%20%3CBR%20%2F%3E%7D%3B%20%3CBR%20%2F%3E%2F*%20Sets%20the%20input%20pin%20configuration%20*%2F%20%3CBR%20%2F%3EGPIO_PinInit(CINT_GPIO%2C%20CINT_PIN%2C%20%26amp%3Bsw1_config)%3B%20%3CBR%20%2F%3EPRINTF(%20%22Init%20CINT%5Cr%5Cn%20%22)%3B%3C%2FP%3E%3CP%3Evoid%20CINT_IRQ_HANDLER(void)%20%3CBR%20%2F%3E%7B%20%3CBR%20%2F%3EGPIO_GpioClearInterruptFlags(CINT_GPIO%2C%201U%20%26lt%3B%26lt%3B%20CINT_PIN)%3B%20%3CBR%20%2F%3Eg_touch%20%3D%20true%3B%20%3CBR%20%2F%3ESDK_ISR_EXIT_BARRIER%3B%20%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%3EHi%20%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%2C%3CBR%20%2F%3EThanks%20for%20confirming.%3CBR%20%2F%3EI'm%20having%20an%20issue%20setting%20up%20the%20P4_6%20pin%20as%20an%20input%20interrupt.%20The%20same%20code%20works%20fine%20when%20I%20configure%20it%20for%20Port%200%20pins%2C%20but%20it%20doesn't%20seem%20to%20work%20for%20P4_6.%3CBR%20%2F%3ECan%20all%20pins%20on%20the%20MCXN947%20be%20configured%20as%20GPIO%20input%20interrupts%3F%3CBR%20%2F%3EAny%20assistance%20would%20be%20appreciated.%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%3EHi%26nbsp%3B%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%2C%3C%2FP%3E%0A%3CP%3EThat%20is%20correct.%20Each%20GPIO%20has%20two%20interrupt%20vectors%3B%20one%20for%20each%20half%20of%20the%2032%20pins%20per%20port.%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E