How to Select the R and C at the RCx Pins on the DRV8811 Bipolar Stepper Driver

The DRV8811 is clearly a bipolar stepper driver that makes our lives considerably easier. It is just so simple to drive a stepper with this powerful device, as well as similar internal indexer microstepping engines, who takes care of all the nuances of phase commutation and current control. Just supply your stepping rate in the form of a square wave with the desired frequency and a direction signal, and WALAS! Your motor moves!

Unfortunately, it is not as easy as it sounds. There are still a few components we need to add when it comes to properly polarizing the DRV8811 device. Other than the DRV8811 and the motor itself, we need a series of capacitors and resistors which will take the device from a semiconductor device to the ultimate stepper driver! Well, one of them, anyway… The “dreaded” passive components can be seen on the picture below:  

 

Caps needed for the charge pump and the internal regulator are a piece of cake. The datasheet is more than clear than three ceramic caps of 0.22 uF value should go in between (1) CP1 and CP2, (2) VCP and VM and then (3) VGD to GND. The voltage? The CP1/CP2 and VCP/VM caps I would make 50V just to be safe. The VGD cap can be 16V as this is a 10V node.  

 

But how about the components needed to properly configure the RC pins RCA and RCB? These are harder to allocate as now we need to understand what is going on with the current regulation engine! In fact, selecting these components is not a trivial endeavor. Make them too big and your switching frequency is too slow, with a high pitch squaling noise making your life miserable. Make them too small, and the switching losses increase, removing total power dissipation capability from the H Bridge’s power FETs. We need to match these values as close as possible to the optimal set of parameters in order to maximize out output. This task may seem daunting and annoying, but I assure you it is quite simple.  

But first we need to understand the circuit block which makes it all possible: The Current Regulation Engine!  

DRV8811 Current Regulation Engine

We are dealing with a stepper. In the past, steppers were driven with a particular voltage to obtain a current. Or, a winding series resistor was put in place to limit the current. This resistor was bulky and costly. But today we do not need to worry about any of this. We can use any voltage and forget about power resistors, and still obtain whatever current we desire. And for this to be possible, we must thank our current regulation circuit, also known as current chopper. But how does this work? OK, I promise to go there, but let us make sure you know the basics.  

We can regulate current across an inductor because inductors do not accept abrupt changes in current. They will allow the current to charge up or discharge down, but even this takes time, and this time is directly proportional to how inductive the winding is and how big the power supply voltage is. The higher either (or both) of them, the less time it takes for the current magnitude to change as it flows through the winding. And of course, vice versa.  

As a result, we can then allow charge and discharge cycles such that at the end we obtain one particular current which is the one we want to drive our stepper. Per example, you could use 40V to drive a 100 mA stepper. This sounds preposterous but by controlling the current, we can ensure the winding sees only about 100 mA. How can we do this?  

Inductive Winding Average Current

 

As you can see in the picture above, if we allow the current to increase/decrease in between two values such as 105 mA and 95 mA, we should obtain an average current of 100 mA. It is possible you are worrying whether 105 mA is too much for this 100 mA stepper motor, but truly it is not an issue at all. As the winding current increases and passes above the 100 mA mark, it also goes below it by a same amount. To the eyes of the motor, a 100 mA is passing through across time. Plus, I do not recommend to drive a 100 mA Abs Max stepper motor with this kind of current. It is always safe to run the motor a little bit cooler than what an Abs Max will give you. But so that you know, on motor land, Abs Max are really not as deadly as in IC land. A motor may take considerably larger currents as long as you manage to keep it cold. But I digress…  

What you want to understand is how Current Regulation works. This is piece of cake!  

Current Regulation Typical Circuit

 

The picture above shows the current regulation engine. It consists of an amplifier, a comparator and some logic.  

A SENSE resistor is placed in series with the motor winding. It is then safe to assume whatever current is flowing through the winding is also flowing through the resistor. At the same time we know that a current flowing through a resistor must imply a voltage drop equal to I*R. This is how then we can measure this voltage and learn what current we are dealing with.  

The problem is that this voltage is rather small. Why? Because in the first place, the SENSE resistor is made to be on the small side itself. You will see SENSE resistors in anywhere from 100 mOhms to 400 mOhms and similar values. Why so tiny, you ask? Because if it were any larger, the power losses on the resistors would not be appealing. Hence, the smaller the resistor the better (in terms of power loss, at least…).  

It is then expected that the voltage across this resistor will be considerably small. Per example, if your current is 2A and the SENSE resistor is a measly 100 mOhms, then the voltage must be equal to 200 mV. 200 mV is not that small, but what if your current is 100 mA? Then the voltage is a measly 10 mA. That is a minute voltage!  

