Other Parts Discussed in Thread: CONTROLSUITE
Tool/software: Code Composer Studio
Is there a way to measure the DC bus voltage internally using a code in CCS ?
Please direct me to a sample code if available.
Thank you
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Is there a way to measure the DC bus voltage internally using a code in CCS ?
Please direct me to a sample code if available.
Thank you
Please download the controlSUITE as the following link, and install it on your PC.
https://www.ti.com/tool/controlsuite
And each motor control example code measure the DC bus voltage, you may refer to the hardware and software that can be found in the project folder, like below.
C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1
I used the following piece of codes from the HVACI_Sensorless_PFC to measure the DC bus voltage:
if (HistPtr >= HistorySize)
HistPtr = 0;
// BoxCar Averages - Input Raw samples into BoxCar arrays
Hist_Vbus[HistPtr] = AdcResult.ADCRESULT4; // Vbus
// VrectAvg and VrectRMS are Q24: convert to Q12
Hist_VrectAvg[HistPtr] = (int16) (VrectAvg >> 12);
Hist_VrectRMS[HistPtr] = (int16) (VrectRMS >> 12);
// Freq_Vin is Q15; convert to Q12
Hist_Freq_Vin[HistPtr] = (int16) (Freq_Vin >> 12);
// Measurements
// View the following variables in Expressions Window as:
// Gui_Ipfc, Gui_Vbus, Gui_VrectAvg, Gui_VrectRMS, Gui_Freq_Vin (All are Q06)
// Calculate GUI values which can be seen in the Expressions Window.
temp_Vbus = temp_VrectAvg = temp_VrectRMS = temp_Freq_Vin = 0;
for (i = 0; i < HistorySize; ++i){
temp_Vbus += Hist_Vbus[i];
temp_VrectAvg += Hist_VrectAvg[i];
temp_VrectRMS += Hist_VrectRMS[i];
temp_Freq_Vin += Hist_Freq_Vin[i];
}
Gui_Vbus = ((long) temp_Vbus * (long) K_Vbus) >> 15;
Gui_VrectAvg = ((long) temp_VrectAvg * (long) K_VrectAvg) >> 15;
Gui_VrectRMS = ((long) temp_VrectRMS * (long) K_Vrms) >> 15;
Gui_Freq_Vin = ((long) temp_Freq_Vin);
++HistPtr;
According to the highlighted line the ADC channel 4 is used to measure the Bus voltage. However the following code is also found at the initialization:
// Initialize ADC for DMC Kit Rev 1.1
ChSel[0]=1; // Dummy meas. avoid 1st sample issue Rev0 Picollo*/
ChSel[1]=1; // ChSelect: ADC A1-> Phase A Current
ChSel[2]=9; // ChSelect: ADC B1-> Phase B Current
ChSel[3]=3; // ChSelect: ADC A3-> Phase C Current
ChSel[4]=15; // ChSelect: ADC B7-> Phase A Voltage
ChSel[5]=14; // ChSelect: ADC B6-> Phase B Voltage
ChSel[6]=12; // ChSelect: ADC B4-> Phase C Voltage
ChSel[7]=7; // ChSelect: ADC A7-> DC Bus Voltage
ADC_MACRO_INIT(ChSel,TrigSel,ACQPS)
According to the above code the ADC channel 7 is assigned for the DC bus voltage.
I am confused which channel I should use to obtain the correct value. Your assistance is highly appreciated.
Thank you in advanced.
You might have a look at the schematic of this kit that can be found in below folder, A4 is the output of PFC, A7 is the input of DC bus for inverter, both should be equal if you connect them together.
(C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\~HVMotorCtrl+PFC-HWdevPkg\HVMotorCtrl+PFCKit-R1.1)
Thank you for the explanation.
The code worked but in order to verify the values I tried measuring the DC bus manually using a multi-meter. But there was a significant difference between the value in the expression window vs the value shown by the multi-meter.
The multi-meter reading was obtained by having the probes between the BS1 and GND.
The following table shows the difference between them:
| Multi-meter Reading | Value on Expression Window |
| 61.1 V | 41.3 V |
| 90.2 V | 59.9 V |
| 111.5 V | 73.5 V |
Is there a reason for the difference or is there an error I am making? Please explain the reason due to this difference.
Hoping for an explanation. Thank you.
Maybe, the voltage scale and calculation formula you used is not correct, you may check again.