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.

Question about TSCL, TSCH usage

Hi,

There are many posts mentioning time measurement with TSCH, TSCL. One except is listed below. I have tried with loadti to run my program. It has no problem to test the outside of the main function. Now I want to a part of the function (loop). There are almost half time from the difference fo TSCL(H) before and after the code to be test are all 0's. The second half time shows a larger value (about 1218 cycles). This is rather bizzarre.

Now, I want to get the TSCL(H) difference with EVM(6678) by hardare method. It can be test with debug info turned on. With debug info switch to skeletal, the breakpoint cannot setup. How to deal with this difficulty?

 

Thanks.

 

.............

I recommend you start with the assumption that the value you see in TSCL is correct. If it is correct, this represents approximately 1.5 seconds of delay, and that can be checked by setting a breakpoint at the last read of TSCH and trying to judge the time by watching the second hand on a clock.

  • Excuse me. I would add that the above screen shot was taken with the Release code version. Can TSCL, TSCH be read correctly with the full debug infomation turned on?

    I guess it can now, but the time difference reading is 0 for the h, l values.

    BTW, the algorithm is in a function, which is called from the main(). I test the time in the algorithm. In the test, I put the start and stop time variable in the algorithm. Then, I change them to global variable. It still gives 0 difference.

    What trick is in TSCL, TSCH usage?

    Thank.

  • With debug info switch to skeletal, the breakpoint cannot setup. How to deal with this difficulty?

    Keep the debug info and select the option "Optimize Fully in presence of debug directive" (Runtime settings). This give you a minimum of debug support. Then, use the Disassembly view to set the breakpoint just after the "MVC TSCL". To prevent the optimizer to schedule the read in parallel add some nop:

    volatile unsigned int t_start;

    ...

    {

      __asm(" nop");

      t_start=TSCL;

      __asm(" nop");

    }

    I recommend you start with the assumption that the value you see in TSCL is correct. If it is correct, this represents approximately 1.5 seconds of delay

    Well, This is not clear: 1218 cycle correspond to 1.218 microseconds

  • Robert,

    Showing your code would help to figure out what's going on.  You may also what to have it dump out the actual values along with the difference for extra info.

    Best Regards,

    Chad