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 (DRV8301-69m-kit)

Other Parts Discussed in Thread: DRV8301, MOTORWARE

Hi folks,

I posted this question to the motor driver forums but was recommended by Nicholas to come here with my problem. Here is the link to my exchange with him: http://e2e.ti.com/support/applications/motor_drivers/f/38/p/449884/1618330#1618330

I'm trying to figure out how to control the low side FET's to be able to utilize regenerative braking for the system I'm working on. Here is the last thing I posted on the motor drive forums and it's where I'm currently at:

" 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?  "

Any help would be greatly appreciated!

-Jim

  • Just an update:

    I've followed the motorware hal tutorial "6.4.4. Create a Write Function". Based on the description, it sounds like this is what I need to do to alter the duty cycle for CMPA or CMPB. Unfortunately, I still get the high pitched noise coming from the motor when I activate my brake. I've been slogging through the header files and it seems like the pwms are setup to only use or have access to the high side PWMs. The DRV8301 is configured for 3 independent inputs . Inside the Hal_setuppwms function, the action qualifier for output A is the only one that is set. I would expect both action qualifier registers to be configured if I would want access to CMPB.

    Can anyone chime in on this?
    -Jim
  • Hi Jim,

    The DRV8301 is capable of providing its own dead-time.  When operating in this mode, the PWM outputs are complimentary, which means that whenever a PWM top signal for a given half-bridge is ON, the PWM bottom signal for that half-bridge is OFF, and vice-versa.  This allows for the creation of 8 voltage vectors (states) which are all the states needed by InstaSPIN.  The only exception is when the inverter is placed in high-impedance mode where all transistors are turned OFF.  Since the DRV8301 can create its own dead-time, this also means that only three of the six PWM signals from the processor are needed.  Bottom Line:  You can't control the bottom PWMs independently from the top PWMs.

     

    It sounds like you are trying to control the PWM states from your forever loop in main.c.  But if you have not disabled interrupts, this means that the InstaSPIN ISR is still running.  So when you set the duty cycle to zero, and then you get an interrupt, the ISR overrides your backgroun code and sets the PWMs to values based on the InstaSPIN FOC function.  Then you exit your ISR, and your forever loop resets the PWMs to zero, and so on.  This might be the source of the high pitched noise coming from the motor.

     

    Perhaps you could provide a little more information on what you are trying to do.  If you are trying to do regenerative breaking, you should be able to achieve that by simply setting Iq to a negative value.  If you have a switchable bus resistor, then you could monitor the DC bus level, and control the bus resistor switching based on the voltage level.  Or, if you are trying to do DC braking, then you could do dynamic braking by commanding null voltage vectors, and controlling them based on the shunt current signals to insure you don't exceed your maximum current limit.

     

    Best Regards,

    Dave

     

  • Hi Dave,

    I'm trying to incorporate regenerative braking and this was exactly the answer I was looking for. Can you recommend any literature on how modifying Iqref can result in regenerative braking? I know the theory states turning off the high side FETs and pwming the low side would result in controlled regenerative braking (with the addition of some hardware to control and monitor voltage levels). Simply modifiying a current value sounds too simple! In any case, should the interrupts be disabled for modifications to iqref? I'll start playing around with it and see what happens.

    Thanks!
    Jim
  • Hi Jim,

    No, it really is that simple!  In fact, when slowing down a motor using field oriented control, it is hard NOT to regenerate.  You don't have to change anything.  You don't have to disable interrupts.

    To explain how this works, are you familiar with LTSpice?  It is a simulation tool that you can install on your computer for free.  If so, I can send you a simulation or two that you can play with, and get a feel for how regeneration works.

    Regards,

    Dave

     

  • Dave, that would be awesome! I'm more familiar with Multisim but I'll figure out LTSpice since it's something I should be familiar with anyhow.

    Thanks!

    Jim

  • Hi Jim,

    For some reason, I can no longer upload files to the E2E forum.  I suspect that we have "improved" our website again, which really means we broke it.  So I have placed the simulation files on my dropbox site:

    https://www.dropbox.com/s/wfxxqcr3s82x2sa/Motor%20Control%20Sims.zip?dl=0

    1.  Download LTSpice and install it on your computer.

    2.  Go to the link above and find the file "Motor Control Sims.zip", and download it to your computer.  Right click on it and select "Extract All".  Then pick a folder to extract to.

    3.  Go to that folder and right click the file called "Support Pack.zip" and select "Extract All".

    4.  Change the default folder which is shown to the same folder you picked above.  The Support Pack files MUST be in the same folder as the sim files.

    5.  Open the file "41 PMSM Digital FOC Speed control.asc".  If you installed LTSpice correctly, and all of the Support Pack files are in the same directory as this file, you should see a block diagram for a Field Oriented system.

    6.  On the toolbar, click the "Running Man" icon to run the simulation.  You will see waveforms of some of the important signals in the block diagram.  You can change parameters, plot different signals, etc.

    7.  When you are finished playing with this file, open the file "06a Three Phase Centered PWMs Regen.asc".  Click the running man icon again and wait a while for the waveforms to appear (I put a delay in so that the system can reach a steady-state condition before the waveforms appear.)  This simulation shows bus regeneration on the actual PWM and system level.  I have already configured the phase relationship between the applied voltage waveforms (PWMs) and the motor back-EMF signals so that regeneration will occur.  You can see this by observing the "Bus Current" waveform and the "Bus Power waveform".

    I suspect you will probably have additional questions.  Please feel free to continue this discussion as needed.

    Best Regards,

    Dave

     

  • Dave, you've been a great help! Thank you for this. I'll begin simulation sometime this week and will let you know if I have any questions!

    Cheers,
    Jim
  • Dave, could you make your LTSpice model available again? Thanks!
  • Hello,

    If you still have a question, please consider creating a new post as old posts are generally closed and no longer tracked. You can provide the necessary information regarding your issue in the new post and include a link to this post if you'd like.

    Thanks,
    Elizabeth