Why is output driver enabled for INPUT pins? Seeking understanding.

shawn

Well-known member
Why is the output driver enabled for INPUT modes for GPIO pins? (Drive Strength Enable (DSE) bits.) I'm seeking understanding. (Even for pull-up and pull-down input modes, maybe the pin sources current through the pull resistors, but this doesn't explain to me the need for the enabled output driver.)

Input pins are configured here:

They're set here:
 
An auxiliary question is: Are pull-ups and pull-downs enabled when DSE (drive strength) is set to non-zero (output driver not disabled)? The chip spec. leaves me a little uncertain. It does say, “Pull-up, pull-down, and pad keeper are disabled in output mode" (page 952). But what does "output mode" mean? Does that specifically mean DSE is non-zero?

Update: Maybe "output mode" is referring to the GDIR bits, where 0 is input and 1 is output.
 
Last edited:
Definitely GDIR controls direction.
The drive strength needs to be setup ready for open-drain operation I think - you don't want to have to configure a bunch of different registers to do open-drain signalling, and open drain is basically toggling the direction register... DSE goes to the output driver, GDIR controls whether the driver is enabled.
 
Are you saying that the drive strength is only relevant to open-drain-output-configured pins? If that’s true, why are those being set for input pins? Even if it’s not true, why would they be set for input pins at all?
 
No, "open drain" is usually faked on a microcontroller by toggling the direction register while leaving the output register low, as this involves only touching one register.

True open-drain requires the pad hardware to be open drain which it isn't. Drive strength configures the output devices in the output driver, it doesn't turn them on or off.
 
So when input mode is set the library has no idea what you want to do, so its best to configure everything so you're ready.
 
Note that you can drive data into the GDIR register with DMA directly if you want, which would be the fastest way to get "open drain" data pushed out. DMA rather assumes a single destination register...
 
Thank you for those clarifications, but I'm not following your answer with regards to INPUTs (Arduino-style "INPUT", no pull-up or pull-down) (I also think you were trying to answer my auxiliary question; thank you). Why would the DSE (drive strength) bits be set for pins that are configured to Arduino INPUT? See the links in the first post. (I'm just trying to not have the original question get lost. :))

Specifically, this:
Code:
if (mode == INPUT) {
            *(p->pad) = IOMUXC_PAD_DSE(7);

The logic of setting this because it might be needed later doesn't make much sense to me, because whenever state or configuration changes, all the bits in the config registers change too (in the file digital.c, where pinMode() and digitalWrite() are defined).

I'm trying to understand this circuitry more fully and whether I need, for a manually configured pin that only does INPUT, to also enable the DSE bits, and I just don't understand why pinMode(pin, INPUT) sets those DSE bits. I'm not and won't in the future use these particular pins as outputs.

Let me rephrase the question: Is DSE needed at all for INPUT (no pull-up or pull-down) pins? If yes, question answered, then the new question is "Why?" If no, then why is it being used in pinMode(pin, INPUT)?
 
Last edited:
The DSE is only used when direction is output.

The DSE is set up ready for future use such as toggling the direction for pseudo-open-drain. The DSE is part of the configuration of the pad, GDIR and DR operate the pad.

One thing to remember is that when a pin is connected to a peripheral (ie not in GPIO control) the pad configuration still applies, its good that whatever pinMode option is used the pad configuration is setup.
 
Thanks for the explanation. I’m trying to solve some slowness if QNEthernet’s Ethernet.end() and then begin(…) is called. I’m verifying that all the pins are as they should be when they should be. You’re correct that I’m using these as peripheral pins and not GPIO.

I think I’d need to see a schematic to fully understand this. If not GPIO, and if the pin is strictly an input, then from your explanation, it sounds like I don’t need DSE, however.

I was surmising that for peripheral-connected pins (not GPIO, i.e. a different ALT setting), that a pull-up or pull-down might still need the DSE enabled. I’m still uncertain if this is the case. A schematic would help me sort this out. This is still an outstanding question for me.
 
Last edited:
Back
Top