TMS320F28388D: Calculate the elapsed clock cycles

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Dear Experts,

I am attempting to calculate the elapsed clock cycles for my ISR code to ensure they do not exceed the PWM cycle duration. I have approached this by enabling the clock (run->clock->enable) and setting breakpoints. Unfortunately, this method has not been successful this time. Here are the issues I've encountered:

(1) RAM:

(1.1) I am unable to add a breakpoint at the end of my ISR code, as well as in some configuration codes (e.g., EPWM settings), as shown below; the breakpoint indicator remains gray.

1.2 When I set a breakpoint at the first line of my ISR code, I sometimes need to press "run" twice to advance to the next breakpoint. Other times, a single press suffices.

(2)Flash 

I am only able to set one breakpoint. Attempting to set an additional breakpoint results in an error:

(3) Debug vs Release Mode

I read in a thread that using release mode might be more accurate than debug mode for timing measurements. How can I switch to release mode?

Here is the link to the thread for reference:

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1323740/tms320f280049-code-execution-clock-cycles/5049174?tisearch=e2e-sitesearch&keymatch=calculate%2520the%2520elapsed%2520clock%2520cycles#5049174

Thanks,

Eric

  • Hi Eric,

    Have you considered toggling a GPIO at the beginning and end of your ISR as well and viewing it on an oscilloscope to ensure your ISR completes in time? This may be a more accurate test of whether your ISR is finishing in time since the start of your ISR can be delayed by other ISRs.

    Debug vs Release mode applies to the driverlib.lib file, not entire C2000Ware projects. You can build driverlib.lib in Release mode by importing the driverlib project from C2000WARE/driverlib/f2838x/driverlib. Set the active build configuration to Release when building this project, and then copy driverlib.lib into your project.

    Thank you,

    Luke

  • Hi Luke,

    I will try using GPIO as per your advice. However, could you also help me with the problems I encountered about breakpoints? This is important for us as well. Additionally, I'm still unsure how to set the build configuration to Release mode, even though I have included the driverlib in my project.

    Thank you,

     Eric

  • Hi Eric,

    Release vs. Debug mode only applies to the driverlib.lib library. For entire projects, there is the option to turn compiler optimization on, but there is no Release or Debug mode.

    Can you view all of the breakpoints you have set by selecting View -> Breakpoints? Then remove all of the breakpoints you have set and try again.

    Thank you,

    Luke

  • Hi Luke,

    1. Where can I set the release mode for drive.lib? In the following screenshot, I can't find this setting for driverlib.lib.

    2. I have removed all breakpoints and tried again, but the problem in RAM/Flash still exists. For instance, the breakpoint can't be effectively added to the line (RAM) shown in the following screenshot.

    Thanks,

    Eric

  • Hi Eric,

    There is a project in C2000Ware dedicated to building the driverlib.lib file. You need to import it from C2000Ware/driverlib/f2838x/driverlib folder. Change the build configuration of that project to release mode and then copy the resulting driverlib.lib file into the project containing your application code.

    Thank you,

    Luke