Part Number: CC3200
Hi,
I am trying to implement GPIO interrupt, in ISR i am incrementing counter by 1 and also toggling another GPIO. After implementation i noticed that counter is increasing by any number but not by 1 and also GPIO is not toggling properly. Here is my interrupt configurations, handler andmain: -
//----------------PIN Configuration-----------------------------// // // Configure PIN_61 as INPUT for AFE_Interrupt PinTypeGPIO(PIN_61, PIN_MODE_0, false); GPIODirModeSet(GPIOA0_BASE, 0x40, GPIO_DIR_MODE_IN); // // Configure PIN_50 as Output PinTypeGPIO(PIN_50, PIN_MODE_0, false); GPIODirModeSet(GPIOA0_BASE, 0x1, GPIO_DIR_MODE_OUT); //----------------GPIO Interrupt Initialization---------------------------// void afeIntInit(void) { IntPrioritySet(INT_GPIOA0, INT_PRIORITY_LVL_1); GPIOIntTypeSet(GPIOA0_BASE, GPIO_PIN_6, GPIO_FALLING_EDGE); GPIOIntRegister(GPIOA0_BASE, AfeIntHandler); GPIOIntClear(GPIOA0_BASE, GPIO_PIN_6); // IntPendClear(INT_GPIOA0); IntEnable(INT_GPIOA0); GPIOIntDisable(GPIOA0_BASE, GPIO_PIN_6); GPIOIntEnable(GPIOA0_BASE, GPIO_PIN_6); } //------------------------ISR------------------------------------// void AfeIntHandler(void) { unsigned long getModestatus = 0, getIntstatus = 0; getIntstatus = MAP_GPIOIntStatus(GPIOA0_BASE, true); MAP_GPIOIntClear(GPIOA0_BASE, getIntstatus); if(getIntstatus & GPIO_PIN_6) { intcount = intcount+1; intflag = 1; getModestatus = GPIOPinRead(GPIOA0_BASE, GPIO_PIN_0); if(getModestatus == 0x01) { GPIOPinWrite(GPIOA0_BASE, GPIO_PIN_0, 0); } else if(getModestatus == 0x00) { GPIOPinWrite(GPIOA0_BASE, GPIO_PIN_0, 1); } } } //-------------------------main-----------------------------------// int main() { // // Board Initialisation // BoardInit(); // // Configure the pinmux settings for the peripherals exercised // PinMuxConfig(); afeIntInit(); while(1) { if(intflag == 1) { intflag = 0; if(intcount >= 100) { intcount = 0; } } } }
In this interrupt is coming from PIN 61 and toggling PIN_50. Also increasing intcount by 1. I am testing in debug mode, and checking value of intcount which is increasing by any amount instead of increasing by 1.
I am also attaching DSO capture of Interrupt pulse coming after every 10s at PIN_61(Yellow) and toggle of PIN 50(Blue) after receiving interrupt. As per logic whenever the interrupt comes if PIN 50 state is low than change it to high and remains high until next interrupt is not received, and after next goes low and remains low.
But you can see in the capture it is not working as per logic. Also when i added delay in ISR then it somehow works but the issue with count remains same. If it is working after adding delay then falling edge configuration is not working as per its nature, it is working like level trigger.