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.

Clock source for internal DSP and external timer

Hi Team,

We are calculating the time for a particular set of application and tried with possible 2 options:

a. Using internal core timer , i.e., TSCL

b. Using external timer with internal dsp clock as the source.

Target: C6678

CCS: 5.5 ; Simulator mode.

We could see that time calculated using approaches (a) and (b) are different.

The code snippet used is attached for reference for register configuration.

Please check and let me know if there is anything that can done ?

#include "stdio.h"
#include <c6x.h>

#define core_num 0
#define MPAXL2 0x08000010
#define MPAXH2 0x08000014
#define TIMER0_BASE 0x2200000
volatile unsigned int *CNTLO = (volatile unsigned int *)(TIMER0_BASE+0x10);
volatile unsigned int *CNTHI = (volatile unsigned int *)(TIMER0_BASE+0x14);
volatile unsigned int *PRDLO = (volatile unsigned int *)(TIMER0_BASE+0x18);
volatile unsigned int *PRDHI = (volatile unsigned int *)(TIMER0_BASE+0x1C);
volatile unsigned int *TCR = (volatile unsigned int *)(TIMER0_BASE+0x20);
volatile unsigned int *TGCR = (volatile unsigned int *)(TIMER0_BASE+0x24);


void main()
{

int i = 0, j = 0;

printf("TCR 0x%08x TGCR 0x%08x CNTLO 0x%08x CNTHI 0x%08x PRDLO 0x%08x PRDHI 0x%08x\n",*TCR,*TGCR,*CNTLO,*CNTHI,*PRDLO,*PRDHI);

*(PRDLO) = 0xFFFFFFFF;
*(PRDHI) = 0x0FFFFFFF;
*TGCR = ( *(TGCR) | (0x00000003));
*(TCR) = ( *(TCR) | (0x00400040));
TSCL = 0;
printf("TCR 0x%08x TGCR 0x%08x CNTLO 0x%08x CNTHI 0x%08x PRDLO 0x%08x PRDHI 0x%08x\n",*TCR,*TGCR,*CNTLO,*CNTHI,*PRDLO,*PRDHI);
printf("TSCL 0x%08x\n",TSCL);

while ( i < 10){
i++;}
i = 0;

printf("TCR 0x%08x TGCR 0x%08x CNTLO 0x%08x CNTHI 0x%08x PRDLO 0x%08x PRDHI 0x%08x\n",*TCR,*TGCR,*CNTLO,*CNTHI,*PRDLO,*PRDHI);
printf("TSCL 0x%08x\n",TSCL);

}