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.

DRV8301-kit Over current , TZ configuration,GPIO settings

Expert 1570 points

Other Parts Discussed in Thread: DRV8301, MOTORWARE, CONTROLSUITE

Hi,

I fail to understand the Over-Current handling and Trip-Zone configuration.

1. In the code the One-shot is configured on TZ1, Cycle-by-cycle on TZ6.

2. In the schematics, the Fault and OCTW are connected to GPIOs 13 and 14.

3. GPIO setting:

     TZ1 is set on GPIO12. But GPIO12 is connected to LED1

     TZ6 is not assigned to any GPIO.

     GPIO13,14 are configured as general purpose, input

4. This brings me to a conclusion that the MCU doesn't know about over-current and fault events.

5. In order to recover from over-current and other events it is stated in the DRV8301 datasheet that some action is required, which I didn't find in the code.

6. communication with the DRV8301 is not possible since all SPI GPIOs are configured as "general purpose"

can you please clarify the protection handling / GPIO settings ?

thanks a lot

  • you discovered one of our secrets, the Trip Zones / Fault management have not been configured correctly in MotorWare :(

    This has been completely updated for the next release _09 on 8/22.

    I've attached the new drv.c file that is in release _09 that replaces

    C:\ti\motorware\motorware_1_01_00_08\sw\drivers\drv\boards\drv8301kit_revD\f28x\f2806x\src\drv.c

    I'll post the drv.h in the next post (our e2e system doesn't let us upload multiple attachements)

    The drv_obj.h is unchanged EXCEPT in _09 we are also changing the path of this include
    #include "sw/modules/types/src/32b/types.h"
    to
    #include "sw/modules/types/src/types.h"

    but if using these files with _08 the drv_obj.h in _08 should work.

     

    5. This action is not in the MotorWare projects today, it is in the GUI project (Reset DRV) because I added it myself :)  I'll need to check if this has been updated as well.

    6. Communication is possible in the GUI project...I honestly haven't tried with the MotorWare projects so I'll need to check if these are set correctly now.

     

  • the DRV8301 drv.h for _09

    drv.h
  • Hi Chris,

    sorry, I didn't know it was a secret... it wasn't written anywhere :)

    thanks for the update...

  • Ok, it was pretty easy to confirm that the SPIs are still being set as GPIO even in _09 of MotorWare.

    Looks like this release only addresses the TZ functionality of the F2806x devices, not the DRV8301. I checked and it looks like this is something we will add to the October _10 release. We already have a branch with API commands for the DRV8301.

    If you cannot wait til October:
    You can enable the SPI in the drv file and here is some simple code I used on the GUI proejct to handle the reset. Note that this code isn't used in MotorWare and some of the variable conventions and API names have since changed. It is not supported code, so use at your own risk....

    void ResetFault(void)
    {
     //Reset DRV devices
      //de-assert the DRV830x EN_GATE pin - DIMM_42; GPIO39 on F2806x

      DRV_setGpioLow(drvHandle, DRV_8301_EN_GATE);
      DRV_setup8301(drvHandle);
      Gui.gFaultStatus = 1;
     }

     DRV_resetPwmTripZone(drvHandle);
     

    // reset starting variables for the GUI
     SpinTAC_setup();
     PID_setUi(pidHandle_fw,_IQ(0.0));
     Gui.gSetSpeedRef_krpm = _IQ(0.2);
     SetSpeedRef_pu = _IQmpy(Gui.gSetSpeedRef_krpm,One_Over_Speed_krpm_sf);
     Gui.gSpinWashState = 0;
     Gui.gSpinWashIsrCnt = 0;
     Gui.gWashCycleState = 0;
     Gui.gWashCycleIsrCnt = 0;
     Gui.gAccAngle_kdeg = _IQ(0.0);
       
     Gui.gResetFault = 0;
     return;
    }

    ----------------------------------

    the DRV_setup8301() function was defined in my drv.c as:

    void DRV_setup8301(DRV_Handle drvHandle)
    {
      DRV_Obj *drv = (DRV_Obj *)drvHandle;
      uint32_t n = 0;

      //assert the DRV8301 EN_GATE pin
      GPIO_setHigh(drv->gpioHandle,DRV_8301_EN_GATE);

      for(n=0;n<1000000;n++)
        {
          asm("   NOP");
        }

      gdrv8301_cntrl_reg1.bit.GATE_CURRENT = 0;       // full current 1.7A
      gdrv8301_cntrl_reg1.bit.GATE_RESET = 0;         // Normal Mode
      gdrv8301_cntrl_reg1.bit.PWM_MODE = 0;           // six independant PWMs
      gdrv8301_cntrl_reg1.bit.OC_MODE = 1;            // latched OC shutdown
      gdrv8301_cntrl_reg1.bit.OC_ADJ_SET = 15;        // OC @ Vds=0.358V
      gdrv8301_cntrl_reg1.bit.Reserved = 0;

      gdrv8301_cntrl_reg2.bit.OCTW_SET = 1;           // report OT only
      gdrv8301_cntrl_reg2.bit.GAIN = DRV_8301_GAIN;   // CS amplifier gain

      gdrv8301_cntrl_reg2.bit.DC_CAL_CH1 = 0;         // not in CS calibrate mode
      gdrv8301_cntrl_reg2.bit.DC_CAL_CH2 = 0;         // not in CS calibrate mode
      gdrv8301_cntrl_reg2.bit.OC_TOFF = 0;            // normal mode
      gdrv8301_cntrl_reg2.bit.Reserved = 0;

      //write to DRV8301 control register 1, returns status register 1
      gdrv8301_stat_reg1.all = DRV_writeSpiData(drvHandle, DRV_8301_CNTRL_REG_1_ADDR, gdrv8301_cntrl_reg1.all);

      //write to DRV8301 control register 2, returns status register 1
      gdrv8301_stat_reg2.all = DRV_writeSpiData(drvHandle, DRV_8301_CNTRL_REG_2_ADDR, gdrv8301_cntrl_reg2.all);

      return;
    } // end of DRV_setup8301() function

    ---------------------

    the DRV_resetPwmTripZone() function is no longer used in MotorWare, but it was defined in the drv.h file used with the GUI as:

    inline void DRV_resetPwmTripZone(DRV_Handle handle)
    {
      DRV_Obj *obj = (DRV_Obj *)handle;

      // Proceed to Trip Zone Reset
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_1]);
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_2]);
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_3]);

      return;
    } // end of DRV_resetPwmTripZone() function

     

    and, if you can't wait for _10, you can look at the SPI read/write of DRV8301 in the controlSUITE project and try to migrate into the MotorWare style.

    C:\ti\controlSUITE\development_kits\DRV830x-HC-C2-KIT_v104\GUI_project_InstaSPIN_BLDC