How to Flash LOLin NodeMCU v3

Republishing old content. This is from when I bought and flashed my first NodeMCU clone (perhaps "loose implementation"?) of NodeMCU v3 called LOLin v3.

This little board is using CH340 TTL to USB converter, so if you happen to work on Windows you must make sure you have the driver installed beforehand. Mentioned chip is quite common, and I've seen it on various Arduino, so there is a high chance that you already have it.

Without further notes, here is the specification:

Baud rateFlash modeFlash sizeFlash frequency
9600 QIO 4MiB 40MHz

You will need a combined firmware binary. If you are compiling it by yourself, I suggest using one of the development branches. If you don't have environment set up there are online building services available e.g. NodeMCU custom builds.

To write the firmware use e.g. esptool:

$ esptool.py --port /dev/ttyUSB0 --baud 9600 erase_flash
$ esptool.py --port /dev/ttyUSB0 --baud 9600 write_flash \
  --flash_mode qio --flash_size 4MB --flash_freq 40m \
  0x00000 combined-firmware-file.bin

To test it you can connect to it with e.g. screen:

$ screen /dev/ttyUSB0 115200

Or use your favourite terminal emulator:

$ st -l /dev/ttyUSB0 115200
nodemcu drawing

In case the device does not appear. Check whether appropriate module (usually ch341) is loaded with:

$ lsmod | grep -i ch34.
ch341                  28672  0

To check if it was compiled:

$ zgrep -i CH34. /proc/config.gz
CONFIG_USB_SERIAL_CH341=m

If you want a non-root user to be able to flash and use it, assign system appropriate group. Usually it's serial but it is not a requirement. You can check what group user needs by simply looking at the file permissions:

$ ls -l /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 0 Jan  6 17:16 /dev/ttyUSB0
$ sudo usermod -aG uucp user

If flashing fails with Write timeout, you can try tweaking baud rate.