Updating or downgrading the Gateway firmware

Warning

If you load the incorrect firmware you will brick your Gateway and you cannot access it anymore via the web interface. You have to use one of the other methods below to bring it back to life.

Do not perform a software update when you do not have physical access to the device. In case the update goes wrong, you need to use the USB connection on the Gateway. So if the Gateway is in a remote location, postpone the update until you are near the device.

Note

EMS-ESP32 is under continuous development. There are often breaking changes in the code. This means that after an update some things work differently, or it does not behave in the way you expected anymore or some functions are deprecated. Please carefully read the changes on the repository before applying an update.

Logo EMS-ESP firmware

The Gateway as delivered to you is loaded with a recent version of the open-source EMS-ESP or EMS-ESP32 firmware from Proddy’s Github repository.

It is very easy to do firmware updates yourself via the web interface. Aside from stable releases you can also load beta versions (pre-releases) and you can also downgrade the firmware if needed.

Updating firmware via the web interface

To update the firmware first download the correct bin file from the firmware releases page of the correct software repository.

Note

Perhaps a bit confusing but there are two software repositories for EMS-ESP. There is ‘EMS-ESP’ for the V2 firmware for ESP8266 based Gateways and there is ‘EMS-ESP32’ for the V3 firmware for all newer EPS32 based Gateways like the S32 and E32.

For the Gateway Premium, Premium II, Standard or Regular download the ESP8266 bin file from the EMS-ESP repository. See the firmware releases EMS-ESP 2 page.

You can select the latest stable release or one of the newer pre-releases (beta firmware). If unsure, just select the newest stable V2.0 release.

For the Gateway S32 and E32 download the ESP32 bin file from the EMS-ESP32 repository. See the firmware releases EMS-ESP32 3 page.

Now click on the ‘assets’ button. A number of files will appear. If your Gateway is based on the ESP8266, you need to select an ESP8266 bin file. For ESP32 Gateways select an ESP32 bin file.

Firmware selection

Warning

If you upload the ESP32 bin file on a ESP8266 Gateway or vice verse you will brick the Gateway and you need to use Platform I/O or the ESP tool to install the correct firmware again.

If you click on the (correct!) bin file, it will be downloaded to your pc. Now take note where this file is stored.

Next go to the Gateway web interface and select the firmware update page.

Web interface firmware update menu

Click in the upload window and select the bin file you just downloaded and wait until the update is completed. Do NOT close the web page. After a minute or two refresh the page and now the new version should be displayed in the top left of the interface.

If you perform an update via the web interface, all settings are stored. However, sometimes settings may go corrupt and you have to configure EMS-ESP like new. EMS-ESP will default to the S32 board profile. If you have an E32 this will mean you’ll lose the Ethernet connection. You have to login via WiFi and manually changen the board profile to E32 again and reboot.

If your Gateway works fine and there are no significant new features, its not recommended to update the firmware just for the sake of updating. Some firmware versions are not stable, features might be missing, and it can give stability or other issues.

Using beta firmware

Its also possible to install beta versions via the web interface. However, in rare cases a wrong beta version may brick the Gateway and thus you cannot reach the web interface anymore. In that case you have to use Platform IO, NodeMCU/ESPFlasher flash tool or the Espressif ESPtool to write a stable firmware version to the Gateway. If you don’t know how to do this, its better to not install beta versions.

Downgrading firmware

If for some reason you want to go back to a previous firmware version, use the method as described above to select a stable version on the firmware releases page and to upload it to the Gateway.

Building and loading firmware via Platform IO

See the instructions on the Proddy’s Github repository 1.

Loading firmware via the ESPtool

See the instructions on the Proddy’s EMS-ESP Wiki 4.

Loading firmware via OTA (Over The Air)

You can update the firmware via a feature called OTA. This means ‘Over The Air’. You need to use espota.py (just Google it).

The basic command is:

espota.py --debug --progress --port 8266 --auth ems-esp-neo -i <IP address> -f <firmware.bin>

Uploading the firmware via NodeMCU flashtool

Gateway Premium II, Standard, Regular

First remove the Wemos from the Gateway and connect it via USB to a pc.

Then download the NodeMCU flash tool 6. If you do not have Windows 64 bit download a NodeMCU flash tool for other OS 7

Now download the correct bin file as described above.

