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.

TMS320F28027F: Current reconstruction fails

Part Number: TMS320F28027F
Other Parts Discussed in Thread: DRV8301

Hello

I have the current reconstruction implemented by coping the required code from lab10 to my project.

But now the motor current is unstable and the motor makes more noise.

It seems the main ISR runs no longer on a stable 10 KHz rate but interrupts are missing or triggers twice after each other. Even if all the three currents are available.

So, it seems there is something going wrong with the calculation of the next trigger.

Yellow/Green: PWM outputs Blue: high during execution of the main ISR

3000 rpm, all current are available

Yellow/Green: PWM outputs Blue: high during execution of the main ISR

5000 rpm, not all current are always available.

Execution time of main ISR ~50us Interrupt rate should be 10 kHz (100us)

Any idea how to solve this ?

  • What board are you using? TI EVM kit? Or your own board.

    Any other codes you added in ISR in the example lab?

    Please post the user.h in your project to know the PWM and control frequency you used.

  • Hello

    We are using our own hardware but this is based on the EVM DRV8301 evaluation board and are using the same PWM outputs.

    37373.user.h

    // Interrupt routines

    __interrupt void mainISR(void)
    {
    #if EN_CURRENT_RECONSTRUCTION > 0
      SVGENCURRENT_MeasureShunt_e measurableShuntThisCycle = SVGENCURRENT_getMode(svgencurrentHandle);
    #endif

      HAL_setGpioHigh(halHandle,(GPIO_Number_e)HAL_Gpio_LED);

      // acknowledge the ADC interrupt
      HAL_acqAdcInt(halHandle,ADC_IntNumber_1);

      // convert the ADC data
      HAL_readAdcData(halHandle,&gAdcData);

    #if EN_CURRENT_RECONSTRUCTION > 0
      // run the current reconstruction algorithm
      SVGENCURRENT_RunRegenCurrent(svgencurrentHandle, (MATH_vec3 *)(gAdcData.I.value));

      gIavg.value[0] += (gAdcData.I.value[0] - gIavg.value[0])>>gIavg_shift;
      gIavg.value[1] += (gAdcData.I.value[1] - gIavg.value[1])>>gIavg_shift;
      gIavg.value[2] += (gAdcData.I.value[2] - gIavg.value[2])>>gIavg_shift;

      if(measurableShuntThisCycle > two_phase_measurable)
      {
          gAdcData.I.value[0] = gIavg.value[0];
          gAdcData.I.value[1] = gIavg.value[1];
          gAdcData.I.value[2] = gIavg.value[2];
      }
    #endif

      // run the controller
      CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData);

    #if EN_CURRENT_RECONSTRUCTION > 0
      // run the PWM compensation and current ignore algorithm
      SVGENCURRENT_compPwmData(svgencurrentHandle,&(gPwmData.Tabc),&gPwmData_prev);
    #endif

      // write the PWM compare values
      HAL_writePwmData(halHandle,&gPwmData);

    #if EN_CURRENT_RECONSTRUCTION > 0
      {
        SVGENCURRENT_IgnoreShunt_e ignoreShuntNextCycle = SVGENCURRENT_getIgnoreShunt(svgencurrentHandle);
        SVGENCURRENT_VmidShunt_e midVolShunt = SVGENCURRENT_getVmid(svgencurrentHandle);

        // Set trigger point in the middle of the low side pulse
        HAL_setTrigger(halHandle,ignoreShuntNextCycle,midVolShunt);
      }
    #endif

      // setup the controller
      CTRL_setup(ctrlHandle);

      // Run field weakening, alway's PM motor
      runFieldWeakening();

      // Run the over voltage controller
    #ifdef  OVERVOLTAGE_CONTROL_ENABLED
      runOverVoltageController();
    #endif

    #ifdef ENABLE_VOLTAGE_OFFSET_CONTROL
      // calculate the voltage offset if motor runs
      runVoltageOffsetsCalculation();
    #endif

      HAL_setGpioLow(halHandle,(GPIO_Number_e)HAL_Gpio_LED);

      return;
    } // end of mainISR() function

    With EN_CURRENT_RECONSTRUCTION we can enable the current reconstruction, if disabled everything works fine.

    Also the initialization of the current reconstruction are copied from the example.

    Regards,

    Jan

  • Are there any other interrupts in your project? Any other codes/functions in this mainISR except the codes you mentioned above.

    Seems like the execution time of the mainISR() is too long to cause the interrupt overflow. You can try to reduce the PWM frequency to see what happens.

  • The SCI, at 38400 baud is running under interrupt just place characters in to buffer or read from TX-buffer. SCI data is handled in the main loop.

    ePWM4 is used as 1 ms timer, just sets a flag other actions are executed from the mainloop.

    I have tried to set USER_NUM_PWM_TICKS_PER_ISR_TICK to 3 so, the mainISR is called at a rate of 150 us instead of 100 us, but this will not solve the problem.

  • Do you try to run the original lab10a? As mentioned above, there are some functions/codes take many CPU cycles in a ISR to cause the Interrupt overflow in your project.

    You may try to disable all of the other interrupts to see what happens. Or reduce the PWM frequency.

  • I don't think the original lab 10a will not run on our hardware without a lot lot of software adjustments.

    Unfortunately the DRV8301 EVM we used for the development is destroyed so will also takes a lot of time to build a new EVM for the 28027 CPU, the 28027 EVM will not fit in a standard DRV8301 EVM.

    Because of the low motor induction of 11uH lowering the PWM frequency is not an option.

    To day I have moved the "HAL_setTrigger" function to the end of the ISR and now the ISR interrupt rate is stable as long the three current measurements are valid, before this was not the case.

    It seems the timing to set this trigger is very critical, because the ISR takes about 50us, the same as the PWM period time for the 20 KHz PWM, the the moment of setting the new trigger coincidence with the next PWM pulse and triggers the ADC.

    Yellow: PWM-A output Blue: execution of the ISR.

    The next ISR should be started on the third PWM puls after the left marker, USER_NUM_PWM_TICKS_PER_ISR_TICK = 3 , but starts already after the second one.

    The 1 kHz interrupt takes only 1us and the SCI interrupts (10 * 5us)/100ms, so no heavy load. There are no interrupts executed during the execution of the main interrupt.

    I have also tried to set the minimum pulse width to 4 us, but does not solve the problem.

    The 28027 has only one ADC, a single conversion takes 13+7 = 20 clock cycles, because there are 8 channels converted on a trigger, the ADC will be ready after 8 * 20 / 60 = 2.6 us (according the documentation this may shorter due to pipe lining).

    What do you think about the timing mentioned above ?

  • I have increased the PWM frequency to 25 KHz so, the new trigger point is always set after the first PWM pulse and now have a stable ISR rate of 25/3 KHz.

  • What do you think about the timing mentioned above ?

    As mentioned above, you may try to disable all of the other interrupts, and refer to lab10a without add any other codes in the mainISR. To see what happens, this example lab can still support ~15kHz control frequency with over modulation.

    BTW, it's better to set the USER_MAX_VS_MAG_PU is less than (0.57).