Firmware Update from Module#

This section provides a reference to the APIs used to perform firmware updates from the module.

Functions#

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.

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.

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.

Parameters
[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

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.


Definition at line 1197 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.

Parameters
[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.

  • The maximum supported HTTP URL is 2048 bytes, when the SL_SI91X_FEAT_LONG_HTTP_URL Bit is enabled in the feature_bit_map.

  • If the SL_SI91X_FEAT_LONG_HTTP_URL Bit is disabled, then the maximum supported length for HTTP URL is (872-(length of User_name + length of Password) - length of hostname - length of IP address) bytes excluding delimiters.

[in]host_name


Host name.

[in]extended_header
  • The purpose of this function is to append user configurable header fields to the default HTTP/HTTPS header. The extended header can have multiple header fields, each ended by "\r\n" (0xD 0xA)

  • If "\r\n" is present in the extended header content, "0xDB 0xDC" bytes can be used to separate multiple header fields. Example: key1:value1"\r\n"key2:value2"\r\n"

[in]user_name


Username for server authentication.

[in]password


Password for server authentication.

[in]post_data


HTTP data to be posted to the server. (Currently not supported)

[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

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.

    • 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.


Definition at line 117 of file components/device/silabs/si91x/wireless/firmware_upgrade/firmware_upgradation.h