Main Content

Detect and Fix Task Overruns on Texas Instruments C2000 Hardware

You can configure a Simulink® model running on the target hardware to detect and notify you when a task overrun occurs. A task overrun occurs if the target hardware is still performing one instance of a task when the next instance of that task is scheduled to begin. You can fix overruns by decreasing the frequency with which tasks are scheduled to run, and/or by reducing the number of tasks defined by your model.

To enable overrun detection:

  1. Click the Tools menu in the model, and select Run on Target Hardware > Options.

  2. In the Hardware Implementation pane that opens, select the Overrun detection > Enable overrun detection check box.

  3. Use the Digital output pin to set on overrun parameter to specify the GPIO pin number of a digital output.

    • Select the GPIO mode: Set, Clear or Toggle.

    • If required select the additional notification option to notify when task overrun occurs: Trigger interrupt or Call user-defined function.

  4. Click OK.

When a task overrun occurs:

  • The state of the digital output pin specified by the Digital output to set on overrun parameter changes from low (0 Volts) to high (3.3 Volts).

  • If Additional notification is selected as Trigger Interrupt then ISR with mentioned PIE and CPU number will be triggered.

    Note

    Set the priority value of the interrupt to less than 40 (default base rate priority) to ensure interrupt will trigger on overrun.

    If Additional notification is selected as Call user-defined function then C function will be called on overrun.

  • The model continues running, but the effective sample time will be longer than specified.

To fix an overrun condition, reduce the processing burden of the model by applying one or more of the following solutions:

  • Profiling can be used to measure execution time of each task and analyze in detail about the task which is overrunning.

  • Increase the sample times for the model. For example, increase the values of the Sample time parameters in all of your data source blocks.

  • Simplify the model.

If you are using External mode, and the preceding solutions do not fix the task overrun condition, consider disabling External mode. External mode adds a lightweight server to the model running on the target hardware. This server increases the processing burden upon the target hardware, which can contribute to a task overrun condition. There will be additional overhead due to profiling logic as well. This may also contribute to overrun condition.

See Also

|

Related Topics