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.

DRV8876: PWM mode operation

Part Number: DRV8876


Hello,

In operating the device in PWM mode, I have noticed drastically different behavior in what I think would be equivalent use cases.

ex) Say I want to drive a brushed DC motor at 70% duty cycle and 16kHz. Referencing table 4 from the datasheet and holding nSLEEP high in both methods:

Method 1:

  • Hold In2 Low
  • Apply a 70% duty cycle PWM waveform at 16kHz to In1

Method 2:

  • Hold In1 High
  • Apply a 30% duty cycle PWM waveform at 16kHz to In2

I recognize that in method 1 I'm switching between drive and coast, while method 2 I'm switching between drive and brake. But I would expect the behavior to be nearly identical. What I'm finding, is that method 2 gives me a lot less motor to motor variation. I'm also able to drive forward at a lower duty cycle with method 2. Is this expected behavior? 

  • Hi Brandon,

    The quick answer to your question is yes. When the decay mode (non-driving portion) is set to BRAKE (method 2), the current recirculates between the bottom FETs of the H-bridge and the motor. Different motor inductances, resistance, and other characteristics will affect the rate at which the current recirculates. On the other hand, when the decay mode is set to COAST (method 1), the motor is disconnected from the H-bridge and the current flows through the body diodes of the FETs to VM.. If you want to learn more about decay modes, this  E2E post gives a good explanation: https://e2e.ti.com/support/motor-drivers/f/38/t/809695

    The reason why you are able to drive the motor at a lower duty cycle, when in method 2, is because you are holding IN1 HIGH and toggling IN2. Let me explain. If you look at the control table (shown below), the outputs states are switching between Forward and BRAKE. During the FORWARD state, IN2=0, and during the BRAKE state, IN2=1. So this means that the longer IN2 is HIGH (higher duty cycle), the longer it stays in the BRAKE state causing the motor speed to be lower. On the other hand, when IN2 is HIGH for a shorter period of time (lower duty cycle), the more time that the outputs stay in the FORWARD state causing the motor speed to be higher. The same logic can be applied to method 1 to explain why a higher duty cycle causes higher motor speeds.

  • Hi Pablo,

    The explanation of current re-circulation methods and the other post (as well as the app note linked in that post) make sense to me and are definitely putting me on the right path.

    However, I'd like to clarify a portion of my original post, because I am not sure your second paragraph is capturing what I'm seeing.

    I'm trying to describe a situation where in either method, the forward mode is engaged for the specified duty cycle. So method 1: forward for 70%, coast for 30%. Method 2: forward for 70%, brake for 30%. In both cases, my duty cycle is 70%. 

    I'm seeing two differences in my driving methods:

    • The first, is that I see much higher variation in realized speed from motor to motor when using method 1. 
      • Is this due to coast relying on the body diodes of the H-Bridge, and thus having more inherent variability?
    • The second, is that I am able to get the motor physically moving at lower duty cycles ONLY when using method 2.
      • It feels like this has to due with the current in the windings, and the initial torque required to overcome that current. Maybe in brake  mode, there is less initial torque to overcome? 
        • Does this mean that in method 1, I'm using neither slow decay nor fast decay mode? so there is just a ton of current/torque to overcome everytime I try to drive the motor.

  • Hi Brandon, The reason for the speed variation when in COAST mode is due to the FETs disabling while the H-bridge goes into COAST mode. The energy stored in the motor windings will quickly decay through the body diodes. The motor will lose its energy much quicker, as compared to Brake mode, so it will lose much of its momentum and require higher initial torque to get the motor up to its nominal speed. In brake mode ( which is the same as slow decay) the current decays much slower so much of its momentum is preserved. This means a lower initial torque is required to overcome inertia and get the motor up to its nominal speed. And just for clarification, you can think of COAST as Fast decay and BRAKE as slow decay. I hope this answers your questions
  • This is counter intuitive to me.... so in coast mode, we are coming to an immediate stop. and in brake mode, we are coasting/preserving momentum? That doesn't feel quite right....

  • Brandon,

    Let me rephrase my previous explanation. In COAST mode, the FETs are disabled and the current flows through the body diodes. This causes the current in the winding to decay much quicker (read section 2.1 of this app-note to learn more). During TOFF (period of time when the H-bridge is in decay mode), the motor will continue to spin until it slows down due to mechanical friction. After TOFF expires and the FETs are re-enable, the winding current will be much lower (since much of it has been decayed during TOFF), so the H-bridge will need to drive the motor for much longer time (TON) in order to increase the winding current up to what it was before TOFF begin. For this reason, a higher TON time (or duty cycle) is required in COAST mode to keep the same RPM speed.

    in the case of BRAKE (again read section 2.2 of the app-note), the current recirculates between  the motor winding and the bottom FETs. The decay rate is dictated by the LR time constant where L is the motor inductance and R is the total resistance (2 x RDson + R_motor). Because of this re circulation, the winding current decays at a lower rate than COAST mode. This means that when TOFF expires and the H-bridge changes to FORWARD drive state, the winding current will be higher, as compared to COAST decay for the same TOFF time. So the H-bridge needs to drive the motor for a shorter TON time (duty cycle) in order to keep the same RPM speed.

  • Pablo,

    This answers my question perfectly. Thank you so much for these detailed and thought-out answers!!

  • I think the confusion is because no distinction is being made between the current in the motor coil (the rotor) and the momentum in the rotor.  When the motor is being driven and is spinning it has both current and momentum.  As long as the current is steady it creates no voltage.  The speed of the motor creates a counter EMF (voltage) that opposes the flow of current from the power source.  These are very different things.

    When the current is interrupted, the inductance of the coil creates a voltage of the opposite polarity of the applied voltage as the current flow decreases.  This is the voltage surge that drills through the body diodes and dissipates quickly. 

    Meanwhile this has little effect on the motor speed or inertia.  There is still the counter EMF from the rotation of the motor.  Being the same polarity as the applied voltage that spun up the motor, it is not conducted unless the FETs are turned on.  With the FETs off the motor continues to spin freely, so "coasting".  By turning on either both high or both low FETs, the counter EMF is allowed to create current.  This current is the opposite direction of the current that spun the motor up and acts to slow the motor down, so "braking". 

    The difference is timing.  If you shut off PWM so that no more pulses drive current into the motor, coast mode will cause the current to fade to zero letting the motor continue to spin freely with no interaction with a current.  If the controller is in brake mode without PWM the motor will act as a generator and slow itself.  But when being driven by PWM pulses, the timing does not allow the current to fade enough so that the braking or coast effect from the counter EMF is significant.  Instead the electrical energy put into the motor winding will be dissipated more rapidly in "coast" mode or allowed to continue longer in "brake" mode for more efficiency.

    At least, that is my "spin" on it.

  • Thanks for this great discussion. I've learned a lot. But I'm still a bit confused by the wording. In the SLVA321, page 5, it says ".. (slow decay) results in a very quick rotor stop", but this mode actually preserve more current so it requires lower duty cycle to maintain the RPM than COAST mode. Could you please confirm what Rick said,  ? Thanks

  • Hi Will,

    What Rick said is mostly true. When a motor is spinning, there will be voltage generated that opposes the current flow through the windings of the motor. I made a video talking about this here. This video is about using back-EMF for sensorless stall detection in stepper motors but I go into detail about back-EMF which you might find interesting to learn.

    Let me clarify some of the wording. the "slow decay" mentioned in the app-note (SLVA321) is the same as "Braking" which has been used in this thread. Slow decay can either be on the two High-side FETs or the low-side FETs. In this decay mode, the current recirculates and the decay rate is governed by the LR time constant. Normally, the switching happens very fast (20kHz is the typical) so there is usually not enough time for the current in the motor to decay all the way to 0-A or even start flowing in the opposite direction. With "coast decay", which is also referred to as "asynchronous fast decay", the FETs are disabled and the motor is basically spinning freely and slows down due to inertia and mechanical friction. The current in the winding has no where to go but back to the H-bridge supply through the FET body diodes. The current during fast decay normally decreases much faster compared to "slow decay" but never has enough time to decay all the way to 0-A. So if you were to measure the current ripple of a motor control in "fast decay", the ripple will be higher than the same motor control in "slow decay".

    In brushed motors, the RPM speed is proportional to the current flowing through its windings. If you increase the voltage across the windings, the current will increase and so will the motor speed. Obviously you have to take into account the Back-emf which is trying to oppose the current flow. But if we ignore the back-emf effects, at the end of the decay period, the current in the motor windings will be be lower when in "fast decay" compared to "slow decay" as I mentioned in the paragraph above. So the motor will lose more of its momentum (m*V) when in fast decay. This means the motor windings need to be energized for much longer to reach the momentum (or speed) that it had at its peak right before the H-bridge went to the current decay phase. So the control PWM duty cycle has to be higher in fast decay to maintain the same average speed. Applying the same logic to "slow decay", the PWM duty cycle can be lower (compared to "fast decay") to maintain the same average speed.

    Obviously we can spend a lot more time diving into the physics and calculations but I just want to provide a simple explanation for why you need a higher duty cycle in when in "fast decay" to maintain same speed as when in "slow decay".

    I hope my explanation is clear for you to understand. we have made a lot of educational videos which you can browse in training.ti.com if you are interested in learning more about how motors work. I know we have made several videos about this topic already.

  • Thank you, it all makes sense to me. To clarify:

    Between "fast delay" and "slow decay", which mode takes less time for the motor to fully stop given everything else equal? My guess is "fast decay" based on what you said, but the names (COAST vs BRAKE) makes me doubt.

  • Wang,

    It is hard to say which of the two decay modes will bring the motor o a full stop. There is a lot of dependencies on the motor characteristics (construction, inductance,etc.) For example, if the motor has a lot of friction, the motor might stop faster when in Coast. But you can also get faster slow-down time with Braking in some cases. It all depends on the motor. I know the name Coast and Brake can be confusing that's why I prefer the name "Asynchronous fast decay" and "slow decay" instead.

  • Hi,

    If I wanted to stop quickly brushed DC motor I would try BRAKE function (shorting motor wires).

    Braking torque will be proportional to current that will be proportional to BEMF that will be proportional to motor rpm.

    At the beginning braking torque will be high and become lower with motor speed reduction.

    I would watch motor current if it does not go over the driver max rating.

    If I had to brake effectively near zero speed I would consider reverse drive.

    Regards,

    Grzegorz 

  • Will, let me try to explain this differently.  The problem is there are two different effects and two different applications.  The two effects are the energy in the inductance of the motor and the energy in the momentum of the motor.  The two situations are the PWM of controlling the motor speed and the sequence of running or stopping the motor.  Then there are the three modes of controlling the motor.  I'm not going to use the fairly misleading terms.  Instead I will call them "driven" (one end of the motor pulled high and the other low, either forward or reverse), "open" (all FETs off) or shorted (both low or both high FETs connecting both ends of the motor to a common conductor). 

    When running the applied voltage causes the current in the motor to rise at a rate determined by the inductance, until the motor has spun up fast enough for the back EMF to oppose the applied voltage.  The current is then stable. 

    To PWM the motor the other state is typically to short the motor.  This allow the current to continue since the inductance will provide an opposite voltage from the running condition to maintain the current.  Shorting the motor draws little power from the inductance, so for a short time the current will continue, dropping only as much as the short time allows.  The ratio of the driven time and the shorted time determines the amount of power into the motor. 

    If instead of shorting the motor, all the FETs are opened, the motor inductance will create a voltage of the opposite polarity which will flow through the body diodes of the FETs.  If you look at a diagram of the FETs in the bridge you will see this puts power back into the power rail from the inductance.  This current will only flow as long as that current drops fast enough to drive the body diodes.  At some point it drops near zero and no longer flows.  That will be a lot longer than the typical PWM period.  This current flowing has NOT slowed the motor at all.  Even as the current reduces, it is still flowing in the right direction to drive power into the motor rotation.  The only slowing is from friction or the load. 

    Once the dropping current has drained the inductor magnetic field all current stops and the motor is free to spin other than friction and the load.  That's why the FETs open is called "coast".  In PWM it's not good to "coast" because it is burning significant power in the body diodes.  Instead the motor is shorted which allows the current to continue flowing with minimal impact from the conductors and FETs. 

    But... if you short the motor for a longer time, the inductor energy will eventually drain away in the FET and motor resistance.  Then the motor is producing a "counter EMF" based on its speed of rotation, which is the same polarity as the applied voltage was, so now the current will flow in the other direction.  The power also flows in the other direction since the reverse current is working to slow the motor.  This can generate some high currents and the power is dissipated in the FETs and other resistance in the loop including the motor windings.  This power flow acts to slow the motor and is why shorted operation is called "brake" mode. 

    Once in the brake mode with the current flowing in the opposite direction, using the PWM will work in the other direction allowing a high voltage to be generated driving current back into the power source.  This is how electric cars regenerate driving power back into the battery.  If I had the time I would make some drawings to show all this more clearly with arrows, color and all manner of fancy visual aids.  ;) 

  • Our office is closed today for a US holiday.  My colleague will respond on Monday.