8000 Missing pin 20 on ESP32 definition · Issue #8393 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Missing pin 20 on ESP32 definition #8393

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

Closed
ladyada opened this issue Mar 8, 2022 · 6 comments
Closed

Missing pin 20 on ESP32 definition #8393

ladyada opened this issue Mar 8, 2022 · 6 comments

Comments

@ladyada
Copy link
Contributor
ladyada commented Mar 8, 2022

hiya for the esp32 pico v3 chip variant of the esp32, pin 20 is exposed:

image

but in the esp32 board definition this pin isnt available because WROVER and WROOM modules don't have this pin available
https://github.com/micropython/micropython/blob/master/ports/esp32/machine_pin.c#L96
shall i submit a PR to change this so the pin is valid?

@dpgeorge
Copy link
Member
dpgeorge commented Mar 9, 2022

because WROVER and WROOM modules don't have this pin available

Is the reason they don't have it available because it's (1) just not wired through to the outside world; or (2) because it's used internally for something?

We had issues in the past where pins were enabled which were used for internal things like SPIRAM and so using them crashed the firmware.

shall i submit a PR to change this so the pin is valid?

If using this pin on a WROVER/WROOM will not crash the firmware, then yes please!

@ladyada
Copy link
Contributor Author
ladyada commented Mar 9, 2022

looks like it isnt exposed on the QFN of original ESP32's...but what it was used for is unclear
https://esp32.com/viewtopic.php?t=6151
we could go with adding a new chip #define for the ESP32_PICO_V3_02 which has fixed flash, ram, different available pins...

@dpgeorge
Copy link
Member
dpgeorge commented Mar 9, 2022

we could go with adding a new chip #define for the ESP32_PICO_V3_02

Would be good if there was already such a define in the IDF, but it doesn't look like there is. Eg in components/soc/esp32/gpio_periph.c:

    IO_MUX_GPIO19_REG,
    IO_MUX_GPIO20_REG, // This corresponding pin is only available on ESP32-PICO-V3 chip package
    IO_MUX_GPIO21_REG,

So I think just make it available on all ESP32 parts. It should be safe to use it on a package that doesn't expose it, it just won't do anything.

@ladyada
Copy link
Contributor Author
ladyada commented Mar 13, 2022

yep! @kattni has kindly made a minimal PR :)
#8406

@dpgeorge
Copy link
Member

Fixed by 61c02e6

@jerryneedell
Copy link
jerryneedell commented Mar 23, 2022

I tried the 20220323 nightly build for MP on the feather esp32 v2 and I no longer get the invalid Pin error with scl = Pin(20)) but I am not able to access my I2C device
the I2C configuration is

from machine import Pin, I2C

i2c = I2C(0, scl=Pin(20), sda=Pin(22))
network config: ('10.0.0.161', '255.255.255.0', '10.0.0.1', '75.75.75.75')
MicroPython v1.18 on 2022-03-23; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> 
>>> 
>>> import pos
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pos.py", line 31, in <module>
  File "lsm6dsox.py", line 95, in __init__
  File "lsm6dsox.py", line 152, in __read_reg
OSError: [Errno 116] ETIMEDOUT

It works fine if I move back to scl on Pin(14)

I tried a simple test -- connecting Pin 22 (SDA) to Pin 13 (which has a LED on it) then

from machine import Pin
p = Pin(22,Pin.OUT)   --- the RED LED comes on
p.value(False)        --- the RED LED goes off

then move to Pin 20 (SCL)
p = Pin(20,Pin.OUT)     --- no response on RED LED
p.value(False)          --- no response on RED LED
p.value(True)           --- no response on RED LED

also tried Pin 14  -- works as expected -- LED responds

also reading back pin 20 after setting it to True or False. It always returns 0. Other pins return the expected value

>>> p = Pin(20,Pin.OUT)
>>> p.value()
0
>>> p.value(True)
>>> p.value()
0
>>> p = Pin(22,Pin.OUT)
>>> p.value()
0
>>> p.value(True)
>>> p.value()
1

tannewt pushed a commit to tannewt/circuitpython that referenced this issue Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0