3
\$\begingroup\$

Problem

I am trying to design a 24V, 4A BLDC motor driver. Here is the PCB I have designed for it.

Discussion on this topic could be found here. In summary, open-loop works, but closed-loop is all over the place.

I was told that the current feedback is too noisy for the closed-loop mechanism to work. Also, I was given a reference current feedback reading.

Measurements

Here is my current feedback readings and below is the one for the reference board. These readings are transferred to my computer over UART with the help of Kinetis Motor Suite GUI. So, these are the readings of the ADC of the microcontroller which measures the output of the current sense resistor amplifier. More specifically CUR_A, CUR_B etc..

enter image description here

enter image description here

With no activity on gates, here is the voltage across R52, which is the Phase C current sense resistor. Scope is AC coupled and BW is limited to 20 MHz in this measurement. Scope probe ground lead has about 1 cm length:

enter image description here

This is the output of the OP-AMP, U6, pin 14. DC Coupled. Scope and probe BW is 200 MHz:

enter image description here

Zoomed of above, noticeable, steady ~56 MHz oscillation:

enter image description here

This is also the output of the OP-AMP, U6, pin 14. But AC Coupled. Scope and probe BW is 200 MHz:

enter image description here

Zoomed of above:

enter image description here

enter image description here

A New Observation

enter image description here

enter image description here

enter image description here

I have removed the feedback capacitor C39, which did not have much help with the oscillation, then, when the starred components are not populated, which are C28, R23, C29, R26, C34 and R36 from left to right, the above oscillation problem is solved. Not populating these components effectively prevents ADC_MID line from going to other OP-AMPs in the package. Why would this cause a problem?

PCB Layout

I am suspicious that my PCB design is problematic. Here are my schematics, layer drawings and gerbers. Could you notice a problem that would cause this?

Top Copper:

enter image description here

Bottom Copper:enter image description here

Schematics in PDF: https://drive.google.com/file/d/0B1xsxA1iARHGNUlVR3YwOWxCQzA/view?usp=sharing

PCB layers in PDF: https://drive.google.com/file/d/0B1xsxA1iARHGblBZZDRLd0hScWM/view?usp=sharing

Gerbers, zipped: https://drive.google.com/file/d/0B1xsxA1iARHGU0w2a3ZQeUQ5bTA/view?usp=sharing

enter image description here

\$\endgroup\$
6
  • 2
    \$\begingroup\$ Your graphs are missing units for the axis. Also we don't know where it was measured. Note that self contained questions are preferred since external links will go away. The people with the most knowledge here will have the least time to download zips and try to find a program that opens them, so having all information available in the question as images is beneficial \$\endgroup\$ – PlasmaHH Jun 20 '17 at 7:01
  • \$\begingroup\$ Where is the heatsinking for those 6 FETs? \$\endgroup\$ – analogsystemsrf Jun 20 '17 at 7:35
  • 1
    \$\begingroup\$ Also migt be worth looking more in detail for noise sources due to coupling etc. Probe a few of powersupply rails to see if you find any correlation. Same with data lines and such. \$\endgroup\$ – Joren Vaes Jun 20 '17 at 7:53
  • \$\begingroup\$ Relative to your new observation, have you then looked at the output of the LM358 to see if it is clean? Also did you check on my answer about securing the other op amp in the package? \$\endgroup\$ – Glenn W9IQ Jun 20 '17 at 13:38
  • \$\begingroup\$ @GlennW9IQ Yes, the other OP-AMP in the package is secured. The output is very clear. With this new observation, notice that ADC_MID from the LM358 is still connected to the MAX4354 (U6:D), but not connected to U6:A, U6:B, U6:C. \$\endgroup\$ – abdullah kahraman Jun 20 '17 at 13:42
4
\$\begingroup\$

Congratulations on your well written question loaded with information.

The answer to your question is in the opamp's datasheet:

MAX4352/MAX4353/MAX4354 are compensated for a minimum closed-loop gain of +5V/V

Your schematic sets the MAX4354 opamp for unity gain at HF via the feedback capacitors (C31 and the rest). Therefore it will oscillate, this is inevitable.

The fix is to remove all the 150pF caps.

Now, the amplifier will still be unstable, as explained in datasheet page 11 "Choosing resistor values". You really don't want a 10k feedback resistor on such a fast opamp, this will create a pole with the input capacitance, let's say 3pF or so including trace capacitance. This adds phase lag into the feedback, which will eat into the phase margin and either make it oscillate or screw up transient response and settling time, which I presume are important to you since you chose this fast opamp for a reason!

