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.

Problems with Interrupts in TM4C123 and TivaWare

Other Parts Discussed in Thread: TM4C123GH6PM

Greetings:

I am moving some code from an LM4F120XL launchpad  to the TM4C123GXL launchpad and moving from Stellaris to Tiva.  This code worked on the 120 but I have not been successful in getting it to run on the 123.    The problem is getting interrupts to work using GPIOIntRegister.  Interrupts for timers and UARTs work fine through the startup_css.c vectors.  The problem is with GPIO interrupts which are never being recognized.  I'm afraid this may be a pin configuration issue.  

In the Properties -> General setting I have selected Tiva TM4C123GH6PM as the device  .In the Properties->Target Build  -> Arm Compiler -> Predefined Symbols I have entered PART_TM4C123GH6PM and TARGET_IS_BLIZZARD_RA1. I have tried other variants such as _RB1 but have not been successful.  

The project builds and links without errors.  However, the interrup handlers loaded via GPIOIntRegister are never called.  

Here are the includes:

#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/timer.h"
#include "driverlib/fpu.h"
#include "driverlib/uart.h"
#include "driverlib/debug.h"
#include "driverlib/rom.h"

Here is the code segment in question:

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

// Port B Pin 6 and Pin 7 Setup
GPIOIntRegister(GPIO_PORTB_BASE, PortBPin6IntHandler); // start things on rising edge
GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 |GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_6, GPIO_RISING_EDGE);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_7, GPIO_FALLING_EDGE);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_4, GPIO_RISING_EDGE);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_5, GPIO_FALLING_EDGE);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_2, GPIO_RISING_EDGE);
GPIOIntTypeSet(GPIO_PORTB_BASE, GPIO_PIN_3, GPIO_FALLING_EDGE);

GPIOIntClear(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);

GPIOIntDisable(GPIO_PORTB_BASE, GPIO_PIN_3 | GPIO_PIN_5 | GPIO_PIN_7);
GPIOIntEnable(GPIO_PORTB_BASE, GPIO_PIN_6);
//GPIOIntClear(GPIO_PORTB_BASE, GPIO_PIN_6 );
IntMasterEnable();

The oscilloscope confirms the signals are reaching the appropriate Port B pins.  The interrupt service routine is never called.  Again, this code worked on the LM4C120.  The only changes were changing the GPIOPinIntEnable, Disable, Clear, etc. to GPIOIntEnable per the Migration Instruction document.

Sure would appreciate some help.  I have run out of ideas.

Thanks,

Dan

  • Hi,

    You did not told us what some debugging results did you got - i.e. if you checked the port's B IME, IEV, IS registers to confirm your configuration.

    Please take care the port B defaults with PB[3:2] pins configured as I2C0, so you may have some problems with those pins. Suggest to try PinMux utility to configure port B pins.

    Note also that there is only one interrupt handler for port B, so you must add GPIO_DISCRETE_INT parameter, which sets discrete interrupts for each pin on a GPIO. Some ports do not allow discrete interrupts, but the driverlib code suggest it is safe to add it.

    Petrei

  • Petrei:

    Thanks for the reminder about the PinMux utility.  I had heard of it but never used it.  Nice to have confirmation of my configuration.  I have the problem fixed now.  It was a combination of a hardware PC board error on a card driving the TM4C123 and the way interrupts were chained.  Difficult to find but now everything is working well.

    Thanks again for your help.

    Dan