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.

TMS320F28379D: Clock Timing does not make sense

Part Number: TMS320F28379D

I notice a timing problem when timing some code.  I can duplicate it using a slightly modified version of the GPIO Toggle example for the f2837xD.  I am running this on the '379D launchpad. The SYSCLK is setup as follows:

InitSysPll(XTAL_OSC,IMULT_40,FMULT_0,PLLCLK_BY_2);

I execute the following instructions:

       GpioDataRegs.GPADAT.bit.GPIO10 = 1;
       GpioDataRegs.GPADAT.bit.GPIO10 = 0;

When I scope the output it takes about 35ns to toggle the bit.  However, When I step through the instructions in Code Composer the CCS clock says it should only take 3 clock cycles (I'm not sure why it is not 2 but 3 is ok).  The clock is running at 200Mhz so 3 clock cycles should be 15ns.  Here is the scope output:

What am I missing here? Do I have something set wrong?  Thanks

  • Did you look at the corresponding assembly instructions and totaled the number of clock cycles they would take? The cycle information is present in www.ti.com/lit/spru430.

    the CCS clock says it should only take 3 clock cycles

    I didn't understand the above. Please clarify.

  • Hareesh,

    From my understanding there are two ways to get the number of cycles:  

    1. look at the .asm file and count up the clock cycles for each instruction as you suggest

    or

    2. use CCS and put a breakpoint at the line you want to start with and start the clock on the Run menu, doing Run->Clock->Enable, then step to the line you want to end with, and look at the clock cycles CCS reports in the lower right hand corner of the screen. (and using reset to clear it for multiple tests).

    I did both and got the same answer.  -- 3 clock cycles.  The asm code looks like this:

            MOVW      DP,#_GpioDataRegs     ; [CPU_ARAU] 
            OR        @$BLOCKED(_GpioDataRegs),#0x0400 ; [CPU_ALU] |172| 
            AND       @$BLOCKED(_GpioDataRegs),#0xfbff ; [CPU_ALU] |173| 
    

    and CCS tells me it took 3 clock cycles to execute the two lines of C code.

    My question is if the clock runs at 200Mhz, why do 3 clock cycles of instructions take 34us to execute? (They should take only 15us).  The code executes from RAM so its not a flash problem (does this processor slow down running from flash??). Thank you for your help.

    Regards

  • My question is if the clock runs at 200Mhz, why do 3 clock cycles of instructions take 34us to execute? (They should take only 15us).

    See Toggling of the GPIO seems slower than it should be in [FAQ] C2000 GPIO FAQ for a possible explanation.