Considering the motor currents involved, you're not saving milliamps on the opamps' power supply, so you need lower feedback resistors. Try 1k/100R instead of 10k/1k.

Problem is, all the extra traces and pads for your unnecessary capacitors do add parasitic capacitance, so put the feedback resistors in whatever SMD footprint is closer to the IC (which will probably be the caps) and cut the traces to the unused footprint.

If it still gives you trouble, don't do another board revision yet. Just solder the feedback resistors across the MAX4354 pins, and cut more unnecessary traces to reduce capacitance. With 0402 resistors this should work just fine. If this gets your opamp rock stable, then you know your next board revision should have the resistors R33 and R24 (and their equivalents for the other opamps) as close to the pins as possible with minimum length traces.

But it will still suck on transient response, maybe ring, because the opamps are driving capacitive loads, which are the long traces to the microcontroller. I would add 15R to 33R resistors at the opamp outputs.

You could even use lower feedback resistor values, although the LM358 might start to bitch a little.

LM358 is a old piece of crap with crummy slow transient response. Your fast MAX4354 is drawing steep current pulses from its output. Output impedance of LM358 at high frequencies is "mmeeeehhhh" because it has 1MHz bandwidth.

Therefore ADC_MID is likely to move around. The fix is to have a look at the internal schematics of LM358 (datasheet page 13), notice how the compensation is wired, and stick a resistor between the output and ground (like 470R) to bias the output stage into class-A, which will lower its output impedance and make it faster.

If this is not enough and you notice transient variations on ADC_MID,
stick a big fat low-ESR cap right across the output of LM358, like 470µF 6.3V Panasonic FR which costs 9c and has 80 mOhms ESR. Or even a polymer cap. Opamps driving capacitive loads will be stable if the cap is large enough.

Other advice:

  • Increase bypass cap values from 100nF to 1µF
  • L2 will resonate with C42, download L2 spice model from murata simsurfing website, spice it, then replace C42 with cheap 105°C electrolytic with suitable ESR like Panasonic FC 100µF.
  • Stick 1-2 MLCC in parallel with C26 right at the output of the switcher U4 to shunt HF noise at the source and reduce noise in your GND.
  • Liberally spray the +24V rail with 100nF MLCCs, 1-2 per MOSFET, put them right next to the FET, you want to have a tight loop for the FET's HF switching currents.
  • Bootstrap diodes D1 D3 D4 can be replaced by smaller cheaper and more important, lower capacitance models.
  • I don't know how your micro handles its internal ADC reference, whether it needs to be bypassed by a cap, or if it has separate AVCC pin, you should check

Layout:

  • R20 is a problem as it prevents you from shrinking the high di/dt current loops by returning currents from the other sense resistors to the GND pin of the three big capacitors. Thus, EMI. Since R20 provides a measurement which is redundant (it is the sum of the three currents which are already measured) it can be removed along with associated circuitry.
  • This frees up an opamp which can now be used instead of LM358. It is not stable at unity gain though, so a little trickery is needed in the feedback network.
  • The FET driver should be in the center of the board (there is an empty space) next to the FETs, which reduces the length of the gate traces, which reduces LC oscillations, which allows you to get rid of the zeners, you save money. Also this cuts crosstalk between the MCU PWM traces and the analog current measurement traces. Also this removes the gate drive traces which cut a large swath of the bottom ground plane out.
  • Remove ground pour under micro or tie it down to ground plane with many vias. The main use of ground pours on toplayer is to make you forget to put a dedicated GND via for a component that really needs one (like that AGND pin) and increase noise. Ground pours are evil since they connect that sensitive AGND pin to the noisy GND pin of a decoupling cap. Ground pours on toplayer need to die.
  • Add more vias, 2 GND vias per decoupling cap reduces inductance.
  • The 2 slot antennas in the ground plane may be a problem
  • Your opamps are wired as differential, the GND side of the sense resistor should be taken at the resistor, not at whatever potential GND is under the opamp. Thus, route the sense lines as a differential pair. Your CAD software will want to connect your "GND" trace to the rest of the GND, so use a net tie, which is a virtual component allowing you to do this.
  • The micro's ADC measures voltage in proportion to its internal ADC reference (is it the power supply? a VREF pin? check datasheet on how to handle this).
  • ADC_MID is generated from a +3V3 which is not really the same as the micro's, so there will be an offset. This is solved by sampling the currents in the MOSFETs which are not turned on, which gives you the offset, and substracting in software. Time your ADC sampling points with your PWM. Your micro should know how to do this.
  • C37 is a MLCC thus piezoelectric, ADC_MID will respond proportional to vibration and board flex. Also C37 value 100nF is too low. Use electrolytic cap instead.
  • and most important, your ADC measures voltage relative to ITS OWN GROUND. Which is why R20 is trouble, as it routes the motor current all over the ground, destroying its integrity. The bottom pins of R44/C37 should sample the GND at the micro's AGND pin to fix this. Capacitor at the output of LM358 (if any) should also be grounded near this point.

