We do everything we can so that the firmware updates of Yoctopuce modules work smoothly and without any hitch. However, it may happen that some external event, such as a power failure or a communication loss, prevents the process to end properly. We are going to see how to reset the module into a working state and restore its configuration parameters when the update process was interrupted.
Note: Some of the features that we are going to use are very recent. Make sure to have an up-to-date version of the VirtualHub and/or a YoctoHub with an up-to-date firmware.
The first action is to retrieve all the configuration parameters of the module and to store them for the duration of the update process.
The second action is to update the module firmware. This is the most critical part of the process. During this part, the modules reboots in reprogramming mode, deletes the configuration parameters, and updates the code of the module. Then, the module boots with the code of the new firmware. At the end of this step, the module is up-to-date and in working order, but all the configuration parameters are deleted and default parameters are used.
The third and last action is to restore the parameters that we stored at the beginning.
When everything goes well, the module is updated and the configuration parameters are retained. However, if an error occurs during the process, such as a communication loss or a power failure, the module can be in one of these 3 states:
- The module is in working order and the configuration parameters are applied.
- The module is in reprogramming mode and the parameters have already been deleted.
- The module is in working order, but the configuration parameters have been deleted.
The first case is very unlikely. The error would have had to happen at the very beginning of the process. In this case, you must simply restart the update process.
Saving the parameters in case of error
In cases 2 and 3, the configuration parameters have already been deleted from the module and are only present on the web browser. When the update process fails, the web interface offers you to save these parameters in order to apply them later on, when the module is in working order again.
If an error happens during the update, the wizard offers you to save the configuration parameters to apply them later on
In case of error, the first thing to do is to save these parameters, because if you close the browser window, these parameters are lost forever.
Restarting the firmware update
Even if the update process failed, you can start a new update process and provide the saved configuration parameters.
At the beginning of the process, you must simply check the Override settings with value from file option and select the file containing the configuration parameters.
In the web interface, you can indicate a file with the configuration parameters to be applied
The module is in reprogramming mode
If the module is in reprogramming mode, you can nevertheless restart the firmware update process. In this situation, the module isn't listed with the other modules, but separately at the bottom on the main page of the web interface.
Modules in reprogramming mode are listed at the bottom of the page (ex: THRMSTR2-EF59B)
If you click on the module serial number, you start the firmware update process. The same Override settings with value from file option allows you to restore the configuration parameters from a file.
Import/export of configuration parameters
Note that since recently, you can save and restore a module configuration parameters from the configuration panel.
You can save and restore configuration parameters from the configuration panel
The Export settings button enables you to save all the parameters into a file.
The Import settings button enables you to load and apply the configuration parameters from a file. Note that this button only replaces the current parameters with those of the file. To save these parameters permanently in the flash memory of the module, you must click on the Save button at the bottom of the configuration window. Following the same logic, if you click on the Cancel button, these modifications are canceled.
Important note: this feature is available only on VirtualHubs since version 1.10.47158 and YoctoHubs with firmware 47157 or more recent.