3.2.2 mcCurI_CurrentOffsetCalculation

C


/* Function to calculate the current sensor offset */
tmcTypes_StdReturn_e mcCurI_CurrentOffsetCalculation( tmcCur_ModuleData_s * const pModule );	

Summary

Calculates the offset for the motor phase current sensor

Description

This function calculates the current offsets for the motor phase currents ia and ib by reading and averaging a specified number of ADC samples. This offset calculation is essential for calibrating the ADC inputs to ensure accurate current measurements

Precondition

None.

Parameters

ParamDescription
pModuleA constant pointer to the module data structure. This structure holds the ADC input data used for offset calculation

Returns

  • StdReturn_Progress - The offset calculation is in progress.
  • StdReturn_Fail - The offset calculation failed.
  • StdReturn_Complete - The offset calculation is complete.

Example

tmcCur_ModuleData_s mcCurI_ModuleData_gds;
tmcTypes_StdReturn_e returnStatus;

returnStatus = mcCurI_CurrentOffsetCalculation(&mcCurI_ModuleData_gds);

if (returnStatus == StdReturn_Complet) {
    // Offset calculation completed successfully
} else if (returnStatus == StdReturn_Fail) {
    // Offset calculation failed
} else {
    // Offset calculation in progress
}
    

Remarks

None.