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.

Generating an interrupt for Timer0 on TMS320C5515

Hi all,

I'm new in the DSP world and have a question for programming a timer in code composer.
I want to generate an interrupt every second and toggle the blue led on the development board. (If this works I can expand.) 

The code I have is:

********************

void main( void )
{

/* Initialize BSL */
USBSTK5515_init( );
USBSTK5515_ULED_init( );

Timer0Init();
//Init_Intrupt();
printf("\n Timer initialization");
StartTimer0();

while(1); /* endless loop, wait for interrupt */
}

********************

Uint16 fTimer =0;

void Timer0Init(void)
{
/*Timer0 Initialization
timer interval 0.5sec (2Hz)
prescale = 1011 (devide by 4096)
98.304M/4096 = 24K
24K/12K = 2Hz (12K = 0x2EE0)*/

/* TIM0 EN | AutoReload disable | Prescale = 0(100/2 = 50MHz) ==> 20nsec */
*CPU_TIM0_CTRL = 0x802E; // autoReload(32814Hz)
//*CPU_TIM0_CTRL = 0x802C; // disable autoReload (32812Hz)

//*CPU_TIM0_PLWR = 0x5DC0; // (24khz)
*CPU_TIM0_PLWR = 0x2EE0; // (12khz)
*CPU_TIM0_PHWR = 0x0000;

*CPU_TIM0_CLWR = 0x0000;
*CPU_TIM0_CHWR = 0x0000;

/* Clearing timer Aggregation register*/
*CPU_TIMINT_AGGR = 0x0007;

/* enable timer0 int flag*/
*CPU_TIM0_IER = 0x0001;
}

void StartTimer0(void)
{
/* Start the Timer 0*/
*CPU_TIM0_CTRL = *CPU_TIM0_CTRL | 0x0001;
}


interrupt void Timer_isr(void)
{
// clear timer int flag
IFR0 = IFR0&0x0010; // bitwise AND

/* clear timer0 int flag*/
*CPU_TIM0_IER = 0x0001;

/* Clear Timer0 bit in Timer Aggregate register*/
*CPU_TIMINT_AGGR = *CPU_TIMINT_AGGR | 0x0001 ;

USBSTK5515_ULED_toggle( 3 ); // Toggle DS2

fTimer=1;
//StartTimer0();
}

********************

The problem is that I never enter "interrupt void Timer_isr(void)". I have been searching on the net but can't find a solution.

Thanks in advance,

Tim