Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Espressif: GPIOs default state is HIGH #5931

Closed
microdev1 opened this issue Jan 27, 2022 · 5 comments · Fixed by #6057
Closed

Espressif: GPIOs default state is HIGH #5931

microdev1 opened this issue Jan 27, 2022 · 5 comments · Fixed by #6057
Assignees
Labels
bug espressif applies to multiple Espressif chips
Milestone

Comments

@microdev1
Copy link
Collaborator

CircuitPython version

Adafruit CircuitPython 7.2.0-alpha.1-229-gfff68c9f8 on 2022-01-27; MicroDev microS2 with ESP32-S2

Code/REPL

N/A

Behavior

I noticed that the on-board led was dimly lit and on further investigation, I found that the GPIOs were at ~3.2V.

Description

No response

Additional information

No response

@microdev1 microdev1 added bug espressif applies to multiple Espressif chips labels Jan 27, 2022
@tannewt
Copy link
Member

tannewt commented Jan 27, 2022

Yes, I did this deliberately in #5892 to keep the pins from floating (specifically neopixel pins.) Perhaps we need to special case on-board LED pins.

@tannewt tannewt added this to the 7.2.0 milestone Jan 27, 2022
@dhalbert
Copy link
Collaborator

dhalbert commented Feb 8, 2022

As noted in #5679:

If the GPIO is placed in InputEnable mode (without pull up or down, i.e., just create a DigitalinOut object for the pin), it happens to stop the flickering. But since the neopixel pin is usually freed by the supervisor between color settings, it is normally placed in input disabled / output disabled / no pulls mode.

So maybe the solution is to default all the pins to input mode, instead of defaulting to high? I think this is more like SAMD, etc., where the default state is input.

@tannewt
Copy link
Member

tannewt commented Feb 8, 2022

Setting pins to input mode is a higher power consumption than a pull. See https://www.st.com/resource/en/application_note/dm00315319-stm32-gpio-configuration-for-hardware-settings-and-low-power-consumption-stmicroelectronics.pdf chapter 6. Floating pins with input enabled will randomly flicker the input buffer on and off and consume power. It's better to pull each pin that is unused.

However, for cases like this, I think we want to have boards dictate whether pins are pulled high or low.

@dhalbert dhalbert modified the milestones: 7.2.0, 7.x.x Feb 14, 2022
@dhalbert
Copy link
Collaborator

Another side effect of the default high is that, at least on the MagTag, it cycles the speaker amp, which causes clicking and a quiet hum.

@dhalbert
Copy link
Collaborator

In some discord discussion, @tannewt suggested that we needed to be able to special-case certain pins, for reasons such as the above.

@dhalbert dhalbert modified the milestones: 7.x.x, 7.2.0 Feb 17, 2022
dhalbert pushed a commit that referenced this issue Feb 18, 2022
This allows board code to override the default pull up reset state.

It is useful for pins that are already externally connected, pulled
or otherwise used by the board.

Fixes #5931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants