Main Content

Troubleshoot Task Overrun Issue onRaspberry PiHardware

You can configure a model running on the target hardware to detect and notify you of task overruns.

Standard scheduling works well when a processor is moderately loaded but may fail if the processor becomes overloaded. A task overrun occurs when a task is scheduled to execute before a previous instance of the same task has completed.

To enable overrun detection:

  1. In your Simulink®model, selectSimulation>Model Configuration Parameters.

  2. In the Configuration Parameters dialog box, selectHardware Implementation.

  3. Set theHardware boardparameter toRaspberry Pi.

  4. InHardware board settingsunder theOperating system/scheduler settingsgroup, select theDetect task overrunsoption.

  5. ClickOK.

When a task overrun occurs:

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

  • The model saves diagnostic information to a log file. The name of the log file is the model name followed by.log. For example, if the task overrun occurs when running theraspberrypi_audioequalizermodel, the diagnostic information is saved to theraspberrypi_audioequalizer.logfile. To view the diagnostic information, open the log file by entering these commands in the MATLAB®Command Window:

    r = raspberrypi; system(r,'cat raspberrypi_audioequalizer.log')
    ans = **starting the model** Overrun detected: The sample time for the rate 0 is too short.

当一个被condition occurs, you can correct it using one or both of the following approaches:

  • Simplify the model.

  • Increase the sample times for the model and the blocks in it. For example, change theSample timeparameter in all of your data source blocks, such as blocks for input devices, from0.1to0.2.

Note

External mode increases the processing burden of the model running on your board. If the software reports an overrun, disable External mode.

Related Topics