Closed robtinkers closed 11 months ago
The firmware was compiled with SPIRAM enabled, which requires this flag CONFIG_ESP32_SPIRAM_SUPPORT=y in the sdkconfig.board
The "machine_pin.c" file defines which pins are available, and we have this
...
{{&machine_pin_type}, GPIO_NUM_14},
{{&machine_pin_type}, GPIO_NUM_15},
#if CONFIG_ESP32_SPIRAM_SUPPORT
{{NULL}, -1},
{{NULL}, -1},
#else
{{&machine_pin_type}, GPIO_NUM_16},
{{&machine_pin_type}, GPIO_NUM_17},
#endif
{{&machine_pin_type}, GPIO_NUM_18},
{{&machine_pin_type}, GPIO_NUM_19},
...
which means that GPIO16 and GPIO17 are not defined because they are used by SPIRAM.
I have no idea how the other firmware was satup, especially if the PSRAM was enabled.
All other pins except GPIO16 seem to be OK.
>>> from machine import Pin
>>> b = Pin(16, Pin.IN)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid pin
>>> b = Pin(0, Pin.IN)
>>> b.value()
1
>>> del b
>>> b = Pin(4, Pin.IN)
>>> b.value()
0
>>> del b
>>> b = Pin(2, Pin.IN)
>>> b.value()
0
>>> del b
>>> b = Pin(14, Pin.IN)
>>> b.value()
1
>>> del b
>>> b = Pin(15, Pin.IN)
>>> b.value()
1
>>> del b
>>> b = Pin(13, Pin.IN)
>>> b.value()
1
>>> del b
>>> b = Pin(12, Pin.IN)
>>> b.value()
0
Try using any of them in your project.
The other firmware was generic "for ESP32-based boards without external SPIRAM" so it makes sense that it worked there.
Pins are obviously a bit in short supply on this board if you want to use the sd card and have a display, so I'll rejigger things and see what I can come up with.
Thanks for your time and the firmware!
I'm using an AI Thinker ESP32-CAM from Aliexpress (are there clones of this board? if so, possibly a clone).
I read a comment from Sara Santos on randomnerdtutorials that "I’ve used GPIO 16 with a pushbutton in a project that takes photos when the button is pressed. The button worked when I connected it with a 10kOhm pull up resistor." so I added a similar button to mine.
This works as expected with the latest micropython.org firmware:
but with your builds, I just get "invalid pin":
I also tested with the 20221121 firmware and got the same result.