Others:

  • You have no height restriction, so tantalum caps are not your friend, in fact they are expensive little firebombs, good thing you don't use any. But aluminium caps are not obsolete! There is nothing wrong with putting a few on your board to stiffen up your +5, +15, +3v3 supplies. I like Panasonic FC, FM, FR, they're 105°C, very tough, small, cheap, reliable, with ESR low enough to offer superb decoupling performance, but still high enough to make your LDOs stable and not ring with MLCCs. Polymer caps ESR is too low, which is problematic, as they will ring with MLCCs and do evil things to LDOs, polymer caps need to be handled with care.

FYI by following these rules I did a board with 4 switchers, 1 micro, 1 H-bridge, everything switching all over the place, and I got less than one ADC LSB noise on the current sense resistor.

\$\endgroup\$
2
  • \$\begingroup\$ Wow, thanks for this GREAT and COMPREHENSIVE answer and tips list! Absolutely will be one of my go-to lists =) As for my problem, I have changed my OP-AMP to TLV274 and the problems are gone. I will have a look at eliminating R20.. \$\endgroup\$ – abdullah kahraman Aug 22 '17 at 13:30
  • \$\begingroup\$ Hehe, thanks ;) TLV274 is unity gain stable, this is what solved your issue. Also it is slower than MAX4354 and that makes it less temperamental and fussy about layout, decoupling, stray capacitances, etc... \$\endgroup\$ – bobflux Aug 22 '17 at 14:36
3
\$\begingroup\$
  1. Check the placement of C39. It should be physically right at the two adjacent pins it is connected between. If it's not, then remove C39 from its pads and solder it directly between the two pins. See if that changes anything.
  2. Show the opamp power connections in the schematic. As shown now, you haven't powered the opamp at all.
  3. Stay after school and write on the board 100 time "I will always use proper bypassing". Don't be so sloppy with bypassing next time.
  4. Actually use the proper bypassing. Especially with a lot of noisy nodes nearby, I'd put a ferrite chip inductor in series followed by 20 µF or so ceramic to ground.
  5. If the opamp is still oscillating, increase C39 until it stops. If the resulting bandwidth of the current signal is good enough, then just leave it like that.

Added

I can now see the full schematic, and you say the oscillations go away when disconnecting ADC_MID from the other three current sense opamps. A few new observations:

  1. You actually did a bunch of things right, unlike the small snippet you showed implied.

  2. I don't like how you're showing the power connections to U6. You show them on each of the individual amps of the four. This is confusing since they are only shown connected on U6B. It would be better to make a separate sub-part just for the power connections. Call it U6PWR or something. That avoids clutter at the individual amps, and doesn't give the impression that power is not connected when looking at something like U6D in your schematic.

  3. All the ADC_MID inputs to the diff amps are directly connected to the opamp + inputs for the purpose of high frequency AC. At the oscillation frequency of 56 MHz, the 150 pF caps have only 19 Ω impedance.

  4. Try putting the resistors R23, R36, and R26 back, but leave off the caps C28, C34, and C29. I expect U6D will no longer oscillate that way either. I would then remove C38 for completeness.

  5. The caps aren't doing anything useful anyway. It looks like you were trying to get a little low pass filtering, but that can be achieved by adjusting the values of the feedback caps (C39 for U6D). Increasing those has the additional advantage of making the amps more stable. I didn't look at the opamp datasheet, but if they are oscillating at 56 MHz, they must be pretty twitchy amps in the first place.

  6. I would want the impedance of ADC_MID to be lower at high frequencies. Right now it's only driven by U7A, a LM358. It's no good at 56 MHz. Maybe a few 100 Ω in series with the U7A output, then a 1 nF or so ceramic cap to ground. Look up what you need to do to keep the LM358 stable.

  7. You did filter the power connection to the processor with L2 and C42. Do the same thing for the opamps.

  8. In general, 100 nF bypass caps are from the 1980s. Today there is little reason to not use at least 1 µF. The multi-layer 1 µF ceramic caps of today have less effective series inductance than the leaded 100 nF ceramic caps from the ancient days, and therefore have lower impedance at all frequencies.

    100 nF was chosen for bypass caps in the Pleistocene not because the value was optimal, but because that was the largest cheap and small ceramic capacitor you could get.

