Other Parts Discussed in Thread: TMS320F28335,
您好,我所使用的硬體是 TMDSHVMTRPFCKIT 和 TMS320F28335 來控制馬達。在執行 "C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVPM_Sensored\~Docs\Sensored FOC of PMSM" 文件中的 Level2,代碼如下:
#if (BUILDLEVEL==LEVEL2)
// ------------------------------------------------------------------------------
// Connect inputs of the RMP module and call the ramp control macro
// ------------------------------------------------------------------------------
rc1.TargetValue = SpeedRef;
RC_MACRO(rc1)
// ------------------------------------------------------------------------------
// Connect inputs of the RAMP GEN module and call the ramp generator macro
// ------------------------------------------------------------------------------
rg1.Freq = rc1.SetpointValue;
RG_MACRO(rg1)
// ------------------------------------------------------------------------------
// Measure phase currents, subtract the offset and normalize from (-0.5,+0.5) to (-1,+1).
// Connect inputs of the CLARKE module and call the clarke transformation macro
// ------------------------------------------------------------------------------
#ifdef DSP2833x_DEVICE_H
clarke1.As=((AdcMirror.ADCRESULT1)*0.00024414-offsetA)*2*0.909; // Phase A curr.
clarke1.Bs=((AdcMirror.ADCRESULT2)*0.00024414-offsetB)*2*0.909; // Phase B curr.
#endif // ((ADCmeas(q12)/2^12)-offset)*2*(3.0/3.3)
#ifdef DSP2803x_DEVICE_H
clarke1.As = _IQmpy2(_IQ12toIQ(AdcResult.ADCRESULT1)-offsetA); // Phase A curr.
clarke1.Bs = _IQmpy2(_IQ12toIQ(AdcResult.ADCRESULT2)-offsetB); // Phase B curr.
#endif // (ADCmeas(q12->q24)-offset)*2
CLARKE_MACRO(clarke1)
// ------------------------------------------------------------------------------
// Connect inputs of the PARK module and call the park trans. macro
// ------------------------------------------------------------------------------
park1.Alpha = clarke1.Alpha;
park1.Beta = clarke1.Beta;
park1.Angle = rg1.Out;
park1.Sine = _IQsinPU(park1.Angle);
park1.Cosine = _IQcosPU(park1.Angle);
PARK_MACRO(park1)
// ------------------------------------------------------------------------------
// Connect inputs of the INV_PARK module and call the inverse park trans. macro
// ------------------------------------------------------------------------------
ipark1.Ds = VdTesting;
ipark1.Qs = VqTesting;
ipark1.Sine=park1.Sine;
ipark1.Cosine=park1.Cosine;
IPARK_MACRO(ipark1)
// ------------------------------------------------------------------------------
// Connect inputs of the SVGEN_DQ module and call the space-vector gen. macro
// ------------------------------------------------------------------------------
svgen1.Ualpha = ipark1.Alpha;
svgen1.Ubeta = ipark1.Beta;
SVGENDQ_MACRO(svgen1)
// ------------------------------------------------------------------------------
// Connect inputs of the PWM_DRV module and call the PWM signal generation macro
// ------------------------------------------------------------------------------
pwm1.MfuncC1 = svgen1.Ta;
pwm1.MfuncC2 = svgen1.Tb;
pwm1.MfuncC3 = svgen1.Tc;
PWM_MACRO(1,2,3,pwm1) // Calculate the new PWM compare values
// ------------------------------------------------------------------------------
// Connect inputs of the PWMDAC module
// ------------------------------------------------------------------------------
pwmdac1.MfuncC1 = clarke1.As;
pwmdac1.MfuncC2 = clarke1.Bs;
PWMDAC_MACRO(6,pwmdac1) // PWMDAC 6A, 6B
pwmdac1.MfuncC1 = svgen1.Tc;
pwmdac1.MfuncC2 = svgen1.Tb-svgen1.Tc;
PWMDAC_MACRO(7,pwmdac1)
// ------------------------------------------------------------------------------
// Connect inputs of the DATALOG module
// ------------------------------------------------------------------------------
DlogCh1 = (int16)_IQtoIQ15(svgen1.Ta);
DlogCh2 = (int16)_IQtoIQ15(rg1.Out);
DlogCh3 = (int16)_IQtoIQ15(clarke1.As);
DlogCh4 = (int16)_IQtoIQ15(clarke1.Bs);
#endif // (BUILDLEVEL==LEVEL2)
在進行電流採樣的 clarke1.As、clarke1.Bs 數值都維持在初始值,並沒有改變,想請問:
1. 是中斷點設定的問題嗎? (所設定的觀察點如下圖) 還是有其他原因導致未接收到電流值?
2. 其中 AdcMirror.ADCRESULT1 的數值是如何得到的呢?