ESP8266 Firmware messing arounds…

So after I checked how to restore the base firmware that my board came with, It was time to do some messing with alternative firmwares…

The first one that I’ve heard was the Lua base NodeMCU firmware, now open sourced available at https://github.com/nodemcu/nodemcu-firmware.git .  The official web site seems to be here: http://nodemcu.com/index_en.html

This one is rather interesting that allows not to control the ESP8266 by using AT commands (tedious…) but to use some of the processing power on the chip itself (it has a processor, ram and flash) using the Lua language. So for example we can use Lua to set up the wifi communication and use the serial port only for data transfer between the Arduino and the ESP8266 without using tons of AT commands.

To use this firmware, use the following procedure:

1st) Download the NodeMcu firmware. Just do a git clone https://github.com/nodemcu/nodemcu-firmware.git on a working directory.

2nd) Put the Esp8266 in firmware update mode (tie GPIO0 to GND and power cycle)

3rd) With the esptool.py upload the NodeMcu firmware located at the pre_build/latest/nodemcu_512k_latest.bin directory, by using the following command:
/pathtoesptool/esptool.py -p /dev/ttyUSB0 write_flash 0x000000 nodemcu_512k_latest.bin

After the firmware is uploaded, disconnect the GPIO0 from ground and reset the module.

Connect through the terminal and it should show this after (another reset):
NodeMcu 0.9.4 build 20141226 powered by Lua 5.1.4'
And pressing ENTER should show the > prompt.

We can now program the Esp8266 in Lua. The chip when reset calls an init.lua file if it exists in flash storage.

The .lua files can be programmed on our PC and then uploaded to the esp8266 chip, without any need to enter the firmware upgrade mode. There are several tools to do that namely the luatool available at https://github.com/4refr0nt/luatool.git . Just make sure that no other terminal is using the serial port when uploading the files. Just check the readme of the luatool for some samples on using the Lua language.

We can also see some Lua samples and discussion forum here: http://www.esp8266.com/viewforum.php?f=17 and some Lua samples for the ESP8266 here: http://bbs.espressif.com/viewtopic.php?f=15&t=45&p=175&hilit=lua#p175

There is another esp8266 firmware, MicroPython where the language is not Lua but Python, but it hasn’t yet support for the WiFi part of the esp8266 chip I think, so not very useful for the moment.

Finally there are firmwares based on the original esp8266 firmwares, using the AT command set.

These normally are named eagle_something and are uploaded into the esp8266 also with the esptool.py tool.

I’ve tried this one: http://bbs.espressif.com/viewtopic.php?f=15&t=105 that adds NTP (Network time protocol) support to the command set. Please note that after flashing this firmware, the base baud rate changes to 115200 instead of 9600.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s