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.

VC5504 Timers

Hi:

I am observing that Timers 1 and 2 on the VC5504 don't work unless Timer 0 is enabled. If I try to use either Timer 1 or Timer 2 alone without enabling neither one works.  I am using the CSl Timer code with slight modifications. Below is the file in which I configure the timers. Could you please help? Thanks a lot.

Cheers,

Mushtaq

#include "GPTimer0.h"
#include "sysdef.h"

void CSL_gpt0Config(void)
{

 /* Open the CSL GP Timer0 module */
 hGpt0 = GPT_open (GPT_0, &gpt0Obj, &status);
 // Configure GPT module //
 hwGpt0Config.autoLoad   = GPT_AUTO_ENABLE;
 hwGpt0Config.ctrlTim   = GPT_TIMER_ENABLE;
 hwGpt0Config.preScaleDiv = GPT_PRE_SC_DIV_7; //Divide CPU clock by 256.
 hwGpt0Config.prdLow   = 0x0100;
 hwGpt0Config.prdHigh   = 0x00;
 GPT_reset(hGpt0);
 GPT_config(hGpt0, &hwGpt0Config);
 //GPT_start(hGpt0);
 //GPT_stop(hGpt0); */

 /* Reset the GPT module //
 hGpt1 = GPT_open (GPT_1, &gpt1Obj, &status);
 hwGpt1Config.ctrlTim   = GPT_TIMER_ENABLE;
 hwGpt1Config.preScaleDiv = GPT_PRE_SC_DIV_7; //Divide CPU clock by 256.
 hwGpt1Config.prdLow   = 0x0100;
 hwGpt1Config.prdHigh   = 0x00;
 GPT_reset(hGpt1);
 GPT_config(hGpt1, &hwGpt0Config);
 // Start the Timer //
 GPT_start(hGpt1); */
 
 /* Reset the GPT module */
 hGpt2 = GPT_open (GPT_2, &gpt2Obj, &status);
 hwGpt2Config.ctrlTim   = GPT_TIMER_ENABLE;
 hwGpt2Config.preScaleDiv = GPT_PRE_SC_DIV_7; //Divide CPU clock by 256.
 hwGpt2Config.prdLow   = 0x0100;
 hwGpt2Config.prdHigh   = 0x00;
 GPT_reset(hGpt2);
 GPT_config(hGpt2, &hwGpt2Config);
 // Start the Timer //
 GPT_start(hGpt2); //

 INT_ENABLE;

 IRQ_setVecs((Uint32)(&VECSTART)); //Mushtaq 072210 Setup entry into interrupt vector table.
 IRQ_plug(TINT_EVENT, &gpt0Isr); //Mushtaq 072210 Plug in Timer0 ISR. Interrupt not enable yet.
 IRQ_enable(TINT_EVENT); //Enable Timer0 interrupt.
 //IRQ_disable(TINT_EVENT); //Enable Timer0 interrupt.
 //IRQ_globalEnable();

}

interrupt void gpt0Isr(void)
 {
  long temp;
  IRQ_clear(TINT_EVENT);
  temp = CSL_SYSCTRL_REGS->TIAFR;
  CSL_SYSCTRL_REGS->TIAFR = 0x04; //Clear Timer 0 interrupt flag in TIAFR.
  //IRQ_disable(TINT_EVENT); //Disable timer interrupts.
    
 }
 
 /* Read the Timer Count */
Uint32 getTimeStamp(void)
{
 GPT_getCnt(hGpt0, &timeCntGpt0);
 return (timeCntGpt0);
}