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.

Cycle Counter

Other Parts Discussed in Thread: MSP430F5438A

Hi!

Im writting a code for MSP430f5438A in code composer studio 5.2.1.00018, to implement a timer of 1ms.

Is there a way to watch the cycle counting for every instruction in code composer as we can see at IAR ?

I want to check if I got exactly 1ms.

Thanks. Any help would be much appreciated!

  • Hi,

    Did you try the Profile clock? It can give the number of cycles between breakpoints.

    Hope this helps,

    Rafael

  • Hi Raiff,

    open CCS Debug->Run->Clock ... There you are able to setup, enable, disable and reset the cycle counter. But stepping through your code will be very slow. There might be some breakpoint interference and even interrupts have influence to the counter.

    Why don't you set an GPIO output pin at start of that function and clear it at the end? So you are able to measure the time at realtime.

    Best regards
    Christian

  • Thank you all for your replies!

    I found this feature but It seems to count cycles differently than IAR (and slower).

    IAR counts exactly 25000 cycles as I set in my code, but CCS counts 20113. (same code)

    Do I need to set something ? What contributes to that great difference ?

    Thanks in advance!

  • Hi,

    Well, that is indeed strange. However, when you say "same code" you mean the exact same binary executable or the same source code but each executable was built in each IDE? If that is the second case, I wonder if some optimization or simply a different way of assembling the C sources may be causing this difference. You can build the project with IDE "A" and load with IDE "B" and see if you still see the difference. If the executables are somehow incompatible (I don't think they are), you can also build and flash your code with IDE "A" and then simply launch it with IDE "B" (without re-flashing) - details to launch the debugger without loading code are here.

    Cheers,

    Rafael