Firmware Update from Module#
This section provides a reference to the APIs used to perform firmware updates from the module.
Functions#
Create an OTAF client and initialize it with a given configuration.
Sends an HTTP request to a specified server URL.
Function Documentation#
sl_si91x_ota_firmware_upgradation#
sl_status_t sl_si91x_ota_firmware_upgradation (sl_ip_address_t server_ip, uint16_t server_port, uint16_t chunk_number, uint16_t timeout, uint16_t tcp_retry_count, bool asynchronous)
Create an OTAF client and initialize it with a given configuration.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_ip_address_t | [in] | server_ip | OTAF server IP address of type sl_ip_address_t. |
uint16_t | [in] | server_port | OTAF server port number. |
uint16_t | [in] | chunk_number | Firmware content request chunk number. |
uint16_t | [in] | timeout | TCP receive packet timeout. |
uint16_t | [in] | tcp_retry_count | TCP retransmissions count. |
bool | [in] | asynchronous | OTAF upgrade done asynchronously when this is set to true, else synchronous upgrade. |
This function creates an OTAF (Over-The-Air Firmware) client and initializes it with the provided configuration parameters.
It supports both synchronous and asynchronous firmware upgrades.
In synchronous mode, the response is received via sl_net_event_handler_t with SL_NET_OTA_FW_UPDATE_EVENT as the event.
Pre-conditions:
sl_net_up API needs to be called before this API.
Returns
sl_status_t. See Status Codes and Additional Status Codes for details.
Note
For a safe firmware upgrade via TCP server, it will take approximately 65 seconds to upgrade the firmware of a 1.5 MB file.
sl_si91x_http_otaf#
sl_status_t sl_si91x_http_otaf (uint8_t type, uint16_t flags, uint8_t * ip_address, uint16_t port, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, const uint8_t * post_data, uint32_t post_data_length)
Sends an HTTP request to a specified server URL.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | type | Valid values are: 2 - HTTP_OTAF. |
uint16_t | [in] | flags | Configuration flags. See the table below for details. |
uint8_t * | [in] | ip_address | Server IP address. |
uint16_t | [in] | port | Port number. Default: 80 - HTTP, 443 - HTTPS |
uint8_t * | [in] | resource | Requested resource URL in string format.
|
uint8_t * | [in] | host_name |
|
uint8_t * | [in] | extended_header |
|
uint8_t * | [in] | user_name |
|
uint8_t * | [in] | password |
|
const uint8_t * | [in] | post_data |
|
uint32_t | [in] | post_data_length | HTTP data length to be posted to the server. (Currently not supported) |
This function sends an HTTP request to a specified server URL with optional data and headers, and facilitates firmware downloads from the server.
This API is blocking API.
By default, the following values are used:
SSL version: 1.0
HTTP version: 1.0
Certificate index: 0
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/latest/platform-common/status for details.
Note
The following table lists the flags that can be used with this function:
Flags | Description |
---|---|
BIT(0) | Set this bit to enable HTTPS feature. |
BIT(1) | Set this bit to enable IPv6. By default, it is configured to IPv4. |
BIT(2) | Set this bit to support TLS Version 1.0 if HTTPS is enabled. |
BIT(3) | Set this bit to support TLS Version 1.2 if HTTPS is enabled. |
BIT(4) | Set this bit to support TLS Version 1.1 if HTTPS is enabled. |
BIT(6) | Set this bit to use HTTP version 1.1 |
BIT(9) | Set this bit to specify index of SSL cert to be used for HTTPS. |
BIT(10) | Set this bit to specify index of SSL cert to be used for HTTPS. |
Note
Maximum supported length for user_name, password together is 278 bytes.
Maximum length should be 872 bytes, which includes user_name, password, host_name, ip_address, resource, and extended_header.
If username, password, hostname and extended http headers are not required, user should send empty string separated by delimiter.
If content of any field contains a comma then NULL delimiter should be used.
This API will wait until the response is received from NWP.
When the SL_SI91X_FEAT_LONG_HTTP_URL feature is enabled, the maximum supported URL length for HTTP OTAF is 2048 bytes.
To select certificate index 0, no additional flags are required to be configured explicitly.