Flashing Espruino Onto the ESP8266 Dev Board

Getting Started on OSX

Ths guide tells you how to get connected to your ESP8266 on a mac:

https://github.com/nodemcu/nodemcu-devkit/wiki/Getting-Started-on-OSX

All that we need from that guide is this link to the SiLabs serial driver: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Flashing the ESP8266 Dev Kit

The ESP8266 needs to be in flash mode before you can put Espruino on it. According to https://nodemcu.readthedocs.io/en/master/en/flash/#putting-device-into-flash-mode putting the 8266 into flash mode will either just happen over USB, or I need to push the reset button while powering on the 8266.

Downloaded Espruino (version 1v92 at time of writing) http://www.espruino.com/Download

Downloaded esptool.py by installing pip https://pypi.python.org/pypi/pip

Run pip install esptool

This installed esptool to /Library/Python/2.7/site-packages/esptool.py

Flashing Espruino: https://www.espruino.com/ESP8266_Flashing

I have an ESP 12 which has 4mb of flash. I extracted the espruino_1v92.zip file and cd’d to ~/Downloads/espruino_1v92/espruino_1v92_esp8266_4mb/.

I then ran the following command, which I put together from the post I linked to at the start and the nodemcu docs:

1
2
3
4
python /Library/Python/2.7/site-packages/esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 \
write_flash --flash_freq 80m --flash_mode qio --flash_size 32m \
0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin

The outcome:

1
2
3
4
5
6
7
8
9
esptool.py v1.3
Connecting........
Running Cesanta flasher stub...
Flash params set to 0x004f
Wrote 4096 bytes at 0x0 in 0.4 seconds (90.1 kbit/s)...
Wrote 479232 bytes at 0x1000 in 41.7 seconds (91.9 kbit/s)...
Wrote 4096 bytes at 0x3fc000 in 0.4 seconds (90.0 kbit/s)...
Wrote 4096 bytes at 0x3fe000 in 0.4 seconds (90.1 kbit/s)...
Leaving...

You can then install the Espruino Web IDE from https://www.espruino.com/Web+IDE.

To connect the Web IDE to your ESP8266, go to settings (top right), communications and change baud to 115200.
You can then select dev tty slab_usbtouart when clicking the connect button in the top left.

A note about the pin labels

The Espruino Web IDE lets you reference pins by simply specifying D4 like so:

1
analogWrite(D4, 1);

However, D4 references the GPIO number which differs from the actual board labels as shown in the image in this article: http://crufti.com/getting-started-with-espruino-on-esp8266/. The correct way to reference a pin by the physical label on it is as follows:

1
analogWrite(NodeMCU.D4, 1);

This maps the pins correctly to the labels on the board.