It’s a good idea to erase the existing flash memory first. To do this use esptool.py. First determine the COM port the ESP8266 module is on. Use Device Manager in Windows to find the COM port to use then, at a command prompt, type…
esptool.py --port [COMport] erase_flash
(where [COMport] is the COM port concerned, e.g. COM6, COM12, etc)
Flash the new firmware
First download the firmware you need.
- For Micropython go to http://micropython.org/download#esp8266
- For Circuitpython go to https://github.com/adafruit/circuitpython/releases
Please note that Circuitpython is no longer supported on the ESP8266. See the notes on the Adafruit page.
Use esptools.py at the command prompt type…
esptool.py --port [COMport] --baud 460800 write_flash --flash_size=detect 0 [firmwareFileName]
(where [COMport] is the COM port concerned, e.g. COM6, COM12 etc, and [firmwareFileName] is the location and name of the firmware file you just downloaded, e.g. C:\temp\esp8266-20180511-v1.9.4.bin)
If you are flashing an Adafruit Feather Huzzah then the flash process will go ahead automatically but most other ESP8266 modules require you to hold down the Reset (RST) button then press the FLASH button as well then release the Reset button and finally release the FLASH button. This puts the module into flash mode and the process should then proceed as normal.
If the ESP8266 will still not accept the flash try connecting GPIO0 (D3) to Ground (GND) and trying again.