I am assuming that you are referring to the following shipped examples:
Based on my experience, I can give some of the suggestions that you might find usefull.
case-1: if you are using the same motor as suggested in the above example:
- Calibrate the offset of the encoder by executing the below example: https://www.mathworks.com/help/mcb/gs/hall-offset-calibration-pmsm-motor.html
- Update the eQEP offset in the script "mcb_pmsm_foc_sensorless_f28379d_datascript.m". It can be found in the directory: "MATLAB\Examples\R2024b\mcb\SensorlessFocFOSMOExample". This is highlighted in below figure.
- Please identify the COM port connected to the F28379D launch pad by checking the Device Manager. Update this COM port number in the script "mcb_pmsm_foc_sensorless_f28379d_datascript.m".This is highlighted in below figure.

- Connect the motor to the three phase output of the inverter, following the correct phase sequence.
- Open the simulink model "mcb_pmsm_foc_sensorless_f28379d.slx" found in the directory: "MATLAB\Examples\R2024b\mcb\SensorlessFocFOSMOExample". Note: the above directory is automaticall created in the current working directory if you run the command: openExample('mcb/SensorlessFocFOSMOExample')
- Deploy the code by pressing the button as shown below:
- After the code is successfully deployed, open the host model by clicking the hyperlink as shown in the below attached image.
- The host model communicates with the motor and gives the command to start/stop the motor. You can also vary the reference speed by the host model. Note: After deploying the Simulink model "mcb_pmsm_foc_sensorless_f28379d.slx", the ePWM is disabled due to a forced one-shot trigger event. The one-shot trigger flag is cleared when you toggle the "start" button in the host model. Once the one-shot event is cleared, you will be able to observe the PWM pulses on oscilloscope. Therefore, the host model is essential in running the motor.
- Press the run button in the host model.
- You can start the motor by toggling the "start/stop" switch. Set the reference speed to the desired value before starting the motor.
- In order to monitor the motor currents, speeds and other signals, you can use the scope found in the host model.
Case-2: If you are using a different motor:
Trouble shooting:
You can also try to first run the motor in open loop using the following shipped example:
Additionally, you may refer to the examples given under the motor control blockset:
I hope you find the information useful !