Updating or downgrading the Gateway firmware¶
Uploading the 3.5 beta version via the web interface on existing gateways may give errors. If you get an error 500 during uploading, you have to flash the Gateway via USB. See below.
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.
EMS-ESP 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.
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.
For the Gateway S32 and E32 download the ESP32 bin file from the EMS-ESP32 repository. See the firmware releases EMS-ESP32 2 page.
Now click on the ‘assets’ button. A number of files will appear. Select the bin file. If you have a Premium II or older Gateway, DO NOT upload this firmware, it will brick your device.
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.
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. (In the latest firmware this is not needed anymore)
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.
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.
Uploading the firmware via EMS-ESP Flasher flashtool¶
For loading the firmware onto the E32 you can use EMS-ESP Flasher tool 5. See the image above. Do not use another tool as this version creates the correct partition sizes for EMS-ESP.
Download the zip file EMS-ESP-Flasher.zip, unzip all the files to a folder on your pc.
This method of flashing will also erase the whole flash and all settings. You can download the config from the web interface before the update, and upload it after the update.
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. For the E32 in default state you need to login to the ems-esp WiFi network. (In the latest firmware the E32 is automatically detected).
First remove the Gateway from the bus and connect a USB cable to the PC and the Gateways’ internal USB connector.
First remove the Gateway from the bus and connect a USB cable to the PC and the Gateways’ internal USB connector. Open the EMS-ESP-Flasher.exe tool. Set the correct COM port for the Gateway. If you do not know it find it with Device Manager. Sometimes there is no driver installed, or it is behaving incorrectly (Win10).
The 2022 model of the E32 has an internal micro USB port. Use this one to connect a cable to your pc. For the E32 it is recommended to connect the 12V DC power supply as the USB connection of the E32 can only supply very limited power.
Open the EMS-ESP-Flasher.exe tool and set the correct COM port for the Gateway.
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.
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 4 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. Open the EMS-ESP-Flasher.exe tool and set the correct COM port for the Gateway. After you have finished uploading the firmware, remove the jumper otherwise the Gateway will not reboot.
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.
This CH340 stick or internal USB port of the E32 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.
After you selected the correct bin file and the COM port, you can press Start. Now first the chip is identified. Then it is erased. If you have an S32 the erasing make take quite long. Next the firmware is flashed.
If its ready, you’ll see something like below. You can ignore the LittleFS error and most other errors. This does not hurt operation of the Gateway.
If the flashing was succesful, the LED will blink three times intermittently. If you have a S32 you are done and you can set up the device as new. If you have an E32 you need to login to the WiFi network ems-esp and go to settings and set the board profile to E32. (In the latest firmware the E32 is detected automatically) Then save and reboot the Gateway. Now Ethernet will be active again and the EMS bus can be found.
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 3.
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>
If the LED does not blink at all, press the reset button on the Gateway. It should start blinking three times in a row. If it does not, the update failed.
If the update via the web interface has failed, try the EMS_ESP 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.