Hi,
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?
GPIO0 and GPIO2 flashing / gpio_init() mystery
Re: GPIO0 and GPIO2 flashing / gpio_init() mystery
Postby pratik » Tue Oct 17, 2017 11:20 pm
The gpio_init() is not required anyway, you can skip it.
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.
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.

Re: GPIO0 and GPIO2 flashing / gpio_init() mystery
Postby blubb » Wed Oct 18, 2017 12:43 am
Thanks for your answer.
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?
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 120 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
-
- All times are UTC+08:00
- Top
- Delete all board cookies
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.