Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed the week of November 23.

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.

What is the difference between "offsetHandle_I" and "adcBias.I" in struct _HAL_Obj_ ?

Other Parts Discussed in Thread: DRV8312

Hello:

Once the offset calibration is done, the final result will be stored in the driver object (HAL_Obj).Figure 6-9 shows the final results of calibrating the offsets for the DRV8312 Revision D board(a picture of adcBias I and V values)

Once the offset calibration is done, the Main Run Forerver Loop in lab02a also called HAL_updateAdcBias() to modify "adcBias" by subtracting "offsetHandle_I" .

1. What is the relation between "adcBias" and "offsetHandle_I" ?
2. Is it mandatory to call HAL_updateAdcBias() once the offset calibration is done?
3. If HAL_updateAdcBias() is not called immediately(e.g., not called until EST_State_Rs), will there be a problem for calculation in the previous EST_State_RoverL state?

if(flag_ctrlStateChanged)
{
   ...
   else if(ctrlState == CTRL_State_OnLine)
   {
       if((estState < EST_State_LockRotor) || (estState > EST_State_MotorIdentified))
          // update the ADC bias values
          HAL_updateAdcBias(halHandle);
       ...
   }
   ...
}

static inline void HAL_updateAdcBias(HAL_Handle handle)
{
  ...
  for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
    {
      bias = HAL_getBias(handle,HAL_SensorType_Current,cnt); 
      bias -= OFFSET_getOffset(obj->offsetHandle_I[cnt]);
      HAL_setBias(handle,HAL_SensorType_Current,cnt,bias);
    }
  ...
}

Thank you very much.

  • HAL is the interface layer where the core code communicates with the peripherals.

    OFFSET is what actually does and calculates the offset

    HAL_updateAdcBias is the function that takes the OFFSETs and puts them into the proper structure inside of HAL for use by the rest of the code.

    It's basically just following the rules of having a HAL layer as the interface between the projects and anything that touches a device specific peripheral/function.