If you wish to control the motor speed without using the host model, you can try changing the structure of the target model. You can try modifying it such that, instead of receiving the speed reference from the host model, the speed reference values are hard coded using ‘Step Input’ blocks or ‘Repeating Sequence Stair’ blocks, in the target model itself.
Alternatively, you can generate code using ‘Embedded Coder’ and deploy it using a third-party software ‘Code Composer Studio’. Then, add the variable ‘Enable’ to the watch window, where you can toggle its values to turn the motor On/ Off.
In order to add a potentiometer for speed control, you can make some modifications in the shipping example model. Since a potentiometer gives analog values as outputs, you will need to connect it to an ‘ADC’ module on the target board. Ensure that the ADC Module is not used by any other components in the model. In the control algorithm, read the ADC value corresponding to the potentiometer's position. Then, scale this ADC value to match the rated speed range of the motor being used. This will allow the potentiometer to control the speed linearly or as per the desired mapping.
To understand the configuration settings based on the target hardware, you can refer to the workflow mentioned in the below documentation link: https://www.mathworks.com/help/releases/r2024b/ti-c2000/ug/foc-hall-sensor-example.html You can also try running the following command in the MATLAB Command Window:
openExample('c2b/FOCHallSensorUsingC2000Example','supportingFile','mcb_pmsm_foc_hall_f280049C')
This will open an example model for Field Oriented Control, which is configured for the F280049C target board. Please refer to the hardware configuration settings for the above example model.
I hope this answers your question.