Pull-up and pull-down resistor - Page 1
Forum section: electronics / beginners

author: sy
author_rank: Regular Contributor
timestamp: July 01, 2023, 06:46:14 am
content: I know what a pull-up and pull-down resistor does, but I am still having trouble understandingwhento use it. I know the SIOC and SIOD require to be pulled up for I2C communication, but some connections like RESET and PWDN are directly tied to the supply voltage and ground. Why is this not a problem?And also how are these values calculated? I don't see where on thedatasheetthat specifies the maximum current to the input terminals of the OV7670, to calculate these values.

author: Siwastaja
author_rank: Super Contributor
timestamp: July 01, 2023, 07:04:01 am
content: Well, reset and PWDN being hardwired, you obviously have no control over them. The thing won't ever be reset through the reset pin, and it's never going to be put in powerdown mode using PWDN pin. It's worth reading the datasheet carefully because some rare devices mightneedresetting through reset pin to start operating correctly.You would use pull-up / pull-down resistors if you used IO pins to drive those signals, and wanted to have a defined state (1 or 0) during the time microcontroller code has not yet initialized the pins into output mode.10kOhm for the I2C is not probably calculated, just hand-waved in. There are countless of appnotes how to actually calculate pull-up values for I2C. On low side, limiting factor is voltage divider being formed between the pull-up and the parasitic resistance of the ground-driving transistor in the IC (around 50 ohms). On the high side, the limiting factor is RC time constant being formed with the pull-up resistor and parasitic capacitance of the bus (all IO pins plus PCB traces). I recommend something like 2.2k for pretty much sweet spot pull-up value for 3.3V I2C.

author: sy
author_rank: Regular Contributor
timestamp: July 01, 2023, 07:12:43 am
content: Quote from: Siwastaja on July 01, 2023, 07:04:01 amSo from what I am understanding, as the SIOC and SIOD are being driven by pins A4 and A5 of the microcontroller, there would be some internal switching that drive SIOC and SIOD to ground, and then that would result in a short circuit if we didn't put those pull-up resistors in?Quote from: Siwastaja on July 01, 2023, 07:04:01 amTying the RESET or PWDN directly to the supply voltage and ground means I have no control over them, but is there any concern to the amount of current supplied to the pin?Quote from: Siwastaja on July 01, 2023, 07:04:01 amIf I wanted more control over the reset pin would I tie it to some other GPIO with a pullup/pulldown resistor and pull that to some value HIGH or LOW, then switch it when I needed to?

author: Siwastaja
author_rank: Super Contributor
timestamp: July 01, 2023, 07:28:05 am
content: Quote from: sy on July 01, 2023, 07:12:43 amNo, not short circuit, but opposite of it, nothing driving the pins. I2C works by resistors driving pins high, and a single ground side transistor driving them low. This works as the transistors are orders of magnitude "stronger", i.e. lower resistance than the resistors. When the transistor is on, it fights against the resistor so current flows through the resistor + transistor. This is acceptable because the resistor value is quite big (> 1kOhm).QuoteNo, because both ICs are supplied from the same supply voltages, which come up together. With direct connection, the datasheet conditions (usually something like pins have to be within GND-0.3 to Vcc+0.3V) are thus satisfied. No current flows to/from the pins.QuoteYes. If you have spare IO pins, it's usually a good idea to wire a reset pin under your control, because it might happen there is some rare bug or something which requires you to reset the IC.

author: gnuarm
author_rank: Super Contributor
timestamp: July 01, 2023, 07:39:43 am
content: Quote from: sy on July 01, 2023, 07:12:43 amI would highly recommend that you control the reset pin from your MCU. I2C has a problem where some devices can hang the bus. The only way to resolve this is to reset the slaves. Without control over the reset pin, you can't do this.Intel has a variation on I2C called SMB (if I remember correctly) which includes a timeout on bus transactions. If they do not complete in some time frame, the bus is automatically reset. I don't recall the details, but I assume for this to work, all slaves and the master have to support it. Otherwise, SMB is very much like I2C.

author: wasedadoc
author_rank: Super Contributor
timestamp: July 01, 2023, 07:56:15 am
content: Basically you need a pull-up or pull-down when the driving circuit can only pull in the opposite direction. Common cases are an open collector output or an on-off switch.

author: EPAIII
author_rank: Super Contributor
timestamp: July 01, 2023, 11:51:30 am
content: The key idea here, that perhaps no one has stated quite plainly, isIt is the OUTPUT that determines IF/WHEN a pull-up or a pull-down resistor needs to be added to the circuit.Generally speaking, INPUTS will accept a specified range of Voltages. For logic circuits that range is usually from 0 to the positive supply Voltage (+5V or +3.3V or whatever the particular chip uses). Inputs are usually designed as a high impedance (high resistance) circuit that will not be damaged by any Voltage in that range, even coming directly from the power supply.A very frequently used type of output circuit is the open collector. That is simply an NPN, BJ transistor with the signal connected to the base and the emitter connected to ground. The collector is not internally connected to anything except the OUTPUT PIN. So the collector can do NOTHING unless there is a pull-up resistor which forms the output circuit.One reason why this configuration is used is so that the circuit (the other chip) that is connected to the output can have a different Voltage range (different supply/operating Voltage) than the circuit (chip) where the signal originates. So, for instance, a processor (like your Arduino) that operates with a 3.3V supply can drive an output attached to a 5V chip. In that case, while the Arduino is operated with a 3.3V supply, the pull-up resistor would be connected to a 5V supply.To state it more completely, it is the OUTPUT that determines IF a pull-up or pull-down resistor is needed. But it is the INPUT that determines what Voltage (or ground) that pull-up or pull-down resistor needs to be connected to.There are more complicated situations, like transmission lines between ICs which need both Voltages and the correct termination impedances, but don't worry about that until you actually get there.Quote from: wasedadoc on July 01, 2023, 07:56:15 am