Strange waveform with LMD18200 H Bridge

Hi all,

I'm trying to get a LMD18200T H Bridge from National Semiconductor working properly - but am getting strange results. I'm trying to use the 'Simple locked anti-phase PWM' mode as described in the datasheet - tie the PWM pin high, then apply the PWM signal to the direction pin, that way 50% duty cycle should be zero drive, 0% = full reverse, 100% = full forward.

Datasheet; LMD18200 pdf, LMD18200 Description, LMD18200 Datasheet, LMD18200 view ::: ALLDATASHEET :::

However, 50% for me is 50% in one direction, 0% is 0 drive and 100% is full speed. There is not change of direction.

Here's my schematic - the grounds are common between the Arduino and the schematic circuit.

Here's a scope shot of the PWM signal, good.

...and this is what I REALLY don't understand - these are the scope shots from each terminal of the motor.


The datasheet says logic high is 2V min, 12V max. I'm wondering if maybe the 5V logic signals are not high enough. I'm just using a pot into an ADC input, and outputting a value accordingly. Earlier on today, it seemly worked for a moment in that as a crossed 50% on the pot, the motor switched direction. Here's the very simple test code I'm using.

int potPin = 4;
int val = 0;
int pwmPin = 3;

void setup()
{
  pinMode(pwmPin, OUTPUT);
}

void loop()
{
    val = analogRead(potPin);
    analogWrite(pwmPin, val / 4);
}

Your diagram is not like the one on page 10 of the data sheet. You have left the current sense floating and also not connected pins 5 & 9 high.

Pin 5 is connected to 5v in my schematic, albiet pin 9 is not.

Earlier, I was not wearing a ground strap when I removed the chip from its package and soldered on wires to stick in the breadboard - so, I thought I'd try another chip (after I'd found my ground strap). The new chip works perfectly, while the old chip does not.

So, yes - current sense and pin 9 were floating - however, if I disconnect them and let them float now the circuit still works as expected. So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

EDIT: I now also have the same waveform on both motor pins, which is good - however, why does the waveform not replicate a 'proper' square wave, and instead has the flicks?

leaving those pins floating killed the chip

I would vote for that one. The clue was that it worked the very first time and not after.

why does the waveform not replicate a 'proper' square wave

That is the voltage across an inductive load. Instantly the voltage is applied there is an infinite impedance and so the voltage is at its highest because no current is being drawn. Then as the current starts to flow it drags the voltage down because of the internal impedance of the switches or the lack of power in the power supply ( or both ). It is normal to see waveforms like this.

Brilliant, thanks for all your input.

I believe there's somebody who's subline under their username is something along the lines of "knowledge is proportional to the number of destroyed parts". There's another to add to the list :wink:

The questions appear to have been answered, but I was wondering what the PWM
frequency is, as I cannot see any time scale anywheres?

jtw11:
So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

Possibly (b), although most chips are fairly resistance to static these days. A dodgy connection to one of the bootstrap capacitors is another possibility, it would damage the chip when you use it to drive a load.

oric_dan(333):
The questions appear to have been answered, but I was wondering what the PWM
frequency is, as I cannot see any time scale anywheres?

I was using just the standard Arduino PWM function, which I think is really quite low - around the 500Hz mark I believe. (EDIT - just checked, 488Hz)

dc42:

jtw11:
So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

Possibly (b), although most chips are fairly resistance to static these days. A dodgy connection to one of the bootstrap capacitors is another possibility, it would damage the chip when you use it to drive a load.

When you say a dodgy connection, do you mean a bootstrap cap that didn't have a brilliant connection (as this was only wired up on a breadboard), or an intermittent short from an output to a bootstrap pin?

Grumpy_Mike:

why does the waveform not replicate a 'proper' square wave

That is the voltage across an inductive load. Instantly the voltage is applied there is an infinite impedance and so the voltage is at its highest because no current is being drawn. Then as the current starts to flow it drags the voltage down because of the internal impedance of the switches or the lack of power in the power supply ( or both ). It is normal to see waveforms like this.

The power supply I was using was set up only to supply 2A thinking back now actually, and was driving a motor that draws average 1A no load. Maybe the power supply caused a little of that droop.

jtw11:
When you say a dodgy connection, do you mean a bootstrap cap that didn't have a brilliant connection (as this was only wired up on a breadboard), or an intermittent short from an output to a bootstrap pin?

