GPIO on P6

P6 is the DAC/ADC line, in addition to a timer. But doesn’t it have to be configured for DAC/ADC first? If I just assign it as a GPIO, shouldn’t it act like a GPIO? I ask because that’s not what I observe. If I set it to a pull-down, it remains up, but if I set it to a pull-up, I can pull it down with a switch. So it doesn’t “respond correctly” to a switch, the way, say, P4 and P5 do, which both respond to a switch correctly in both pull-up or pull-down fashion.

I just hooked a momentary switch between pins 4, 5, or 6 and the 3.3V rail for a pull-down/switch-up test and the ground rail for a pull-up/switch-down test…which I presume was the proper arrangement.

Is there any overarching electronic philosophy as to whether it is better to configure switches in a pull-up/switch-down fashion or the other way around?

Hi, it should act as a GPIO with pull ups and downs. That could be a bug. Please create a bug on GitHub about this and Ibrahim will take a look and fix it.

As for using pull ups or downs. For switches there’s no particular way you have to go. Most folks do pull ups with a switch pulling to ground however.

It could also be this Chinese knock off board I’m working with. I already pointed out that the darn LED is soldered on wrong. :smiley:

I’m quite certain that what’s going on is I’m doubling up on the LCD’s backlight control by accident. I realize there is some discussion elsewhere about disabling the backlight control pin to provide an additional GPIO, but even without doing that, the pin can still be used as a switch, but only in the pull-up/switch-down fashion. Wired that way, you can detect when the button is down (but of course the LCD briefly goes dark while you press the button). This is sufficient for a momentary switch for providing instantaneous binary signals to the program (for example, to increment a counter or trigger some other single function call and behavior).

So, I have three functional switches at lines P4, P5, and P6. In theory, I would have four if I count P9, but I’m using that for SPI-select to a second SPI device. I’ve found a Qwiic-interfaced I2C keypad on Sparkfun ( If I can get that to work, then I can use 12 buttons through just two wires. Presumably I don’t have to use some sort of Qwiic environment for that keypad. I should be able to use the keypad directly (realizing that all Qwiic does is simplify the GPIO-to-I2C layer that I have no particular interest in hacking up through, say, SparkFun 16 Output I/O Expander Breakout - SX1509 - BOB-13601 - SparkFun Electronics, as recommended in another thread). So that will be the next thing I try.

I2C I/O expansion is the way to go. It just is the easiest way to add a ton of stuff.

Yes, but I’m lazy! :smiley:

There was something different about this pin in the datasheet, let me check and get back to you.

EDIT: No actually other than something about current injection, it looks normal. If you’re still having a problem post the code and I’ll test it.