Error when deploying mcb_open_l​oop_contro​l_nucleo_g​474re on target

7 次查看(过去 30 天)
I am getting an error as shown below, please let me know the resolution:

回答(1 个)

Vedant Shah
Vedant Shah about 6 hours 前
The error occurs because Simulink does not allow changing certain block parameters while the model is running in External mode. In this case, the "Constant block value" inside the Start and Stop Motor subsystem is a non-tunable parameter, so when the model is executing on the target, Simulink cannot update it and throws that error.
To fix this:
One quick ways is to stop the simulation before modifying that Constant value, then run again.
And a more proper way is to:
  • Make the parameter tunable by replacing the constant with a variable (e.g., a Simulink.Parameter)
StartMotor = Simulink.Parameter(1);
StartMotor.CoderInfo.StorageClass = 'ExportedGlobal';
and now if we set the value of constant block as "StartMotor", it will become tunable.
  • Using an input/dashboard control instead of a Constant block.
For start/stop signals specifically, it’s better to use a runtime input (button, switch, or Inport) rather than a Constant block, since constants are compiled as fixed values during code generation.
For more information, refer to the following documentations:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by