for a project I am using the very simple ESP-01 modules. I use the UART for communication with another uC. This is all fine.
Now I still have two free pins: GPIO0 and GPIO2. I want to use them to display the current WiFi status. I know these pins have to be high during boot, so I wired two LEDs so that they are driven in active low:
3V3 ---> resistor ---> LED0 ---> GPIO0
3V3 ---> resistor ---> LED2 ---> GPIO2
Well, the ESP still boots fine and I can indeed use gpio_output_set() to signal the stuff I want.
However, I noticed that on every boot both LEDs flash for a short period when they should not. I can even remove all the pin related code and the flashing still happens. Why is that? I thought those pins are inputs with pullups enabled as long as the bootloader is active and they basically stay like this until I change that.
Also, my second question concerns the function gpio_init(). There are many examples which call gpio_init() in user_init(void). But there is no further explanation. It is not mentioned in the SDK manual either. What exactly is this functions purpose?
And you are getting the flashes because GPIO0 outputs 40 MHz clock signal when the ESP8266 is booting. So you may have a dimly lit LED on boot.
The initial state of GPIO after booting can be set by the bootloader or "boot.bin". You can request a custom boot.bin from Espressif technical support.
Nice to know that gpio_init() is not required. I guess this is one of the things that get copied from example to example to example without questioning its use. That always makes me suspicious.
The 40 MHz signal, does it happen before the bootloader? Then a custom boot.bin would not help. What about GPIO2? Why is it flashing? And what are the initial states of the pins with the default boot.bin? Not input?
Who is online
Users browsing this forum: No registered users and 7 guests
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
We also have a RTOS version and a MESH version too!
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!