u-blox SARA-R4 Series: Firmware Update Guide
Firmware update with uFOTA, FOAT and EasyFlash
Application note
Abstract
u-blox cellular modules offer flexibility by providing multiple options for firmware updates. These options include Firmware Over-The-Air (FOTA) via the u-blox uFOTA server using the LwM2M client or FTP, and tethered updates via Firmware Over AT command (FOAT). Additionally, modules can be flashed directly via the USB interface using the u-blox EasyFlash tool. This application note covers all these available methods.
Document Information
Title: SARA-R4 series
Subtitle: Firmware update with uFOTA, FOAT and EasyFlash
Document type: Application note
Document number: UBX-17049154
Revision and date: R07, 01-Mar-2021
Disclosure restriction: C1-Public
Applies to: SARA-R4 series (Except for "00B" and "01B" product versions), SARA-N4 series.
1 Introduction
Device firmware (FW) management is a key feature for devices integrating a cellular module. u-blox cellular modules support Over-the-Air (FOTA) and tethered (FOAT) techniques for firmware updates. FOTA updates are downloaded via cellular technology using the LwM2M protocol through the u-blox uFOTA service or FTP. Tethered updates are downloaded via USB/UART interfaces from a host processor.
Figure 1: uFOTA, FOAT, FOTA ecosystem depicts the system architecture. It shows servers (u-blox uFOTA package, MNO FOTA package, u-blox LwM2M, MNO LwM2M, Customer FTP) interacting with the SARA-R4 module (LwM2M client, uFOTA client, FTP client, FOAT) and a Customer host, facilitated by an Update Agent and AT interface.
This document details u-blox's implementation of FOTA and FOAT methods, offering design-in guidance and recommendations, along with instructions for the EasyFlash tool.
Table 1: FOTA and FOAT methods compatibility matrix lists product names (SARA-R410M-02B, SARA-R410M-52B, etc.) and their compatibility with uFOTA, Change Lifetime Timer, FTP, and FOAT.
The document does not apply to SARA-R4 "00B" and "01B" product versions. The following symbols are used:
- ? An index finger points out key information pertaining to integration and performance.
- ⚠️ A warning symbol indicates actions that could negatively impact or damage the module.
2 uFOTA
uFOTA is u-blox's solution for managed and automated FOTA services based on the LwM2M protocol. It uses "campaigns" to manage upgrades for multiple modules. Section 2.7 details the campaign process, and Section 2.1 describes module behavior during uFOTA. Figure 2: uFOTA system architecture options illustrates the process flow, including package upload, campaign start, server communication, download, and installation.
The embedded LwM2M client offers features such as device management, secure communication (DTLS), and full control over application logic, including firmware upgrades.
During a uFOTA download, Power Save Mode (PSM) is held off.
2.1 Functional overview
Upon module power-up and cellular network attachment, the LwM2M client registers with the uFOTA server. It periodically checks the server based on the Server Registration Life Timer (SRLT). Registration is performed to extend lifetime, notify parameter changes, or indicate object instance modifications.
The SRLT default is 24 hours. The LwM2M client may receive an updated SRLT value from the uFOTA server. If an active campaign and available firmware are detected during a registration update, the server initiates an observation request, and the client downloads the package. The LwM2M client reports download status via Unsolicited Response Codes (URCs).
Package downloads use HTTP for SARA-R4 "02B", "52B" versions, and CoAP or HTTPS for "63B", "73B", "83B" versions. IPv6 is not supported for uFOTA on certain SARA-R410M and SARA-R412M variants.
Update packages are signed. Upon download completion, the server commands a module reset to install the update. The module restarts after installation. The server is then notified of the update status.
The server URL is configured via the +UMNOPROF AT command. Registration payload size depends on MNO profile configuration.
Issuing FOAT or FTP download commands during an active uFOTA download will result in an error.
2.2 Unsolicited result codes management
The +UFOTASTAT AT command (or +ULWM2MSTAT for specific versions) enables/disables URCs reporting status back to the host. Enabling URCs is recommended for uFOTA downloads.
2.2.1 Download success example
Successful downloads are indicated by URCs like +UFOTASTAT: 2,2,100
or +ULWM2MSTAT: 2,100
, signifying 100% downloaded.
2.2.2 Download resume example
Downloads interrupted by signal loss, power loss, or device reset can be resumed. The module resumes from the last written flash image page. URCs indicate the resuming status and progress, e.g., +UFOTASTAT: 0,0,63
for 63% downloaded.
2.3 Download cancellation
A download in progress can be cancelled using AT+UFOTA=0
or AT+ULWM2M=0
commands, which return a URC indicating cancellation. A new campaign is needed to restart the process.
2.4 Firmware package update
A firmware package can include firmware only, carrier profile only, or both. After download, the module reboots to install the update, which can take up to 21 minutes. The AT interface is unavailable during installation.
Table 2: Delta FOTA package update estimates provides estimated download and installation times based on package size and module type.
2.5 Server registration life timer (SRLT)
The SRLT determines how often the module checks in with the u-blox uFOTA server for updates. The default is 24 hours. The LwM2M server can potentially update this value. For SARA-R4 "63B" with Softbank profile, the SRLT is fixed at 1 week and cannot be modified via AT commands.
Frequent SRLT changes are not recommended. For testing, a value above 1200 seconds (20 minutes) is advised. Production devices should not use a static timer less than the factory default.
Commands like AT+ULWM2MLIST
, AT+ULWM2MREAD
, and AT+ULWM2MWRITE
are used to manage SRLT settings.
2.5.1 Server registration life timer configuration
The host can change the SRLT by writing to the server object instance. For SARA-R4 "63B", the +UMNOPROF profile may restrict SRLT modification. Deregistering with +ULWM2MDEREG
is an alternative to control check-ins.
2.5.2 uFOTA configuration +UFOTACONF
The +UFOTACONF AT command is not supported on all SARA-R4 versions. It allows SRLT value changes and disabling the timer. Setting values lower than factory defaults is for testing only. Disabling the timer triggers a check-in within 60 seconds.
2.6 Application design
The host application must behave correctly during uFOTA processes to avoid disturbing downloads or installations.
2.6.1 Enable the uFOTA URC
+ULWM2MSTAT
and +UFOTAST
URCs provide status updates. Enabling these URCs informs the host about download initiation and progress. The host can cancel downloads based on these URCs. Once download is complete, the module resets for installation, which the host cannot cancel.
Examples show URC sequences for download progress (e.g., +UFOTASTAT: 0,0,30
for 30% downloaded) and completion (e.g., +UFOTASTAT: 2,2,100
).
2.6.2 Module reboot per uFOTA server request
For specific SARA-R410M/R412M models, a server-triggered reboot may precede FW delta package download. After reboot, the module re-checks the server for configuration files and then delta packages.
2.6.3 Firmware downloading
Downloading firmware can be data-intensive and may block other download commands. Refer to Section 6 for a list of blocked commands.
2.6.4 Firmware installation
The host application should close open sockets before the download complete URC. Upon receiving the URC (+ULWM2MSTAT: 2,100
or +UFOTASTAT: 2,2,100
), the host should store the state. The module resets to apply the update upon receiving an execute command. The host cannot cancel the upgrade at this stage.
GPIO pins can indicate update mode (low) and completion (high after boot-up). Alternatively, the UART RX pin status can be monitored. If no hardware indication is available, the host must poll the AT interface.
2.6.4.1 Do not reboot module when installing
Installation can take time. Avoid unnecessary resets. Interrupting boot code updates can corrupt the module. Avoid power loss, unstable supply, external resets, or turning off the module via PWR_ON/RESET_N.
2.6.4.2 Do reboot module if the installation does not start after download
If the module does not reset within 180 seconds after the download complete URC, the host can trigger a reset to initiate installation as a failsafe.
2.6.5 Cancelling the uFOTA process
The uFOTA download can only be cancelled while receiving specific URCs (+ULWM2MSTAT:1,xx
, +UFOTASTAT: 0,0,xx
, or +UFOTASTAT: 0,1,xx
). Once the firmware is downloaded, the upgrade cannot be cancelled.
2.6.6 After firmware has been installed
After installation, the module reboots and re-registers. It is good practice to report the successful upgrade, including the new firmware version, to the application cloud service. Firmware and carrier profile versions can be queried using AT commands like ATI
or AT+CGMR
.
2.6.6.1 Performing EFS backup after flashing FW update with delta package
The EFS/Backup & Restore feature is not supported on certain SARA-R4 versions. If updating with this feature via FOTA/uFOTA, perform a backup using the +UBKUPDATA
AT command after a successful update.
2.7 uFOTA campaign
To start a uFOTA upgrade, a "campaign" must be requested from u-blox support. Requirements include product type, FW versions, IMEI list, schedule, and transfer protocol.
Campaigns require u-blox approval. A design review by u-blox support is recommended to ensure application compatibility. A test campaign with a few modules is strongly suggested before a full rollout.
2.8 uFOTA server access
2.8.1 u-blox uFOTA server
Network access to lwm2m-fota.services.u-blox.com
(port 5684) for LwM2M and s3-us-west-1-r-w.amazonaws.com
(port 80) for package download is required. For NTT DoCoMo, the u-blox LwM2M server is not used; the NTT DoCoMo LwM2M server is used instead. Mismatches in LwM2M binding modes may prevent registration.
2.8.2 Softbank MNO profile
For Softbank, a fixed IP address is used, routed via PDP context #2.
2.8.3 Verizon MNO profile
This section details APN configuration for uFOTA on Verizon networks. It explains using +CGDCONT
to set the APN for specific contexts, ensuring correct network access.
2.8.4 2G PDP context management
On 2G RAT, the active PDP context cannot be shared between LwM2M and host data services. Activating PDP context via +CGACT
prevents LwM2M client data calls.
Managing the 2G PDP context involves options like manual check-ins using +UFOTACONF
or +ULWM2MREG
, or allowing check-ins upon boot-up after life timer expiry. For devices that do not power down, the host can manage PDP context to facilitate check-ins.
3 Firmware download via FTP
Firmware can be downloaded using standard FTP. The host must configure an FTP profile first. After download, use the +UFWINSTALL
command for installation.
FTP download commands will error if issued during an active LwM2M download.
3.1 +UFTP AT command
This command configures the FTP profile. It sets parameters like server name, username, and password. Values are volatile.
3.1.1 Syntax
The syntax covers generic commands, server IP, server name, username, and password configuration.
3.2 FTP command +UFTPC
+UFTPC
triggers, cancels, or resumes FTP downloads. Resume is supported even after power cycles. Cancellation means a new session must start. The command requires successful login.
+UUFTPCR
URCs provide status (e.g., +UUFTPCR: 100, 202752 / 1103692
) and results (+UUFTPCR: 100,1
for success).
3.2.1 Syntax
Syntax is provided for starting, cancelling, and resuming downloads.
3.3 Unsolicited result codes (URC)
URCs provide status and results during FTP transfers.
3.3.1 Syntax
Syntax for status and result URCs is shown.
3.3.2 Defined values
Defines values for <ftp_result>
(0: fail, 1: success), <stored_byte>
, and <total_byte>
.
3.4 Example
An example sequence demonstrates configuring FTP settings, logging in, starting a download, and receiving status updates.
3.5 Error result codes
The +UFTPER
command retrieves error reasons if a download returns +UUFTPCR: 100,0
.
4 Firmware download via AT (FOAT)
FOAT provides tethered data transfer for firmware updates over USB/UART. It does not support resume; interrupted downloads must be restarted. Figure 3: FOAT architecture system illustrates the process involving the host, module, and update agent.
Two AT commands are used: +UFWUPD
(Xmodem protocol) and +UDWNFILE
(file system management).
PSM is held off during FOAT download. FOAT commands will error if issued during an active LwM2M download.
4.1.1 +UFWUPD AT command
This command initiates firmware updates using Xmodem or Xmodem-1k protocols. The <option>
parameter specifies the download type (e.g., 3 for firmware package).
4.1.1.1 Syntax
Syntax for setting and testing the +UFWUPD
command is provided.
4.1.1.2 Defined values
Defines the <option>
parameter for download types.
4.1.2 +UDWNFILE AT command
This command downloads firmware delta packages or carrier profile files.
4.1.2.1 Syntax
Syntax for downloading firmware delta packages and carrier profile files is shown.
4.1.2.2 Defined values
Defines parameters like <size>
and <tag>
.
5 Firmware installation +UFWINSTALL
This command is used for firmware installation after download via AT commands (+UDWNFILE
, +UFWUPD
) or FTPC. It's not applicable if LwM2M was used. Figure 4: Firmware installation after FTPC, for FOAT file transfer shows the process.
The command triggers installation, which may involve a module reset. Interrupting boot code updates can cause corruption. The AT interface is unavailable during installation.
If installation doesn't start within 180 seconds after the download complete URC, the host can trigger a reset.
Table 3: +UFWINSTALL AT command syntax lists commands for setting, testing, and action.
5.1.1 Performing EFS backup after flashing FW update with delta package
The EFS/Backup & Restore feature is not supported on certain SARA-R4 versions. If updating with this feature, perform a backup using +UBKUPDATA
after a successful update.
6 AT commands blocked during uFOTA download
Only one download method can be active. Table 4: Firmware download methods lists AT commands blocked during active downloads (e.g., LwM2M FOTA download blocks FTP commands).
During FOTA/FOAT download, PSM is disabled and re-enabled after completion, failure, or cancellation.
7 Power Save Mode (PSM)
Before uFOTA/FOAT updates or when a download is detected, eDRX should be disabled by the host to ensure smooth communication. PSM is held off during FOTA/FOAT downloads until completion.
8 EasyFlash
EasyFlash is a Windows application for flashing SARA-R4 modules via USB. It requires Windows 7 or 10. Consult u-blox support for recommended EasyFlash versions.
Flashing steps:
- Copy the FW .dof file to the EasyFlash directory.
- Close any running module-related tools.
- Run EasyFlash as Administrator.
- Select Product (SARA-R4), Port (USB), leave Baud rate blank.
- Enable trace for logging.
- Click "Start".
- Power up the module.
- Wait for flash completion.
- Close EasyFlash.
Figure 5: EasyFlash directory and file details shows the application's directory structure and files, including a sample .dof file.
Figure 6: Setting up EasyFlash and start the FW installation and Figure 7: Flash process in progress illustrate the tool's interface and the flashing procedure.
Figure 8: Flash process complete and successful shows a successful flash completion.
EasyFlash tips:
- Do not use a USB hub.
- Remove other chipset drivers if issues occur.
- Retry if flashing fails.
- EasyFlash (v10+) creates a backup file before flashing, containing device data like calibration and IMEI. This backup is restored if the process is interrupted between backup and restore.
- Reboot the PC if multiple flashes fail.
8.1.1 Setting preferred message storage after FW update
For modules supporting Backup & Restore, after an EasyFlash update, set preferred SMS storage using the +CPMS
AT command if SMS functionality is used.
9 FW update: device files and settings
Table 5: Summary of each firmware update method and impact to device files and settings compares EasyFlash, uFOTA/FOTA, and FOAT methods regarding user files, MNO profiles, and NVM settings. Generally, EasyFlash erases and reconfigures, while FOTA/FOAT preserve files but may modify profiles and NVM items.
Appendix A Glossary
Table 6: Explanation of the abbreviations and terms used provides definitions for abbreviations like API, AT, DTLS, eDRX, FOAT, FOTA, FTP, FW, GPIO, HTTP, HW, IMEI, IPL, LTE, LwM2M, MNO, OTA, PSM, RF, SMS, SRLT, UART, UFE, uFOTA, URC, URI, URL, and USB.
Appendix B MNO certification notes
B.1 Verizon
Verizon requires demonstration of Over-The-Air (OTA) FW update capability. Steps include obtaining FW packages, preparing campaigns on the uFOTA server, setting up the device with specific AT commands (e.g., AT+UMNOPROF=3
, AT+CFUN=15
, AT+UFOTASTAT=1
, AT+ULWM2MSTAT=1
, AT+CGDCONT?
, AT+ULWM2MREG=721
), capturing FW version before and after the update, and executing the campaign.
Related documentation
References include AT commands manuals, data sheets, system integration manuals, application development notes, and OMA technical specifications. Updates and notifications are available at www.u-blox.com.
Revision history
The revision history tracks changes from initial draft (R01) to the latest revision (R07, 01-Mar-2021), detailing document updates and applicability extensions.
Contact
Contact information for u-blox offices worldwide is provided, including phone numbers and email addresses for general inquiries and technical support.