SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
This configuration allows the system to avoid time spent doing the offsets recalibration after the user has commanded a motor startup. However, since low speed and motor startup requires the offsets to be correct, the user must load these pre-calibrated offsets prior to the CTRL_setFlag_enableCtrl(ctrlHandle, TRUE) function. The following code example loads known pre-calculated offsets into the HAL object.
// disable automatic calculation of bias values
CTRL_setFlag_enableOffset(ctrlHandle,FALSE);
// set the current bias
HAL_setBias(halHandle,HAL_SensorType_Current,0,_IQ(I_A_offset));
HAL_setBias(halHandle,HAL_SensorType_Current,1,_IQ(I_B_offset));
HAL_setBias(halHandle,HAL_SensorType_Current,2,_IQ(I_C_offset));
// set the voltage bias
HAL_setBias(halHandle,HAL_SensorType_Voltage,0,_IQ(V_A_offset));
HAL_setBias(halHandle,HAL_SensorType_Voltage,1,_IQ(V_B_offset));
HAL_setBias(halHandle,HAL_SensorType_Voltage,2,_IQ(V_C_offset));
Notice that I_A_offset, I_B_offset, I_C_offset, V_A_offset, V_B_offset and V_C_offset are the pre-calculated offsets on previous runs of the system. The following example can be used to get these offsets from the HAL object when they are updated after offsets recalibrations are enabled.
// enable automatic calculation of bias values
CTRL_setFlag_enableOffset(ctrlHandle,TRUE);
// Return the bias value for currents
I_A_offset = HAL_getBias(halHandle,HAL_SensorType_Current,0);
I_B_offset = HAL_getBias(halHandle,HAL_SensorType_Current,1);
I_C_offset = HAL_getBias(halHandle,HAL_SensorType_Current,2);
// Return the bias value for voltages
V_A_offset = HAL_getBias(halHandle,HAL_SensorType_Voltage,0);
V_B_offset = HAL_getBias(halHandle,HAL_SensorType_Voltage,1);
V_C_offset = HAL_getBias(halHandle,HAL_SensorType_Voltage,2);