Thales IoT Developer Community
FOTA Example (Firmware Update Over The Air) - EHS5, EHS6, EHS8 modules
Showcase, February 11, 2016 - 4:36pm, 10909 views
The article contains the short description how to update a module’s firmware over the air (not to be confused with userware software which is a separate story).
Gemalto provides the possibility of performing the firmware update procedure from the file stored in the local file system of the module. The rest of the logic should be implemented in the user application.
An over-the-air firmware update should include the following steps:
• Downloading the firmware update file to the module's flash file system (FFS)
• Downloading the JRC MIDlet to the module's flash file system (FFS)
• Checking the integrity of the downloaded files
• Stopping and removing of the current JRC MIDlet
• Starting the actual firmware update
• Installing the downloaded JRC MIDlet
• Validating of the update and restoring the normal operation
The above steps can be handled from an external application by means of AT commands issued over the external interface or can be implemented in the Java MIDlet.
Please note that besides the firmware file the application is also updating the JRC MIDlet (Java Remote Control MIDlet Suite) which is a factory MIDlet implementing some of the module’s functionality. There is a dedicated version of JRC released for every firmware release and it MUST be updated together with the firmware.
The versions of the installed firmware and JRC should be verified and compared with the new software to check if the update is really needed and if it was successfull.
The user applications cannot be running during the firmware update process so please consider stopping your other applications to avoid data loss or any other consequences depending on your application's logic.
When the JRC MIDlet is not running the Java code will not be able to receive URC's. So after stopping the JRC this demo application will not be able to receive any SMS messages.
In case of implementation of the update logic in Java such a MIDlet can also be remotely installed with OTAP which is provided by all Java enhanced modules.
The possibility of remote control of the module always includes some risks. So please consider this while developing your solution.
Here are some (probably not all) issues to take into account:
• When developing SMS communication, remember to implement some password and/or sender number verification.
• While using OTAP for remote installation of the MIDlet for remote firmware updating remember also to configure the password for OTAP SMS commands.
• Configure the password authentication on the server and use secure connection.
• The module can be configured to only accept the signed applications (the certicicat must be loaded to the module) to avoid installation of the unwanted application.
• The MES access can also be blocked for the modules working in the field.
• Remember that firmware update is a risky operation - if something goes wrong you may loose contact with your device. So prepare your scenario carefully.
The attached MIDlet demonstrates how the remote firmware update can be performed. The application can be controlled by SMS commands. Please keep in mind that this is only a demo, the aim of which is to show the possibilities. It is not the complete and fully tested application that could be used as it is in the real system.
About the demo
The demo application downloads the files from the http server mainly because the implementation is simple and does not require any additional API's. But any other protocol that can be implemented in Java could be used here (for example FTP).
In case of download failure there is some debug information displayed. Some retries and nottifications should be considered in the real application.
Step by step - how to proceed with demo
• Upload the MIDlet to the module with MES.
• Make sure that the System.out is configured to one of the interfaces (serial is recommended: asc0 or asc1).
Set if needed:
• Install the MIDlet with the following command:
• Run the MIDlet with:
or just reset the module (The MIDlet is enabled for autostart)
• Send SMS to the module with configuration data and start command (see more details below)
• Watch the results on System.out interface
• The MIDlet will start with every module reboot, so if it is not needed any more it should be uninstalled
The following configuration parameters and start command can be sent in SMS:
• FOTA_START – start command
• APN – Access point number
• USER – APN user
• PASS – APN password
• USF – Firmware file name on HTTP server
• JRC – JRC MIDlet file name (same for .jar and .jad)
• PATH – http or https path to the FOTA files
• JAD_MD5 – Md5 checksum for .jad file
• JAR_MD5 – Md5 checksum for .jar file
• USF_MD5 – Md5 checksum for usf file
• DEBUG – Enable/disable additional debug output (by default it is disabled)
Please find more detail in the attached documents and Eclipse/NetBeans projects.