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.
[in] | server_ip | OTAF server IP address of type sl_ip_address_t. |
[in] | server_port | OTAF server port number. |
[in] | chunk_number | Firmware content request chunk number. |
[in] | timeout | TCP receive packet timeout. |
[in] | tcp_retry_count | TCP retransmissions count. |
[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.
1133
of file components/device/silabs/si91x/wireless/inc/sl_si91x_driver.h
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.
[in] | type | Valid values are: 2 - HTTP_OTAF. |
[in] | flags | Configuration flags. See the table below for details. |
[in] | ip_address | Server IP address. |
[in] | port | Port number. Default: 80 - HTTP, 443 - HTTPS |
[in] | resource | Requested resource URL in string format.
|
[in] | host_name |
|
[in] | extended_header |
|
[in] | user_name |
|
[in] | password |
|
[in] | post_data |
|
[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 | Macro | Description |
---|---|---|
BIT(0) | HTTPS_SUPPORT | Set this bit to enable HTTPS_SUPPORT to use HTTPS feature. |
BIT(1) | IP_VERSION_6 | Set this bit to enable IPv6. By default, it is configured to IPv4. |
BIT(2) | SI91X_TLS_V_1_0 | Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled. |
BIT(3) | SI91X_TLS_V_1_2 | Set this bit to support SSL TLS Version 1.2 if HTTPS is enabled. |
BIT(4) | SI91X_TLS_V_1_1 | Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled. |
BIT(6) | HTTP_V_1_1 | Set this bit to use HTTP version 1.1 |
BIT(9) | SL_SI91X_HTTPS_CERTIFICATE_INDEX_1 | Set this bit to specify index of SSL cert to be used for HTTPS. |
BIT(10) | SL_SI91X_HTTPS_CERTIFICATE_INDEX_2 | 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.
115
of file components/device/silabs/si91x/wireless/firmware_upgrade/firmware_upgradation.h