AnsweredAssumed Answered

Errors in motor control library

Question asked by Davide Zanni on Jul 11, 2018

I use the SDK 4.3 and I have found this errors:

- in open loop mode when enabled the V/F mode and reverse rotation the OL_Calc when increase the absolute speed, the voltage decrease

void OL_Calc(COL this)
  pVars_t pVars = CLASS_VARS;
  if (pVars->VFMode == TRUE)
    /* V/F mode TRUE means enabled */
    int16_t hMecSpeed01Hz = SPD_GetAvrgMecSpeed001Hz(pVars->oVSS);
    if (hMecSpeed01Hz >= 0)
      int16_t hOLVoltage = pParams->hVFOffset + (pParams->hVFSlope*hMecSpeed01Hz);
      pVars->hVoltage = hOLVoltage;
      int16_t hOLVoltage = pParams->hVFOffset - (pParams->hVFSlope*hMecSpeed01Hz);
      pVars->hVoltage = -hOLVoltage;


- when enable the startup on the fly, sometimes the initial speed is high (when the motor is stopped) because the read of the current is wrong. The source of the problem is the procedure of calibration. To solve the problem in the file MCTask.c I initialize the variable Iab to zero in functions TSK_HighFrequencyTask and FOC_CurrController

Curr_Components Iab = {0,0}


- in the startup on the fly sometimes with GCC and optimization enabled (-O2) the function RUC_Exec could go in HardFault_Handler. The source of the problem is the use of a NULL pointer for read the duration of the phase. Infact the pointer pVars->pPhaseParams could be NULL


  pRUCPhasesParams_t pPhaseParams = pVars->pPhaseParams;
  uint16_t hDurationms = pPhaseParams->hDurationms; /*Duration of the rev up phase*/