The set command downloads a firmware update package from an HTTP or HTTPS server and triggers a firmware update.
For HTTP and HTTPS error codes and server response codes, see HTTP and HTTPS error codes.
Syntax:
%HTTPFOTADL=<HTTP_URL>[,<download_URC_max>]
The set command parameters and their defined values are the following:
- <HTTP_URL>
- String. Maximum length 255 characters. URL of the firmware update package. Must start
with
http://orhttps://. - <download_URC_max>
- Integer, 0 and 50–100. Maximum download progress reporting.
During download and verification, the following Unsolicited Result Code (URC)s are sent:
%HTTPURC: "FOTA","DOWNLOAD START"
%HTTPURC: "FOTA","DOWNLOADING",<percent>
%HTTPURC: "FOTA","DOWNLOADED"
%HTTPURC: "FOTA","VERIFIED"
- <percent>
- Integer, 0–100. Download progress.
"DOWNLOADED" indicates that the entire package is received but not yet
verified. "VERIFIED" indicates that the package passed verification and is
going to be applied.
If the download or verification fails, one of the following URCs is sent:
%HTTPURC: "FOTA","DOWNLOAD ERROR",<cause>,<detail>
%HTTPURC: "FOTA","VERIFICATION FAILURE",<cause>,<detail>
The error notification parameters and their defined values are the following:
- <cause>
- Integer, 1–7. Error cause.
- <detail>
- Integer. Error detail. The meaning depends on <cause>. 0 indicates that no further information is available.
When <cause> is 1, <detail> is the HTTP status code as received.
When <cause> is 2, the values of <detail> are the following:
- <detail>
- 8 – No such file.
When <cause> is 3, the values of <detail> are the following:
- <detail>
- 34 – I/O error.
When <cause> is 4, the values of <detail> are the following:
- <detail>
- -2 – Offset past the end of the delta partition.
When <cause> is 5, the values of <detail> are the following:
- <detail>
- 1 – Delta package was not found.
When <cause> is 6, a negative <detail> from -32767 to –1 is an Mbed TLS return code as a decimal number. Negative values outside that range are modem-specific:
- <detail>
- -65537 – The peer closed the TLS record layer during a read.
A positive <detail> is an X.509 verification bitmask that can combine several of the following values.:
- <detail>
- 1 – Certificate is expired.
For example, <detail> 12 indicates an untrusted CA (8) and a CN mismatch (4)
When <cause> is 7, <detail> is the attempted package size in bytes.
When the download and the verification complete successfully, the module reboots and applies the delta update during the bootloader phase.
The following command example downloads a firmware update package with progress reporting:
AT%HTTPFOTADL="http://example.com/delta.binpkg",100
OK
%HTTPURC: "FOTA","DOWNLOAD START"
%HTTPURC: "FOTA","DOWNLOADING",10
%HTTPURC: "FOTA","DOWNLOADING",30
%HTTPURC: "FOTA","DOWNLOADING",50
%HTTPURC: "FOTA","DOWNLOADING",80
%HTTPURC: "FOTA","DOWNLOADING",100
%HTTPURC: "FOTA","DOWNLOADED"
%HTTPURC: "FOTA","VERIFIED"
The following command example shows a download failure caused by the server not having the package:
> AT%HTTPFOTADL="http://example.com/delta.binpkg"
OK
%HTTPURC: "FOTA","DOWNLOAD ERROR",1,404