This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to capture GPIO interrupt with EK-TM4C123GXL

Other Parts Discussed in Thread: EK-TM4C123GXL

Hello everyone,

I'm having a very basic issue with the EK-TM4C123GXL kit. I simply want to be able to invoke an interrupt on a button SW2 push. This is the code I have:

IntMasterEnable();

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOIntRegister(GPIO_PORTF_BASE, myS2buttonISR);
GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_BOTH_EDGES); // both edges will be changed later...
GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_0);

My code never jumps to the ISR when pushing the button. Note that I don't have any startup_css.c file like in the TivaWare examples but rather have my vtable in the interrupt.c file like this:

#pragma DATA_ALIGN(g_pfnRAMVectors, 1024)
#pragma DATA_SECTION(g_pfnRAMVectors, ".vtable")
void (*g_pfnRAMVectors[NUM_INTERRUPTS])(void);

Any ideas what might be wrong? Thanks to everyone.

 

  • Martin Zeman said:
    I simply want to be able to invoke an interrupt

    While your quest may appear, "simple" - you've simply chosen one of two MCU pins which do not so qualify!

    You are not alone - PF0 & often PD7 default as NMI - and demand special, "unlocking procedure" to, "repurpose."

    You can (simply) switch to another GPIO or find/read/apply the unlock procedure w/in GPIO Section of MCU manual.

    Believe there's a "cookbook" code example - w/in your kit's SW listings...

     

  • I totally missed that! Thank you! I just used SW1 (PF4) instead of SW2 and it works.

  • Good for you - thanks - have often urged vendor to "better emphasize."

    Avoidance - as you've done - eliminates NMI battle for now.

    We have fluorescent placards - installed each/every workstation - warning of this and other, "gotchas."  (ours are color-coded - by vendor - as clients demand we employ many ARM makers)

    Another "solution" involves a "pin-search" - w/in target MCU manual - each/every time an MCU pin does not behave as reasonably expected.  Usually this quickly "flags" special (i.e. trouble) pins - enabling pin substitution or attempt @ prescribed, "work-around."