My H-Bridge Blewup using a PIC, HELP

Thread Starter

howdoesthatworkguy

Joined Jul 23, 2007
39
Details. PIC16F685, 16Mhz with 5v+ rail. Using the PIC's ECCP which is designed for H-Bridge PWM.

******************************
Bridge
P-Channels were IRLML6402 Logic level
N-Channels were IRLML2502 Logic level
16v to 18v on Bridge
PWM 18khz to drive the N-Channels.
Pullup resistors 10K on P-Channel
Pulldown resistors 10K on N-Channel
The bottom N-Channels have the PWM, the top P-Channels only switch on or off depending on direction.
******************************
I created two PCB's, one with the H-Bridge and one with the MCU.

When testing the H-Bridge PCB without the MCU connected everything worked well. This was my tests for the bridge below

Forward,
Ground Left P-Channel Gate, applied 5V+ to N-Channel gate. Motor turned. Disconnect P-Channel gate and motor stopped. Reconnecedt P-Channel and discounted N-Channel gate and motor stopped.

Reverse
Same as Forward but with the Top Right P-Channel, and Bottom Left N-Channel. Tested with no problem.

Powersupply showed no accessive current draw.

Connected the PIC, turned it on, motor turned in forward direction. Them SMOKE started coming out of the FET, I think it was the bottom N-Channel.

Question?????????
Am I driving the FET's to fast with 18khz ?
Have I choosen the wrong resistor values ?
 

lightingman

Joined Apr 19, 2007
374
A couple of things....is your PIC turning on both MOSFET's at the same time for a few mS (stick a logic analyser on the outputs), or for safety put a small delay in between output states...Do yoy have diodes to protect your FET's from back EMF from the motors ???....Also, at 18 KHz you may get ringing, this can cause voltages above that safe for the MOSFET's...Daniel.
 

hgmjr

Joined Jan 28, 2005
9,027
As lightingman has pointed out, the PIC may have briefly enable both the N-channel and the P-channel in the same leg of the H-bridge. This is a condition that must be avoided.

When using a microcontroller to control the inputs to an H-bridge, there is always a potential for this condition to happen. The remedy often takes the form of circuitry that is placed in between the H-bridge and the microcontroller. The role of this circuitry is to eliminate the possiblilty of simultaneously driving the two fets in either of the legs of the H-bridge.

hgmjr
 

Thread Starter

howdoesthatworkguy

Joined Jul 23, 2007
39
Yes, that was my thinking, if the bottem right N-Channel blewup it could only mean that the Top right P-Channel must have been on. I am going to make sure when the PIC first starts up that all I/O are set as input just to make sure its not a start up issue as well.

What is Motor Ringing ?, How do I know if 18khz is to fast ?

The FET's have built in diodes so I did not think that I had to add more for B-EMF.

The PIC16F685 does not allow the condition of the Left P & N channel or the Right P & N Channel on at the same time. We are using the ECCP function which I can configure in 4 ways, ECCP is designed for motor control plus other things, below is the PIC config,

1100 = PWM mode; P1A, P1C active-high; P1B, P1D active-high
1101 = PWM mode; P1A, P1C active-high; P1B, P1D active-low
1110 = PWM mode; P1A, P1C active-low; P1B, P1D active-high
1111 = PWM mode; P1A, P1C active-low; P1B, P1D active-low

We are using 1110 = PWM mode; P1A, P1C active-low; P1B, P1D active-high
P1A is Top Right, P1B bottom Left, P1C Top Rgith, P1D bottom right.

Anyhow, I will probe it and see what I get.
 

nanovate

Joined May 7, 2007
666
The PIC16F685 does not allow the condition of the Left P & N channel or the Right P & N Channel on at the same time. We are using the ECCP function which I can configure in 4 ways, ECCP is designed for motor control plus other things, below is the PIC config,
The IRLML2502 turns off approx 10X faster than the IRLML6402 (and turns on even faster) so unless there is a little delay in between you might have had some shoot through. As suggested above you can also put some circuitry in to avoid this.


The bottom N-Channels have the PWM, the top P-Channels only switch on or off depending on direction.
We are using 1110 = PWM mode; P1A, P1C active-low; P1B, P1D active-high
Which is it? What is the content of the whole CCP1CON register?
Is it 0b11xx1110? (x=do not care)

Just a note the max gate to source voltage of your MOSFETs are 12V and you are using 18V which can damage the gate and cause the MOSFET to fail short until it releases the magic smoke. ;)

Can you post a schematic of your circuit?
 

Thread Starter

howdoesthatworkguy

Joined Jul 23, 2007
39
OK, I am going to add some delay time in for the N-Channels since they turn on to fast. I wondered why the motor would turn for a while before these things blew up.

I don't see how I can post a schematic on this forum, how I do it ?

The brigde V+ is about 16 to 18v, but on the Gates of the Mosfets directly from the I/O is only 5V+.

CCP1CON Forward
01001110

CCP1CON Reverse
11001110
 

nanovate

Joined May 7, 2007
666
They are called "body diodes" and power MOSFETs almost always have them. They are not optimized for speed. They are sort of parasitic but not really since they help to prevent a parasitic NPN from forming.

On the P-Ch you are switching in -16V from gate to source since the source is connected to the 16V and the gate is 0V when you turn it on.

The CCP1CON looks OK to me. What is the configuration sequence you are using? Do you enable the ECCP then enable the pins as outputs afterwards? Your 10K pull-ups and pull-downs should keep the MOSFETs off while the I/O pins are tri-stated during power-up. The PIC datasheet has a table in section 14.2 that shows the state of the registers after reset, power-up and sleep-- this comes in handy. Make sure weak pull-ups are not enabled also-- if the pin is output then it should do that automatically but after a reset or power on WPUx has '1' on some of the pins.
 

Thread Starter

howdoesthatworkguy

Joined Jul 23, 2007
39
OK ECCP turns on first, then outputs turn on. I did not understand the -16v thing you talked about. switching in -16V from gate to source?

The weak internal pullups are not enabled.

So the internal diodes are enough, or should I add some extrernal diodes ?
 

nanovate

Joined May 7, 2007
666
For the P-CH you pull the I/O pin low to ground which pulls the gate of the mosfet low so the gate is at 0V and the source pin of the mosfet is at 16V.

Also the pull-ups on the gate pin try to pull the I/O pin to 16V also which might cause the P-CH to turn on since there are internal protection diodes on the PIC I/O pins that are connected to the PIC power supply 5V. This might cause the gate to be at ~5V instead of ground.

You are probably OK with using the body diodes but it doesn't hurt to add external diodes.
 

Thread Starter

howdoesthatworkguy

Joined Jul 23, 2007
39
Yep, the P-Channels were the problem. I added BC108's to turn the P-Channels on and that fixed the problem, had to change ECCP since its now active high. Anyhow now when I turn it on it works and I don't get a short. Thanks for the advice.

Now I got to figure out the correct values for the drive transistors.
 
Top