Author Topic: Simple FET circuit for OneWire Protocol doesn't work as expected?  (Read 3450 times)

0 Members and 1 Guest are viewing this topic.

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
I've shamelessly copied the circuit from the datasheet for the Maxim DS2502 Write Once EEPROM device. I've taken a screen shot and coloured it in so that you can see what parts of the circuit I'm monitoring on the scope. In my defense whilst I did copy the circuit I thought I fully understood it and so was happy enough with it. My understanding turned out to be not as complete as I might have hoped.

This looks simple to me, the programming pulse, PGM, connects from the uC to the Gate of Q2, an N-FET, that is idle high, so Q2 normally has the Source connected through to Drain. That seems to be the case as my scope trace shows that the light blue test point is normally at a low voltage. Which means that Q3's Gate is Low and the Drain of Q3 is pulled up to +12V, (Well +9V in my case under test). So I'm happy with normal idle case. Purple point idles at +9V.

My problem is when the uC pulls the PGM pin low. The scope trace shows that when this happens the Gate of Q2 is indeed being pulled down to ground. So that should mean that the light blue test point should get pulled high to the 3v3 of Vdd (The data sheet states that the maximum threshold for Vgs(th) is 3V. So Q3 should get fully turned on. I'm not getting this as whilst I think that the light blue test point should be pulled to 3v3 it's only about 1/3 of a Volt. That's not even close to the minimum Vgs(th) of the 2N7000 (0.8V) So Q3 never gets turned on.

So my question really concerns Q2, whilst I'm not getting what I want out of Q3 I can understand why, Vgs(th) not reached. My problem is the Q2 FET with the 10K pullup resistor. One FET and one Resistor and I'm struggling :-(
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #1 on: August 08, 2017, 03:16:34 pm »
Quote
I'm not getting this as whilst I think that the light blue test point should be pulled to 3v3 it's only about 1/3 of a Volt. That's not even close to the minimum Vgs(th) of the 2N7000 (0.8V) So Q3 never gets turned on.

 Vgs(th) is not the parameter to use here. You require much lower value available with "logic level mosfets".

 

Offline eblc1388

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: gb
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #2 on: August 08, 2017, 03:26:50 pm »
You're getting low voltage across Q2 D & S after switching off suggests a possible DRAIN/SOURCE pin reverse in Q2 physical connection. The low voltage most likely comes from the forward voltage drop of the body diode.
« Last Edit: August 08, 2017, 03:32:23 pm by eblc1388 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #3 on: August 08, 2017, 03:27:30 pm »
The Vgs(th) voltage is when a MOSFET just *starts* to turn on.  As a rough rule of thumb, you need gate drive levels of double the threshold voltage to get full conduction.  The 2N7000 is specced as having a max threshold voltage of 3.0V @1ma Id, so isn't really suitable for interfacing 3.3V logic.   However 1mA would be enough to pull down a 10K resistor so you should be seeing a greater swing and must have something else wrong.  Maybe Q3 has a gate-channel short?

When you find and fix the problem, consider changing Q2's pullup to 27K to the 9V rail to get adequate gate drive to Q3.     

N.B. due to the sum of the threshold voltages of Q1 and Q4 being less than the difference between the power rails, it will dump a brief spike of 9V into the 3..3V I/O pin on every /PGM transition.  I would strongly recommend a Schottky clamp to 3.3V on the source side of Q1, and possibly a series resistor between the source and the clamp.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #4 on: August 08, 2017, 03:54:32 pm »
You're getting low voltage across Q2 D & S after switching off suggests a possible DRAIN/SOURCE pin reverse in Q2 physical connection. The low voltage most likely comes from the forward voltage drop of the body diode.

This will get my vote.
 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #5 on: August 08, 2017, 04:14:39 pm »
Thanks for all your help. I have a 5V rail available so I might pull up to the 5V instead of 3v3. Actually as Ian.M Suggested go straight to 12V rail I'll do that.

Then I'm concerned about Ian.M's info about a voltage spike from Q1!  Thanks a million for that head's up. I've drawn what I think I should now have the only question I would have is the value of R. Ian.M described it as a series resistor between the source and clamp of Q1. I hope I've understood that correctly. I ask about the value of R because I don't want it to interfere with the OneWire comms. I don't think a resistor would interfere, but then I misunderstood the threshold voltage of a FET. (Threshold, I don't think that word means what you think it means!)

Thanks again for all your help
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19671
  • Country: gb
  • 0999
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #6 on: August 08, 2017, 04:24:54 pm »
How about using the CD4007, rather than all those transistors?
http://cva.stanford.edu/classes/cs99s/datasheets/CD4007C.pdf

The circuit is compatible with it, but I haven't checked whether it can drive enough current at the gate voltages in your circuit. That might be a show stopper.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #7 on: August 08, 2017, 05:10:05 pm »
Hmmm, a CD4007 could work - power it from 12V with /PGM input on pin 6 to level shift it with a pullup on pin 8 for the N-MOSFET and pin 13 tied to Vdd to disable the P-MOSFET, then use the inverter to restore the signal polarity and the remaining uncommitted pair of MOSFETs (pins 1-5) to replace Q1 and Q6 above.  However the DS2502 datasheet calls for a 10mA programming pulse supply, and the CD4007 only guarantees 0.55mA (@10V Vdd, 25°C), so it would need the P-MOSFET boosted by connecting a PNP transistor base to its source, emitter to the rail and collector to the DS2502 data pin.

It would still need the Schottky clamp and series resistor R.  The purpose of R is to limit current in the Schottky clamp to prevent the 3.3V rail glitching excessively (fit a 0.01uF decoupling cap on the 3.3V rail right next to its cathode), and to prevent its Vf drop exceeding the permissible excursion of the MCU's I/O pin above its Vdd rail - typically 0.3V.   Try a BAT54 or similar diode and for R use 100R to start with, which should cause negligible voltage drop when either the MCU or the DS2502 is pulling the bus low.  Personally, I'd prototype the DS2502 bus driver without the MCU connected, applying debounced control signals manually via ordinary logic gates, and if you observe an excessive spike on the MCU side of the bus, try a beefier Schottky diode, as increasing the resistor too much will compromise your logic levels.  I know a 1N5817 will clamp it OK at less than 0.3V above the rail, but its leakage current may be objectionable.
 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #8 on: August 09, 2017, 11:14:12 pm »
Thank a million for all the contributions to this. I'm not for changing devices at the moment, I've got the bit between my teeth because I stripped the circuit down to a single N-FET switch. That didn't work on my prototype PCB so I went back to a bread board. It worked on a breadboard so I took the 2N7000 I'm using and soldered it into the PCB, stripping everything else out of the board. Tried it there and not only did it not work it broke the 2N7000, so that once taken back to the break board it didn't work.

I've checked and re-checked the PCB, comparing it to the breadboard and managed to brick 3 of my 2N7000 devices. I've repeatedly buzzed the PCB but I've gotten too close and I'm missing something obvious. What ever it is I'm determined to find it. Don't want to be making this mistake twice.

Thanks again.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #9 on: August 09, 2017, 11:45:44 pm »
2N7000 like most other small MOSFETs doesn't have any integrated Zener clamping or any other ESD protection and is rather sensitive to ESD   If your soldering station isn't properly grounded with good continuity to the tip, leakage current from the hot element can deliver enough voltage to blow the gate oxide.

If you suspect ESD or leakage current damage during assembly, working with full ESD precautions, assuming you are using the through hole 2N7000 not the SMD 2N7002, try sticking the legs through a small scrap of aluminium foil.  Use some high density conductive foam as a backer to get the legs through the foil, and if its tough to insert, pre-prick the leg holes with a needle thinner than the legs.   That will keep the gate shorted to the drain and source during soldering.  Tear the foil away afterwards.
« Last Edit: August 09, 2017, 11:51:31 pm by Ian.M »
 
The following users thanked this post: tooki

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #10 on: August 15, 2017, 04:46:21 pm »
Ian.M - I'm not sure what it is you're talking about but it only worked! I'm running a Hakko FX888D, which says ESD Safe on the front but I'm only just looking at the plug of it. I'm not sure where I bought it, but probably on eBay. It has a foreign mains plug. I'm in Ireland so UK style 3 pin plug. I'm only now looking at the adapter that was supplied with the iron. It has an insulated Earth pin. The other two, shorter, pins are meant to be insulated but the longer Earth is meant to be conductor for the whole length of the connector.

So your metal foil trick worked brilliantly so I'm going to get a new proper 3 Pin plug, put that on the Iron tomorrow and try solder another one of these FETs to see does that make a difference. Thank you so much for your help. I could have looked at that for a month of Sundays and got nowhere. I know far too little about ESD. Back to The Art of Electronics, still on the 2nd edition.
Thanks again.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #11 on: August 15, 2017, 05:13:27 pm »
Yes, that adapter isn't 'kosher' and should be replaced or the lead rewired with a BS1363 plug.  However it *MAY* still be making effective Earth contact. 

Start by checking continuity between the Hakko bit and the earth contact on its Europlug.  Then plug it in via the adapter, leaving it switched off and check continuity between the tip and the earth pin of an adjacent socket.  A convenient way of getting access to the earth pin would be to probe the middle contact of an IEC60320 C5, C13 (PC) or C15 (kettle) power lead (check its continuity to the earth pin first), or a grounding terminal on your scope or PSU.

If the Hakko is confirmed as having a bad Earth connection when plugged into the adapter, rewiring it with a BS1363 plug will significantly reduce the risk of further MOSFET damage.  If it actually had earth continuity, however, then you've got some other type of ESD event happening during the handling that happens as part of your soldering process, and until you get it figured out, you'll need to keep on with shorting the gate with the aluminium foil, which is a royal PITA as you have to be careful not to leave slivers of foil behind and you cant use a foil short when soldering SMD MOSFETs.   

Its worth remembering that back in the old days, MOSFETs in TO-18 packages almost invariably came with a fine wire shorting spring wrapped round the leads that could be removed after soldering.

The problem isn't exactly ESD as electrostatic charge buildup isn't actually involved here. Ceramics are typically good insulators at room temperature but tend to become resistive when hot. A conventional soldering iron needs good thermal contact between its heating element and its bit. Therefore there tends to be a leakage current from a soldering iron element to its bit.  Its *ESSENTIAL* that the bit of mains element irons is earthed as the lekage current has enough voltage driving it to punch through *any* MOSFET gate oxide.   Low voltage irons like your Hakko still have ebough voltage driving the leakage current to damage more delicate devices.  Also anything with a switched mode PSU and a three pin mains lead tends to dump up to half a mA of leakage from its PSU EMI filter caps to earth, and if the earth wire is broken/disconnected, you will typically get half mains voltage on all metalwork that is supposed to be earthed, another certain way of zapping delicate circuits.
« Last Edit: August 15, 2017, 05:24:31 pm by Ian.M »
 

Offline eblc1388

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: gb
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #12 on: August 16, 2017, 06:14:03 am »
Warning: 13A square pin plug with partly insulated earth pin
===========================================

This is deadly. It will make connection to the socket earth conductor initially when partly plugged in and then it will *BREAK* the earth continuity when fully plugged in. It will give user a false sense of security of earthed connection but in fact there is no earth.

The reason being the earth contact on the 13A socket is at the very front portion of the opening and this contact will be touching the plastic portion of the square earth pin instead when the plug is fully inserted. Therefore there is NO EARTH.

You've been warned. Break any such plug or adapter with a hammer to avoid it being used ever again. Whoever dreamed up such a stupid design to save on some metal cost should be sent to jail.
 
The following users thanked this post: Ian.M, tooki

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #13 on: August 16, 2017, 06:42:15 am »
Yes.  I should have clarified that it is unfit for use even if its Earth pin makes contact in a particular socket.   Assuming you bought it locally, you should report it to the appropriate authorities.  If you bough it online from an overseas seller, there's not much you can do - trying to stamp out sellers of dangerous electrical items is like trying to piss upwind in a hurricane.
 

Offline jwhitmoreTopic starter

  • Regular Contributor
  • *
  • Posts: 155
  • Country: 00
  • Software head strays into the Hardware.
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #14 on: August 16, 2017, 03:30:18 pm »
Thank you all for your help. So  I think I blew 4 or 5 FETs before I got help here. I buzzed the plugs and the earth on the Hakko was good, straight through to the tip. The converter from the Hakko plug to the 3 Pin square plug was another matter entirely. There was no earth connection through, even at the metal tip of the square Earth pin. So I should have paid a lot more attention to detail. I know that those insulated Earth pins are sh1t but I missed it.

So I've cut the mains cable and connected a good three pin plug. Earth connected through to the Iron tip. Soldered in 2 FETs and both working perfectly. :-D

As I said previously it would have taken me a month of Sundays to figure out that problem without ye. Thanks again
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12947
Re: Simple FET circuit for OneWire Protocol doesn't work as expected?
« Reply #15 on: August 16, 2017, 04:43:28 pm »
Now check the earthing of all your other bench equipment . . . .  ;)

If you have a lot of equipment with Schuko or similar plugs, its worth getting a compatible good quality multi-socket extension lead for them and fitting the lead with a BS1363 plug.  For flat 2 pin Europlugs, you can get permanent fused BS1363 adapter plugs that assemble round the Europlug.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf