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.

LM4F120 (launchpad) interrupt not working



Hello everyone,

I am a newbie with the launchpad and trying to run FREERTOS with a few tasks. One of my tasks is to get triggered by an interrupt on portE, pin 5. Then start a task which signals it's ready on portA, pin6.

The problem I´m having is that the interrupt doesn´t seem to be firing. I have put a breakpoint in my ISR to check if the code reaches that point, but it doesn´t.

Below is my code for setting the interrupt on port E pin 5. Can anyone tell me what I'm missing?

SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA | SYSCTL_PERIPH_GPIOE );          //enable clocks for port A and E

GPIOPinTypeGPIOOutput( GPIO_PORTA_BASE, GPIO_PIN_6 );                                        // Set direction for pins in port A (pin 6 output)

GPIOPinTypeGPIOInput( GPIO_PORTE_BASE, GPIO_PIN_5 );                                          // Set direction for pins in port E (pin 5 input)
GPIOPortIntRegister( GPIO_PORTE_BASE, &vPortEISRHandler );                                   // Enable interrupt for port E and point to handler
GPIOPinIntClear( GPIO_PORTE_BASE, GPIO_PIN_5 );                                                      // Clear any pending interrupts
GPIOIntTypeSet( GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_RISING_EDGE );              // Setup pin to trigger on rising edge

GPIOPinIntEnable(GPIO_PORTE_BASE, GPIO_PIN_5);                                                    // Enable pinint, portint and master int
IntEnable(INT_GPIOE);

IntMasterEnable();

  • Hi,

    J.C.C Smits said:
    SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOA | SYSCTL_PERIPH_GPIOE );

    This is the first time in the forum, I have seen SysCtlPeripheralEnable set with two parameters. I don't have time yet to dig deeper if this is possible. Try just this below.

    SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOE );

    -kel

  • Hi Kel,

    You care right about the SysCtlPeripheralEnable. It cannot be used as what is shown in the user code paste. Every SysCtleripheralEnable can have only one peripheral call.

    Hi JCC

    As what Kel mentioned it should be split as below

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE );

    Regards

    Amit Ashara

  • Hi Amit,

        I don't know any documentation for Tivaware that mentions "SysCtlPeripheralEnable can have only one peripheral call".  Anyone, who is unfamiliar with this can make that mistake of setting two or more parameters at SysCtlPeripheralEnable.

        I think this is the same case with GPIOPinConfigure. Only, one parameter can be set. I remember one post before with someone setting two parameters at GPIOPinConfigure. Which, that setting of two parameters at GPIOPinConfigure was the cause of the error.

    -kel

  • Hi Kel,

    Point taken. Yes, it would make a lot of sense to have it documented.

    Regards

    Amit

  • @JCC,

    There are some specific things to take into account when you use FreeRTOS:
    1) Read this page (http://www.freertos.org/RTOS-Cortex-M3-M4.html) to understand the interrupts implementation in FreeRTOS. Note the global interrupts are enabled by the scheduler and never disabled, unlike for other chips, where it is enabled/disabled at each interrupt level.
    2) For other interrupts: prioritize them, usually above the kernel. 
    3) Take care to not enable the interrupt until scheduler is running (call portDISABLE_INTERRUPTS() function before setting it) - a good example how to write is in the following file
    Tiva/Third-party/FreeRTOS/Demo/CORTEX_LM3Sxxxx_Eclipse/RTOSDemo/IntQueueTimer.c
    The order of operations is important, do not neglect that.
    4) Take care about the place of all initializations: prvSetupHardware();