I have copied from code from the CSL_GPT example and compiled it into a test program of my own. I can't figure out why this interrupt never fires. Could someone look through this code and tell me what I'm doing wrong? I have confirmed that the GPT initalizes and begins its countdown, and resets afterwards.
/*GPT Test by Timothy Sapio 7-24-11
* This program is for testing the various functionings of the General Purpose Timer module present in the TI 5505 Microcontroller.
* It also demonstrates functioning of the timer by flashing the LED on and off.
* */
#include "csl_gpt.h"
#include "csl_intc.h"
#include <csl_general.h>
#include "usbstk5505.h"
#include "led_test.h"
#define CSL_PLL_CLOCKIN (32768u)
CSL_Handle hGpt;
CSL_Status status;
CSL_Config hwConfig;
CSL_GptObj gptObj;
Uint32 sysClk;
extern void VECSTART(void);
volatile Uint16 hitIsr = 0;
Uint32 getSysClk(void)
{
Bool pllRDBypass;
Bool pllOutDiv;
Uint32 sysClk;
Uint16 pllVP;
Uint16 pllVS;
Uint16 pllRD;
Uint16 pllVO;
pllVP = CSL_FEXT(CSL_SYSCTRL_REGS->CGCR1, SYS_CGCR1_VP);
pllVS = CSL_FEXT(CSL_SYSCTRL_REGS->CGCR1, SYS_CGCR1_VS);
pllRD = CSL_FEXT(CSL_SYSCTRL_REGS->CGICR, SYS_CGICR_RDRATIO);
pllVO = CSL_FEXT(CSL_SYSCTRL_REGS->CGOCR, SYS_CGOCR_OD);
pllRDBypass = CSL_FEXT(CSL_SYSCTRL_REGS->CGICR, SYS_CGICR_RDBYPASS);
pllOutDiv = CSL_FEXT(CSL_SYSCTRL_REGS->CGOCR, SYS_CGOCR_OUTDIVEN);
sysClk = CSL_PLL_CLOCKIN;
if (0 == pllRDBypass)
{
sysClk = sysClk/(pllRD + 4);
}
sysClk = (sysClk * ((pllVP << 2) + pllVS + 4));
if (1 == pllOutDiv)
{
sysClk = sysClk/(pllVO + 1);
}
/* Return the value of system clock in KHz */
return(sysClk/1000);
}
/**
* \brief GPT Interrupt Service Routine
*
* \param none
*
* \return none
*/
interrupt void gpt0Isr(void)
{
hitIsr = TRUE;
IRQ_clear(TINT_EVENT);
/* Clear Timer Interrupt Aggregation Flag Register (TIAFR) */
CSL_SYSCTRL_REGS->TIAFR = 0x01;
toggleLED();
}
void main(void)
{
USBSTK5505_init( );
IRQ_setVecs((Uint32)(&VECSTART));
IRQ_plug(TINT_EVENT, &gpt0Isr);
IRQ_enable(TINT_EVENT);
IRQ_globalEnable();
hGpt = GPT_open(GPT_0, &gptObj, &status);
sysClk = getSysClk();
hwConfig.autoLoad = GPT_AUTO_ENABLE;
hwConfig.ctrlTim = GPT_TIMER_ENABLE;
hwConfig.preScaleDiv = GPT_PRE_SC_DIV_1;
hwConfig.prdLow = (sysClk)*10;
hwConfig.prdHigh = 0x0000;
status = GPT_config(hGpt, &hwConfig);
//status = GPT_reset(hGpt);
status = GPT_start(hGpt);
while(1);
}