This problem is solved by adding an amplifier stage with a known gain which will take the practically insignificant voltage and generate a larger version. We want this larger version as we will supply another voltage (we call the Reference Voltage) which we will compare against the amplified voltage version from the winding current. This comparison is important because it will define whether the H Bridge is enabled, current flows and increases, or the H Bridge is disabled with the current decreasing through an alternate path (you may want to check my post on decay modes).  

What we will see then is that as current is increasing but with a respective voltage smaller than our comparison voltage, the H Bridge will le this current flow. As soon as the current reaches the maximum allowed current, as specified by the reference voltage, the H Bridge is disabled. This is how we make the current oscillate in between two values. This current at which we disable the H Bridge is called I TRIP as it is the current magnitude which signals the H Bridge to move into disablement. Each driver chip has its own I TRIP equation and it is very important to know which equation you are dealing with.  

In the case of the DRV8811, the ITRIP equation goes as follows:  

ITRIP = VREF / (8*RSENSE)  

 

That is, if you VREF = 1V and your sense resistor is 100 mOhms, the H Bridge will allow current to increase until it reaches 1.25A in magnitude.  

Sounds simple and easy! We should be done, except that clearly we are not. I have not even explained how the RC values are selected on the DRV8811. To go into these we need to understand why this previous picture is not as simple as we thought. In reality, there are still two problems we need to solve:  

TBLANK:

When you enable an H Bridge driving an inductive load, spurious noise may be present which will be taken by the current chopper as a current trip event. The problem is that this high current spike is by no means conducing to a real current at the winding, hence torque at the motor shaft. The high current spike is most likely caused by diodes switching or capacitive parasitics at the winding itself. Either way, we need to make sure we do not regulate winding current by looking at this false current spike and the way to do this is by ignoring it. We know this spike does not last forever. A few hundred nano seconds at best. So if we apply some form of delay to make sure we do not act on these spikes, we can then focus on looking at the real current. We call this wait period TIME BLANK or TBLANK because this is the amount of time in which the current regulation engine is ignoring current shortly after the H Bridge is enabled.  

 

Time Blank Ignores False Current Spikes

 

The beauty on the DRV8811 is that you can configure this TBLANK. Why do we want to configure this value? Shouldn’t we just fix it at some appropriate value and get it over with? We can certainly do that but by adding this flexibility you can take into consideration your particular motor and tailor the system’s TBLANK to an optimal value. You can make it as small or as large as you want.  

On the DRV8811, TBLANK is computed as TBLANK = 1400 *C. On my boards I use a 1000 pf ceramic cap which takes the TBLANK parameter to 1.4 us. This time is more than plenty to ignore spurious pulses at the SENSE resistor. Do note this amount of time will elapse whether the current magnitude is falsely spiking or truthful going above my ITRIP value. This plays a role on your system as your inductance and input voltage may be taking the winding current to ITRIP levels considerably quicker than 1.4 us. If this is the case, then you would need to make TBLANK smaller. If you do not, by the time you see an ITRIP event, the current will be considerably larger than the value you wanted to ITRIP at. It will look something like this:  

TBLANK is too large

 

Remember! Current is ignored while TBLANK, so even if you are above ITRIP when the next cycle starts, the H bridge will charge the inductance during this period.  

TIME ON

TBLANK defines what we call the minimum TIME ON. However, it is important to understand that TIME ON is indirectly proportional to motor inductance and input power supply. As I have stated before, the larger either of this, the quicker the current builds up. But the quicker the current builds up, the quicker you reach your ITRIP, hence the shorter the H Bridge remains ON. It is very hard to coordinate TIME ON. Actually, practically nobody worries about this as once you have chosen a motor and a power supply rail, there is very little you can do. You could add resistors in series or inductors, but this practice is quite undesirable as it raises cost and complexity.  

On the other hand, selecting a motor based on inductance alone is almost impractical. What you will be looking for is torque and speed. Hence, optimizing for how long the H Bridge is ON, is not very practical. What we can do however, is optimize how long will the H Bridge be OFF. Which takes us to the end of our journey.  

Current Chopping PWM

Once you have configured how long will the H Bridge will at least remain ON (TBLANK), we need to configure for  how long it will remain OFF once an ITRIP event is registered. Ideally, you would make your TIME OFF to be equal to TIME ON. That wat you get a 50% duty cycle and the average current is right in the middle. However, this is not demanded. You can make your PWM duty cycle whatever you want. Do have in mind that the longer the TIME OFF, the more the current will decay away from ITRIP. This is either a good or a bad thing, and will depend on what you are trying to accomplish. At the end, we must not forget how much the current decays is both a factor of how large the TIME OFF is and the DECAY mode as well! Fast, Slow or Mixed. I tell you, you will need to check that other posting in decay modes!  

