I am using a Kinetis KL16Z128 processor, developing with KDS 3.0.0 and KSDK 1.2.0 / Processor Expert. I am looking for a simple project code example of a GPIO input pin triggering an interrupt. Is there one I can look at? So far I have:
Component Inspector:
gpio1:fsl_gpio Input pin "SYNC_IN" Interrupt/DMA: Interrupt on falling edge
main.h:
extern volatile uint32_t syncCount;
main.c:
syncCount = 0; // count of sync line input signals (updated in interrupt routine)
INT_SYS_EnableIRQ(PORTA_IRQn);
INT_SYS_EnableIRQGlobal();
do { various stuff... } while ( 1 ); // main loop
events.c:
void PORTA_IRQHandler(void) {
PORT_HAL_ClearPortIntFlag(PORTA_BASE);
syncCount++;
}
This compiles OK, and it runs, but I never see syncCount increment from 0, even though I am generating pulses on the PTA_4 input pin ("SYNC_IN") which I can detect using a normal port read from the main.c using GPIO_DRV_ReadPinInput(SYNC_IN).
I have read through the document Interrupt handling with KSDK and Kinetis Design Studio and it has useful information, but not quite enough for me to get a project working. Any suggestions would be appreciated. Thank you!
Hello John,
- Could you please show your code clearly , or how do you configure the component of fsl_gpio .
- Under the SDK1.2 , there is a GPIO interrupt demo :
Freescale\KSDK_1.2.0\examples\frdmkl26z\driver_examples\gpio
this demo is about KL26, while the configuration is the same with KL16, you can refer to .
Hope it helps
Alice