Saturday, June 22, 2019

The benefits of networking

One of the presentations I attended at KiCon 2019 was one entitled "Preserving History with KiCad" by James, the self-professed "Bald Engineer". Given my work with recreating the Intel 4004 CPU, his presentation sounded interesting to me.

One of the things James attempted was an automated conversion of a printed schematic to an electronic format. Although I'd had success with converting the schematic of the 4004 to Eagle format, I had several advantages, including that the 4004 schematic image was computer generated, rather than hand-drawn, and an accurate netlist detailing both connections and locations was available. Thus what James had attempted was far more ambitious.

Quite accidentally I happened across his blog last night. One of his articles was called "7 MOSFET Myths and Misconceptions Addressed". The first in his list addresses the potential need for a resistor between a microprocessor GPIO output and a MOSFET. As he points out, a MOSFET's gate is basically a small capacitor. When the GPIO tries to change the charge on the capacitor, there is going to be current flow to charge or discharge that capacitance. That initial current flow may or may not damage the GPIO driver.

Do you need a series resistor or not? As with many things in life, the answer is "maybe". A digital input on a CMOS logic gate is a pair of MOSFETs, but no one suggests the need for a series resistor. Why not?

I believe the answer depends on the capacitance of the thing the GPIO is driving. The input capacitance of most logic gates I surveyed is about 5pF while the output is rated for driving a 50pF load, giving a fan-out of 10. An input to the Xilinx Spartan 6 FPGA I'm using is a bit more complicated than the average logic gate, and appears to have an input capacitance of about 10pF.

What about driving discrete transistors? If you're driving a BSS83, with an input capacitance of about 2pF, a series resistor isn't needed. Driving a DMG2305UX, a low-voltage power MOSFET with an input capacitance of 808pF? A series resistor might be advisable, or use a gate driver designed to drive high capacitance MOSFET gates.

The PIC 16F876 I use for a lot of my breadboard experiments is rated for 25mA output on any individual I/O pin. When it starts to swing the gate of a power MOSFET like the DMG2305UX, it's driving what initially will look like a dead short. When operating from a +5V supply, we can guarantee the peak current will be less than 25mA by placing a 200 ohm resistor in series with the gate. Is that necessary? Probably not. I've seen some references that model this I/O pin as having a 100 ohm pull-down and a 120 ohm pull-up impedance. This suggests that adding a 100 ohm series resistor would be sufficient. But 200 ohms would be safe.

The Spartan 6 FPGA has programmable output drive strengths of 2, 4, 6, 8, 12, 16, or 24 mA. Does this mean I can skip the series resistor when driving the MOSFETs that control the printer motor and hammer solenoid? Possibly, but I don't know. It's not like I need to switch them that rapidly. Even the FET that controls the piezoelectric keyclick sounder will only be switching at 2 KHz, and its input capacitance is only 110pF. But resistors are cheap and the FPGA is expensive, so I have them in there.

No comments:

Post a Comment