I am trying to install an interrupt handler for GPIO on K64 twr kit using KSDK 1.2.0. These are the steps I am following,
CLOCK_SYS_EnablePortClock(PORTE_IDX);
PORT_HAL_SetMuxMode (PORTE, 6, kPortMuxAsGpio );
GPIO_HAL_SetPinDir(PTE_BASE_PTR, 6, kGpioDigitalInput);
INT_SYS_InstallHandler(PORTE_IRQn, BSP_GPIO_IRQHandlerPortE);
PORT_HAL_SetPinIntMode(PORTE, 6, kPortDmaRisingEdge );
NVIC_SetPriority(PORTE_IRQn, 0);
INT_SYS_EnableIRQ(PORTE_IRQn);
But the call to InstallHandler is stuck, what could be the reason for this?
Hi Sandeep Thota,
KSDK1.2 is very older, please download the newest KSDK2.1-TWR-K64F120M code from this link:
Welcome to Kinetis Expert | Kinetis Expert
Click build an SDK, and choose the board as TWR-K64F120M, generate the code and download it.
We can modify the SDK_2.1_TWR-K64F120M\boards\twrk64f120m\driver_examples\gpio\input_interrupt
Add PTE6 input falling interrupt code:
void PORTE_IRQHandler(void)
{
GPIO_ClearPinsInterruptFlags(GPIOE, 1U << 6);
g_ButtonPress = true;
}
In main function:
gpio_pin_config_t pte6_config = {
kGPIO_DigitalInput, 0,
};
PORT_SetPinInterruptConfig(PORTE, 6, kPORT_InterruptFallingEdge);
EnableIRQ(PORTE_IRQn);
GPIO_PinInit(GPIOE, 6, &pte6_config);
Then, after you pull down the PTE6, you will enter the PTE6 handler.
I also attach the gpio_input_interrupt.c for your reference, you can unzip it to folder : SDK_2.1_TWR-K64F120M\boards\twrk64f120m\driver_examples\gpio\input_interrupt
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------