\$\endgroup\$
7
  • \$\begingroup\$ Can you comment on if the following statement from the opamps datasheet is possibly related? "The [..] are optimized for AC performance. They are not designed to drive highly reactive loads. Such loads decrease phase margin and may produce excessive ringing and oscillation. The use of an isolation resistor eliminates this problem " \$\endgroup\$ – PlasmaHH Jun 20 '17 at 11:41
  • \$\begingroup\$ @Plas: Lots of opamps don't like driving capacitive loads. It is saying that if you need to drive a capacitive load, then put a resistor in series first. Of course then the voltage won't be as well regulated by the opamp. The OP hasn't shown us what the opamp is driving, so anything more would be speculation. \$\endgroup\$ – Olin Lathrop Jun 20 '17 at 12:11
  • \$\begingroup\$ Ah, come on Olin! I didn't show you as an image, yes, but the schematic is there as a PDF =) \$\endgroup\$ – abdullah kahraman Jun 20 '17 at 12:38
  • \$\begingroup\$ @Abdullah: Ah, I didn't notice that. \$\endgroup\$ – Olin Lathrop Jun 20 '17 at 13:01
  • \$\begingroup\$ For the series resistor, the datasheet gives guidelines in figure 1. The value ranges from 22 ohms to 18 ohms. \$\endgroup\$ – Glenn W9IQ Jun 20 '17 at 13:27
1
\$\begingroup\$

In general I note that there are inadequate bypass caps throughout the design. A motor controller has high di/dt so extra care must be taken. A good practice is a ceramic in parallel with a tantalum. And place them liberally through the board.

I also note that you do not show the other half of the LM358 op amp. Make sure this is properly bypassed to prevent oscillations. This could be a source of your problems.

Another likely source of your noise is the switching regulator. Simply tacking an electrolytic on the output will not adequately suppress the harmonics. I recommend disabling the switcher and power the circuit with a linear bench supply to test this theory. If it proves out, you will want to revisit the position of the supply on the board and improve your output filtering of the supply. Also do not overlook the fact that the switcher can place noise on the 24V bus.

The quad op amp appears to be powered by a single supply and you are attempting to pick up current signatures that are near ground level. This is typically problematic even with an input offset circuit like yours. You should consider a differential supply with an appropriate op amp.

Edit: Per the suggestion of PlasmaHH, also consider the capacitive load on the op amp output. Figure 1 in the op amp datasheet shows the appropriate series resistor to maintain stability in the event of higher capacitive loads.

Edit: In response to the OP's additional testing, the output of the LM358 can only tolerate about a 50 pF load when set for unity gain. Possible solutions include a series resistor on the output of the op amp or increasing the gain of the op amp and change the bias resistors ratio to retain the desired reference voltage.

\$\endgroup\$
2
  • \$\begingroup\$ At 56MHz that must be quite an interesting regulator. I would rather guess its something with driving too much capacitive load from the opamp, but without further measurements and tinkering around impossible to say for sure. \$\endgroup\$ – PlasmaHH Jun 20 '17 at 10:55
  • \$\begingroup\$ Yes, capacitive load on the op amps should also be considered. Regarding the switcher, I have had bad experiences with parasitic effects in high di/dt devices so I always button down the hatches. \$\endgroup\$ – Glenn W9IQ Jun 20 '17 at 12:34
0
\$\begingroup\$

I believe the issue you are facing is a schematic level one. When you capactively load an opamp you end forming a pole with the intrinsic output impedance of the opamp.

For a buffered reference I suggest you mod wire the following, enter image description here

Capacitive Load Drive Solution using an Isolation Resistor

\$\endgroup\$
2
  • \$\begingroup\$ Does it apply to OP's problem? I looked at his schematics, but I do not see any capacitor at the opamps' outputs. \$\endgroup\$ – Chupacabras Aug 22 '17 at 7:43
  • \$\begingroup\$ @Chupacabras yes it applies to the OP. The OP's amplifier is oscillating either from capactive loading on the output (degrading phase margin) or capacitive coupling onto the ref line (positive feedback). At 56MHz a 10 pF parasitic cap is only 280 Ohms. The ADC reference is only low output impedance at low kHz frequencies. I would personally have employed the schematic above to the lm358 with reference bypass caps local to each current sense opamp. \$\endgroup\$ – sstobbe Aug 22 '17 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.