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.

CCS/DRV8301-HC-C2-KIT: Set overcurrent mode

Part Number: DRV8301-HC-C2-KIT
Other Parts Discussed in Thread: DRV8301

Tool/software: Code Composer Studio

I am having some issues with my DRV8301-HC-C2-KIT resetting while driving a high load with large torque spikes. I'm thinking this may be due to the overcurrent protections. I'm confident that I have all of my current settings correct in my user.h file, but I haven't been able to figure out how to change the OcMode in the drv8301.h file. I see the different modes are enumerated starting on line 228, but I don't know which mode is currently in use. How do I set the mode? I am relatively new to coding in CCS, so my apologies if this is a dumb question. I've attached my drv8301.h file (currently using the unedited file provided by the instaspin labs).drv8301.h

  • You don't need to change the drv8301 header file and source file, just need to add some codes to set the limitation current or over current mode as below in proj_labx file.

    // turn on the DRV8301 if present
    HAL_enableDrv(halHandle);
    // initialize the DRV8301 interface
    HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars);

    // Imax=Vds/RdsOn=0.576V/3.9mOHM=147A(peak)
    gDrvSpi8301Vars.Ctrl_Reg_1.OC_MODE = DRV8301_OcMode_LatchShutDown;
    gDrvSpi8301Vars.Ctrl_Reg_1.OC_ADJ_SET = DRV8301_VdsLevel_0p576_V;
    gDrvSpi8301Vars.SndCmd = true;
    HAL_writeDrvData(halHandle,&gDrvSpi8301Vars);