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.

Continuation of 'Clock source for internal DSP and external timer'

Hi Team,

I have performed the Worst case execution time calculation the target and results are attached to the case.

Code snippet used is also attached for reference.

1. Could find that the time calculated using external timer (configured in unchained 32 bit mode) (CNTLO) is not same as TSCL (core internal timer).

2. From the excel sheet, the columns - G7,O7,X7,AG7,AP7,AY7,BH7,BQ7 are showing different values.

  i.e., initially, the max time taken is high for first 4 times (20,60,92,66) and then after that, its all in single digits.

  Please let us know your comments on this behaviour.

Configuration details:

1.The Sample code attached is run on all the other cores, except the external timer configuration part.

2. Grouped all cores in to a single, using CCS5.5

Attached excel sheet contains values collected on all cores and calculated the current core time taken with respect to minimum time taken among all cores.

Timers:

32 bit unchained mode.

Considered CNTLO (lower 32 bit timer) for calculation, as we didn't configured prescaler configuration for CNTHI (upper 32 bit timer).

c6678_tests.xls

#include "stdio.h"
#include <ti/sysbios/family/C66/Cache.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()
{

	volatile int *ptr, *ptr1;
    volatile unsigned int * mpaxl2 = (volatile unsigned int *)MPAXL2;
    volatile unsigned int * mpaxh2 = (volatile unsigned int *)MPAXH2;
    unsigned  int st_u_bef[50]={0};
    unsigned  int st_u_aft[50]={0};
    unsigned  int st_l_bef[50]={0};
    unsigned  int st_l_aft[50]={0};

    unsigned int value;
    int i = 0, j = 0;
    Cache_Size *size;
    Cache_getSize(size);

    *(PRDLO) = 0xFFFFFFFF;
    *(PRDHI) = 0x0FFFFFFF;
    *TGCR = ( *(TGCR) | (0x00000003));
    *(TCR) = ( *(TCR) | (0x00400040));

    TSCL = 0;

    ptr =  (volatile unsigned int *)((0x0c000002) + (0x1000 *core_num));
    ptr1 = (volatile unsigned int *)((0x80000000) + (0x1000 *core_num));

    *(mpaxh2) = (0x0c00000b + (0x1000 * core_num));
    *(mpaxl2) = (0x0c0000bf + (0x1000 * core_num));
    *(mpaxh2);
    *(mpaxl2);
    *(ptr) = 100;

	TSCL = 0;
	while(i < 50)
    {
    	Cache_wbInvAll();
    	st_u_bef[i] = (unsigned int)*CNTHI;
    	st_l_bef[i] = (unsigned int)*CNTLO;
        while(j < 100)
        {
        	*(ptr+j*64);
        	j++;
        }
    	st_u_aft[i] = (unsigned int)*CNTHI;
    	st_l_aft[i] = (unsigned int)*CNTLO;

    	printf("After ch1 value is  0x%x  0x%x\n",*CNTHI, *CNTLO);
    	i++;
    	j = 0;
    }
	i = 0;
	while(i < 50)
	{
       printf("ch value is 0x%x  0x%x  0x%x  0x%x  0x%x\n",st_u_bef[i],st_l_bef[i],st_u_aft[i],st_l_aft[i],ptr);
       i++;
	}
}