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.

C6745 PLL EMUCNT0/EMUCNT1 question

Other Parts Discussed in Thread: TMS320C6745

I need high-resolution continuously running counter.

According to datasheet C6745 has not EMUCNT0/EMUCNT1 in PLL. But if I saw registers in memory at address 0x1C111EC/0x1C111F0 (the addresses correspond to C6748 and OMAP), then I found that 32 bit counter (EMUCNT1 at 0x1C111F0) works as described in section "PLLC Registers" TMS320C6745/C6747 DSP System Reference Guide (SPRUFK4D). i.e. after I wrote something to EMUCNT1, the counter starts continuously count. The achieved behavior contradicts with the documentation.

I would like to know whether it would be correct to use EMUCNT1 as high-resolution continuously running counter.

  • I see the EMUCNT0 and EMUCNT1 registers are documented in SPRUFK4D at addresses 0x01C111F0 and 0x01C111F4 and I anticipate that you should be able to use them as described there.  Another alternative is to use the TSCL and TSCH timestamp registers of the C674x DSP core.  These free running timer operates in a similar manner and will increment at the clock speed of the DSP core itself.  You can find details on these registers in the CPU instruction set guide.

    Regards, Daniel

  • Daniel,

    Thank you for the answer.
    I follow your advice and will use TSCL/TSCH timestamp registers.

  • Here is some simple code that shows how to use TSCL/TSCH

    // Required header file // both files come with the code generation tool

    #include <stdint.h> // defines uint64_t

    #include <c6x.h> // defines _itoll, TSCH, TSCL 

    // In the variable declaration portion of the code:

    uint64_t start_time, end_time, overhead, cyclecount; 

    // In the initialization portion of the code:

    TSCL       = 0;                   //enable TSC

    start_time = _itoll(TSCH, TSCL);

    end_time   = _itoll(TSCH, TSCL);

    overhead   = end_time-start_time; //Calculating the overhead of the method.

    // Code to be profiled

    start_time = _itoll(TSCH, TSCL);

    function_or_code_here();

    end_time   = _itoll(TSCH, TSCL);

    cyclecount = end_time-start_time-overhead;

    printf("The code section took: %lld CPU cycles\n", cyclecount);