My biggest worry when selecting TIME OFF is making the PWM frequency too low. Have in mind we are configuring an oscillator here. The DRV8811 does not have an internal PWM generator, but the combination of the logic and the RCx pin, along with the motor, make up for one. So, if the inductance is too large and it takes forever to reach ITRIP, the TIME ON will be quite long. If we then add a lot of time on TIME OFF, we have a total T (T = TIME ON + TIME OFF), which when inverted (F = 1/T) may give us a too low frequency. Is this an issue? If you don’t like hearing your motor squeals, then yes, it is a problem! And in my experience nobody likes this particular noise. Well, it is called noise for a reason…  

Current Chopping Frequency

Current Chopping Frequency

The equation for TIME OFF on the DRV8811 is TIME OFF = R*C. I use a 47K resistor on my circuits. Assuming TIME ON is identical to TBLANK (which is the quickest our H Bridge could respond), I will have a frequency of 1 / (1.4 us + 47 us) = 20.6 KHz. This frequency is good enough to be unhearable by the great majority of us. Do note, however, that if the motor has enough inductance to make TIME ON larger than a 1.4 us TBLANK (and most bipolar motors will), I will expect to see the frequency to frop below 20 KHz, which may result in a high pitch squealing audible to kids in elementary school. In the event that I learn they are pissed at my existence, I would switch to a smaller resistor. Maybe something in the 30K range. I think anything above 16 KHz is more than fine, but maybe my six month old will complaint in a few years as he is deafened by my stepper based projects…  

Summary:

By selecting the R and the C on the DRV8811 RCx input pins you can fully control the current control engine. This will allow you to “program” a switching frequency. Remember that too high a switching frequency makes switching losses grow and this is not pretty. But decreasing switching losses by reducing the frequency can lead to audible noise, poor motion quality and some increased torque ripple. Hence, it is your responsibility to choose these components carefully. In the event you feel a neurism about to pop as you take on to these two “heinously complex” equations from hell, you may want to consider the typical values of 1000 pf and 47K or maybe even a smaller resistor. But seriously, if you have read so far, I doubt these equations are hard to grab at all!

