CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

FET Latch-up During Programming

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

FET Latch-up During Programming
PostPosted: Thu Nov 03, 2005 8:02 pm     Reply with quote

Hello All,

I have a FET attached to pin A3 on a 18F4620. The FET is a BTS117 that is used as a low-side switch for a cooling fan. Logic pin to the gate is current limited w/ a 150R and is also pulled up w/ a 10K. The Fan operates at 5V, 400mA, and the PIC is at 3.3V. The fan is on with output high.

When I ICSP the PIC the fan comes on during programming and the PIC doesn't restart after programming. I also noticed that the fan came on once when I connected the programmer to the header. However, after disconnecting the programmer and cycling the power it works as expected.

I assume I'm getting a lesson on latch-up in a FET? Is that actually what I'm seeing and if so, how can I prevent it?

Thanks,

John
Eric Minbiole



Joined: 10 Jun 2004
Posts: 16
Location: USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Nov 03, 2005 8:46 pm     Reply with quote

Quote:
is also pulled up w/ a 10K. The Fan operates at 5V, 400mA, and the PIC is at 3.3V. The fan is on with output high.


It sounds to me that the problem is with your 10K pull up resistor: When the PIC is in reset (during ICSP, etc), the PIC's outputs will float. In that case, the 10K pullup will turn on the FET and your fan.

Since the fan is on when the output is high, it seems that you should use a pull *down* resistor instead. (Or none at all.) This should keep the fan off when the PIC's outputs are floating.
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Fri Nov 04, 2005 7:07 am     Reply with quote

Eric,

Thanks. I modified the board to pull down the gate on the FET. Everything works as expected now.

I had used the pull-up configuration in previous designs and had never had a problem. But in those designs the load that was being switched wasn't connected at the time of programming, so I'd never seen that bug.

I would still like to understand what is happening, so I can learn from my mistake. In my brain I had figured that the PIC would be able to pull the gate on the FET low after programming... Is what I'm experiencing "Latch-up"? If so I'll do some more reading about it. I saw Microchip has a good appnote on it.

Thanks again to everyone,

John
Eric Minbiole



Joined: 10 Jun 2004
Posts: 16
Location: USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Nov 04, 2005 8:04 am     Reply with quote

Glad to hear the circuit is working now.

I don't think the problem you are seeing has anything to do with "Latch up". Here's a quick explanation of what's happening:

A PIC's I/O pins can have one of three states: 1) Actively driving the pin HIGH, 2) actively driving the pin LOW, or 3) letting the pin "float" to whatever voltage it wants to settle at. This is used for reading inputs.

Your software can configure the pin to be any of the three states. In your case, setting HIGH turns on the FET, and setting LOW turns off the FET. In either of these two states, the PIC's I/O line can easily overpower the 10K resistor, so it doesn't matter whether its a pull up or pull down.

The problem comes when the PIC is in reset, or is in the middle of being programmed. In that case, there is no software running to tell the PIC what to do in that case. In that case, the I/O lines default to the floating state. (This is considered a "safe" default state, since it prevents outputs being shorted to other outputs.) When this PIC line goes to the floating state, the resistor takes over (since nothing else is driving the line). When you had it configured as a pull-up, the FET's gate went HIGH, and the device turned on. The FET doesn't care whether it was the PIC pulling the gate high or the resistor: All that matters is that the gate was high.

In general, choose the pull up / pull down resistor based on what you want the "safe" default state to be. In general, you will pull it in the direction of the OFF state.

Hope this helps.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group