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.

Controlling Low Side Fets

Other Parts Discussed in Thread: DRV8301, DRV8301-69M-KIT, MOTORWARE

Hi folks,

I'm using a DRV8301-69m-KIT to control a motor and I'm trying to figure out how to control the individual FETS to utilize regenerative braking for the system. Looking at the schematic, I see that GPIO 0-5 are tied to the DRV8301 INH and INL pins to control the FETs, unfortunately, I can't seem to find anything in the software that controls the individual pwm pins off the F28069m. I've scoured all of the header files in my project (Instaspin Lab5e) but have come up short. Anyone able to point me in the right direction?

Cheers,

Jim

  • Jim,

    The INH and INL pins of the DRV8301 are driven by the EPWM modules of the C2000.

    These are setup in the hal.c file (Hardware Abstraction Layer). 

    sw\modules\hal\boards\drv8301kit_revD\f28x\f2806x\src\

  • Hi Nicholas,

    I've spent quite a bit of time looking through hal.c and came up short with what I wanted. I guess I was looking for a duty cycle parameter or something and didn't notice anything. Although, after further reading, I've noticed that epwm 1,2, and 3 get initialized in Hal.c:
    // initialize PWM handles
    obj->pwmHandle[0] = PWM_init((void *)PWM_ePWM1_BASE_ADDR,sizeof(PWM_Obj));
    obj->pwmHandle[1] = PWM_init((void *)PWM_ePWM2_BASE_ADDR,sizeof(PWM_Obj));
    obj->pwmHandle[2] = PWM_init((void *)PWM_ePWM3_BASE_ADDR,sizeof(PWM_Obj));

    Each ePWM has an A and B associated with it for high side and low side FETs. The pwm object associated with the pwmHandle has a slew of different variables associated with it. After ctrl+f'ing through spruh18e.pdf, I've found this:

    B Duty modulation for EPWMxA is set by CMPA, and is active high (that is, high time duty proportional to CMPA).
    C Duty modulation for EPWMxB is set by CMPB and is active high (that is, high time duty proportional to CMPB).

    So it sounds like I need to write to the CMP registers to get the duty cycle that I want. In my main file (inside the forever loop), I write the following for a duty cycle of 0%:

    halHandle->pwmHandle[0]->CMPA = 0;
    halHandle->pwmHandle[1]->CMPA = 0;
    halHandle->pwmHandle[2]->CMPA = 0;

    All I get is a high pitched noise coming from my motor as it continues to spin. Am I off track or getting close?

    Cheers,
    Jim
  • Jim,

    You are outside my area of expertise now. I would recommend posting your questions over to the InstaSPIN forums (C2000). They can help you more with the code aspect. I imagine you need to disable the motor control loop that is running before you take over the PWM signals.

    https://e2e.ti.com/support/microcontrollers/c2000/f/902#pi317047=1&pi317049=1

  • Thanks for trying Nicholas! I've posted to the C2000 forums. I'll reply here again if I get a solution just incase you encounter this question again in the future.

    Cheers,

    Jim

  • Hi Nicholas,
    I haven't received any help at the C2000 forums yet but I was wondering if you could clarify your statement about disabling the motor control loop? I followed the motorware Hal tutorial and one section involves setting up a function for writing a duty cycle to the pwms. It just says to make sure you call the function anywhere in the main loop to ensure the duty cycle gets updated and nothing about disabling anything.

    -Jim
  • Hi Jim,

    I am not sure on the exact procedure. The general thought is that you do not want the motor control loop running while you are trying to insert your own drive commands.

    I pinged the C2000 team and they should reply soon.