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.

problem in running timer0 in c6474

Hi,

I am new to multicore dsp families.  I am working with evm c6474 with ccs3.3.  I tried to run a simple timer code on the core 1A. I found using breakpoints the timer0 registers are updated.  But no output is getting displayed on the output window.  what is happening?  can any one help me? is my code wrong?

#include<stdio.h>
#define TINPSEL (*((volatile unsigned int *) 0x0290000))
#define TOUTPSEL (*((volatile unsigned int *) 0x02910004))
#define CNTLO (*((volatile unsigned int *) 0x02910010))
#define CNTHI (*((volatile unsigned int *) 0x02910014))
#define PRDLO (*((volatile int *) 0x02910018))
#define PRDHI (*((volatile int *) 0x0291001C))
#define TCR (*((volatile int *) 0x02910020))
#define TGCR (*((volatile int *) 0x02910024))
#define EMUMGT_CLKSPD (*((volatile int *) 0x02910004))

void main(void)
{
   
    int x,i;
    unsigned char d;
    PRDHI=0xFFFFFFFF;
    PRDLO=0xFFFFFFFF;
    CNTLO=0x00000000;
    CNTHI=0x00000000;
    TGCR=0x00000003;
   
    printf("\nloop to run upto:");
//    scanf("%d",&i);
       
    TCR=0x000800008;   
    TCR|=0x00400040;    //timer starts
   
    for(x=1;x<100;x++);   
   
    TCR&=0xFFFFFFBF;    //timer stops
   
    printf("\nloop ran upto:%d",x);
    printf("\ncounter low:%x",CNTLO);
    printf("\ncounter high:%x",CNTHI);
    d=(EMUMGT_CLKSPD&0x000F0000)>>16;
    printf("\ntimer input fqn=CPU fqn/%d",d);
    return;
}

  • You need to use the CSL Chip Support Library that is available for the C6474. It includes examples for working with the timers.

    If you get the timer working with the CSL, then you can inspect how the code worked and how the registers were setup, then migrate back to direct hard-coded register writes. But it is very difficult to start from where you are right now. And it is very difficult to debug someone's hard-coded software. That is why we offer the CSL, so your job is easier, and ours is also.

    Regards,
    RandyP