Pages

Tuesday, 28 August 2018

Flashing ESP32 MicroPython firmware



I have been enjoying using MicroPython on the ESP32 based boards and recently upgraded the firmware to the latest daily build. The upgrade process is straightforward. You will require Python on your computer (I am using Windows 10 and Python 3.6) and Espressif's esptool.py firmware update utility. This utility can be installed using the Python package manager.


pip install esptool

Once installed you can get a summary of the tool commands using


esptool.py -h

Now that the prerequisites are installed on your computer, the easiest way to update your firmware is to download the latest pre-built firmware from the MicroPython website. Select your board type and review the board specific details.


I am upgrading an ESP32 board connected to my computer via COM4. The ESP32 firmware starts at address 0x1000. If you are putting MicroPython on for the first time then you should first erase the entire flash using 

esptool.py --chip esp32 --port COM4 erase_flash


If you are just upgrading previously installed MicroPython firmware you can skip erasing the flash memory and update the firmware with the following command

esptool.py --chip esp32 --port COM4 write_flash -z 0x1000 esp32-20180827-v1.9.4-479-g828f771e3.bin


To test the update, connect to your board using you preferred terminal program (in my case Putty). From the board Python REPL use the following code to return information about the board and installed firmware

>>> import os
>>> os.uname()

(sysname='esp32', nodename='esp32', release='1.9.4', version='v1.9.4-479-g828f771e3 on 2018-08-27', machine='ESP32 module with ESP32')


The MicroPython team are doing a great job at developing the language, libraries, and ports for different microcontroller boards. I would like to thank them for their awesome work.

No comments:

Post a Comment