Input Impedance of Digital I/Os in Atmega328P

10 posts / 0 new
Author
Message

I was trying to see what is the input impedance of PORTD/PORTB in Atmega328P. I could not find this in datasheet. I found Analog Input Resistance RAIN=10M but nothing for other DIOs.

The datasheet doesn't give a resistance but it does give a current (assuming the pull-up resistor is off)... #1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

Thank you for the info. So @5V, the input resistance is around 5M when input is high (V/I)?

But what is the meaning of leakage current when input is low? How leakage is possible when low? Appreciate if you could give some input on this.

The current quoted is the maximal leacage current for an input pin with pullups disabled. The input impeadence would be extreemly high when pullups are disabled and dominated by input capaitance as speed increases.

The input current due to capacitance is based on I=CV/T, where "C"=input pin Capacitance including any pcb track layout etc, "V" is the supply voltage if the voltage swing is rail to rail, "T" is the time in seconds of the input voltage swing.

If "C" is 5-10pF and V is 5V while "T"=1s "I"= small

If "C" is 5-10pF and V is 5V while "T"=1ns "I"= big

joneewheelock wrote:

How leakage is possible when low?

Easy, it comes out of the pin.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

The actual impedance is hard to measure. It can be in the hundreds of MegaOhms. It is also not a resistor to GND and not a resistor to 5V, and it might be different for DC and AC voltages.

If you have to ask, you might be doing something wrong.

The RAIN is typical 100MOhm (not 10) for an analog input. See page 375 of the complete datasheet. However, the impedance of the circuit around the ATmega chip should be 10k or less to make the ADC work properly.

For a digital input, a high impedance circuit could increase electrical noise.

Why do you want to know ? What is your project about ?

Input impedance is generally NOT a useful concept for CMOS logic inputs. Why? The input is highly nonlinear and is mostly characterized by a leakage current. Further, even the polarity is poorly defined, unit to unit. In some, it can be dominated by a current in to ground. In others, it can be out from Vcc. That is because there are several leakage paths, including the ESD protection diodes (reverse biased, to Vcc and ground) and the gates of the N and P channel input devices. If the reverse leakage of the ESD protection diode to Vcc happens to have the highest leakage, the input leakage will be out from Vcc And so forth.

For AC signals (that is, during logic rise and fall times), the input primarily appears capacitive in the range of 2-8pf, depending on the feature size used in the device design.

Thus, you do yourself a disservice if you try to cast the input into the mold of a "resistance". It just does not fit.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Why do you want to know ? What is your project about ?

I was referring to pull up resistance calculation in  https://learn.sparkfun.com/tutorials/pull-up-resistors. Site says "The general rule for condition 2 is to use a pull-up resistor (R1) that is an order of magnitude (1/10th) less than the input impedance (R2) of the input pin". So I was thinking how to know input impedance. The same site says pull up = Vcc/Current through Pull up.

What are the various considerations to select pull ups? Current value is of any importance or voltage ultimately at the input pin is important? Generally 1K or 10K is common. But wanted to know exact calculations if any.

Pull-up resistors can be all over the map.

The ONE case where pull-up value is important is I2C/TWI at maximum clock rate. The NXP handbook on I2C tell you what the pull-up resistor values need to be as a function of the supply voltage.

Otherwise, there are a large number of trade-off factors that impact the choice. But, in many cases, these factors are not relevant, leading to a fairly arbitrary choice, such as 10K. Here are some of the factors:

1) Driving source: Is it open drain/collector or a switch to ground? If its not one of these, then you mostly do not even need a pull-up.

2) Data rate: The higher the data rate, then the smaller the pull-up has to be, in order to get a rise time compatible with the signal period. I2C/TWI is a big example of this.

3) Activation duration: is there going to be current flowing through the pull-up for significant time intervals? If so, AND it is a power sensitive application, you need to use the largest possible pull-up compatible with the application.

4) Line capacitance: If the line capacitance is high, then you need to use a smaller pull-iup in order to get a reasonable rise time.

5) Wiring: If the input is connected by wiring that can pick up noise or power line trash, then you may need a smaller pull-up. In severe cases, additional filtering may be needed.

6) Input structure: If it is bipolar (bjt) then you need a small enough resistor to supply the base current to turn the device on. If it is CMOS, then the resistor can be orders of magnitude larger.

7) Input leakage: When the leakage to ground is significant, then the pull-up needs to be small enough that the input stays logic high. This can be written as Vcc - Ileak*Rpullup > Vih. If we use the 1uA number with Vcc = 5 and Vih = 0.6*Vcc, then Ileak*Rpullup < 0.4Vcc = 2.0V. So, for Ileak < 1uA, Rpullup can be as high as 2Meg!

8) There are probably other factors I am not considering, like switch bounce and transmission line termination.

So, in ordinary circumstances, just use a bloody 10K and forget about it.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

The Sparkfun tutorial is wrong in many ways. There is no R2. There is no internal resistor to GND. There is no voltage divider. The impedance of a microcontroller is not 100k to 1M. You got confused for nothing 