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.

TMS320F28377D: Execution time of code generated from Simulink

Part Number: TMS320F28377D

Hello everyone,

How can I measure the main loop execution time of a code generated by the Simulink Coder? How can I implement that in the Simulink model?

Additionally, I have noticed that the functions that are on the root of the Simulink do not execute continuously in the main loop, but actually, it executes at a fixed time interval defined by the sample time of the blocks (If I put all the sample times as inf, it executes every 200ms).

How can I make these functions execute continuously inside the main loop?

Thank you,

Renato

  • Renato,

    If you have the ability to modify the generated source code, you can add some GPIO toggles, or use a CPU Timer to start and stop a counter at the start and end of the function in question.

    I have forwarded your question on the Simulink Support team. They should reply here within a few days. Have you looked on the Simulink support forums as well? www.mathworks.com/.../

    Thanks,
    Mark
  • HI Renato,

    Please refer this post for performing the real time execution profiling of the generated code.

    For running code in main loop, please note that in TI C2000 we are using the timer interrupt driven scheduler to time the code execution. The main loop works as a background task. You can use the Idle Task block from the support package to make the required code to get executed in main loop. It would be interesting to know the use case for this approach.

  • Thank you for the answers. I will just complement here that in order to include code in your simulink model you can use the blocks in the lybrary: simulink coder> custom code. I used those blocks to toggle a GPIO in the beginning and end of the code. As mentioned before, the idle task is also an option since it is executed in the main loop.