I meant a poor connection or open circuit. Without the bootstrap capacitor, the upper mosfet in that half of the H-bridge won't get enough gate drive to run on fully.

jtw11:
The power supply I was using was set up only to supply 2A thinking back now actually, and was driving a motor that draws average 1A no load. Maybe the power supply caused a little of that droop.

When the H-bridge changes state, power will initially flow out of the inductive load into the power supply capacitor, raising the voltage a little. Later on in the cycle power, will flow from the supply into the load again. Depending on how much dead time the chip provides, you may also see the voltage go briefly above the supply voltage (and below ground on the falling edges) by 1 diode drop.

Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.

oric_dan(333):
Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.

I agree.

oric_dan(333):
Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.

Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.

[edit: the LMD18200 is nice and fast switching and will handle higher PWM frequencies well - I've used it as
a class D audio amplifier in fact]

Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.

Can you elaborate on this? I always thought that the higher the frequency, the worse the losses because of the skin effect. Or are you talking about something else?

bobthebanana:

Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.

Can you elaborate on this? I always thought that the higher the frequency, the worse the losses because of the skin effect. Or are you talking about something else?

Skin effect isn't worth worrying about at audio frequencies typically, but does become important from
10's kHz up with thicker wires (an example being induction hob coils). Here we want to reduce the
copper losses from large AC currents when the motor is nominally "off" - the winding inductance will
nicely limit the (AC) current if the frequency is high enough. With a low PWM frequency in this
mode you may well be pulling more current with the motor stationary than when its moving!!

However there will be switching losses (and iron losses) at higher frequencies so there is a compromise
frequency which is best determined by experimentation, but ought to be closer to 10kHz than 500Hz for
a small motor. So

Thanks to all for all the input so far. I was planning on running at much faster in the final project - I'm not bothered about any hum, so 20+ kHz isn't what I was thinking. Around 10kHz is what I was aiming for.

The motor was certainly running hot during this test, the bridge was cool still however. I'm not sure I understand why this mode generates extra heat, is it not just normal PWM still?

The one thing I did notice was I couldn't actual switch the motor off at the half way point on the pot, the motor would just hum and get hot. I figured that could be fixed though with a dead band in the code, where half the control input +- a small amount would output exactly a 50% duty cycle. Or would the motor still hum?

In its application, the motor is never actually going to be off - so it's not a problem, but it looks like I need to do some more reading on the downsides of this mode,

I can't see any good reason at all to use antiphase PWM. It will always lead to additional power dissipation in the motor. I suggest you try more conventional PWM where you keep the direction input constant until you want to reverse the motor.

dc42:
When the H-bridge changes state, power will initially flow out of the inductive load into the power supply capacitor, raising the voltage a little. Later on in the cycle power, will flow from the supply into the load again. Depending on how much dead time the chip provides, you may also see the voltage go briefly above the supply voltage (and below ground on the falling edges) by 1 diode drop.

A, that makes sense - peak to peak was the power supply + ~2 diode drops.

EDIT: My thoughts behind it were to simplify the code, however - reflection doesn't really seem to make me think adding a direction control output would complicate things too much. I just need to make sure there is not a condition that switches the direction input if load is high. I also suppose then the resolution of PWM from 0 to full speed will be increased.

I've just started reading about the different PWM modes - I had no idea the actual way in which the different sides of the bridge are manipulated are affected by the modes, I just assumed the input logic of these chips decided the input into the same output either way. Hence the confusing as to why anti-phase increases heat.

It never ceases to amaze me the brilliant information one can get from this forum!

Hence the confusing as to why anti-phase increases heat.

See the first graph. You're always driving max-current into the motor, just reversing its
direction, every half-cycle. Normally, when a motor is "off", no current flows through it.

http://modularcircuits.tantosonline.com/blog/articles/h-bridge-secrets/lock-anti-phase-drive/

dc42:
I can't see any good reason at all to use antiphase PWM. It will always lead to additional power dissipation in the motor. I suggest you try more conventional PWM where you keep the direction input constant until you want to reverse the motor.

I can see it being useful for smooth transitions between forwards and backwards. Standard Class D audio amplication does this specifically
to avoid cross-over distortion for instance. For reversing a robot that level of smoothness isn't warranted of course, a little extra software
can convert the input value to direction + magnitude.