Configuration Parameter |
Selectable Option/Value |
Description |
Mode |
SD card--SPIFFS |
Allow user to select Local Firmware upgrade mode. |
Enter File Path |
specify |
Allow user to enter the file path for the .bin file to be used for firmware upgrade. Make sure the correct folder root and correct path is entered here. |
Use input port to provide file path |
Check-Uncheck |
Allow user to give file path as an input to the block |
Select Upgrade Type |
Upgrade only--Upgrade or Downgrade |
When Upgrade only is selected the firmware will only be updated when the given .bin file project version is larger than the current project version. When Upgrade or Downgrade is selected the firmware will be updated when the given .bin file project version is larger or smaller than the current project version. Please note: when both versions are same the update will not trigger.When project name affixes are not similar the update will not trigger. |
Sample time (sec) |
-1 (inherited) or specify |
Specify sample time of the block |
INPUT/ OUTPUT Port
Port Name |
Port Type |
Date Type |
Description |
Status |
Scalar |
int8 |
outputs the status of the firmware upgrade function. UPGRADE_OK = 0, UPGRADE_INIT =1, UPGRADE_VER_INCOMPATIBLE =2, UPGRADE_ERR_NOT_FOUND =3, UPGRADE_ERR_INVALID_ARG =4, UPGRADE_ERR_INVALID_SIZE =5, UPGRADE_ERR_WRITE_FAIL =6, UPGRADE_ERR_READ_FAIL =7, UPGRADE_ERR_OTA_BEGIN =8, UPGRADE_ERR_OTA_WRITE_FAIL =9, UPGRADE_ERR_OTA_END =10, UPGRADE_ERR_PARTITION_SWITCH =11, UPGRADE_ERR_HASH_COMPARE =12 |
File Path |
Scalar/Vector |
uint8 |
accepts the filepath as an input |
Trigger |
Scalar |
int8 |
Port that triggers the function |
This block is used to upgrade firmware using .bin file located on SD card or SPIFFS storage.
This block requires SD card setup Block or SPIFFS setup Block to function. The requirement is based on the mode selected by the user. Depending on the mode selected the file path should be given to the correct location of the .bin file that is to be used for the firmware upgrade.
When the block is triggered by the user during run time, the firmware upgrade will be triggered if the chosen .bin file meets the upgrade requirements chosen by the user under "Select Upgrade Type".
Demo file : esp32_local_firmware_sd_demo.slx
This demo is used to demonstrate how to upgrade firmware using a .bin file stored on the SD card. When the correct path to the file on sd card is given and the given .bin file project version meets the upgrade trigger requirements the firmware will be upgraded.
1.ESP32 module
1.First change the project version of the project using a certain project version set on the Target Setup Block to something similar to "waijung2 20" and compile and build the project
2.Navigate to the build folder as shown below and copy the file on to the sd card.
3.Make sure the correct path to the file on SD card is given on the Local Firmware Upgrade block mask.
4.Change the project version to be smaller than the previous project version used in step 1. For example "waijung2 15". Compile, build and run the project.
After build compile and upload process is completed, the ESP32 device should boot up in the current firmware version and upgrade to the firmware stored on the SD card.
Demo file : esp32_local_firmware_spiffs_demo.slx
This demo is used to demonstrate how to upgrade firmware using a .bin file stored on the SPIFFS storage. When the correct path to the file on spiffs storage is given and the given .bin file project version meets the upgrade trigger requirements the firmware will be upgraded.
1.ESP32 module
1.Please ensure the correct path to the file on spiffs is selected on the Local Firmware Upgrade Block mask.
2.Inside the SPIFFS Setup block, please select the /spiff folder located in the folder with the demo model file.
3.Ensure the project version is lower than 20 to trigger the upgrade.
After build compile and upload process is completed the ESP32 device should boot up in the current firmware version and upgrade to the firmware stored on the spiffs storage. Please use the given .bin file to trigger an upgrade.
Alternative to this method would be to build the program using a certain project version set on the Target Setup Block, then navigate to the build folder and copy the generated "waijung2_esp32.bin" into the folder given to the SPIFFS setup block. Then compile the program again using another project version that meets your requirements.
Similar to results of esp32_local_firmware_sd_demo explained earlier the project versions will be upgraded when the firmware upgrade has been successfull.