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.

Time requirement of simple instruction does not fulfill expectation

Other Parts Discussed in Thread: TMS320F2812

CCS 3.3.38

Emulator: TDS510USB 2.0

Target: TMS320F2812

 

Hi!

I am struggling in the following phenomena: 1000 NOP instructions need about 50 us with a clock of CLKIN or SYSCLKOUT of 150 MHz. I expected about 6ns per NOP what makes 6us for 1000.

Why is my processor working 8 times slower...?

 

These checks are already done:

- Measured the clock frequency at crystal with an oscilloscope.

- Verified if the PLL was initialized and if it works correctly

- Triggered my oscilloscope before and after running the NOPs to verify the speed of my CPUTIMER0 us-timer, used for performance measurements.

 

Any ideas?

thanks in advance.                     Timon Meier

  • Timon,

    Can you give some more info -

    Are you running the NOP's from flash or from RAM?

    What does the code look like for the NOPs?  i.e. I want to make sure they aren't in a loop;  the overhead of the branches will add cycles.

    You mentioned you verified the PLL was working correctly - did you do this by checking the frequency of XCLKOUT?

    -Lori

  • Hi Lori

    -> I ran the NOP's from flash,

    -> I know that the PLL was working because the internal us-timer I set up was running correctly (I cleared the timer register before starting a routine, and at the end of the routine, I read it out. To verify, I measured the time with an oscilloscope). It was also possible to change the PLL factor.

    -> Here is the code:

        oc_StartUsTimer();

        GpioDataRegs.GPBCLEAR.bit.GPIOB6 = 1;        // neg. edge
        asm("    NOP");
        asm("    NOP");
        asm("    NOP");

    ...

        asm("    NOP");
        asm("    NOP");
        asm("    NOP");
        GpioDataRegs.GPBSET.bit.GPIOB6 = 1;            // pos. edge
        timeUs=oc_StopUsTimer();

     

    where oc_StartUsTimer(); and oc_StopUsTimer(); are functions with inline-statement.

  • Timon Meier said:

    I am struggling in the following phenomena: 1000 NOP instructions need about 50 us with a clock of CLKIN or SYSCLKOUT of 150 MHz. I expected about 6ns per NOP what makes 6us for 1000.

    Why is my processor working 8 times slower...?

    -> I ran the NOP's from flash,

    Running from flash introduces wait states.  At reset the flash is configured for 15 waitstates and no prefetch.  To improve performance you can lower the waitstates (down to 5 for 150Mhz SYSCLKOUT operation) and enable the prefetch.  Even in this case the first fetch of 128 bits from flash will take the full 6 cycles (5 wait + 1).  The CPU will start processing those instructions while the prefetch mechanism gets the next set.  If the CPU finishes with the first set of instructions before the next prefetch has completed, then the CPU will stall again, but not for the full 6 cycles - the stall will only be for a couple of cycles. 

    How is the flash configured?

    Have you tried running the same code from RAM?

    -Lori

     

  • Yes it was the RAM. ty!