Thread 中讨论的其他器件: EK-TM4C123GXL、EK-TM4C1294XL、 TM4C123GH6PZ
工具/软件:
大家好!
我们公司已使用 MSP432P401R 芯片作为我们的多个产品的 32 位嵌入式控制器。
在 MSP432P401 停止支持后、我们现在尝试使用 TM4C 系列芯片作为主 32 位 MCU。
我们购买了 TM4C123G LaunchPad。
我正在尝试 将代码传输到 TM4C 芯片、用于下一个产品。
当我检查计时器的功能时、无法进入 ISR。
系统卡在 tm4c123gh6pm_startup_ccs.c 的静态 void IntDefaultHandler (void) 中
以下是代码。
代码中是否有任何问题? 或者如何解决问题?
顺便说一下、我之前使用寄存器级对 MSP430 和 MSP432 进行编码、因此这是第一次使用该方法对 TI 芯片进行编码。
#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;
}
}