11 comments for “How to Select the R and C at the RCx Pins on the DRV8811 Bipolar Stepper Driver

  1. steph
    March 9, 2011 at 8:39 am

    Thanks for this post it really helped me to understand how the DRV8811 operate!

  2. Sachin
    August 17, 2011 at 8:13 am

    Hey ..thanks for this blog,,,i got clear my concept after reading about CURRENT REGULATION ENGINE.

  3. RL
    September 14, 2011 at 2:20 am

    Thank you for this great post/article. I’m currently using the same stepper motor controller. I’m planning to use the mixed decay mode, but I still have no idea how to choose the capacitor and the two resistor values. I read the article you referred us to read but things are still not clear.

    • avayan
      October 17, 2011 at 10:48 pm

      Hi RL,

      What is exactly not clear? Because in this article I have explained the details concerning the selection of these two components. You select the cap to configure the TBLANK and then the resistor to configure the TIME OFF. I think I detailed what each one of these parameters is. If you can direct me towards what is not as clear as I thought, I may be able to improve on it.

  4. allen
    November 2, 2011 at 7:45 am

    Thank you !Your explanation is very good!I had tested and verified.

  5. servet ayok
    June 29, 2012 at 11:57 am

    Hello,

    Do you have any experience on Allegro A4982 Bipolar Stepper motor Driver. I made my PCB and it did not work. Are there any rules we should obey while designing and producing the PCB?

  6. avayan
    June 29, 2012 at 2:06 pm

    Hi Servet,

    I haven’t used Allegro devices in a little bit over 7 years. I believe they have changed their portfolio quite a bit since then, so this particular device is not one that I am well versed. Not versed at all! Lately I have been focusing on the Texas Instruments offerings as they are just amazing parts, not to mention they keep on bringing more and more new devices regularly.

    Now, you don’t mention what didn’t work with your implementation so it is hard to give you advice on how to fix it. Were you able to check that all the signals are present and working accordingly? Sometimes pads are not soldered properly and depending on the signal this could cause the device to be completely non-operational. Similarly shorts may be invisble to the naked eye, but will equally cause all sorts of havoc. But let’s assume the board was in pristine shape. What can the layout do to mess it all up?

    There are definitely guidelines that I like to follow when I design boards around any stepper driver. First of, you need to make sure the thermal heat sinking is better than good. Use an infinite amount of copper and by this I mean, do not try to remove copper, try to add it! I see people shaving copper off from here and there which could have been used to dissipate heat out of the device. Allow me assure you: the chip WILL GET HOT!!! If it gets hot, it will enter its protection and everything will be hosed. Hence, we need to make sure this does not happen.

    All of this copper is part of the GND plane. Make sure the GND plane is as solid as frozen adamantium. We want to ensure resistance and inductance on this copper structure to be as small as possible in order to avoid noise such as ground bounce and unwanted oscillations.

    Where you allocate the SENSE resistor is crucial as well. Yes, a resistor is still a resistor if you place it at the Jupiterian orbit, but it is not going to work as good out there. We need that SENSE resistor as close to the pin as possible because the trace resistance from the high side will add up. You may be thinking “why is this guy worrying about one dinky little resistance on the trace from the resistor to the pin? Is he nuts???” Remember that the SENSE resistor is made to be as small as possible in order to decrease power losses in it. Any trace resistance will add to this and possibly change the expected current regulation result.

    At the same time, traces have inductance. If you have an inductor in series with the SENSE resistor, this will cause some very short duration voltage spikes at the SENSE pin. This noise is not desirable and in some cases can mess you up pretty badly. I must admit, however, that for this effect to be apparent the routing must be pretty bad. But believe it or not I have seen it being done a few times and sure enough, the device had a hard time behaving.

    Use the thickest traces possible at the outputs. Although most of these integrated drivers have tiny chip leads, you do not need to use a dinky little trace from output pin to motor connector pin. You can start small (say 15 thousands of an inch) and then, as soon as possible, increase the trace width to something like 50 or 75 thousands of an inch. This will decrease resistance and inductance. Especially resistance, as inductance is kind of harmless in this case. Heck, you are driving a motor which has way much more inductance than any trace can ever pack!

    These are the guidelines that I make sure to follow on each and everyone of my designs and until today I have not had any issues.

  7. rs
    August 13, 2013 at 7:49 am

    Thanks for the great tutorial! I built a breakout board to test out this chip and it works…sort of! The problem is, when I use my onboard 5V voltage regulator (supposed to give up to 250mA) with a 10µF capacitor across it, my VCC voltage drops to around 3V. When I use 5V from a USB, this problem isn’t so bad.

    I can’t run the motor at a very high RPM (it just doesn’t spin) and when I change the microstepping mode to anything but full steps, the motor just jitters.

    My chopping current is around 200mA, and my motor resistance is 23?. I’m using a 12V power supply that can give up to 1A.

    I also notice that only about 80mA is drawn from the main power supply. My chopping current is 200mA, so what could be the reason for this?

    Thanks in advance for any help!

    • avayan
      August 21, 2013 at 2:16 am

      Hi Rs,
      Amps
      One common question I get all the time is “if my power supply current is X, why do I get Y Amps on my stepper?” Most of the time, X is smaller than Y and this causes confusion as you would imagine the power supply current is the same as the motor current, right?

      Well, not really. As it turns out, a current chopper driver topology is in essence a buck converter with the motor winding being the buck inductance. What this means is that the voltage is being stepped down in order to regulate current at a command current value (AKA the chopped current command).

      The easiest form to understand this is with “power in” and “power out”. We know by the conservation of energy that power in must equal power out. Unless of course I have been teleported into the Universe in which this is not true…

      So what happens is your stepper is wanting to see a smaller voltage because if you give it all the voltage there is, then the winding will saturate. This is why we need to chop the current! But if the stepper voltage is smaller, the only way in which the power in = power out equation remains true is if the stepper current is larger than the power supply current.

      The truth is the only way to measure the stepper current correctly is with a current probe and an oscilloscope. Yes, I know, current probes are frigging expensive, if not prohibitive. Unfortunately, this is the best way to see the actual stepper current, and I can assure you, it will NOT be the same as the power supply.

      On your second question, the motor is not moving at very high RPM because steppers are just not that good at high speeds. The problem is that steppers are actuated in open loop, so the commutation is not necessarily at the right time. To make matters worse (and the real reason why steppers are not good at high speeds), as the speed increases, so does the BACK EMF. What this means is the available voltage for the motor is less and less as the rotor goes faster.

      With lower voltage, comes lower torque and eventually the rotor just can’t follow the revolving magnetic field. Namely, the motor stalls. Each motor is different and by looking at the torque/speed characteristics you could learn which speeds are realistic and which one are not. Feel assured, the great majority of stepper applications suffer from this problem. If you want heinous speeds, the most efficient way is by using BLDC motors or PMSM motors, but those are quite the pain in the…

      These two items are great topics for a blog posting so I will try to schedule a lengthier write up with some demonstration and hopefully videos. Thanks for these great questions!

Leave a Reply

Your email address will not be published. Required fields are marked *