howto: Flash MicroPython with nodemcu flasher and connect with putty on Windows

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
flywire
Posts: 22
Joined: Wed Jan 02, 2019 7:08 am

Install MicroPython on ESP8266 with Windows

Post by flywire » Wed Jan 02, 2019 8:13 am

I'd like to get http://docs.micropython.org/en/latest/e ... he-esp8266 updated with install instructions for Windows but I can't see how to raise the issue.

This is totally inadequate:
"You might need to change the “port” setting to something else relevant for your PC. You may also need to reduce the baudrate if you get errors when flashing (eg down to 115200). The filename of the firmware should also match the file that you have."

More useful Windows example would be:
"C:\Users\User>esptool.py --port COM3 --baud 115200 write_flash --flash_size=detect 0 C:\Users\User\Downloads\esp8266-20180511-v1.9.4.bin"

Do you really need to erase, write and verify in three steps?

Similarly:
"For best results it is recommended to first erase the entire flash of your device before putting on new MicroPython firmware.

Currently we only support esptool.py to copy across the firmware. You can find this tool here: https://github.com/espressif/esptool/, or install it using pip:"

Better to explain:
platforma wrote:
Fri Mar 11, 2016 11:40 am
If you haven't done "erase_flash" with the esptool.py, or what have you. The chip will remember your last AP settings, depending on how you set them up. It is a "feature" of the ESP8266, so you don't have to reconfigure the AP every time you power up, and save some time. So it's no surprise that it still instantiates the AP if you haven't flashed clean :)

To clarify, Micropython or NodeMCU are not operating systems, rather user applications running in a vendor operating system (the one that comes with the ESP).
Install with nodemcu-flasher tool for windows (the default standard) needs to be included for ESP8266: https://learn.adafruit.com/building-and ... -only-3-18 and full "erase_flash" process explained.

flywire
Posts: 22
Joined: Wed Jan 02, 2019 7:08 am

How to Flash MicroPython with esptool.py and connect with putty on Windows

Post by flywire » Fri Jan 04, 2019 12:20 am

tonyp wrote:
Thu Jan 19, 2017 12:19 pm
... So, here's my take that works 100% for loading either Micropython or Lua. Here's the part for Micropython:

Code: Select all

c:\Python27\python.exe \Python27\Lib\site-packages\esptool.py --port COM8 --baud 460800 erase_flash
c:\Python27\python.exe \Python27\Lib\site-packages\esptool.py --port COM8 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin
esptool.py Install Typically Takes Three Runs
For erasing the entire flash as part of the write_flash command (instead of just erasing sectors which are going to be written, which is what happens now), there is an open pull request in #344 ...

verify_flash command is not really needed in recent versions of esptool.py when using the stub (default behaviour) - the stub automatically reads back the flash after writing and compares the MD5 of the result. This is good enough for almost all practical purposes (except for the capability that verify_flash has to print the byte offsets that are different, this can be useful sometimes.)

flywire
Posts: 22
Joined: Wed Jan 02, 2019 7:08 am

esptool.py erase all flash before writing (single command)

Post by flywire » Wed Jan 09, 2019 7:46 am

https://github.com/espressif/esptool/releases/tag/v2.6
Version 2.6 Features
New write_flash --erase-all ... option to erase all flash before writing (single command).
Done. The hard part will be getting MicroPython documentation updated for esptool.py.

Post Reply