Hi,
Some GPIO pins will not work after being set to outputs in Arduino IDE. Using Arduino IDE I made a simple
program that would pulse all of the IOs that are supposed to be outputs, but on two LoLin32 modules and a
SparkFun Thing these pins would not work on all three boards: 12, 15, 17, 18 and 19.
In my code I set each pin as a BYTE LED1 = 0;, BYTE LED2 = 0; for all output pins
pinMode(LED1, 1); // I made one of these for each output so that they all switched on and off at the same time
delay(10);
pinMode(LED1, 0);
delay(10);
Then I measured each pin with my scope. Most of the pins worked correctly, just the ones listed above
failed to provide a pulse.
So, my question is how do I configure these pins to function as outputs using Arduino IDE.
Thanks for any help that you can provide, Dan
PS I did use the proper board for the two types of modules.
@danc I just want to clarify, the numbers you have provided for the pins are GPIO numbers and not physical pin numbers, correct?
If so then you do have a mystery. ESP32 GPIO pins 34, 35, 36, and 39 are input-only, but among the pins you have listed the only GPIO pin that is restricted is GPIO 12 - and that pin is restricted for inputs, not outputs (if an input pulls it high the ESP32 will not boot).
Sparkfun confirms the above in their guide to the ESP32 Thing, but those GPIO pins don't map to the pins you described.
Sorry, hopefully, someone else can shed some light.
😎
Bill
"Never trust a computer you can’t throw out a window." — Steve Wozniak
Thanks for your reply Bill.
I find it really strange that the same pins on three modules don't work as outputs, I haven't tried testing
them as inputs yet. Have you had any issues with the pins that I listed (except for 12).
I really enjoy your videos and your website. I hope you will be able to do more with ESP32.
Thanks again, Dan
@danc I've done a little looking into this and believe I have found the answer.
The pins you quoted are by default set in JTAG debugging mode. In order to use them as regular GPIO pins for output, you need to change this. You can do this by including the GPIO library
A thread on the Espressif ESP32 forum discusses this in more detail.
😎
Bill
"Never trust a computer you can’t throw out a window." — Steve Wozniak
Hi Bill,
Thank you for your help with this problem of mine, and others.
I checked Github but I could not find a driver/gpio.h zip file for the library, if you or some could
direct me to the file I would really appreciate it.
Thanks very much, Dan