It introduces a quick way to use Mupgrade
to upgrade ESP-WIFI-MESH devices.
Connect PC to the router that is connected to ESP-WIFI-MESH network.
A built-in python HTTP server can be used as the server for the example upgrade. Open a new terminal to run the HTTP server, and then run the below command to generate the firmware to be upgraded and start the server.
Make:
cd $MDF_PATH/esp-idf/examples/get-started/hello_world/
export IDF_PATH=$MDF_PATH/esp-idf/
make
cd build
python -m SimpleHTTPServer 8070
CMake:
cd $MDF_PATH/esp-idf/examples/get-started/hello_world/
export IDF_PATH=$MDF_PATH/esp-idf/
idf.py build
cd build
python -m SimpleHTTPServer 8070
While running the server, you may go to http:// localhost:8070/
to browse the build directory.
Note: 1. The above command may vary from systems. For some systems, the last command line may be
python2 -m SimpleHTTPServer 8070
. 2. As you may have noticed, thehello-world
example doesn't appear anything special when it is used for OTA upgrade. This is because any application files built by ESP-MDF can be used as the application image for OTA. 3. If there are firewall softwares that prevent any access to the port 8070, please grant the access while the example is running.
Navigate to the OTA example directory, and type make menuconfig
(Make) or idf.py menuconfig
(CMake) to configure the OTA example. Under the submenu "Example Configuration", please fill in the following information:
- ESP-WIFI-MESH network configuration information
- Firmware upgrade URL, which would look like this:
https://<host-ip-address>:<host-port>/<firmware-image-filename>
for e.g,
https://192.168.0.3:8070/hello-world.bin
Save the changes and type make
(Make) or idf.py build
(CMake) to build the example.
When downloading the flash, please firstly use erase_flash
to erase the entire flash memory (all the remaining data in ota_data partition will be deleted as well), and then write the followings via a serial port:
Make:
make erase_flash flash
CMake:
idf.py erase_flash flash
When the example starts up, it will print "Starting OTA example..." then:
- Connect to the AP with configured SSID and password.
- Connect to the HTTP server and download the new image.
- Write the image to flash, and configure the next boot from this image.
- Reboot
- Check your PC can ping the ESP32 at its IP, and that the IP, AP and other configuration settings are correct in menuconfig.
- Check if any firewall software is preventing incoming connections on the PC.
- Check whether you can get firmware (default hello-world.bin), by checking the output of following command:
curl -v https:// <host-ip-address>:<host-port> / <firmware-image-filename>
- If you have another PC or a phone, try viewing the file listing from the separate host.
If you see this error then check that the configured (and actual) flash size is large enough for the partitions in the partition table. The default "two OTA slots" partition table only works with 4 MB flash size. To use OTA with smaller flash sizes, create a custom partition table CSV (look in components/partition_table) and configure it in menuconfig.
In order to allow more nodes to join the mesh network for firmware upgrade, example will start the firmware upgrade after 10 seconds.