Hello ,
I am trying to write an ISR routine on s32k148 eval board and would want that it detects the switch (PTC 13 on rising edge) and toggle the output BLUE LED (PORTE 23), but I see the blue LED glowing but the Interrupt is not getting detected when the SW4 is pressed.
So could you please let know if I have missed something.
The below is the sample code.
Config from the processor expert.
{
.base = PORTC,
.pinPortIdx = 12u,
.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.passiveFilter = false,
.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.mux = PORT_MUX_AS_GPIO,
.pinLock = false,
.intConfig = PORT_INT_RISING_EDGE,
.clearIntFlag = true,
.gpioBase = PTC,
.direction = GPIO_INPUT_DIRECTION,
},
{
.base = PORTE,
.pinPortIdx = 23u,
.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.passiveFilter = false,
.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.mux = PORT_MUX_AS_GPIO,
.pinLock = false,
.intConfig = PORT_DMA_INT_DISABLED,
.clearIntFlag = false,
.gpioBase = PTE,
.direction = GPIO_OUTPUT_DIRECTION,
},
void FS0B_ISR(void)
{
PINS_DRV_ClearPinIntFlagCmd(PORTC, (1<<13));
PINS_DRV_TogglePins(PTE, (1<<23));
}
main()
{
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
PINS_DRV_SetPinDirection(PTC, (1<<13), 0);
PINS_DRV_SetPins(PTE, (1<<23));
INT_SYS_InstallHandler(PORTC_IRQn, FS0B_ISR, (isr_t *)0);
INT_SYS_EnableIRQ(PORTC_IRQn);
PINS_DRV_SetPinIntSel(PORTC,(1<<13),PORT_INT_RISING_EDGE);
}
Hi,
here is simple example for GPIO Interrupt handler - https://community.nxp.com/docs/DOC-343587
Hope it helps.
Jiri