Next open the NodeMCU flash tool.

Firmware flash tool

Set the correct COM port for the Wemos. If you do not know it find it with Device Manager. Sometimes there is no driver installed, or it is behaving incorrectly (Win10). For the USB driver for all ESP8266 Gateways look online for the CH340 driver. The Gateway S32 has a Silabs CP2102 USB chip which is usually loaded correctly on Windows systems.

Note

The CH340 driver is not always properly loaded in Windows 10. If no COM port shows up when you plugin the Gateway, the driver has failed to load. Reinstall the CH340 driver. Look at Sparkfun guide on installing the CH340 driver 5 for instruction on how to do so. Before installation remove the Gateway from the pc. After installation, reboot the pc.

Now go to the ‘Config’ tab.

Select in the first row the bin file you downloaded. Do not change anything else.

Firmware flash tool file selection

Leave everything else at the default settings.

Now press ‘Flash’. The program will now upload the firmware to the Wemos. If its ready, it will say ‘Ready’ at the bottom right.

If the Wemos does not start blinking, press the reset button. It should first start blinking fast and after a few seconds it should start blinking slowly. Connect to the ems-esp network and go to 192.168.4.1 to access the web interface. If this works the Wemos is flashed with V2 succesfully and you can now place it back in the Gateway.

Uploading the firmware via ESP Flasher flashtool

Gateway S32

For loading the firmware onto the S32 you cannot use the NodeMCU tool but you need to use f.i. ESP Flasher tool 8.

ESP Flasher tool UI

Set the correct COM port for the Wemos. If you do not know it find it with Device Manager. Sometimes there is no driver installed, or it is behaving incorrectly (Win10). The Gateway S32 has a Silabs CP2102 USB chip which is usually loaded correctly on Windows systems.

Gateway E32

For loading the firmware onto the E32 you cannot use the NodeMCU tool but you need to use f.i. ESP Flasher tool 8. See the image above.

Attention

This method of flashing will also erase the whole flash and all settings. When the firmware update is ready, the board profile will be S32 by default and not E32. This means Ethernet is not working until you set it to E32 again. You have to change this to E32 in the web interface.

The 2022 model of the E32 has an internal micro USB port. Use this one to connect a cable to your pc.

E32 internal USB

The 2021 E32 model without a screw connector have no USB port. To program these E32 models, you need to insert the CH340 USB stick into the header on the Gateway board. See below.

Make sure you insert the USB stick like below. There is only one way it will fit nicely.

E32 CH340 stick orientation

Note

The CH340 driver is not always properly loaded in Windows 10. If no COM port shows up when you plugin the Gateway, the driver has failed to load. Reinstall the CH340 driver. Look at Sparkfun guide on installing the CH340 driver 5 for instruction on how to do so. Before installation remove the Gateway from the pc. After installation, reboot the pc.

E32 model 2021 has a small yellow jumper on the board. Set it over the two header pins. This jumper sets the chip into bootloader mode so you can load the firmware. After you have finished uploading the firmware, remove the jumper otherwise the Gateway will not reboot.

E32 jumper setting

E32 Gateways with the internal USB port have an additional circuit to automatically set the E32 into bootloader mode. They do not have this jumper on board.

Note

This CH340 stick or internal USB port can only be used for programming. After the firmware has been flashed, the Gateway will not start properly. Remove the CH340 stick or USB cable and connect it again to the service jack or the 12V power supply. Also do not forget to remove the yellow jumper otherwise the Gateway can’t boot.

Troubleshooting

If the LED does not blink at all, press the reset button on the Wemos. It should start blinking slowly. If it does not, the update failed.

If the update via the web interface has failed, try the NodeMCU flash tool, ESPTool or Platform I/O method. If that did not work or it is too difficult, contact me via the contact form on the webshop.

If Ethernet does not work anymore, you have to set the board profile to E32 and reboot.

1

https://github.com/emsesp/EMS-ESP

2

https://github.com/emsesp/EMS-ESP/releases

3

https://github.com/emsesp/EMS-ESP32/releases

4

https://emsesp.github.io/docs/#/Uploading-firmware

5(1,2)

https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all

6

https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe

7

https://github.com/nodemcu/nodemcu-flasher

8(1,2)

https://github.com/Jason2866/ESP_Flasher/releases