- Power on the appropriate power supply,
and gradually increase the output voltage of the power supply to get an appropriate DC-bus
voltage.
- If using the graph tool, lab 2 uses the
same graph configurations and parameters as lab 1 to monitor 2 of the phase currents.
- Run the project by clicking on the button, or
click Run → Resume in the Debug tab. The systemVars.flagEnableSystem
should be set to 1 after a fixed time, that means the offsets calibration has
completed. The fault flags, motorVars_M1.faultMtrUse.all should be equal to
0. If this is not the case, the user should double check the current and voltage
sensing circuit in lab 1 as described in Section 3.5.1.3.
- To verify the current and voltage sensing
circuits of the motor driver, set the variable
motorVars_M1.flagEnableRunAndIdentify to 1 in the Expressions window as
shown in Figure 3-33. The motor will run with voltage/frequency (v/f) open loop. If the motor doesn't spin
smoothly, tune the v/f profile parameters in the user_mtr1.h file as shown below
according to the specification of the motor. See1 for more details on tuning the v/f profile parameters. Note: modification of these
parameters will require rebuilding the project. See step 14 of 14 for more information on rebuilding the project in debug mode.
#define USER_MOTOR1_FREQ_LOW_HZ (5.0) // Hz
#define USER_MOTOR1_FREQ_HIGH_HZ (400.0) // Hz
#define USER_MOTOR1_VOLT_MIN_V (1.0) // Volt
#define USER_MOTOR1_VOLT_MAX_V (24.0) // Volt
- The motorVars_M1.speedRef_Hz
variable is used to set the speed reference for the motor. Check the value of the
motorVars_M1.speed_Hz variable in the Expressions window to ensure that the motor
speed (motorVars_M1.speed_Hz) is close to the reference speed
(motorVars_M1.speedRef_Hz) as shown in Figure 3-33.
- In this build level, the current sensing,
voltage sensing, rotor angle estimator, and generator need to be validated. This can be
done using either the PWMDAC or the DAC128S module with an oscilloscope as described in
Section 3.4.2 or Section 3.4.3. Additionally, the DATALOG module can be used to view these sensing waveforms. For more
information on using the DATALOG to view the currents, voltages, and angle signals, see
step 7. If using the DAC128S module, configure the dac128s.ptrdata[] inputs to correspond
with the code shown in each of the following subsections. The code modification can be
done by uncommenting the appropriate code section for the DAC128S initialization and by
commenting out the rest of the DAC128S initialization that is not needed in the
subsection. It will be necessary to rebuild the project after modifying the code to
correspond with each subsection. See step 14 of 14 for more information on rebuilding the project in debug mode.
- The first set of parameters to
monitor is the phase currents. This is done by uncommenting the portion of code shown
below, which sets up the dac128s pointer data to the 3 phase currents as well as the
angle estimator variable. This code is found in the sys_main.c file. The
expected current waveforms should be similar to the waveforms shown on the
oscilloscope in Figure 3-35. The current waveforms measured at the DAC128S outputs should be almost the same as
the corresponding phase current waveforms capture by a current probe. If this is the
case, that indicates the current sensing circuit is good for motor control. If this is
not the case, it may be necessary to tune the v/f parameters in the user_mtr1.h
file as described in 1.
dac128s.ptrData[0] = &motorVars_M1.adcData.I_A.value[0]; // CH_A
dac128s.ptrData[1] = &motorVars_M1.adcData.I_A.value[1]; // CH_B
dac128s.ptrData[2] = &motorVars_M1.adcData.I_A.value[2]; // CH_C
dac128s.ptrData[3] = &motorVars_M1.angleGen_rad; // CH_D
dac128s.ptrData[4] = &motorVars_M1.angleEST_rad; // CH_E, N/A
dac128s.ptrData[5] = &motorVars_M1.adcData.V_V.value[0]; // CH_F, N/A
dac128s.ptrData[6] = &motorVars_M1.adcData.V_V.value[1]; // CH_G, N/A
dac128s.ptrData[7] = &motorVars_M1.adcData.V_V.value[2]; // CH_H, N/A
dac128s.gain[0] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A;
dac128s.gain[1] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A;
dac128s.gain[2] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A;
dac128s.gain[3] = 4096.0f / MATH_TWO_PI;
dac128s.gain[4] = 4096.0f / MATH_TWO_PI; // NA
dac128s.gain[5] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V; // N/A
dac128s.gain[6] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V; // N/A
dac128s.gain[7] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V; // N/A
... ...
dac128s.offset[0] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[1] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[2] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[3] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[4] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[5] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[6] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[7] = (uint16_t)(0.5f * 4096.0f); // N/A
- The second set of parameters to
monitor are the phase voltages. To do this, the section of code that sets up the
dac128s pointer data to point to the phase voltage should be uncommented as shown
below. This code is found in the sys_main.c file. The output waveform shape of
the phase voltage sensing from the DAC128S module should look similar to the image
shown in Figure 3-36 or Figure 3-37. If this is the case, that indicates that the voltage sensing sircuit is working as
expected. Note that the amplitude can vary depending on the supply voltage and motor
used, but the shape of the waveform should be the same. Note the difference in the
phase waveforms depending on the SVM mode used. For the Common SVM mode, there is a
voltage dip at the upper and the lower peaks of the waveform, whereas for the Minimum
SVM mode, the voltage dip only appears on the upper peak, but stays flat on the lower
peak. To change the SVM mode, select either SVM_COM_C or SVM_MIN_C from the
motorVars_M1.svmMode enumeration in the Expressions
window.
dac128s.ptrData[0] = &motorVars_M1.adcData.V_V.value[0]; // CH_A
dac128s.ptrData[1] = &motorVars_M1.adcData.V_V.value[1]; // CH_B
dac128s.ptrData[2] = &motorVars_M1.adcData.V_V.value[2]; // CH_C
dac128s.ptrData[3] = &motorVars_M1.angleGen_rad; // CH_D
dac128s.ptrData[4] = &motorVars_M1.angleEST_rad; // CH_E, N/A
dac128s.ptrData[5] = &motorVars_M1.adcData.I_A.value[0]; // CH_F, N/A
dac128s.ptrData[6] = &motorVars_M1.adcData.I_A.value[1]; // CH_G, N/A
dac128s.ptrData[7] = &motorVars_M1.adcData.I_A.value[2]; // CH_H, N/A
dac128s.gain[0] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V;
dac128s.gain[1] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V;
dac128s.gain[2] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V;
dac128s.gain[3] = 4096.0f / MATH_TWO_PI;
dac128s.gain[4] = 4096.0f / MATH_TWO_PI; // N/A
dac128s.gain[5] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A; // N/A
dac128s.gain[6] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A; // N/A
dac128s.gain[7] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A; // N/A
... ...
dac128s.offset[0] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[1] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[2] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[3] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[4] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[5] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[6] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[7] = (uint16_t)(0.5f * 4096.0f); // N/A
- The third
set of parameters to monitor is the angle generator and the angle estimator
parameters. To do this, the section of code that sets up the dac128s pointer data to
point to the appropriate variables should be uncommented as shown below. This code is
found in the sys_main.c file. The angle from the angle generator and the
estimator waveforms should be similar to the oscilloscope waveforms shown in Figure 3-38. Notice that the angle of the force angle generator is very similar to the
estimated rotor angle of the FAST or eSMO estimator. This indicates that the FAST or
eSMO estimator works as expected with the motor parameters and the sampling current
and voltage
signals.
dac128s.ptrData[0] = &motorVars_M1.angleGen_rad; // CH_A
dac128s.ptrData[1] = &motorVars_M1.angleEST_rad; // CH_B
dac128s.ptrData[2] = &motorVars_M1.anglePLL_rad; // CH_C
dac128s.ptrData[3] = &motorVars_M1.adcData.I_A.value[0]; // CH_D
dac128s.ptrData[4] = &motorVars_M1.adcData.V_V.value[0]; // CH_E, N/A
dac128s.ptrData[5] = &motorVars_M1.adcData.I_A.value[1]; // CH_F, N/A
dac128s.ptrData[6] = &motorVars_M1.adcData.I_A.value[2]; // CH_G, N/A
dac128s.ptrData[7] = &motorVars_M1.adcData.V_V.value[1]; // CH_H, N/A
dac128s.gain[0] = 4096.0f / MATH_TWO_PI;
dac128s.gain[1] = 4096.0f / MATH_TWO_PI;
dac128s.gain[2] = 4096.0f / MATH_TWO_PI;
dac128s.gain[3] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A;
dac128s.gain[4] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V; // N/A
dac128s.gain[5] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A; // N/A
dac128s.gain[6] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_CURRENT_A; // N/A
dac128s.gain[7] = 2.0f * 4096.0f / USER_M1_ADC_FULL_SCALE_VOLTAGE_V; // N/A
dac128s.offset[0] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[1] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[2] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[3] = (uint16_t)(0.5f * 4096.0f);
dac128s.offset[4] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[5] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[6] = (uint16_t)(0.5f * 4096.0f); // N/A
dac128s.offset[7] = (uint16_t)(0.5f * 4096.0f); // N/A
- If using the DATALOG module with the
graph tool to check the current sensing signals, voltage sensing signals, and the angle
outputs, follow the steps described below. For more info on the datalog module, see Section 3.4.1. Note: It will be necessary to rebuild the project in between each of the below steps
after modifying the code. See step 14 of 14 for more information on rebuilding the project in debug mode.
- To test the phase currents for phase
U and V using the DATALOG module, the following code must be set up in the
sys_main.c file.
Note: This code is already configured
by default for build level 2. The phase current sampling signals waveform displayed
on the graph tool as shown in
Figure 3-39.
datalogObj->iptr[0] = &motorVars_M1.adcData.I_A.value[0];
datalogObj->iptr[1] = &motorVars_M1.adcData.I_A.value[1];
- To test the phase voltages for phase
U and V using the DATALOG module, the following code must be set up in the
sys_main.c file and modified to the code shown below. The phase voltage
sampling signals waveform on graph tool as shown in Figure 3-40.
datalogObj->iptr[0] = &motorVars_M1.adcData.V_V.value[0];
datalogObj->iptr[1] = &motorVars_M1.adcData.V_V.value[1];
- Configuring DATALOG module four
inputs as the following codes. The angle from the force angle generator or estimator
waveforms on the graph tool as shown in Figure 3-41. Notice that the angle of the force angle generator is very similar as the
estimated rotor angle of the FAST or eSMO
estimator.
datalogObj->iptr[0] = &motorVars_M1.angleFOC_rad;
datalogObj->iptr[1] = &motorVars_M1.angleEST_rad;
- Verify the over
current fault protection by decreasing the value of the variable
motorVars_M1.overCurrent_A, the over current protection is implemented by the
CMPSS modules. The over current fault will be trigger if the
motorVars_M1.overCurrent_A is set to a value less than the motor phase current
actual value, the PWM output will be disabled, the
motorVars_M1.flagEnableRunAndIdentify is cleared to 0, and the
motorVars_M1.faultMtrUse.all will be set to 0x10 ( 16) as shown in
Figure 3-34.
- Set the variables
motorVars_M1.flagEnableRunAndIdentify to 0 to stop run the motor.
- Once complete, the controller can now be
halted, and the debug connection terminated. Fully halting the controller by first
clicking the Halt button on the toolbar or by clicking
Target → Halt. Finally, reset the controller by clicking on or clicking
Run → Reset.
- Close CCS debug session by clicking on
Terminate Debug Session or clicking Run → Terminate.
- Power off the power supply to the
inverter kit.
Adjust the value of
motorVars_M1.overCurrent_A in Expression window to trigger the over current fault
as shown in Figure 3-34.
Use DAC128S085EVM with an
oscilloscope to monitor three phase sensing current of the motor and compare the sampling
value to the measurement value with a current probe as shown in Figure 3-35.
Use DAC128S085EVM with an
oscilloscope to monitor three phase sensing voltage of the motor, and use common mode SVPWM
by setting motorVars_M1.svmMode equal to SVM_COM_C as shown in Figure 3-36.
Use DAC128S085EVM with an oscilloscope to monitor three phase sensing voltage of the
motor, and use minimum mode SVPWM by setting motorVars_M1.svmMode equal to SVM_MIN_C
as shown in Figure 3-37.
Use DAC128S085EVM with an
oscilloscope to monitor the rotor angle of the motor from the angle generator and the angle
from the FAST estimator as shown in Figure 3-38.
Use Datalog with
Graph Tool to monitor three phase sensing current of the motor as shown in Figure 3-39.
Use Datalog with Graph Tool to monitor three
phase sensing voltage of the motor as shown in Figure 3-40.
Use Datalog with
Graph Tool to monitor rotor angle of the motor from the angle generator and angle from the
FAST estimator as shown in Figure 3-41.