Vince Patron
by Vince Patron

Categories

Tags

Here’s the latest instructions on how to progam MicroPython onto the ESP8266 wifi chip. New changes have made the old directions not work.

Download MicroPython for ESP8266

Download the .bin file from http://micropython.org/download

Make sure you choose ESP8266 version.

Download ESP Tool

Clone the tool from https://github.com/espressif/esptool

This is the most recent, and probably more recent that what you can get from your Linux distribution using apt-get.

Erase Flash

This is a very critical step. If you don’t erase the flash first, you will probably get strange errors in MicroPython. This is because the MicroPython file system will have some garbage data in it.

./esptool.py –port /dev/ttyUSB0 –baud 115200 erase_flash

flash_mode DOUT vs QOUT

See this Hackaday article about choosing which flash_mode to use.

Unfortunately, it may not be documented very well with many of these inexpensive boards. The default is quot so try dout if programming does not work.

Program MicroPython into ESP8266

Here’s an example command line with parameters to program the ESP8266. Change the .bin file name to match the one you downloaded, and change –port for your system.

Remember to use --flash_mode dout or --flash_mode qout (default) for your particular board.

./esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size detect --flash_mode dout 0 ~/Downloads/esp8266-20180511-v1.9.4.bin 

Troubleshooting

OSError: [Errno 1] EPERM

This is a common error after programming MicroPython if you do not erase flash first so make sure you do the erase before programming.

ESP8266 Does Not Respond

UART commands are ignored; ESP8266 appears dead. Nno response to any characters sent. Cause: Failed to use –flash_mode dout parameter. A lot of new boards need this parameter so make sure to include it.