TM4C123GH6PM: Can not enter timer0A ISR

Part Number: TM4C123GH6PM

Tool/software:

Hi all,

Our company has used MSP432P401R chip as our 32-bit embedded controller for several products.

After MSP432P401 stop supporting, we are now trying to use TM4C series chip as our main 32-bit MCU.

We bought the TM4C123G LaunchPad.

I am trying to transfer the code to TM4C chip for our next product.

When I was checking the function of Timer, I can not enter ISR.

The system stuck in static void IntDefaultHandler(void) of tm4c123gh6pm_startup_ccs.c.

These are the code below.

Are there any problems in the code? Or how can I solve the problem?

BTW, I used register level to code MSP430 and MSP432 previous, so this is the first time using the method to code TI chips.

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/timer.h"
#include "driverlib/gpio.h"

void Delay(unsigned long time);
void Initialize(void);
void Set_Timer(void);

unsigned short breathe;

void main(void)
{
	// Set the clocking to run directly from the crystal.
	SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

	Initialize();
	while(1)
	{
	}
}

void Initialize(void)
{
	//***********************
	//* variables and flags *
	//***********************
	breathe=0;
	//*******
	//* I/O *
	//*******
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);// Enable the GPIO port that is used for the on-board LED.
	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1);// Enable the GPIO pins for the LED (PF1 & PF2 & PF3).

	//*************
	//* Operation *
	//*************
	Set_Timer();
}

void Set_Timer(void)
{
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);// Enable the peripherals used by this example.
	IntMasterEnable();// Enable processor interrupts.

	// Configure the two 32-bit periodic timers.
	TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
	TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet());

	// Setup the interrupts for the timer timeouts.
	IntEnable(INT_TIMER0A);
	TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);

	TimerEnable(TIMER0_BASE, TIMER_A);// Enable the timers.
}

#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
void Timer0IntHandler(void)
{
	TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);// Clear the timer interrupt.
	if(breathe)
	{
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0x04);
		breathe=0;
	}
	else
	{
		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, ~0x04);
		breathe=1;
	}
}

  • The system stuck in static void IntDefaultHandler(void) of tm4c123gh6pm_startup_ccs.c.

    Hi Norton,

      Can you show your startup_ccs.c code? You need to make sure you have a vector declared for Timer_A in the vector table. By default, the startup file is filled with IntDefaultHandler for all vectors. See below example. Please also make sure you use the startup_ccs.c file for TM4C123 and not copy the any starrtup file from MSP432P as they are not compatible.

     

  • Hi Charles,

    Thanks for the replying.

    Where can I find the startup_ccs.c file the the TM4C123?

    There is only tm4c123gh6pm_startup_ccs.c file in the created project.

    I have showed my tm4c123gh6pm_startup_ccs.c and there are not any IntHandler in the file but lots of InfDefaultHandler.

    Should I need to edit the Handler by myself?

    It seems that I can not just change the "InfDefaultHandler" to the function of my ISR.

    Sure I do not copy any file from MSP432P.

    I created a new project for the TM4C123 and and linked TivaWare_C_Series-2.2.0.295.