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; } }