-->
Page 1 of 2

The ESP-12E's "bottom" pins - What you need to know

PostPosted: Sat Jul 18, 2015 1:38 pm
by h4rm0n1c
I wanted to put this one to bed, there's too many people asking about this to answer in each thread.

Fiddling with the pins at the "bottom" of the ESP-12E module will result in crashes and/or freezing, as all of those pins are currently used for the on-board flash chip that all ESP8266 based modules have. There is an exception for GPIO9 and 10, the hardware modification required to allow the use of these pins is linked further down this post.

This is actually implied by the greyed out pin functions table in README.md on the GitHub repo:

https://github.com/esp8266/Arduino/blob ... /README.md

Or explicitly stated in the work in progress rewrite:

https://github.com/esp8266/Arduino/blob ... /README.md

The flash itself is memory mapped during run time, this is how procedures prefixed with ICACHE_FLASH_ATTR are accessed and executed, meaning that we can't really mess with those pins without the aforementioned consequences at the moment, the ESP8266 needs to be in practically constant contact with the built in flash.

This is an advanced level topic, it actually goes slightly over my head too, people who are working with the Espressif SDK side of things may know more of the specifics, there may even be some further exceptions, but what I've written above appears to be the general consensus that I have seen in my research into this issue, at this point in time.

So, what to do to get more GPIO pins?

I'm no expert, but if you want more GPIO pins for now you are probably going to have to compromise and just use a GPIO port expander, either I2C or SPI based, if you use SPI, you can share the bus with other SPI peripherals such as SD cards, etc... toggling the appropriate chip select line on the ESP8266, much the same as people do on the AVR Arduino when using multiple SPI devices.

The HSPI bus on GPIO12 to 15 can run up to 40Mhz or so, there's a dedicated UART for it, so there's no issues with slow transmission speeds or an SPI transfer blocking program execution for long periods of time if you were to use an expander, the GPIO lines on a port expander will be blazingly fast.

All that being said, it IS possible to free up GPIO9 and 10!

http://smarpl.com/content/esp8266-esp-2 ... and-gpio10

But it's not easy or for the faint of heart: you'll need a hot air gun to remove the metal shield if your ESP module has one (the flash chip is hidden under it), a steady hand to cut some very small PCB traces and solder a jumper, and you'll need to make sure you set your IDE to use DIO for the Flash Mode, as QIO will no longer work after this hardware modification.

That's about it. I hope people find this to be comprehensive and accurate primer, or caveat, on the current status of the bottom pins on the ESP12-E.

Please feel free to post corrections and I'll edit this post.

Re: The ESP-12E's "bottom" pins - What you need to know

PostPosted: Sat Jul 25, 2015 5:22 pm
by Duane J
Thank you, this is a great synopsis of the current state of things. I'd be interested to know if there are any non-hardware hacks discovered to help make further pins available as GPIOs.

Re: The ESP-12E's "bottom" pins - What you need to know

PostPosted: Thu Apr 15, 2021 5:10 am
by Protoncek
Hi!
Thanks for this. However, interesting thing is that i have a few of those boards and i can use GPIO10 without any modification. GPIO's 6,7,8,9 and 11 are "out of reach", but GPIO10 works as input just fine.
So, where's the catch?

Re: The ESP-12E's "bottom" pins - What you need to know

PostPosted: Thu Apr 15, 2021 11:20 pm
by Pablo2048
If you take a look at the schematic, then you will see, that GPIO10 is SD_DATA3, so the catch is the flash access mode (probably DIO, definitely not QIO).