AnsweredAssumed Answered

verifying the clock rate of ADSP-TS201

Question asked by mohamed on Jul 27, 2009
Latest reply on Jul 28, 2009 by AndyC

hello

 

i am working on ADSP-TS201 and i was developing a program to train my self on delay programs and my calculatios was made so that the clock is 600 MHZ  so the timer clock will be 300 MHZ and when i tried to measure the time for which the delay program works it gives me that delay was for 1,2 sec althogh

 

my calculations are made so that it should be 1 sec and what i think is that we ordered a worng processor so please see the syntax i made and tell me if i am right or wrong

 

/*****************************************************************************
* delay_testing.c
*****************************************************************************/
#include<sysreg.h>                                  //  header file to define the various registers in the ADSP-TS201
#include<math.h>                                    // header file to use variuos math operations
#include<stdio.h>
#include<defts201.h>                                //  header file  to define the bits and registers numbers to be used directly
#include<builtins.h>
#include<time.h>


#define SYSREG_CLR(sysreg,bit) __builtin_sysreg_write(sysreg, __builtin_sysreg_read(sysreg)&~bit)   //macro used to clear the bits
#define SYSREG_SET(sysreg,bit) __builtin_sysreg_write(sysreg, __builtin_sysreg_read(sysreg)|bit)   //macro used to set bits

 


void delay(void)
{
    unsigned int x;


    SYSREG_CLR(__INTCTL,INTCTL_TMR1RN);
  
    SYSREG_SET(__SQCTL,SQCTL_GIE);
        
    __builtin_sysreg_write(__TMRIN1H,0x00000000);
    __builtin_sysreg_write(__TMRIN1L,300000000); 

   
    SYSREG_SET(__INTCTL,INTCTL_TMR1RN);
   
    x= __builtin_sysreg_read(__ILATL);
    x&= INT_TIMER1L;
 
    for(;x!=8;)
    {
     x= __builtin_sysreg_read(__ILATL);
     x&= INT_TIMER1L;
    }
   
    __builtin_sysreg_write(__ILATCLL,0x0);
   
  
}


int main(void)
{
volatile clock_t start;
volatile clock_t stop;
float seconds;

printf("one\n");
start=clock();
delay();
stop=clock();
printf("two\n");
delay();
printf("three\n");
delay();
printf("four\n");
delay();

seconds=((float)(stop-start))/CLOCKS_PER_SEC;

printf("seconds= %f\n",seconds);
return(0);

}

 

 

 

and the output was okay and there was the delay i made but the period of the delay (seconds ) was not correct so i changed the value loaded to the timer to be (250000000) and then the delay was 1 secs  so is that veryfies what i am saying is that the processor is 500 MHZ and not 600MHZ as we ordered it

 

the output was;

 

one
two
three
four
seconds= 1.200000

Outcomes