When I received my two NodeMCU boards, I rapidly tried to update the firmware … and broke the firmware of one of the board. So here is the correct way to flash a firmware on a NodeMCU board which allowed me to save it.
Most of the information here come from NodeMCU’s wiki page dedicated to Mac OS X. But you can safely transpose most of the commands to Ubuntu.
- Download a firmware.
I used the latest one, from NodeMCU, with float support: https://github.com/nodemcu/nodemcu-firmware/releases
- Copy esptools.py to your disk. Direct link on NodeMCU’s github.
- Launch the command to flash the board (I do not remember if I needed to reset the board pressing the flash button).
python ./esptool.py --port=/dev/ttyUSB0 write_flash -fm=dio -fs=32m 0x00000 ./nodemcu_float_0.9.6-dev_20150704.bin
- Unplug and plug the board.
- Connect to the board.
screen /dev/ttyUSB0 9600
- Try to light up the LED (it seems that GPIO can be different depending on board).
gpio.mode(4, gpio.OUTPUT) gpio.write(4, gpio.LOW)