Flashing firmware - Wwarrior1/NodeMCU GitHub Wiki
1. Install CP210x drivers
In order to flash anything to NodeMCU you need to connect it to your PC via USB interface. In order to communicate with the NodeMCU you have to install CP210x USB to UART
2. Install NodeMCU dedicated firmware
Stock NodeMCU has installed AT-command based firmware. To use LUA language (NodeMCU ecosystem) you have to flash their firmware.
For NodeMCU v0.9
You can use "NodeMCU Flasher" from official github project. A polish instruction how to flash the new firmware for NodeMCU v0.9 can be found Here.
For NodeMCU v1.0
Don't use the "NodeMCU Flasher". Instead, you can select one of these:
-
build the new firmware yourself
There are several ways to build firmware which are described here
The best way, which I recommend, to build the firmware is to use Cloud Build Service. It is an online service that provides the firmware build by executing an online build and sending the result file via e-mail.
As firmware to our NodeMCU is updated from time to time on NodeMCU official github project, there is a great solution to prepare the latest firmware. However, as you have to choose which modules to flash, you must learn a bit about each module.
-
flash it by a dedicated tool.
Now if we have prepared the firmware, we want to flash it into the NodeMCU. Tool which is used to do that is called esptool.py. Follow this instruction to install it (there are 2 ways - auto / manual).
If you are using plain ESP8266, follow this instruction (Additional information about GPIO modes).
Before flashing the firmware it is better to ensure that SDK Init Data is up-to-date. In some cases it may be outdated (relating to the newest firmware) so erase flash at first to avoid any problems (e.g. bootloop). Erasing flash is the best solution to clean everything even if bootloop occurs.
-
Erase flash
python esptool.py --port <serial-port> erase_flash
-
Write new firmware
In some cases it may be necessary before flashing to push buttons in correct order: hold FLASH and push once RESET button
-
Firstly, download Espressif SDK patch and extract
esp_init_data_default.bin
. Then type correct address for the init data:0x3fc000
for 4 MB (ESP-12E - NodeMCU v1.0) -
In NodeMCU it is also neccessary to determine Flash Mode:
-fm dio
-
You can also determine baudrate. Recommended by manufacturer is 9600 but there are no obstacle to use higher values. Type e.g.
-b 115200
.
python esptool.py --port <serial-port> -b 115200 write_flash -fm dio 0x00000 <downloaded-firmware>.bin 0x3fc000 esp_init_data_default.bin
After uploading Unplug and Plug again the NodeMCU.
Use ESPlorer (or similar IDE) to have a preview on Serial port. Open connection and fastly after that, push the RESET button... You may be unable to connect for a while or you can see on Serial port
Formatting file system. Please wait...
. It is caused by formatting FLASH after plugging again. Therefore, for some time NodeMCU is freezed by this. Everything is ok.Flashing firmware is DONE. Now you can start programming!
-
Read more:
-