16

I have connected a microcontroller GPIO pin, which is intended to be an output, to a DC-DC converter's active high Enable input pin. Since this pin is active high, and because I do not want this converter to be ON at power up or before it is required, I have used a pull-down resistor on this line to keep it disabled.

I am slightly confused as to where should this pull down resistor be ideally placed. Should it be placed near the GPIO pin or the Enable pin?

Same question for pull-up resistor, in the case when Enable is active low and I have to use a pull up on the line.

JYelton
  • 32,302
  • 33
  • 134
  • 249
LoveEnigma
  • 425
  • 2
  • 7
  • 15
  • 8
    It doesn't really matter, but it may be clearer to place it close to the input it is pulling up or down. – pjc50 Nov 05 '14 at 09:20
  • Thanks for the reply. Its current location is near DC-DC converter's Enable pin, as you have mentioned. So I will leave it there. By the way, I think it is more of an "intuition" case rather than logical. I could be wrong though. – LoveEnigma Nov 05 '14 at 09:43
  • 2
    I find it difficult to imagine that it's going to make any real difference. A pullup resistor is typically on the order of 5-10K ohms. If we assume a 10% resistor, that means the tolerance is +/- 500-1K ohms. It would take a ridiculously long trace before you've change the resistance by even close to that amount. IOW, you could easily build the same circuit twice, and put one resistor next to the input pin, and the other as far away from it as possible, and one that's farther way could still (easily) have a "stronger" pull-up/down than the one that's closer. – Jerry Coffin Nov 05 '14 at 22:26
  • Thanks for your inputs, Jerry. I understand you mean having two PU/PD on the signal, is it? – LoveEnigma Nov 12 '14 at 05:36

1 Answers1

12

Ideally, there should no apparent difference, but I always put this "guard" resistor close to the pin which it will guard. There are two reasons:

  1. If you put the pull-down resistor close to your MCU, and have a long long trace from your MCU to the converter. If your converter's enable pin will source some current, the current will flow through the long trace and your pull-down resistor to ground. If the trace impedance is high, your converter may see a high level at the enable pin! Whatever, it will reduce your noise margin.

  2. If your MCU is far from your converter, put the resistor close to the converter will make the circuit more clear. And once you have problem with your board, this will make the debugging work easier.

JYelton
  • 32,302
  • 33
  • 134
  • 249
diverger
  • 5,828
  • 5
  • 43
  • 79
  • Thanks for the reply, diverger. But how can a pin that is input source current? Do you mean leakage current or noise? – LoveEnigma Nov 05 '14 at 09:59
  • 2
    Yes, maybe leakage, it depend on the internal circuit. In some cases, when you apply a low level at the pin, it may have current flow out of the pin, please read the docs carefully. – diverger Nov 05 '14 at 10:11
  • Good point. Thanks, I will check the documents carefully. – LoveEnigma Nov 05 '14 at 10:38
  • Forgot to ask: Does this rule of placing PU/PD closer to the destination (intended pin) apply to all cases? Example, PU on CS- signal of SPI, when a MCU is interfaced with SPI based memory device. (Except for the open drain/collector outputs, of course, where you need PU/PD near the source output.) – LoveEnigma Nov 05 '14 at 12:17
  • 1
    You can just think all the traces have some impedance, if you have a long trace to your pull-up, then the total pull-up will be \$R_{p} + R_{trace}\$, and if your pin has internal impedance \$R_{in}\$, the trace impedance will make the pull-up more weaker, that is, the voltage on your pin will be lower. Although the difference may be small. So, i always put PU/PD closer to the pins which need them. – diverger Nov 05 '14 at 13:09
  • Just came across one more case of PU/PD, where the signal passes from one board to other. For example, let's say a GPIO pin of MCU which is on board A is connected/controlling to a transistor base on board B. In this case where should I place the pull down resistor? I think it should be near transistor on board B. Am I correct? – LoveEnigma Nov 12 '14 at 05:19
  • 1
    Yes, in this case, i will place it on board B too. In this manner, i can make the transistor on board B has **fixed and known** state on it's base, even when A and B lost their connections. – diverger Nov 12 '14 at 05:25
  • Thanks for the prompt reply, diverger. I appreciate it. Exactly, that is what I also thought. If instead of transistor, I have a diode on board B which is connected to the MCU pin that is on board A, does it make any difference? Actually, I am having a small discussion with my colleague and he wants me to put it on board A. Thus, thought to seek clarification. – LoveEnigma Nov 12 '14 at 05:27
  • Um, in this case, i will choose according to the applications. Because it's only a diode, so the voltage drop on trace/wire may not be a big problem, given they are not two long:). However, make your "guarded" pins has a **fixed and known** state is important. Especially when your CPU and your guarded pin are not on the same board. – diverger Nov 12 '14 at 05:38
  • Hmmm, but won't it more worse in this case because in additional to potential voltage drop because of long trace (which is negligible anyway), there is also a diode drop (which can be significant) after which the actual signal appears on the destination? In my case, we have the GPIO signal connected to the anode of diode and then the cathode of diode is connected to the base of a transistor, both diode and transistor being on board B. – LoveEnigma Nov 12 '14 at 05:56
  • Sorry, i think i know what you mean now. But where your pull is? At which side or your diode? – diverger Nov 12 '14 at 06:05
  • No worries. The pull down will be on the anode of the diode. – LoveEnigma Nov 12 '14 at 06:15
  • 1
    Ok, in this case i'll put the pull down still at the B board. But another question, if you have not any pull down at diode's cathode, that is, the base of the BJT, if your MCU outputs a low level, than your diode will off, then where the BJT's base charge go (assume it's a NPN) ? It will make the shutoff longer. – diverger Nov 12 '14 at 06:27
  • Ahh yes, I did not think about it! Makes sense to put the diode even further as you said, that is on diode's cathode (near transistor base), so that it will also act as quick discharge for base voltage. So, I will consider putting it at diode's cathode, near the BJT base. Thanks a lot for your help. :) – LoveEnigma Nov 12 '14 at 06:33