- Run the code by pressing on the
runbutton, or click Run → Resume in the
Debug tab.
- The project should now run, and
the values in the graph and watch window should keep updating.
- In the Expressions window, set
the variables motorVars_M1.flagEnableRunAndIdentify to 1 after
systemVars.flagEnableSystem was automatically set to 1 in the watch
window.
- The project should now run, and
the values in the graphs and expressions window should continuously update as
shown in Figure 3-30 while using this project. You may want to re-size the windows according to
your preference.
- In the watch view, the variables
motorVars_M1.flagRunIdentAndOnLine should be set to 1 automatically
if there are no faults. The ISRCount should be increasing continuously.
If the ISRCount is not increasing, ensure that the TEST_ENABLE predefine
is defined. If this predefine is not defined, then the ISRCount will not
increment in the code.
- Check the calibration offsets of
the motor driver board. The offset values of the motor phase current sensing
values should be equal to approximately half of the ADC scale current and the
phase voltage offsets should be equal to approximately 0.5 as shown in Figure 3-30.
- If using the graph tool, the
variables shown in the graphs are the phase currents for phase u and v. These
should be close to 0 in magnitude.
- Expand and check the
MotorVars_M1.faultMtrPrev.bit structure to ensure that there are no
fault flags set.
- Using an oscilloscope, probe the
PWM outputs that are used for motor drive control. The duty cycles of the three
PWMs are set to 50% in this build level. The expected PWM output waveforms are
as shown in Figure 3-31. The PWM switching frequency will be the same as the value that was set for
the USER_M1_PWM_FREQ_kHz define in the user_mtr1.h file.
- Set the
motorVars_M1.flagEnableRunAndIdentify variable to 0 to disable the
PWMs.
- If any of the previous steps
provide unexpected results, additional debug will be necessary. A few things to
check are:
- Ensure that the DRV board
is properly set up, with the proper capacitors/resistors populated on
the EVM.
- Ensure that the motor
driver board being used is the same as the board selected in the build
configurations (see 1).
- Ensure that the proper
predefines are set.
- Ensure that the switches
are configured properly on the C2000 MCU Lunchpad/ControlCARD as
described in Section 3.2.
- Once the previous steps are
complete, the controller can now be halted, and the debug connection terminated.
Halt the controller by first clicking the Halt button on
the toolbar or by clicking Target → Halt. Finally, reset the
controller by clicking on thebutton or clicking Run → Reset→CPU Reset.
- Close the CCS debug session by
clicking the Terminate Debug Session button or clicking Run → Terminate. This will halt the program
and disconnect Code Composer from the MCU.
- It is not necessary to terminate
the debug session each time the user changes or runs the code again. Instead,
the following procedure can be followed. After rebuilding the project, press
thebutton or click Run → Reset→CPU Reset,
and then press thebutton or click Run → Restart. The
project must be terminated if the target device or the configuration is changed,
and before shutting down CCS.
The C2000 PWM
with deadband outputs to the input of the gate drive as shown in Figure 3-31