3
\$\begingroup\$

This is for a Raspberry Pi AVR ISP interface board. Most of the functionality is around level shifting the logic to the target board's voltage. This is achieved with a 74ABT125 chip. It's powered by an AP2331 that is fed from a switch which feeds either 3.3v, 5v or nothing (in which case the buffer chip is expected to be powered by the target.

Of concern is one small portion of the circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

VCCIO is the output of the AP2331. It's fed into the Vcc line of the '125 and a couple of other 4.7k pull-up resistors that have diode-resistor level shifters for the MOSI and SCK lines from the Raspberry Pi. !BUFFEN is the output enable line on the '125. !PI_RST is the GPIO pin on the Raspberry Pi that initiates programming. It normally floats, but is asserted to 0 (ground) to reset the target.

Note that the actual programming functionality of this circuit works perfectly. It's just the LED - which is supposed to indicate programming is active - that isn't working.

What's going on is that when the system is idle and the power switch is set for 5 volts, the LED is out, as you'd expect. When the power switch is set for 3.3 volts, the LED glows at something like 1/3 brightness. When the power switch is set for no power, the LED turns on.

Clearly some sort of current path exists through the transistor when the switch isn't set for 5 volts.

I've tried cranking the base resistor up to 200k, but that didn't change anything. What I do notice from doing that is that the LED sort of fades in - probably because the bypass cap across the power supply pin for the '125 is charging up.

I can try cranking up the resistance of the VCCIO pullup resistor - that particular signal doesn't need to be particularly fast.

Anybody have any other ideas how to make this LED act as intended - turning on only when the !PI_RST line is grounded?

\$\endgroup\$
11
  • \$\begingroup\$ Is !PI_RST active low and totem-pole/not open collector? \$\endgroup\$
    – winny
    Commented Jul 16, 2016 at 21:53
  • \$\begingroup\$ !PI_RST is straight from Raspberry Pi GPIO 25. When it's idle, it's high impedance (probably configured as an input), and when it's active and configured as an output it's ether explicitly low or high (+3.3v). \$\endgroup\$
    – nsayer
    Commented Jul 16, 2016 at 22:33
  • 1
    \$\begingroup\$ How does this circuit even work? The diode prevents the PNP from supplying any base current, unless PI_RST is leaking; but the poster says that port is high impedance. Or am I misunderstanding something. \$\endgroup\$
    – jbord39
    Commented Jul 17, 2016 at 1:31
  • \$\begingroup\$ @nsayer Is PI_RST active low when programming? Otherwise I don't see how this will function. The diode blocks all other paths to ground. \$\endgroup\$
    – winny
    Commented Jul 17, 2016 at 7:02
  • 1
    \$\begingroup\$ Maybe add a truth table for the !BUFF_EN, PI_RST, and VCCIO signals, each for any of their possible inputs, showing what you want the LED to do. \$\endgroup\$
    – jbord39
    Commented Jul 17, 2016 at 15:28

4 Answers 4

0
\$\begingroup\$

Padding padding padding...

Try this:

enter image description here

\$\endgroup\$
10
  • 3
    \$\begingroup\$ You should put into your answer that a pull-up resistor is needed and why. Assume the OP does NOT understand all BJT fundamentals. Also, single line snobbish answers are subject to downvotes or deletion. \$\endgroup\$
    – user105652
    Commented Jul 17, 2016 at 0:38
  • \$\begingroup\$ I'm used to the idea of adding source-gate bias for MOSFETs, so the notion of using them for BJTs makes some sense. I am going to try this idea with a P-MOSFET this evening and see if it works. \$\endgroup\$
    – nsayer
    Commented Jul 17, 2016 at 2:31
  • \$\begingroup\$ @nsayer, if you don't deal with the leakage path, you may have a problem no matter what kind of transistor you use. It may be as simple as disabling an internal pulldown resistor on !PI_RST. I am sure current is leaking. You should find out where and how much (read my answer). Then you will be in a position to solve the problem whichever way you choose. \$\endgroup\$
    – user57037
    Commented Jul 17, 2016 at 4:47
  • 1
    \$\begingroup\$ @EMFields. This question was up for review with a 'poor' answer. Someone else had already decided it was a poor answer. I decided to post a comment instead of voting to delete your answer. With your rep points you should know what a good answer consist of. \$\endgroup\$
    – user105652
    Commented Jul 17, 2016 at 16:13
  • 1
    \$\begingroup\$ @EMFields. Yes, someone 'set' a flag for review due to a low quality answer. That's how it went. I did not start this. Enough. \$\endgroup\$
    – user105652
    Commented Jul 17, 2016 at 23:35
2
\$\begingroup\$

A red LED will glow visibly with really tiny currents. Maybe as low as 10uA or 100uA. I don't fully understand your explanation of your circuit. But I suspect that when the LED is on faintly, it is because a small amount of base current is able to flow, most likely to !PI_RST, but it could even be reverse current in the diode, D2. This base current is amplified by the transistor Beta.

The solution is two steps:

First, find out how much current is flowing through the LED. Do this by measuring the voltage across R1 when the LED is glowing faintly. It will probably be mV, but of course I am not sure. Anyway, calculate the current through the resistor and LED using Ohm's law. Assuming it is a small value (less than 1mA), go to step 2.

Step 2: Put a resistor in parallel with the red LED. The resistor should be calculated as follows: V/I = R Where V is 0.2 * Vf for the LED, and I is the measured current. The idea is to provide an alternate path for the small current so that it doesn't go through the LED. As long as the current going through the parallel resistor does not cause the voltage to rise to near Vf of the LED, the LED will not glow at all.

If the resistor works out to be a small resistor value, then this solution won't work. But if it works out to be like 10k or 100k or more, it might be an acceptable solution.

Good luck! By the way, increasing the base current resistor might help. Just make sure you don't increase it so much that the LED doesn't turn on brightly when it is supposed to.

\$\endgroup\$
1
\$\begingroup\$

I am surprised the LED can ever light up at all, based on your description. Maybe I am misunderstanding the situation but: PI_RST and BUFFEN are both floating.

So, for the PNP to conduct properly it needs for its base node to sink current. But the diode would prevent any current from flowing that way.

So the only way that your circuit can work is if the PI_RST pin is leaking, let us assume 100kOhm. Compare in the simulation images below. You can see that with the diode and PI_RST open, there is not enough current to turn on the diode.

This is because the PNP needs for its base node to pull current (reverse of NPN), and the diode prevents any current except it's reverse current from flowing.

some simulation results

If you want to just keep the current setup but stop the problem, but a diode between the PNP and the positive supply.

Based on my hunch, the current problem is caused by that diode. When it's forward biased, it produces about a forward voltage drop across it. So with VCCIO at 3.3V, this automatically turns on the PNP, weakly.

Adding a diode above the PNP requires at least two voltage drops to weakly conduct, which stops the 3.3V case from turning on the PNP.

See the simulation results below w/ the diode as an example.

potential fix w diode

\$\endgroup\$
10
  • \$\begingroup\$ In your simulation, you have three diodes in series rather than just one diode. Are those silicon diodes? Are you assuming that three silicon diodes have about the same Vf as one red LED? I think that assumption is probably valid, but I just want to confirm. \$\endgroup\$
    – user57037
    Commented Jul 17, 2016 at 4:43
  • 1
    \$\begingroup\$ Yes, it was just a quick approximation; I should have clarified that. \$\endgroup\$
    – jbord39
    Commented Jul 17, 2016 at 4:44
  • \$\begingroup\$ I think you are right about the fact that current is leaking. I suspect that the input pin has an internal pulldown resistor or something else attached to that net (not shown) is sinking a small amount of current. I think the OP needs to identify the current leakage path before deciding on a fix. \$\endgroup\$
    – user57037
    Commented Jul 17, 2016 at 4:49
  • \$\begingroup\$ The point of my post is that the circuit doesn't work without the leakage path. The problem is the diode; w/o any leakage path it prevents the PNP from have enough base current to forward bias. \$\endgroup\$
    – jbord39
    Commented Jul 17, 2016 at 4:52
  • \$\begingroup\$ I know the point of your post. But you missed something in one of the comments. The OP is actually driving !PI_RST low. The LED is supposed to be off all the time except when the OP drives !PI_RST low. At least that is how I read it. \$\endgroup\$
    – user57037
    Commented Jul 17, 2016 at 5:33
0
\$\begingroup\$

My guess would be that it's because a BJT is a current amplifier not a switch. It would be interesting to see if you still had this problem with a P-channel FET in place of Q1. In particular, the Base-Emitter junction of a BJT is modeled as a simple diode in DC analysis, if I recall correctly. So if there is a path from GND from the !PI_RST pin Q1 is going to conduct (amplify by about 100x) the current that flows from 3.3V through the Base-Emitter junction and your LED is going to light up.

\$\endgroup\$
4
  • \$\begingroup\$ I can certainly swap out a P channel MOSFET and try that. Traditionally I add a source-gate bias, but don't have the footprint for that on this board. I'll try without one and see how it behaves. \$\endgroup\$
    – nsayer
    Commented Jul 16, 2016 at 22:32
  • \$\begingroup\$ Yeah, I think that @vicatcu is right on the money with his evaluation. Even with the !PI_RST signal driver tristated there is still a leakage current to GND that can allow the PNP to come on some. If you add a resistor to the existing circuit to bias off the transistor you would be adding it "base to emitter". I guess you learn the hard way that it is a good idea to always add "bias off" resistors to transistor circuits. \$\endgroup\$ Commented Jul 16, 2016 at 23:18
  • \$\begingroup\$ How can the PNP come on at all without a leakage path? The diode would prevent the base current from flowing. \$\endgroup\$
    – jbord39
    Commented Jul 17, 2016 at 1:42
  • \$\begingroup\$ The transistor is supposed to turn on when !PI_RST is grounded. \$\endgroup\$
    – nsayer
    Commented Jul 17, 2016 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.