Silicon Labs documentation on RS9116 SDK version 2.14.0.

Documentation source: https://docs.silabs.com/rs9116-wiseconnect/2.14.0

# RS9116 SDK

## RS9116 SDK

The RS9116 SDK offers a full network offload option for embedded systems with low-end host microcontrollers running an RTOS or bare metal OS.  The RS9116 SDK connects to a host MCU using UART or SPI interfaces. A complete set of wireless, networking and security stacks run on the RS9116 SDK device, however the networking stack can be bypassed if required. Communication with the host MCU is achieved with AT Commands, or alternately a simple binary API referred to as SAPI. Embedded products provide greater than 20 Mbps Wi-Fi application throughput with multiple operating modes including Wi-Fi Client, Wi-Fi Access Point, Simultaneous Wi-Fi Client & Access Point and Dual-mode Bluetooth.

To get started using the RS9116 SDK, follow the instructions in on one of the getting started guides below:

- [**Getting Started with PC using AT Commands**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/)
- [**Getting Started with EFx32 Host**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/)
- [**Getting Started with STM32 Host**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-stm32/)

The software package is available directly in Simplicity Studio for Silicon Labs EFx32 hosts.  For other MCU hosts the software package can be downloaded directly from the [Silicon Labs GitHub](https://www.github.com/SiliconLabs) space.

- [Download the latest **RS9116 SDK Software Driver Package**](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)

## Developer Guide

Following is the list of recommendations, and new options:

### Wi-Fi

- Enable aggregation using the opermode parameter to improve throughput [feature_bit_map[2]](https://docs.silabs.com/rs9116-wiseconnect/2.6/wifibt-wc-sapi-reference/opermode#rsi-feature-bit-map).
- Disable high MCS rates to improve the robustness of a connection for low throughput applications in congested networks. For instance, turning off `MCS6` and `MCS7` helps a Smart Lock in a congested wireless environment.
- To restart the RS9116, the application must call `rsi_driver_deinit()` followed by `rsi_driver_init()` and `rsi_device_init()`. For OS cases, also call rsi_task_destroy(driver_task_handle) to delete the driver task before calling rsi_driver_deinit() and then create the task again after rsi_device_init() by calling rsi_task_create().
- To prevent interoperability issues and connection failures, it is advisable to disable powersave mode before establishing a Wi-Fi connection.

### Network Stack

- To ensure graceful handling during asynchronous TCP closures from a peer, enable the opermode parameter [ext_tcp_ip_feature_bit_map[16]](https://docs.silabs.com/rs9116-wiseconnect/2.6/wifibt-wc-sapi-reference/opermode#rsi-ext-tcpip-feature-bitmap).
- To avoid TCP disconnects during a rejoin, set TCP re-transmission count to >= `30`.
- Implemented a new API - `rsi_network_app_protocol_config()` to config the network application protocols, such as cipher selection for HTTP protocol.

### BT-Classic/BLE

- Following is the recommended range for the BLE Connection Interval:  
  - Powersave (BLE only) - 100 ms to 1.28 s  
  - BT Classic + BLE Dual Mode is >= 200 ms  
  - Wi-Fi + BLE coex - 30 to 250 ms
- During connection in BLE, it is not recommended to configure the scan window and scan interval with the same value.
- In BT Classic, the recommended Sniff Interval configuration during powersave is limited to 100 ms (<= 100).
- In BLE, if a device is acting as central, the scan window (in `set_scan_params()`, and `create_connection()` APIs) must be less than the existing connection interval.
- In BLE mode, when scanning and advertising are in progress, and the device connects and switches to the central role, both scanning and advertising stop. Furthermore, to connect to another peripheral or central device, the application must initiate advertising and scanning again.
- Device powersave must be disabled prior to BT initialization and deinitialization.
- It is recommended to keep a delay of 5 seconds before calling switch_proto to clear background functions in the firmware.

### Coexistence

- For concurrent Wi-Fi + BLE, and while a Wi-Fi connection is active, we recommend setting the ratio of the BLE scan window to BLE scan interval to 1:3 or 1:4.
- Wi-Fi + BLE Advertising  
  - All standard advertising intervals are supported. As Wi-Fi throughput is increased, a slight difference in on-air advertisements compared to configured intervals might be observed.  
  - BLE advertising is skipped if the advertising interval collides with Wi-Fi activity.
- Wi-Fi + BLE scanning  
  - All standard scan intervals are supported. For better scan results, we recommend setting the ratio of the BLE scan window to BLE scan interval to 1:3 or 1:4.  
  - BLE scan would be stopped for intervals that collide with Wi-Fi activity.
- Wi-Fi + BLE Central/Peripheral Connections  
  - All standard connection intervals are supported.  
  - For a stable connection, use optimal connection intervals and maximum supervision timeout in the presence of Wi-Fi activity.
- Wi-Fi + BLE Central/Peripheral Data Transfer  
  - To achieve higher throughput for both Wi-Fi and BLE, use medium connection intervals, such as 45 to 80 ms with maximum supervision timeout.  
  - Ensure Wi-Fi activity consumes lower intervals.
- To ensure a stable, and seamless connection, connect Wi-Fi before BT/BLE connections in the following operating modes: Wi-Fi + BT + BLE, Wi-Fi + BT, and Wi-Fi + BLE.
- For Wi-Fi + BT + BLE, Wi-Fi + BT, and Wi-Fi + BLE operating modes, if BT/BLE must be connected before Wi-Fi, use with a high supervision timeout, a high connection interval for BLE, and a high sniff interval for BT to ensure seamless and stable connection. This configuration ensures that the BT/BLE connection stays stable when Wi-Fi connects/disconnects/rejoins.

### System

- For User Store configuration and Configuration Save, do not enable powersave or save it as a configuration. If powersave is enabled and saved as a configuration, then on boot up, the RS9116 boots with the saved configuration. In this scenario, the RS9116 goes to powersave mode without giving any indication to the host.
- Set the compiler optimization level to `O0` in project settings for IDE (KEIL).
- Memory configuration must be 384 KB for BT/BLE and coex operating modes.  
  - Usage of low-power flash mode bit (bit 19 in extended customer feature bitmap). Enable this bit for ultra-low-power, standby-associated scenarios. This results in about 20µA lower Wi-Fi standby associated current consumption.
- Memory Configuration in SAPI functions: The default memory configuration is 384 K.
- Apply Opermode commands in AT mode correctly. Using the wrong Opermode command might lead to unspecified behavior.
- Set the recommended Power Save Profile (PSP) type to Enhanced Max PSP.
- It is recommended to disable the powersave functionality while updating the firmware.
- For high-throughput applications, powersave operation should be disabled.
- The application is required to set the real-time clock with the correct timestamp when the feature is enabled before establishing a TLS connection.
- At least one second timeout is necessary for socket select and receive. No timeout value under one second is supported.

## AT Command Programming Reference Manuals

The programming reference manuals listed below describe the **AT-command** interface and other programming details of the RS9116W.  These documents should be referenced for detailed information that may not be available in the [SAPI Reference]({docSpace}/{docSpaceVersion}/wifibt-wc-sapi-reference/).

#### [Wi-Fi AT Command PRM](https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-software-architecture/)

- Software architecture
- Bootloader details
- Host interface guide
- Interface and command protocols
- AT Command reference for Wi-Fi

#### [BLE AT Command PRM](https://docs.silabs.com/rs9116-ble-at-prm/latest/rs9116-ble-at-prm-about-document/)

- Software architecture
- Bootloader details
- Host interface guide
- Interface and command protocols
- AT Command reference for BLE

#### [Bluetooth Classic AT Command PRM](https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-about-document/)

- Software architecture
- Bootloader details
- Host interface guide
- Interface and command protocols
- AT Command reference for Bluetooth Classic

## Application Notes

The Application Notes listed below cover key topics related to RS9116W WiSeConnect™.  For a complete list of technical documentation and resources, see: [RS9116 Technical Resources](https://www.silabs.com/support/resources.p-wireless_wi-fi_rs9116-wi-fi-ncp-modules.p-wireless_wi-fi_rs9116-wi-fi-ncp-socs).

#### [Wi-Fi Regulatory Testing App Note](https://www.silabs.com/documents/login/application-notes/an1279-rs9116w-wi-fi-at-command-regulatory-test-application-note.pdf)

- Guide for Wi-Fi regulatory testing
- Hardware and software requirements and setup
- Configure and execute regulatory test modes

#### [Bluetooth Regulatory Testing App Note](https://www.silabs.com/documents/login/application-notes/an1286-rs9116w-bt-regulatory-test-application-note.pdf)

- Guide for Bluetooth and BLE regulatory testing
- Hardware and software requirements and setup
- Configure and execute regulatory test modes

#### [Power Save App Note](https://www.silabs.com/documents/login/application-notes/an1280-rs9116w-power-save-application-note.pdf)

- Guide to evaluate low power features using the RS9116 EVK
- Hardware and software requirements and setup
- Procedure for performing power measurements

#### [Wi-Fi Throughput App Note](https://www.silabs.com/documents/login/application-notes/an1284-rs9116w-throughput-application-note.pdf)

- Guide to evaluate and measure Wi-Fi throughput using the RS9116 EVK
- Hardware and software requirements and setup
- Setup and use the throughput reference project
- Procedure for performing throughput measurements

#### [Firmware Update App Note](https://www.silabs.com/documents/login/application-notes/an1290-rs9116w-firmware-update-application-note.pdf)

- Guide to firmware update mechanisms offered for RS9116W
- Describes firmware update options using SPI, USB and Wireless interfaces

#### [SPI Protocol App Note](https://www.silabs.com/documents/login/application-notes/an1285-rs9116w-spi-protocol-application-note.pdf)

- Details of the SPI implementation of the RS9116W

#### [RS9113 to RS9116 Migration Guide](https://www.silabs.com/documents/login/application-notes/an1276-rs9113-to-rs9116-migration-guide.pdf)

- Guide for migrating an application from (legacy) RS9113 products to RS9116W
- RS9113 and RS9116 part number compatibility
- Hardware and software migration requirements

## Release Notes

### RS9116 SDK Version 2.14.0 (June 2, 2026) - Release Notes

Wi-Fi 4 RS9116x Series SDK enables Wi-Fi and Bluetooth for MCUs running RTOS or bare metal.

Click [here](https://docs.silabs.com/rs9116-wiseconnect/2.12/wifibt-wc-release-notes/) for earlier releases.

#### Release Summary

<table>
    <thead>
        <tr>
            <th>Release Item</th>
            <th>Version</th>
            <th>Release Date</th>
            <th>Release Notes</th>
            <th>Key Features</th>
            <th>API Changes</th>
            <th>Bug Fixes</th>
            <th>Chip Enablement</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <p>
                    RS9116 Platform
                </p>
            </td>
            <td>
                <p>
                    2.14.0
                </p>
            </td>
            <td>
                <p>
                    June 2, 2026
                </p>
            </td>
            <td>
                <p>
                    <a href="rs9116-platform-release-notes">Release Notes</a>
                </p>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Fixed LP GPIO based wakeup powersave issue.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                <p>
                    Wi-Fi
                </p>
            </td>
            <td>
                <p>
                    2.14.0
                </p>
            </td>
            <td>
                <p>
                    June 2, 2026
                </p>
            </td>
            <td>
                <p>
                    <a href="rs9116-wifi-release-notes">Release Notes</a>
                </p>
            </td>
            <td>
                <ul>
                    <li>Verification of roaming feature.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Resolved an issue where the EAP-TLS client failed to send the complete certificate chain during mutual authentication.</li>
                    <li>Sending Keep-Alive/GARP at the configured Keep-Alive periodicity (default 30 s), independent of data transfer, to avoid interop issues.</li>
                    <li>Added a new SAPI error code, STORE_CONFIG_NOT_AVAILABLE (0x6C) for RSI_REQ_CFG_GET to distinguish "no store configuration available" from generic memory allocation failures.</li>
                    <li>Beacon drops should no longer occur in power-save mode in 5 GHz.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                <p>
                    Network Stack
                </p>
            </td>
            <td>
                <p>
                    2.14.0
                </p>
            </td>
            <td>
                <p>
                    June 2, 2026
                </p>
            </td>
            <td>
                <p>
                    <a href="rs9116-network-stack-release-notes">Release Notes</a>
                </p>
            </td>
            <td>
                <ul>
                    <li>Added CRC-32 integrity validation for RS9116 SAPI APIs.</li>
                    <li>Extended the embedded MQTT username length support to 512 bytes.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Fixed MQTT publish failure (0x0030 / TX_DATA_PACKET_SIZE_EXCEEDED) for MQTT topics exceeding 99 bytes in AT mode.</li>
                    <li>Fixed SNTP subcommands returning 0xFFF8 (ERROR_IN_CMD) and resolved stale time reporting in SNTP_CLIENT_GET_TIME in AT mode.</li>
                    <li>Fixed WLAN initialization failure in the <b>wlan_https_bt_spp_ble_dual_role_v6</b> example when WPA3-Personal is enabled along with 802.11W (PMF).</li>
                    <li>Fixed DUT hang and missing BLE advertise/scan packets over the air in the <b>wlan_throughput_bt_spp_ble_dual_role</b> application.</li>
                    <li>Fixed AWS publish failures with power save enabled in the <b>wlan_station_ble_provisioning_aws</b> application.</li>
                    <li>Fixed BLE disconnection issues observed during HTTP GET operation in BLE + WLAN coexistence mode over the UART interface.</li>
                    <li>Corrected the documented security_type values for the <code>rsi_wlan_ap_start()</code> API to match the actual supported security modes.</li>
                    <li>Added a readme for the <b>wlan_ble_power_save</b> example.</li>
                    <li>Updated the RSI_IP_TOS value table to match the IEEE 802.11e / WMM Access Category mapping.</li>
                    <li>Fixed IP configuration failure (error code 0x21) observed in the station_ping example when CONNECT_WITH_PMK was enabled, by documenting the required SECURITY_TYPE setting (RSI_WPA2_PMK).</li>
                    <li>Updated the HTTP GET and HTTP PUT documentation to clarify SNI usage, custom cipher suite configuration, and the required parameter sequence.</li>
                    <li>Replaced the Silabs Connect mobile app with the Simplicity Connect app in the wlan_station_ble_provisioning example for compatibility with the latest Android versions.</li>
                    <li>Documented the upper and lower limits of the MQTT keep_alive_interval parameter in the <code>rsi_emb_mqtt_client_init</code> API.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                <p>Bluetooth
                </p>
            </td>
            <td>
                <p>
                    2.14.0
                </p>
            </td>
            <td>
                <p>
                    June 2, 2026
                </p>
            </td>
            <td>
                <p>
                    <a href="rs9116-ble-release-notes">Release Notes</a>
                </p>
            </td>
            <td>
                <ul>
                    <li>Added support for the RC clock for BLE on 1.5 Rev boards.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Added the new API <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize">rsi_ble_vendor_set_SMP_min_enc_keysize</a> for setting minimum SMP encryption key size.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Fixed an issue where the peripheral disconnected immediately when reading coded PHY rates on A7 boards with power save enabled, occurring only when LE Coded PHY (LR) was configured.</li>
                    <li>Fixed a hang issue that occurred when a connection cancel request was triggered with an invalid remote BD address.</li>
                    <li>Repeated passkey strings occur when the RS9116 module operates as a peripheral with power-save functionality during multiple reconnection iterations.</li>
                    <li>Fixed the BLE re-pairing attack vulnerability by adding a new API, <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize">rsi_ble_vendor_set_SMP_min_enc_keysize</a>, which sets the minimum encryption key size (typically 7–16).</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                <p>Multi-Protocol
                </p>
            </td>
            <td>
                <p>
                    2.14.0
                </p>
            </td>
            <td>
                <p>
                    June 2, 2026
                </p>
            </td>
            <td>
                <p>
                    <a href="rs9116-multi-protocol-release-notes">Release Notes</a>
                </p>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

#### Impact of Release Changes

[Impact Statements](#impact-statements) | [Migration Guide](#migration-guide)

##### Impact Statements

None

##### Migration Guide

None

#### Using This Release

[What's in the Release?](#what-s-in-the-release) | [Compatible Software](#compatible-software) | [Installation and Use](#installation-and-use) | [Help and Feedback](#help-and-feedback)

> **Note**:
> 
> - The release packages will have bug-fixes, enhancements, and new features in both 'SAPI' and 'Firmware'. Customer should update and use 'SAPI' and 'Firmware' of same release package. SAPI and firmware combinations that are not released together are not supported.
> - RS9116 release consists of two components:
>   - Firmware - RS9116 Firmware Binary
>   - SAPI Library - SAPI Library runs on Host
> - This release is intended for designs based on RS9116 Silicon revision 1.4 (RS9116X-xxx-xxx-Bxx) and revision 1.5 (RS9116X-xxx-xxx-Cxx).

##### What's in the Release?

- [Wi-Fi 4 RS9116x Series SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master)
- [Application Examples](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples)
- [Connectivity Firmware Images](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/firmware)

##### Compatible Software, Supported Hardware and Host Interfaces

<table>
    <thead>
        <tr>
            <th>Software
            </th>
            <th>Compatible Version or Variant
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Connectivity firmware
            </td>
            <td>
                <ul>
                    <li>Chip Revision 1.4: <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/firmware">RS9116W.2.14.0.0.10</a></li>
                    <li>Chip Revision 1.5: <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/firmware">RS9116W.2.14.0.0.10</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                SAPI
            </td>
            <td>
                2.14.0
            </td>
        </tr>
        <tr>
            <td>
                RTOS
            </td>
            <td>
                FreeRTOS v11.1.0
            </td>
        </tr>
    </tbody>
</table>

##### Installation and Use

To upgrade your existing software with this release, see instructions [Updating RS9116W Firmware](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/update-evk-firmware#updating-rs9116-w-firmware)

To run your first demo, see our [Getting Started Guides](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

To review Security and Software Advisory notifications and manage your notification preferences:

1. Go to [https://community.silabs.com/](https://community.silabs.com/).
2. Log in with your account credentials.
3. Click your profile icon in the upper-right corner of the page.
4. Select **Notifications** from the dropdown menu.
5. In the Notifications section, go to the **My Product Notifications** tab to review historical Security and Software Advisory notifications.
6. To manage your preferences, use the **Manage Notifications** tab to customize which product updates and advisories you receive.

For recommended settings, configurations, and usage guidelines, see the [Recommended Settings](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-developers-guide/) section

To learn more about the software in this release, dive into our [online documentation](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-overview/).

##### Help and Feedback

- Contact [Silicon Labs Support](https://www.silabs.com/support).
- To use our **Ask AI** tool to get answers, see the search field at the top of [this page](https://docs.silabs.com/).  
  > **Note**: **Ask AI** is experimental.
- Get help from our [developer community](https://community.silabs.com/s/?language=en_US).

#### Feature Matrix

The following sections cover the features of the Wi-Fi 4 + BT/BLE (Wi-Fi 4 RS9116x) SDK:

- [Supported Features](#supported-features)  
  - [Wi-Fi](#wi-fi)    
    - [Operating Modes](#operating-modes)    
    - [Wi-Fi Protocol Features](#wi-fi-protocol-features)    
    - [Wi-Fi Scan](#wi-fi-scan)    
    - [Wi-Fi Station Mode](#wi-fi-station-mode)    
    - [Access Point Mode](#access-point-mode)    
    - [Wi-Fi Power Save](#wi-fi-power-save)    
    - [Wi-Fi AT Commands](#wi-fi-at-commands)  
  - [Network Stack](#network-stack)    
    - [Core Networking Features](#Core-Networking-Features)    
    - [Advanced Networking Features](#Advanced-Networking-Features)    
    - [IoT Cloud Integration](#IoT-Cloud-Integration)  
  - [Bluetooth](#bluetooth)    
    - [BT-Classic](#bt-classic)    
    - [Bluetooth Low Energy](#bluetooth-low-energy)      
      - [Legacy Features](#legacy-features)      
      - [Advertising Extensions](#advertising-extensions)      
      - [Power Save](#power-save)  
  - [Multiprotocol](#multiprotocol)  
  - [RS9116 Platform](#rs9116-platform)
- [Unsupported Features](#unsupported-features)  
  - [Wi-Fi](#wi-fi-1)  
  - [Network Stack](#network-stack-1)  
  - [Bluetooth](#bluetooth-1)    
    - [Bluetooth Classic](#bluetooth-classic)    
    - [Bluetooth Low Energy](#ble-1)  
  - [Multiprotocol](#multiprotocol-1)  
  - [RS9116 Platform](#rs9116-platform-1)

##### Supported Features

[Wi-Fi](#wi-fi) | [Network Stack](#network-stack) | [Bluetooth](#bluetooth) | [Multiprotocol](#multiprotocol) | [RS9116 Platform](#rs9116-platform)

> **Note**: The following list specifies the hardware parts compatible with the Wi-Fi 4 SAPI:
> 
> - NCP mode boards supported:
>   - RS9116W-SB00-QMS
>   - RS9116W-SB00-B00
>   - RS9116W-DB00-CC0
>   - RS9116W-DB00-CC1
>   - RS916WS-01-AC1A3
> - Chip Revision:
>   - 1.4
>   - 1.5
> - Host Interfaces:
>   - UART
>   - SPI
>   - SDIO
>   - USB

###### Wi-Fi

[Operating Modes](#operating-modes) | [Wi-Fi Protocol Features](#wi-fi-protocol-features) | [Wi-Fi Scan](#wi-fi-scan) | [Wi-Fi Station Mode](#wi-fi-station-mode) | [Access Point Mode](#access-point-mode) | [Wi-Fi Power Save](#wi-fi-power-save) | [Wi-Fi AT Commands](#wi-fi-at-commands)

###### Operating Modes (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Wi-Fi Station (STA)
            </td>
            <td>
                Wi-Fi Station mode with 802.11n support
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Access Point (SoftAP)
            </td>
            <td>
                Wi-Fi Access Point mode with 802.11n support
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-start">rsi_wlan_ap_start</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-stop">rsi_wlan_ap_stop</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point">Wi-Fi - Access Point</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Station (STA) + Access Point (SoftAP)
            </td>
            <td>
                <p>Wi-Fi concurrent mode support over the same channel. Station with 802.11n + Access Point with 802.11n</p>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Access Point</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/concurrent_mode">Wi-Fi - Concurrent Mode</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Enterprise Client
            </td>
            <td>
                <p>Support for EAP-TLS, EAP-TTLS, EAP-FAST, and PEAP security.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/enterprise_client">Wi-Fi - Enterprise Client</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Transmit Test Mode
            </td>
            <td>
                <p>Custom, connection-less testing.</p>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-transmit-test-start">rsi_transmit_test_start</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-transmit-test-stop">rsi_transmit_test_stop</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-receive-stats-start">rsi_wlan_receive_stats_start</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-receive-stats-stop">rsi_wlan_receive_stats_stop</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_rf_test">Wi-Fi - WLAN RF Test</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Wi-Fi Protocol Features (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                IEEE 802.11b/g/n (2.4 GHz and 5 GHz)
            </td>
            <td>
                <p>IEEE 802.11b/g/n Wi-Fi standards supported over the 2.4 GHz and 5 GHz band.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Multimedia (WMM) Quality of Service (QoS)
            </td>
            <td>
                <p>Wi-Fi Multimedia (WMM) Quality of Service (QoS)</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
        <tr>
            <td>
                2.4 GHz Band
            </td>
            <td>
                See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#channels-supported-in-2-4-g-hz-band-2">Supported channels on 2.4 GHz band</a>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Access Point</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>
                        <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
                    </li>
                    <li>
                        <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point">Wi-Fi - Access Point</a></p>
                    </li>
                    <li>Multiple additional examples.</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                5 GHz band
            </td>
            <td>
                See <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#channels-supported-in-5-g-hz-band-2">Supported channels on 5 GHz band</a></p>
                and <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#dfs-channels-supported-in-5-g-hz-band-2">Supported DFS channels on 5 GHz band</a></p>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Access Point</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>
                        <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
                    </li>
                    <li>
                        <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point">Wi-Fi - Access Point</a></p>
                    </li>
                    <li>Multiple additional examples.</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Alliance (WFA) Certification
            </td>
            <td>
                <p>Pre-testing completed for WFA certification.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>None</td>
        </tr>
    </tbody>
</table>

###### Wi-Fi Scan (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Selective Scan
            </td>
            <td>
                <p>Channel-specific scan</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-scan">API Reference Guide - Scanning</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Active / Passive Scan
            </td>
            <td>
                <p>Active scanning to send probe requests to discover networks; and passive scanning to listen for beacon frames from access points.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-scan">API Reference Guide - Scanning</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Background (BG) Scan
            </td>
            <td>
                <p>Background scan is a scan triggered after connection in station mode</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-bgscan-profile">API Reference Guide - Background scanning</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Wi-Fi Station Mode (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Wi-Fi Re-join
            </td>
            <td>
                <p>Enable a device to automatically re-connect to a previously connected wireless network after disconnection.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-connect">rsi_wlan_connect - refer to the Note section of this API</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Station Ping</a></p>
                <p>
                    <strong>Note:</strong> This application needs to be modified to check for rejoin. See the <strong>Note</strong> section of <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-connect">rsi_wlan_connect</a>.
                </p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Security
            </td>
            <td>
                <ul>
                    <li>Wi-Fi open security</li>
                    <li>WPA</li>
                    <li>WPA / WPA2 Mixed Mode</li>
                    <li>WPA2 Personal</li>
                    <li>WPA2 Enterprise security
                        <ul>
                            <li>Method: PEAP/TTLS/TLS 1.0/TLS 1.2/FAST/LEAP</li>
                        </ul>
                    </li>
                    <li>WPA3 Personal</li>
                    <li>WPA3 Personal Transition Mode</li>
                    <li>WPA3 Enterprise security (Beta)
                        <ul>
                            <li>Method: PEAP/TTLS/TLS 1.0/TLS 1.2/FAST</li>
                        </ul>
                    </li>
                    <li>Known security vulnerabilities handled:</li>
                    <ul>
                        <li>WPA2 KRACK attacks</li>
                        <li>Fragment and Forge</li>
                    </ul>
                </ul>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-connect">rsi_wlan_connect</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Station ping</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/enterprise_client">Enterprise client</a></li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Access Point Mode (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                4-client Support
            </td>
            <td>
                <p>Allow up to 4 clients to connect to the access point.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-start">rsi_wlan_ap_start</a></p>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-stop">rsi_wlan_ap_stop</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point">Wi-Fi - Access Point</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Hidden SSID Mode
            </td>
            <td>
                <p>Prevents a Wi-Fi network’s SSID from being broadcast in beacon frames, making the network name invisible to casual scans.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/common#rsi-driver-init">rsi_driver_init</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point">Wi-Fi - Access Point</a></p>
                <p>
                    <strong>Note:</strong> Enable CUSTOM_FEAT_AP_IN_HIDDEN_MODE. See the <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-custom-feature-bit-map">RSI_CUSTOM_FEATURE_BIT_MAP</a>.
                </p>
            </td>
        </tr>
        <tr>
            <td>
                Auto Channel Selection
            </td>
            <td>
                <p>Dynamically select the optimal Wi-Fi channel to minimize interference and improve network performance.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-start">rsi_wlan_ap_start</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/common#rsi-driver-init">Wi-Fi - Access Point</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Scan in Access Point Mode
            </td>
            <td>
                <p>Wi-Fi scanning in access point mode</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-scan">rsi_wlan_scan</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/common#rsi-driver-init">Wi-Fi - Access Point</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Security
            </td>
            <td>
                <ul>
                    <li>Wi-Fi open security</li>
                    <li>WPA2 Personal</li>
                    <li>WPA3 Personal (Alpha)</li>
                    <ul>
                        <li>H2E Method only</li>
                    </ul>
                    <li>WPA3 Personal Transition Mode</li>
                    <li>WPA Mixed Mode (WPA/WPA2)</li>
                </ul>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ap-start">rsi_wlan_ap_start</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/common#rsi-driver-init">Wi-Fi - Access Point</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Wi-Fi Power Save (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Standby Associated
            </td>
            <td>
                <p>Standby Associated (connected sleep) with Max Power Save Profile (PSP), Enhanced MAX PSP and Max PSP</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-power-save-profile">rsi_wlan_power_save_profile</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/powersave_standby_associated">Wi-Fi - Power Save Standby Associated</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Network Processor (NWP) Deep Sleep
            </td>
            <td>
                <p>NWP Deep Sleep with and without RAM retention</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-power-save-profile">rsi_wlan_power_save_profile</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/power_save_deep_sleep">Wi-Fi - Power Save Deep Sleep</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Wi-Fi AT Commands (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Wi-Fi AT Command
            </td>
            <td>
                <p>Host shall use AT Commands for interacting with RS9116 Module. </p>
            </td>
            <td>
                GA
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-wlan-commands/#index">WLAN AT commands reference</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART</li>
                </ul>
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-at-command-examples/#at-command-examples">AT command examples</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Network Stack

[Core Networking Features](#core-networking-features) | [Advanced Networking Features](#advanced-networking-features) | [IoT Cloud Integration](#iot-cloud-integration)

###### Core Networking Features (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name
            </th>
            <th>Description
            </th>
            <th>Quality
            </th>
            <th>Related API Names
            </th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces
            </th>
            <th>Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Core Network Protocols
            </td>
            <td>
                IPv4, UDP, TCP, ARP, ICMP, ICMPv6
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network"> API Reference Guide - Network APIs</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network5"> API Reference Guide - Sockets</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ping-async"> API Reference Guide - ICMP</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput">Wi-Fi - Throughput</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping">Wi-Fi - Station Ping</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Internet Protocol version 6 (IPv6)
            </td>
            <td>
                Connect and exchange data with other hosts using the IPv6 protocol in the networking layer of the network stack.
            </td>
            <td>
                Beta
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network">API Reference Guide - Network APIs</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network5"> API Reference Guide - Sockets</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-ping-async">API Reference Guide - ICMP</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/wlan_throughput_v6"> Wi-Fi - Throughput IPv6</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/station_ping_v6"> Wi-Fi - Station Ping IPv6</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                TLS Client
            </td>
            <td>
                Supported versions 1.0, 1.2
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network5">API Reference Guide - BSD Sockets</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/tls_client">Wi-Fi - TLS Client</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                DHCP Client
            </td>
            <td>
                Support for DHCPv4 and DHCPv6
            </td>
            <td>
                Beta
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput"> Wi-Fi - Throughput</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/wlan_throughput_v6"> Wi-Fi - Throughput IPv6</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                DHCP Server
            </td>
            <td>
                Support for DHCPv4 and DHCPv6
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/access_point"> Wi-Fi - Access Point</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                BSD
            </td>
            <td>
                BSD
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network5">API Reference Guide - BSD Sockets</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput"> Wi-Fi - Throughput</a></li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Advanced Networking Features (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name
            </th>
            <th>Description
            </th>
            <th>Quality
            </th>
            <th>Related API Names
            </th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces
            </th>
            <th>Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Advanced Network Protocols
            </td>
            <td>
                <ul>
                    <li>HTTP/HTTPS Client</li>
                    <li>mDNS</li>
                    <li>DNS Client</li>
                    <li>Embedded MQTT</li>
                    <li>MQTT on host</li>
                </ul>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network9"> API Reference Guide - HTTP</a></li>
                    <li><a href="https://docs.silabs.com/wiseconnect/3.5.0/wiseconnect-api-reference-guide-mqtt/service-mqtt-functions"> API Reference Guide - MQTT</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network15"> API Reference Guide - mDNS</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network6">API Reference Guide - DNS</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/http_client_v6">Wi-Fi - HTTP Client</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/embedded_mqtt">Wi-Fi - Embedded MQTT Client</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/cloud_apps/azure_iot">Wi-Fi - Azure IoT MQTT Client Application</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/cloud_apps/aws_iot/mqtt">Wi-Fi - AWS IoT MQTT Client</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                mDNS over IPv6
            </td>
            <td>
                Host a Multicast Domain Name (mDNS) service over Internet Protocol version 6 (IPv6) to allow other network devices to look up your IPv6 address based on your host name.
            </td>
            <td>
                Alpha
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network15">API Reference Guide - mDNS</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                SNTP Client
            </td>
            <td>
                Retrieve date and time information from an SNTP server.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network12">API Reference Guide - SNTP</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/sntp_client_v6">Wi-Fi - SNTP Client</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                IGMP
            </td>
            <td>
                Add the multicast group and exchange multicast data on a UDP socket.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/network3">Multicast</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### IoT Cloud Integration (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name
            </th>
            <th>Description
            </th>
            <th>Quality
            </th>
            <th>Related API Names
            </th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces
            </th>
            <th>Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                AWS IoT Core
            </td>
            <td>
                Configure RS9116 as an IoT device and securely connect to the AWS IoT cloud to subscribe and publish on topics using the AWS MQTT library (version 3.1.0).
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/cloud_apps/aws_iot/mqtt">Wi-Fi - AWS IoT MQTT Client</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Azure IoT
            </td>
            <td>
                Configure the RS9116 as an Azure device endpoint, connect, and exchange messages with the Azure IoT Hub.
            </td>
            <td>
                Beta
            </td>
            <td>
                <ul>
                    <li>None</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/cloud_apps/azure_iot">Wi-Fi - Azure IoT MQTT Client Application</a></li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Bluetooth

[BT-Classic](#bt-classic) | [Bluetooth Low Energy](#bluetooth-low-energy)

###### BT-Classic (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name
            </th>
            <th>Description
            </th>
            <th>Quality
            </th>
            <th>Related API Names
            </th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces
            </th>
            <th>Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                BT Classic AT Commands
            </td>
            <td>
                Host shall use AT Commands for interacting with RS9116 Module.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116/wiseconnect/rs9116w-bt-classic-at-command-prm/latest/08-bt-classic-commands">BTC AT Commands</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - UART</li>
                </ul>
            </td>
            <td>
                <ul>
                    All applicable commands.
                </ul>
            </td>
        </tr>
    </tbody>
    <tbody>
        <tr>
            <td>
                Generic Access Profile (GAP)
            </td>
            <td>
                <p>GAP defines how Bluetooth devices discover each other, establish and manage connections, and control access modes (discoverable, connectable, etc.). </p>
                <p>It governs the fundamental behavior of device interactions, including pairing and authentication.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3">BT GAP APIs</a> for the complete API list.
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, UART, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    All applicable examples.
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Serial Port Profile (SPP)
            </td>
            <td>
                <p>SPP enables devices to emulate serial port communication over Bluetooth Classic using RFCOMM. </p>
                <p>It is widely used in industrial, medical, and embedded systems for wireless serial communication between devices like sensors, printers, and terminals.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic4#rsi-bt-spp-init">rsi_bt_spp_init</a> - Set the SPP profile mode.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic4#rsi-bt-spp-connect">rsi_bt_spp_connect</a> - Initiate the SPP profile level connection.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic4#rsi-bt-spp-disconnect">rsi_bt_spp_disconnect</a> - Initiate the SPP profile level disconnection.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic4#rsi-bt-spp-transfer">rsi_bt_spp_transfer</a> - Transfer data through SPP profile.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, UART, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_power_save">BT - Powersave</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing">BT - SPP Dual Role with Secure Pairing</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt_ble/bt_ble_dual_mode">BT/BLE - Dual Mode</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Secure Simple Pairing (SSP)
            </td>
            <td>
                Secure Simple Pairing is a feature that simplifies device pairing while providing strong protection against eavesdropping and man-in-the-middle attacks.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-accept-ssp-confirm"> rsi_bt_accept_ssp_confirm</a> - Confirms the passkey sent by the local BT device during pairing.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-reject-ssp-confirm"> rsi_bt_reject_ssp_confirm</a> - Rejects the passkey confirmation sent by the local BT device during pairing.</li>
                    <li> <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-set-ssp-mode"> rsi_bt_set_ssp_mode</a> - Enables or disables Simple Secure Profile (SSP) mode.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, UART, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing">BT - SPP Dual Role with Secure Pairing</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_a2dp_source_with_avrcp">BT - A2DP Source with AVRCP</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_power_save">BT - Power Save</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Advanced Audio Distribution Profile (A2DP) – Source Streaming
            </td>
            <td>
                <p>A2DP Source functionality allows the device to stream high-quality stereo audio from a source (e.g., smartphone or embedded device) to a sink (e.g., headphones or speakers) over Bluetooth. </p>
                <p>It supports standard SBC and optionally other audio codecs.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic1">BT A2DP APIs</a> for the complete API list</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_a2dp_source_with_avrcp">BT - A2DP Source with AVRCP</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Audio/Video Remote Control Profile (AVRCP)
            </td>
            <td>
                <p>AVRCP functionality allows the device to control audio/video playback remotely over Bluetooth. </p>
                <p>It supports standard remote control operations such as play, pause, stop, volume control, and track navigation for multimedia applications.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic2">BT AVRCP APIs</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_a2dp_source_with_avrcp">BT - A2DP Source with AVRCP</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Role Switch
            </td>
            <td>
                <p>Role switching allows a Bluetooth device to dynamically change roles between master and slave during an active connection.</p>
                <p>This is essential for topology flexibility, improved connection robustness, and compliance with role preference requirements in many applications.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li> <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-set-local-device-role"> rsi_bt_set_local_device_role</a> - Sets the role of local device, whether it is MASTER/SLAVE. </li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, UART, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_a2dp_source_with_avrcp">BT - A2DP Source with AVRCP</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Sniff Mode
            </td>
            <td>
                <p>Sniff mode is a low-power mode that reduces power consumption by allowing the device to periodically wake up and check for activity.</p>
                <p>This is particularly important for battery-operated Bluetooth peripherals like keyboards, mice, and remote controls.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-sniff-mode"> rsi_bt_sniff_mode</a> - Request the local device to enter into sniff mode. </li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-sniff-exit-mode"> rsi_bt_sniff_exit_mode</a> - Request the local device to exit from sniff/sniff subrating mode. </li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-classic3#rsi-bt-sniff-subrating-mode"> rsi_bt_sniff_subrating_mode</a> - Requests the device entered into the sniff sub rating mode. </li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, UART, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_power_save">BT - Powersave</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing">BT - SPP Dual Role with Secure Pairing</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/bt_ble/bt_ble_dual_mode">BT/BLE - Dual Mode</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Human Interface Device (HID) Profile
            </td>
            <td>
                <p>HID allows Bluetooth devices to interact as input devices, such as keyboards, mice, game controllers, or styluses.</p>
                <p>It supports both interrupt and control channels for low-latency and command communication, making it suitable for consumer electronics and PC peripherals.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li> <a href="https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-command/#rsibt-hidsendinterruptdata-hid-send-interrupt-data"> at+rsibt_hidsendinterruptdata</a> - HID Send Interrupt Data</li>
                    <li> <a href="https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-command/#rsibt-hidsendhandshakemsg-hid-send-handshake-message"> at+rsibt_hidsendhandshakemsg</a> -
                        HID Send Handshake Message</li>
                    <li> <a href="https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-command/#rsibt-hidsendcontrolmsg-hid-send-control-message"> at+rsibt_hidsendcontrolmsg</a> -
                        HID Send Control Message</li>
                    <li> <a href="https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-command/#rsibt-hidsendsdpconfig-hid-send-sdp-configuration-data"> at+rsibt_hidsendsdpconfig</a> -
                        HID Send SDP Configuration Data</li>
                    <li> <a href="https://docs.silabs.com/rs9116-bt-classic-at-prm/latest/rs9116-bt-classic-at-prm-command/#rsibt-hidreconnect-hid-reconnect"> at+rsibt_hidreconnect</a> -
                        HID Reconnect</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - UART, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    NA
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Bluetooth Low Energy (heading level 7)

###### Legacy Features (heading level 8)

<table>
    <thead>
        <tr>
            <th>
                Feature Name
            </th>
            <th>
                Description
            </th>
            <th>
                Quality
            </th>
            <th>
                Related API Names
            </th>
            <th>
                Supported Software Variants, Hardware, Modes, Host Interfaces
            </th>
            <th>
                Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                BLE AT Commands
            </td>
            <td>
                Host shall use AT Commands for interacting with RS9116 Module.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116/wiseconnect/rs9116w-ble-at-command-prm/latest/08-ble-commands">BLE AT Commands</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - UART</li>
                </ul>
            </td>
            <td>
                <ul>
                    All applicable commands
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                GAP
            </td>
            <td>
                <p>Advertising, Scanning, Connection Initiation, Establishment and Bonding</p>
                <p>Handling of access modes and procedures of the device including device discovery, link establishment, link termination, initiation of security features, and device configuration.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li> See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1">BLE GAP APIs</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Hardware boards - All</li>
                    <li>Chip revisions - All</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    All applicable examples
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Generic Attribute Protocol (GATT)
            </td>
            <td>
                <p>Defines how data is organized and exchanged between devices.</p>
                <p>It builds on the Attribute Protocol (ATT) by organizing data into hierarchical structures of profiles, services, and characteristics.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy2">BLE GATT APIs</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection Gatt Test</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Attribute Protocol (ATT)
            </td>
            <td>
                Fundamental layer responsible for managing data transmission and handling between devices, particularly within the context of the Generic Attribute Profile (GATT)
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy2">BLE ATT APIs</a> for the complete API list.
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection Gatt Test</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Security
            </td>
            <td>
                <p>Security in LE is handled by Security Manager Protocol. </p>
                <p>The Security Manager (SM) defines the protocol and behavior to manage pairing, authentication and encryption.</p>
                <p>It uses a key distribution approach to perform identity and encryption functionalities in radio communication.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-request">rsi_ble_smp_pair_request </a> - Request the SMP pairing process with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-failed">rsi_ble_smp_pair_failed </a> - Send SMP pairing failure reason to the remote device.</li>
                    <li> <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-ltk-req-reply"> rsi_ble_ltk_req_reply</a> - Send the local long term key of its associated local EDIV and local Rand.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-response"> rsi_ble_smp_pair_response</a> - Send SMP pairing response during the process of pairing with the remote device. </li>
                    <li> <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-passkey"> rsi_ble_smp_passkey</a> - Send SMP passkey during SMP pairing process with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-encrypt"> rsi_ble_start_encrypt</a> - Start the encryption process with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize"> rsi_ble_vendor_set_SMP_min_enc_keysize</a> - Set minimum Encryption Key Size.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_secureconnection">BLE Secure Connections</a>
                </ul>
                <ul><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_privacy">BLE Privacy</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Human Interface Device (HID) Profile
            </td>
            <td>
                <p>HID allows Bluetooth devices to interact as input devices, such as keyboards, mice, game controllers, or styluses.</p>
                <p>It supports both interrupt and control channels for low-latency and command communication, making it suitable for consumer electronics and PC peripherals.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li>See <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy2">BLE GATT APIs</a> for the complete API list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - UART, SDIO, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/hid_on_gatt">BLE - HID on GATT</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LL Privacy 1.2
            </td>
            <td>
                Enhanced privacy by allowing devices to use temporary, non-identifiable addresses (Resolvable Private Addresses or RPAs) instead of their public identity address
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-resolvlist">rsi_ble_resolvlist</a> - Resolvlist API used for multiple purposes based on the process type. It is used to add/remove/clear a device to/from the list.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-get-resolving-list-size">rsi_ble_get_resolving_list_size</a> - Request to get resolving list size.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-set-addr-resolution-enable">rsi_ble_set_addr_resolution_enable</a> - Request to enable address resolution, and to set resolvable private address timeout.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-set-privacy-mode">rsi-ble-set-privacy-mode</a> - Request to set privacy mode for particular device.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_privacy">BLE Privacy</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Accept List
            </td>
            <td>
                Feature responsible for restricting connection allowed to a particular BLE device.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-addto-acceptlist">rsi_ble_addto_acceptlist</a> - Add BD address to accept list.
                    </li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-deletefrom-acceptlist">rsi_ble_deletefrom_acceptlist</a> - Delete particular BD address from accept list.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-clear-acceptlist">rsi_ble_clear_acceptlist</a> - Clear all BD addresses present in accept list.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_accept_list">BLE - Acceptlist</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection GATT Test</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Directed Advertising
            </td>
            <td>
                Broadcasting information to a specific device (the scanner) identified by its address.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-start-advertising">rsi_ble_start_advertising</a> - Request the local device to start advertising. Directed advertising type and address can be mentioned as a parameter to this API.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_heart_rate_profile">BLE - Heart Rate</a></li>
                    <li>Multiple additional examples</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LE PHY and Coded PHY
            </td>
            <td>
                <p>LE PHY (1 Mbps, 2 Mbps, 2M PHY): Higher data throughput physical layer (2 Mbps) enabling faster data transfers while maintaining power efficiency for high-bandwidth applications.</p>
                <p>Coded PHY (125 kbps, 500 kbps): Extended range capability utilizing Forward Error Correction (FEC) allowing connectivity at up to 4x the standard distance in open environments.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-readphy">rsi_ble_readphy</a> - Reads the TX and RX PHY rates of the Connection.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-setphy">rsi_ble_setphy </a> - Set TX and RX PHY.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy8#rsi-ble-on-phy-update-complete-t">rsi_ble_on_phy_update_complete </a> - Indicates PHY rate update complete.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_longrange_2mbps">BLE - Longrange 2Mbps</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection GATT Test</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_throughput_app">BLE - Throughput App</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LE dual role topology
            </td>
            <td>
                Demonstrates ability to function as both a central and a peripheral simultaneously on different connections.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-start-advertising"> rsi_ble_start_advertising</a> - Request the local device to start advertising.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-start-scanning"> rsi_ble_start_scanning</a> - Start scanning.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection Gatt Test</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LE data packet length extensions (DLE)
            </td>
            <td>
                DLE allows Bluetooth LE devices to transmit data packets with larger payloads, increasing the maximum data rate and potentially improving throughput.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info"> rsi_ble_set_wo_resp_notify_buf_info</a> - Configure the buf mode for Notify and WO response commands for the remote device. </li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection Gatt Test</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Asymmetric PHYs
            </td>
            <td>
                The concept of asymmetric PHYs is where different PHYs (Physical Layers) are used for transmission (TX) and reception (RX).
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-setphy"> rsi_ble_setphy</a> - Set TX and RX PHY. A received event rsi_ble_on_phy_update_complete_t indicates PHY rate update complete.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_longrange_2mbps">BLE - Long Range 2 Mbps</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_throughput_app">BLE - Throughput</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified CoEx App</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_multiconnection_gatt_test">BLE - Multiconnection Gatt Test</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LE channel selection algorithm 2 (CSA#2)
            </td>
            <td>
                <p>The LE channel selection algorithm 2 (CSA#2), also known as Channel Selection Algorithm #2, is a more complex algorithm used to determine the channel index for the next connection event.</p>
                <p>It is designed to improve channel hopping and minimize interference, especially in high-throughput and high-interference scenarios.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    NA
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    All applicable examples.
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                LE Secure connections
            </td>
            <td>
                LE Secure Connections uses Elliptic-Curve Diffie-Hellman (ECDH) cryptography to generate a public-private key pair.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-request">rsi_ble_smp_pair_request </a> - Request the SMP pairing process with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-failed">rsi_ble_smp_pair_failed </a> - Send SMP pairing failure reason to the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-ltk-req-reply">rsi_ble_ltk_req_reply </a> - Send the local long term key of its associated local EDIV and local Rand.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-pair-response">rsi_ble_smp_pair_response </a> - Send SMP pairing response during the process of pairing with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-smp-passkey">rsi_ble_smp_passkey </a> - Send SMP passkey during SMP pairing process with the remote device.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-start-encryption">rsi_ble_start_encryption </a> - Start the encryption process with the remote device.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_secureconnection">BLE - Secure connections</a>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Advertising Extensions (heading level 8)

<table>
    <thead>
        <tr>
            <th>
                Feature Name
            </th>
            <th>
                Description
            </th>
            <th>
                Quality
            </th>
            <th>
                Related API Names
            </th>
            <th>
                Hardware Modules, Hardware Chipsets, Host Interfaces
            </th>
            <th>
                Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Extended Advertising
            </td>
            <td>
                <p>Use secondary advertising channels to offload data that would otherwise be transmitted on the primary advertising channel.</p>
                <p>Enables multiple sets of advertisements, each with their own data, intervals, duration, address types, filter policies and PHY rates.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-get-max-no-of-supp-adv-sets">rsi_ble_get_max_no_of_supp_adv_sets </a> - Get maximum number of advertising sets.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-set-ae-params">rsi_ble_set_ae_params </a> - Set the AE advertising parameters.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-start-ae-advertising">rsi_ble_start_ae_advertising </a> - Enable or disable AE advertising.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-get-max-adv-data-len">rsi_ble_get_max_adv_data_len </a> - Get maximum advertising data length.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-set-ae-set-random-address">rsi_ble_set_ae_set_random_address </a> - Update AE random address.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-set-ae-data">rsi_ble_set_ae_data </a> - Set the AE advertising data.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_peripheral">BLE - AE peripheral</a>
                </ul>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified AE app</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Extended Scanning
            </td>
            <td>
                <p>Extended scanning allows scanning for different PHY rates and supports different sets of scan interval, scan window, and scan type for each.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-set-scan-params">rsi_ble_ae_set_scan_params </a> - Set AE scan parameters.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-set-scan-enable">rsi_ble_ae_set_scan_enable </a> - Request the local device to enable scanning for both legacy and extended advertising PDUs.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_central">BLE - AE central</a>
                </ul>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified AE app</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Periodic Advertising Synchronization
            </td>
            <td>
                Periodic Advertising Synchronization in BLE allows multiple devices to wake up and receive data from a single source at the same time, enabling energy-efficient communication and data sharing.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-set-periodic-sync">rsi_ble_ae_set_periodic_sync </a> - Synchronize with a periodic advertising train from an advertiser and begin receiving periodic advertising packets. </li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_central">BLE - AE central</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Simultaneous scanning on 1 Mbps and Coded PHY
            </td>
            <td>
                Involves listening for advertisements on both PHYs at the same time.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-ae-set-scan-params"> rsi_ble_ae_set_scan_params</a> - Set AE scan parameters.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-ae-set-scan-enable"> rsi_ble_ae_set_scan_enable</a> - Request the local device to enable scanning for both legacy and extended advertising PDUs.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified AE app</a>
                </ul>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_central">BLE - AE central</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Periodic Advertising
            </td>
            <td>
                Periodic Advertising enables sending non connectable advertisements at fixed intervals.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-app-set-periodic-ae-params">rsi_ble_app_set_periodic_ae_params </a> - Set periodic advertising parameters.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-app-set-periodic-ae-enable">rsi_ble_app_set_periodic_ae_enable </a> - Enable periodic advertising.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                See example.<ul><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified AE app</a></ul>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_peripheral">BLE - AE peripheral</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Periodic Advertising List
            </td>
            <td>
                <p>A list of periodic advertising events that provides a schedule or timetable of when a device will send its advertisement data at regular intervals.</p>
                <p>This allows devices to synchronize with the advertiser and receive data at the specified times, saving power and improving efficiency.</p>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-dev-to-periodic-list">rsi_ble_ae_dev_to_periodic_list </a> - Manage a device in the periodic advertiser list. This function adds a device to periodic advertiser list stored in the controller.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-read-periodic-adv-list-size">rsi_ble_ae_read_periodic_adv_list_size </a> - Get periodic advertiser list size.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_central">BLE - AE central</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Periodic Advertising Scanning
            </td>
            <td>
                Scan for periodic advertisements.
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-dev-to-periodic-list">rsi_ble_ae_set_scan_params </a> - Set AE scan parameters.</li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy5#rsi-ble-ae-dev-to-periodic-list">rsi_ble_ae_set_scan_enable </a> - Enable scanning for both legacy and extended advertising PDUs.</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - 1.5</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_ae_central">BLE - AE central</a>
                </ul>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/unified_ae_coex_app">BLE - Unified AE app</a>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Power Save (heading level 8)

<table>
    <thead>
        <tr>
            <th>
                Feature Name
            </th>
            <th>
                Description
            </th>
            <th>
                Quality
            </th>
            <th>
                Related API Names
            </th>
            <th>
                Hardware Modules, Hardware Chipsets, Host Interfaces
            </th>
            <th>
                Related Example Names
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Wireless Power Save
            </td>
            <td>
                <ul>
                    <li>BLE Advertising with power save</li>
                    <li>BLE Scan with power save</li>
                    <li>BLE connection with power save</li>
                    <li>Only Max PSP power save mode is supported for BLE</li>
                </ul>
            </td>
            <td>
                GA
            </td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-ble#rsi-bt-power-save-profile"> rsi_bt_power_save_profile</a> - Selects the power save profile mode for BT/BLE. </li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision - All</li>
                    <li>OPNs - All</li>
                    <li>Boards - All</li>
                    <li>Modes - NCP Host</li>
                    <li>Interface - SPI, SDIO, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li> <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/ble/ble_power_save">BLE - Powersave</a> </li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### Multiprotocol

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Wi-Fi Station (STA) + BT Mode
            </td>
            <td>
                <p>Co-existence of Wi-Fi Station (STA) mode and Bluetooth (BT) on the same radio, supporting complex use cases with minimal interference. This solution is built on a Time Division Multiplexing (TDM) architecture that schedules radio access between Wi-Fi and BT with optimal performance.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
                <p><a href="https://docs.silabs.com/rs9116-ble-at-prm/latest/rs9116-ble-at-prm-command/">BLE AT Commands</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role">WLAN HTTPS BT SPP BLE Dual Role</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role">WLAN Throughput BT SPP BLE Dual Role</a></li>
                </ul>
                <p><strong>Note:</strong> This release does not include a standalone Wi-Fi + BT example. To use the Wi-Fi + BT + BLE examples for Wi-Fi + BT functionality only, disable the RSI_ENABLE_BLE_TEST macro.</p>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi Station (STA) + BLE Mode
            </td>
            <td>
                <p>Co-existence of Wi-Fi STA mode and BLE on the same radio, supporting complex use cases with minimal interference. This solution is built on a TDM architecture that schedules radio access between Wi-Fi and BLE with optimal performance.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
                <p><a href="https://docs.silabs.com/rs9116-ble-at-prm/latest/rs9116-ble-at-prm-command/">BLE AT Commands</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_ble_ae_coex_app">WLAN BLE AE Coex App</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_ble_power_save">WLAN BLE Power Save</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_station_ble_bridge">WLAN Station BLE Bridge</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_station_ble_provisioning">WLAN Station BLE Provisioning</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_station_ble_provisioning_aws">WLAN Station BLE Provisioning AWS</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select">WLAN Station BLE Provisioning Select</a></li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi + BLE PTA 3-wire Co-existence
            </td>
            <td>
                <p>Enable connecting two devices via GPIOs, with Wi-Fi as primary and external BLE as secondary, ensuring better performance on the same radio without interference. The solution relies on a radio-sharing mechanism using request, priority, and grant signals. The PTA secondary manages the request and priority, while the PTA primary handles the grant to ensure optimal performance without interference.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI</li>
                </ul>
                <p><strong>Note:</strong> Flow control must be disabled to support PTA in NCP mode.</p>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput">Wi-Fi - Throughput</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi + Zigbee / OpenThread PTA 3-wire Co-existence
            </td>
            <td>
                <p>Enable connecting two devices via GPIOs, with Wi-Fi as primary and external Zigbee or OpenThread as secondary, ensuring better performance on the same radio without interference. The solution relies on a radio-sharing mechanism using request, priority, and grant signals. The PTA secondary manages the request and priority, while the PTA primary handles the grant to ensure optimal performance without interference.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI</li>
                </ul>
                <p><strong>Note:</strong> Flow control must be disabled to support PTA in NCP mode.</p>
            </td>
            <td>
                <ul>
                    <a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput">Wi-Fi - Throughput</a>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                Wi-Fi STA + BT + BLE Co-existence
            </td>
            <td>
                <p>Co-existence of Wi-Fi Station (STA) mode, classic Bluetooth and Bluetooth Low Energy (BLE) on the same radio, supporting complex use cases with minimal interference. This solution is built on a Time Division Multiplexing (TDM) architecture that schedules radio access between Wi-Fi and BLE with optimal performance.</p>
            </td>
            <td>GA</td>
            <td>
                <ul><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan">API Reference Guide - Client</a></ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <ul>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role">WLAN HTTPS BT SPP BLE Dual Role</a></li>
                    <li><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role">WLAN Throughput BT SPP BLE Dual Role</a></li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

###### RS9116 Platform

[Firmware Update](#firmware-update) | [Auto Join](#auto-join)

###### Firmware Upgrade (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Firmware Loading through UART and SPI
            </td>
            <td>
                <p>Load firmware via ISP using UART interface or SPI interface.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/firmware#firmware-update-ap-is">API Reference Guide - Firmware Update From Host</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/firmware_update">Firmware update</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Secure Over-the-Air (OTA) Update
            </td>
            <td>
                <p>Perform OTA firmware update via Wi-Fi from a remote HTTP/HTTPS server.</p>
            </td>
            <td>GA</td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/firmware#firmware-update-ap-is">API Reference Guide - Firmware Update from Module</a></p>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
            <td>
                <p><a href="https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/snippets/wlan/http_otaf">Wi-Fi - HTTP/HTTPS OTAF Update</a></p>
            </td>
        </tr>
    </tbody>
</table>

###### Auto Join (heading level 7)

<table>
    <thead>
        <tr>
            <th>Feature Name</th>
            <th>Description</th>
            <th>Quality</th>
            <th>Related API Names</th>
            <th>Chip Revision, Hardware, Modes, Host Interfaces</th>
            <th>Related Example Names</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                Store configuration
            </td>
            <td>
                <p>Store the profile information in the flash, so that it can be used for consecutive connection or reconnection.</p>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-wlan-commands/#rsi-cfgget-rsi-configget-get-stored-configuration">rsi_cfgget</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-wlan-commands/#rsi-usercfg-store-user-configuration">rsi_usercfg</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-get-profile">rsi_wlan_get_profile</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-fill-config-profile">rsi_fill_config_profile</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-fill-config-profile">rsi_wlan_delete_profile</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI</li>
                </ul>
            </td>
            <td>
                <p><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-wlan-commands/#example-41">AT command example</a></p>
            </td>
        </tr>
        <tr>
            <td>
                Auto join.
            </td>
            <td>
                <p>Auto join to the profile stored using store configuration.</p>
            </td>
            <td>GA</td>
            <td>
                <ul>
                    <li><a href="https://docs.silabs.com/rs9116-wifi-at-prm/latest/rs9116-wifi-at-prm-wlan-commands/#rsi-trigger-auto-config-trigger-auto-configuration">rsi_trigger_auto_config</a></li>
                    <li><a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/wlan#rsi-wlan-enable-auto-config">rsi_wlan_enable_auto_config</a></li>
                </ul>
            </td>
            <td>
                <ul>
                    <li>Chip Revision All</li>
                    <li>Boards All</li>
                    <li>Host interfaces: UART, SPI</li>
                </ul>
            </td>
            <td>
                None
            </td>
        </tr>
    </tbody>
</table>

##### Unsupported Features

[Wi-Fi](#wi-fi-1) | [Network Stack](#network-stack-1) | [Bluetooth](#bluetooth-1) | [Multiprotocol](#multiprotocol-1) | [RS9116 Platform](#rs9116-platform-1)

###### Wi-Fi

- AMSDU transmit is not supported.
- UAPSD is not supported.
- Fragmentation is not supported.
- AMSDUs within AMPDU is not supported.
- Currently, the RS9116 does not support the radio measurement requests feature of CCX V2.
- 802.11k is not supported.
- Short GI is not supported.
- 2.4 and 5 GHz bands do not support 40 MHz bandwidth.
- 802.11J channels less than 16 are not supported.
- Auto PAC Provisioning in EAP-FAST with TLSv1.2 is not supported.
- SA query procedure is not supported in 11W AP mode.
- Channel 144 is not supported.
- AP standalone mode does not support Tx aggregation. Rx aggregation is supported with limited number of BA sessions.
- In concurrent mode - AP mode, aggregation (Tx/Rx) is not supported.
- IEEE802.11R roaming is not supported.

###### Network Stack

- In AT mode, the total MQTT command length (apart from MQTT publish) should not exceed 150 bytes. This includes at+rsi (start of command) to (end of command)\r\n.
- Configure MQTT_VERSION in rsi_mqtt_client.h based on the server configuration; only version 3 and 4 are supported.
- In Wi-Fi-only mode, the module supports either three concurrent TLS connections or one TCP and two TLS connections.
- TLS curve IDs supports from 15-28. TLS handshake with third party clients depends on the TLS curve.
- Transparent mode is unsupported in USB-CDC mode.
- RC4_SHA, DES_CBC3_SHA, and RC4_MD5 ciphers are not supported in enterprise security

###### Bluetooth

###### Bluetooth Classic (heading level 7)

- BT sniff mode does not work if BT multiple peripherals feature is enabled.
- For BT Classic, only one connection is supported at a time.
- When using the rsibt_spptxv2 command, if the data length field value is set higher than the actual number of data bytes provided, the firmware enters a continuous polling state waiting for the remaining data. This results in either no response from the device or causes the system to become unresponsive.
- BT A2DP is only supported in RS9116 Silicon revision 1.5.
- BT-A2DP encoder is not supported in the firmware.
- BT-A2DP is not supported in AT mode.
- BT-A2DP streaming is not supported during Wi-Fi download.
- BT-HID is supported only on the UART interface.
- BT-HID might not interoperate with Apple devices.
- RC clock feature is not supported in BT classic.

###### Bluetooth Low Energy (heading level 7)

- For BLE, if the connection is established with a small connection interval (<15 ms), simultaneous roles are not supported (that is, Central/Peripheral + Advertising/Scanning).
- BLE peripheral latency value is valid up to 32 only.
- Maximum supported AE data length is 200 bytes.
- Maximum supported ADV_EXT sets is 2.
- A maximum of two BLE connections are supported (one central + one peripheral).
- SMP is not supported in AE applications "ble_ae_central" and "ble_ae_peripheral".
- GATT transactions and data transfer are not supported in AE applications "ble_ae_central" and "ble_ae_peripheral".
- BLE duty cycling is not supported.
- BLE does not support the store user configuration method.
- Wake on wireless is not supported for BLE.
- RTOS is unsupported in ae_peripheral, and ae_central applications.
- RC clock feature is not supported with Rev 1.4 hardware.
- The 9116 uses a software-based HRNG for BLE operations because the on-chip Hardware Random Number Generator (HRNG) may exhibit limited entropy or repeated output patterns under certain operating conditions.

###### Multiprotocol

- The following multi-protocol modes are not supported: Wi-Fi Access Point + BLE, Wi-Fi Access Point + BT, and Wi-Fi Access Point + BT + BLE.
- For AT commands, Wi-Fi + BT + BLE (Opermode 9) and BT + BLE (Opermode 8 ) do not work.
- In Wi-Fi + BLE mode, if the BLE scan interval and window have the same value, then the Wi-Fi connection might be unsuccessful.

###### RS9116 Platform

- Wake on Wireless support has only been tested for the UART AT command interface.
- Firmware update via bootloader method requires the user to check the integrity of the RPS file content. A corrupt image may cause the chip to become unresponsive to host commands.

#### SDK Release and Maintenance Policy

For information about the SDK release and maintenance policy, see [https://www.silabs.com/developer-tools/sdk-release-and-maintenance-policy](https://www.silabs.com/developer-tools/sdk-release-and-maintenance-policy).

### RS9116 Platform SDK Version 2.14.0 (June 2, 2026) - Release Notes

[**Wi-Fi 4 RS9116x Series**](.)

The RS9116 Platform software development kit (SDK/SAPI) provides platform features on Silicon Labs SiWx91x microcontrollers, including peripherals, drivers, and services.

Click [here](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tags) for earlier releases.

#### Release Summary

[Key Features](#key-features) | [API Changes](#api-changes) | [Bug Fixes](#bug-fixes) | [Chip Enablement](#chip-enablement)

##### Key Features

None

##### API Changes

None

##### Bug Fixes

- Fixed LP GPIO based wakeup powersave issue.

##### Chip Enablement

None

#### Key Features

[New Features](#new-features) | [Enhancements](#enhancements) | [Removed Features](#removed-features) | [Deprecated Features](#deprecated-features)

> **Note**: See [Feature Matrix](../wifibt-wc-release-notes/#feature-matrix) for a list of any applicable APIs, examples, software variants, modes, hardware, and host interfaces for each feature.

##### New Features

None

##### Enhancements

None

##### Removed Features

None

##### Deprecated Features

None

#### API Changes

[New APIs](#new-apis) | [Modified APIs](#modified-apis) | [Removed APIs](#removed-apis) | [Deprecated APIs](#deprecated-apis)

##### New APIs

None

##### Modified APIs

None

##### Removed APIs

None

##### Deprecated APIs

None

#### Bug Fixes

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1599779
            </td>
            <td>
                Fixed LP GPIO based wakeup powersave issue.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: SPI, UART, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

#### Chip Enablement

None

#### Application Example Changes

[New Examples](#new-examples) | [Modified Examples](#modified-examples) | [Removed Examples](#removed-examples) | [Deprecated Examples](#deprecated-examples)

##### New Examples

None

##### Modified Examples

None

##### Removed Examples

None

##### Deprecated Examples

None

#### Known Issues and Limitations

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue or Limitation Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Workaround (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1502403
            </td>
            <td>
                When coexistence (coex) is configured, the RS9116 may enter powersave mode before the configured monitor interval for inactivity.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1502453
            </td>
            <td>
                The FTP client application does not work with EFx32/STM32 when an RTOS is used.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1502452
            </td>
            <td>
                The HTTP OTA update application does not work with EFR32 and EFM32 when an RTOS is used.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1502446
            </td>
            <td>
                Firmware update does not work for the EFM32 platform.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1502450
            </td>
            <td>
                SAPI driver with the UART host interface is only supported on bare metal.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1502400
            </td>
            <td>
                Powersave without RAM retention does not work when the SPI interface is used.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1077954
            </td>
            <td>
                MQTT receive may encounter failures in STA + AP concurrent mode.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1221686
            </td>
            <td>
                On the EFM platform, standby-associated listen interval current consumption is higher than expected.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1557514
            </td>
            <td>
                USB-CDC enumeration has an issue with USB 1.1. Although the negotiated maximum packet size is 512 bytes, only 64‑byte operation is successful.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

### Wi-Fi  SDK Version 2.14.0 (June 2, 2026) - Release Notes

[**Wi-Fi 4 RS9116x Series**](.)

The Wi-Fi software development kit (SDK) provides Wi-Fi 4 connectivity in various operating modes, including Station and Software Access Point (SoftAP).

Click [here](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tags) for earlier releases.

#### Release Summary

[Key Features](#key-features) | [API Changes](#api-changes) | [Bug Fixes](#bug-fixes) | [Chip Enablement](#chip-enablement)

##### Key Features

- Verification of the Roaming feature.

##### API Changes

None

##### Bug Fixes

- Resolved an issue where the EAP-TLS client failed to send the complete certificate chain during mutual authentication.
- Sending Keep-Alive/GARP at the configured Keep-Alive periodicity (default 30 s), independent of data transfer, to avoid interop issues.
- Added a new SAPI error code STORE_CONFIG_NOT_AVAILABLE (0x6C) for RSI_REQ_CFG_GET to distinguish "no store configuration available" from generic memory-allocation failures
- Beacon drops should not be seen in power save mode in 5 GHz.

##### Chip Enablement

None

#### Key Features

[New Features](#new-features) | [Enhancements](#enhancements) | [Removed Features](#removed-features) | [Deprecated Features](#deprecated-features)

> **Note**: See [Feature Matrix](../wifibt-wc-release-notes/#feature-matrix) for a list of any applicable APIs, examples, software variants, modes, hardware, and host interfaces applicable for each feature.

##### New Features

None

##### Enhancements

- Verification of the Roaming feature.

##### Removed Features

None

##### Deprecated Features

None

#### API Changes

[New APIs](#new-apis) | [Modified APIs](#modified-apis) | [Removed APIs](#removed-apis) | [Deprecated APIs](#deprecated-apis)

##### New APIs

None

##### Modified APIs

None

##### Removed APIs

None

##### Deprecated APIs

None

#### Bug Fixes

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1581054
            </td>
            <td>
                EAP-TLS Client Does Not Send Complete Certificate Chain During Mutual Authentication.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1528028
            </td>
            <td>
                Improve RSI_CFG_GET Error Message for Missing Configuration.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1589922
            </td>
            <td>
                Socket termination due to GARP failure from RS9116.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1535421
            </td>
            <td>
                Beacon drops should not be seen in power save mode in 5 GHz
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

#### Chip Enablement

None

#### Application Example Changes

[New Examples](#new-examples) | [Modified Examples](#modified-examples) | [Removed Examples](#removed-examples) | [Deprecated Examples](#deprecated-examples)

##### New Examples

None

##### Modified Examples

None

##### Removed Examples

None

##### Deprecated Examples

None

#### Known Issues and Limitations

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue or Limitation Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Workaround (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1582409
            </td>
            <td>
                Station forward compatibility with APs advertising various AKMs in the RSN IE is currently failing.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1638284
            </td>
            <td>
                The PTK reinstallation test with a random ANonce in the 4-way handshake is passing functionally, but the certification suite is reporting an incorrect failure status.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1484360
            </td>
            <td>
                The new cipher suites ECDHE-RSA-AES256-SHA and ECDHE-RSA-AES128-SHA are not recognized in the latest versions of radisus server.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1592218
            </td>
            <td>
                WPA3_Personal and WPA2_Enterprise with wrong PSK is triggering Timeout callback handler.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                WPA3 Connection with Hunting and Pecking algorithm takes about three to four seconds.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                If the station performs a scan in concurrent mode (Wi-Fi STA + AP), stations connected to the AP may be disconnected. Enable AP after the STA connection is completed.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                With powersave, PTA 3-wire co-existence does not work. However, if a weak pull-up is applied on the GRANT pin, the PTA 3-wire functionality works while the power is saved. For further information, refer to Application Notes.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                EAP security in the aws_device_shadow application is unsupported on the EFR platform due to memory constraints.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In STA + AP, if AP started first station scan is supported only in channel in which AP is brought up. If multiple channel scan is requested, AP behaviour is undefined.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                Auto channel selection is not supported in AP mode when the EXT_FEAT_IEEE_80211J feature is enabled.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1250359, 1532130
            </td>
            <td>
                This build is not WFA-certifiable due to RSNO and WMM issues; fixes are planned for the next release.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi client mode, disconnections may occur if the AP does not acknowledge QoS null frames when powersave is enabled.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1535439
            </td>
            <td>
                Observed repeated beacon misses every 5 seconds when using 1.4A7 board 5G band.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: A7</li>
                    <li>Chip revision: 1.4</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                During mutual authentication in EAP‑TLS, the client transmits both the leaf and intermediate certificates to the server only when using combined certificate chain loading. Intermediate certificate support is not available in individual certificate loading.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

### Network Stack SDK Version 2.14.0 (June 2, 2026) - Release Notes

[**RS9116**](.)

The Netstack software development kit (SDK) provides robust network protocol support, including TCP/IP, UDP, and DNS capabilities for embedded applications.

Click [here](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tags) for earlier releases.

#### Release Summary

[Key Features](#key-features) | [API Changes](#api-changes) | [Bug Fixes](#bug-fixes) | [Chip Enablement](#chip-enablement)

##### Key Features

- Added CRC-32 integrity validation for RS9116 SAPI APIs.
- Extended the embedded MQTT username length support to 512 bytes.

##### API Changes

None

##### Bug Fixes

- Fixed MQTT publish failure (0x0030 / TX_DATA_PACKET_SIZE_EXCEEDED) for MQTT topics exceeding 99 bytes in AT mode.
- Fixed SNTP subcommands returning 0xFFF8 (ERROR_IN_CMD) and resolved stale time reporting in SNTP_CLIENT_GET_TIME in AT mode.
- Fixed WLAN initialization failure in the wlan_https_bt_spp_ble_dual_role_v6 example when WPA3-Personal is enabled along with 802.11W (PMF).
- Fixed DUT hang and missing BLE advertise/scan packets over the air in the wlan_throughput_bt_spp_ble_dual_role application.
- Fixed AWS publish failures with power save enabled in the wlan_station_ble_provisioning_aws application.
- Fixed BLE disconnection issues observed during HTTP GET operation in BLE + WLAN coexistence mode over the UART interface.
- Corrected the documented security_type values for the rsi_wlan_ap_start() API to match the actual supported security modes.
- Added a readme for the wlan_ble_power_save example.
- Updated the RSI_IP_TOS value table to match the IEEE 802.11e / WMM Access Category mapping.
- Fixed IP configuration failure (error code 0x21) observed in the station_ping example when CONNECT_WITH_PMK was enabled, by documenting the required SECURITY_TYPE setting (RSI_WPA2_PMK).
- Updated the HTTP GET and HTTP PUT documentation to clarify SNI usage, custom cipher suite configuration, and the required parameter sequence.
- Replaced the Silabs Connect mobile app with the Simplicity Connect app in the wlan_station_ble_provisioning example for compatibility with the latest Android versions.
- Documented the upper and lower limits of the MQTT keep_alive_interval parameter in the rsi_emb_mqtt_client_init API.

##### Chip Enablement

None

#### Key Features

[New Features](#new-features) | [Enhancements](#enhancements) | [Removed Features](#removed-features) | [Deprecated Features](#deprecated-features)

> **Note**: See [Feature Matrix](../wifibt-wc-release-notes/#feature-matrix) for a list of any applicable APIs, examples, software variants, modes, hardware, and host interfaces for each feature.

##### New Features

- Added CRC-32 integrity validation for RS9116 SAPI APIs.
- Extended the embedded MQTT username length support to 512 bytes.

##### Enhancements

None

##### Removed Features

None

##### Deprecated Features

None

#### API Changes

[New APIs](#new-apis) | [Modified APIs](#modified-apis) | [Removed APIs](#removed-apis) | [Deprecated APIs](#deprecated-apis)

##### New APIs

None

##### Modified APIs

None

##### Removed APIs

None

##### Deprecated APIs

None

#### Bug Fixes

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1588871
            </td>
            <td>
                Fixed MQTT publish failure (0x0030 / TX_DATA_PACKET_SIZE_EXCEEDED) for MQTT topics exceeding 99 bytes in AT mode.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: SPI, UART, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1534531
            </td>
            <td>
                Fixed SNTP subcommands returning 0xFFF8 (ERROR_IN_CMD) and resolved stale time reporting in SNTP_CLIENT_GET_TIME in AT mode.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1639460
            </td>
            <td>
                Fixed WLAN initialization failure in the wlan_https_bt_spp_ble_dual_role_v6 example when WPA3-Personal is enabled along with 802.11W (PMF).
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1635489
            </td>
            <td>
                Fixed DUT hang and missing BLE advertise/scan packets over the air in the wlan_throughput_bt_spp_ble_dual_role application.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1600627
            </td>
            <td>
                Fixed AWS publish failures with power save enabled in the wlan_station_ble_provisioning_aws application.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1603789
            </td>
            <td>
                Corrected the documented security_type values for the rsi_wlan_ap_start() API to match the actual supported security modes.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1347675
            </td>
            <td>
                Added a readme for the wlan_ble_power_save example.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1616763
            </td>
            <td>
                Updated the RSI_IP_TOS value table to match the IEEE 802.11e / WMM Access Category mapping.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1603928
            </td>
            <td>
                Fixed IP configuration failure (error code 0x21) observed in the station_ping example when CONNECT_WITH_PMK was enabled, by documenting the required SECURITY_TYPE setting (RSI_WPA2_PMK).
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1543833
            </td>
            <td>
                Updated the HTTP GET and HTTP PUT documentation to clarify SNI usage, custom cipher suite configuration, and the required parameter sequence.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1498081
            </td>
            <td>
                Replaced the Silabs Connect mobile app with the Simplicity Connect app in the wlan_station_ble_provisioning example for compatibility with the latest Android versions.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1453571
            </td>
            <td>
                Documented the upper and lower limits of the MQTT keep_alive_interval parameter in the rsi_emb_mqtt_client_init API.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1649389
            </td>
            <td>
                Fixed BLE disconnection issues observed during HTTP GET operation in BLE + WLAN coexistence mode over the UART interface.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

#### Chip Enablement

None

#### Application Example Changes

[New Examples](#new-examples) | [Modified Examples](#modified-examples) | [Removed Examples](#removed-examples) | [Deprecated Examples](#deprecated-examples)

##### New Examples

None

##### Modified Examples

None

##### Removed Examples

None

##### Deprecated Examples

None

#### Known Issues and Limitations

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue or Limitation Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Workaround (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>NA
            </td>
            <td>
                Embedded MQTT does not support reassembly of fragmented MQTT packets. MQTT transactions may fail if fragmented packets are received from the broker.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                TLS handshakes may occasionally fail due to incorrect ECC curve parameter generation, resulting in a BBD2 error. The issue resolves on the next attempt.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                MQTT disconnects may occur during firmware updates if powersave is enabled. Disable powersave during the update and re-enable it after completion.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                All GCM-based cipher suites are software-implemented and may exhibit limited performance.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                The recommended MQTT publish payload is 1 kB.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                If HTTP server functionality is enabled, do not use port 80 for the MQTT client.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Randomize the client port if using rapid connect/disconnect of the MQTT session on the same client port with powersave.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Secure TLS renegotiation is not supported in the embedded networking stack.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                In WPA2 enterprise security mode, getting wireless statistics using rsi_wlan_get() API has restrictions.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                The <b>wlan_throughput_bt_spp_ble_dual_role</b> example is not supported on bare metal platforms.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                In concurrent mode, communication loss could occur on the STA application when, simultaneously, multiple clients are connected to the APUT.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                IP address conflict detection has limitations in STA + AP concurrent mode, and failures are not reported to host.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                mqtt_client and mqtt_client_v6 applications do not support the SDIO host interface.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                If a corrupted firmware image is received during OTA updates via TCP/HTTP, the module may become unresponsive on the next bootup.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                TLS connection problems may occur when attempting to revoke public and private keys using existing keys.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Observed inconsistencies in TCP and UDP RX throughput in AP-alone mode.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Observed that a duplicate IPv6 address is assigned to multiple STAs in AP mode.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Ping timeouts may occur when configured with a 1-second timeout.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Applications using the USB interface support Wi-Fi-only, Wi-Fi + BLE, and Wi-Fi + BTC modes. The Wi-Fi + BLE + BTC coexistence mode is not supported in OS-enabled (Linux) environments and is limited to bare-metal and FreeRTOS only.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                Command-based soft reset using the USB interface is not supported. The application must perform a chip reset.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>NA
            </td>
            <td>
                ULP Power Save mode is not supported.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1557290
            </td>
            <td>
                TCP TX/RX throughput may be ~30% lower than UDP.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1629919
            </td>
            <td>
                HTTP GET requests fail when downloading large files (~1 MB) on RS9116W in UART + SAPI mode.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1649047
            </td>
            <td>
                In STA + BLE coexistence throughput scenarios, UDP RX and TCP RX operations fail when Robust Mode is enabled.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1648571
            </td>
            <td>
                UDP TX throughput operations fail in STA + BLE coexistence mode, irrespective of whether Robust Mode is enabled or disabled.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1648555
            </td>
            <td>
                SSL TX and SSL RX throughput operations yield no data transfer in the STA + BLE coexistence throughput application, irrespective of whether Robust Mode is enabled or disabled.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

### RS9116 Bluetooth LE SDK Version 2.14.0 (June 2, 2026) - Release Notes

[**RS9116**](.)

#### Release Summary

[Key Features](#key-features) | [API Changes](#api-changes) | [Bug Fixes](#bug-fixes) | [Chip Enablement](#chip-enablement)

##### Key Features

None

##### API Changes

- [rsi_ble_vendor_set_SMP_min_enc_keysize](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize)

##### Bug Fixes

- Fixed an issue where the peripheral disconnected immediately when reading coded PHY rates on A7 boards with power save enabled, occurring only when LE Coded PHY (LR) was configured.
- Fixed a hang issue that occurred when a connection cancel request was triggered with an invalid remote BD address.
- Repeated passkey strings occur when the RS9116 module operates as a peripheral with power-save functionality during multiple reconnection iterations.
- Fixed the BLE re-pairing attack vulnerability by adding a new API, rsi_ble_vendor_set_SMP_min_enc_keysize, which sets the minimum encryption key size (typically 7–16).

#### Chip Enablement

None

#### Key Features

[New Features](#new-features) | [Enhancements](#enhancements) | [Removed Features](#removed-features) | [Deprecated Features](#deprecated-features)

> **Note**: See [Feature Matrix](../wifibt-wc-release-notes/#feature-matrix) for a list of any applicable APIs, examples, software variants, modes, hardware, and host interfaces for each feature.

##### New Features

- Added support for the RC clock for BLE on Rev 1.5 boards.

##### Enhancements

None

##### Removed Features

None

##### Deprecated Features

None

#### API Changes

[New APIs](#new-apis) | [Modified APIs](#modified-apis) | [Removed APIs](#removed-apis) | [Deprecated APIs](#deprecated-apis)

##### New APIs

|New API Signature|Deprecated API replaced by this (if any)|
|---|---|
|`int32_t` [rsi_ble_vendor_set_SMP_min_enc_keysize](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize) `(uint8_t min_keysize)`|None|

##### Modified APIs

None

##### Removed APIs

None

##### Deprecated APIs

None

#### Bug Fixes

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1601307
            </td>
            <td>
                Fixed an issue where the peripheral disconnected immediately when reading coded PHY rates on A7 boards with power save enabled, occurring only when LE Coded PHY (LR) was configured.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: 1.4, 1.5</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1614985
            </td>
            <td>
                Fixed a hang issue that occurred when a connection cancel request was triggered with an invalid remote BD address.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: 1.4, 1.5</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1378574, 1596704
            </td>
            <td>
                Repeated passkey strings occur when the RS9116 module operates as a peripheral with power-save functionality during multiple reconnection iterations.
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: 1.4, 1.5</li>
                    <li>Host interface: SPI, UART, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1354933
            </td>
            <td>
                Fixed the BLE re-pairing attack vulnerability by adding a new API, <a href="https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize">rsi_ble_vendor_set_SMP_min_enc_keysize</a>, which sets the minimum encryption key size (typically 7–16).
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: 1.4, 1.5</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

##### Removed Examples

None

##### Deprecated Examples

None

#### Known Issues and Limitations

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue or Limitation Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Workaround (if any)</th>
            <th>Affected Chip Revision, Hardware Modules, Host Interfaces</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                1633218
            </td>
            <td>
                When the RC clock is enabled, the DUT stops BLE advertising at –20 °C. This issue is observed only on the A7 board.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards - A7</li>
                    <li>Chip revisions - 1.5</li>
                    <li>interface - All</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1533268
            </td>
            <td>
                BTC and BLE Power Save is not supported with the USB interface.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards - All</li>
                    <li>Chip revisions - All</li>
                    <li>Interface - USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                None
            </td>
            <td>
                The 9116 uses a software-based HRNG for BLE operations because the on-chip Hardware Random Number Generator (HRNG) may exhibit limited entropy or repeated output patterns under certain operating conditions.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards - All</li>
                    <li>Chip revisions - All</li>
                    <li>Interface - All</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

### Multi-Protocol  SDK Version 2.14.0 (June 2, 2026) - Release Notes

[**Wi-Fi 4 RS9116x Series**](.)

The Multiprotocol software development kit (SDK) provides Wi-Fi and BLE coexistence and packet traffic arbitration (PTA) features.

Click [here](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tags) for earlier releases.

#### Release Summary

[Key Features](#key-features) | [API Changes](#api-changes) | [Bug Fixes](#bug-fixes) | [Chip Enablement](#chip-enablement)

##### Key Features

None

##### API Changes

None

##### Bug Fixes

None

##### Chip Enablement

None

#### Key Features

[New Features](#new-features) | [Enhancements](#enhancements) | [Removed Features](#removed-features) | [Deprecated Features](#deprecated-features)

> **Note**: See [Feature Matrix](../wifibt-wc-release-notes/#feature-matrix) for a list of any applicable APIs, examples, software variants, modes, hardware, and host interfaces for each feature.

##### New Features

None

##### Enhancements

None

##### Removed Features

None

##### Deprecated Features

None

#### API Changes

[New APIs](#new-apis) | [Modified APIs](#modified-apis) | [Removed APIs](#removed-apis) | [Deprecated APIs](#deprecated-apis)

##### New APIs

None

##### Modified APIs

None

##### Removed APIs

None

##### Deprecated APIs

None

#### Bug Fixes

None

#### Chip Enablement

None

#### Application Example Changes

[New Examples](#new-examples) | [Modified Examples](#modified-examples) | [Removed Examples](#removed-examples) | [Deprecated Examples](#deprecated-examples)

##### New Examples

None

##### Modified Examples

None

##### Removed Examples

None

##### Deprecated Examples

None

#### Known Issues and Limitations

<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>Issue or Limitation Description</th>
            <th>GitHub / Salesforce Reference (if any)</th>
            <th>Workaround (if any)</th>
            <th>Affected Chip Revision, Hardware, Host Interface</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + BLE mode, BLE may disconnect if the supervision timeout is set below 16 seconds.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                WPS is not supported.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + BLE or BLE-only modes, BT/BLE reconnection issues may occur when Wi-Fi disconnects.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                1215476
            </td>
            <td>
                In Wi-Fi + BT mode, Wi-Fi throughput logs are not displayed in serial terminals (for example, TeraTerm) when BT SPP is connected using the wlan_bt_throughput_app demo.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + BT/BLE CoEx mode, high Wi-Fi broadcast traffic may cause BT/BLE disconnections.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + BT mode, continuous Wi-Fi data may prevent BT from reconnecting after disconnection.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + BLE mode, Wi-Fi connection attempts may be unsuccessful when the BLE scan interval and scan window parameters are equal.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                In Wi-Fi + AE Coexistence:
                <li>Enable power save to test the Wi-Fi + AE coexistence use cases.</li>
                <li>Maximum supported BLE scan interval and window for 100% duty cycling is 3 seconds.</li>
                <li>Remove bond information on remote device for every connection if SMP is enabled.</li>
                <li>Maximum of 2 extended Advertising sets are supported.</li>
                <li>Maximum of 2 BLE connections ( 1 central + 1 peripheral) are supported.</li>
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interface: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
        <tr>
            <td>
                NA
            </td>
            <td>
                Wi-Fi STA + BT + BLE multiprotocol use cases requires a detailed understanding of the use cases and associated configurations. Contact Silicon Labs support for additional details.
            </td>
            <td>
                None
            </td>
            <td>
                None
            </td>
            <td>
                <ul>
                    <li>Hardware boards: All</li>
                    <li>Chip revision: All</li>
                    <li>Host interfaces: UART, SPI, USB</li>
                </ul>
            </td>
        </tr>
    </tbody>
</table>

## Getting Started

### Getting Started with RS9116W and USB Host Interface on Linux Platform

This guide describes how to get started developing an RS9116W application on a Linux host using the WiSeConnect™ Simple Application Programming Interface (SAPI).

![Getting Started Block Diagram](/wifibt-wc-getting-started-with-usb/0.3/images/getting-started-block-diagram.png)

Getting started with application development on Linux with USB host interface involves the following steps:

- [Getting Started with RS9116W and USB Host Interface on Linux Platform](#getting-started-with-rs9116w-and-usb-host-interface-on-linux-platform)  
  - [32 bit i386 Build Guide for Debian or Ubuntu 64 bit Systems](#32-bit-i386-build-guide-for-debian-or-ubuntu-64-bit-systems)    
    - [Enable Multiarch and Install toolchain once per machine](#enable-multiarch-and-install-toolchain-once-per-machine)    
    - [Add 32bit Flags to your Build System](#add-32bit-flags-to-your-build-system)    
    - [Verify the binary](#verify-the-binary)  
  - [Download the WiSeConnect™ Software Driver Package](#download-the-wiseconnect-software-driver-package)  
  - [Update the RS9116W Firmware](#update-the-rs9116w-firmware)  
  - [Connect the RS9116 EVK to the Linux PC](#connect-the-rs9116w-evk-to-the-linux-pc)  
  - [Enable the USB interface for SAPI execution](#enable-the-usb-interface-for-sapi-execution)  
  - [Compile and insert the USB driver module](#compile-and-insert-the-usb-driver-module)    
    - [For TCP-IP Stack Driver](#for-tcp-ip-stack-driver)    
    - [For TCP-IP Bypass Driver](#for-tcp-ip-bypass-driver)  
  - [Open an Example Project on Linux Terminal](#open-an-example-project-on-linux-terminal)  
  - [Compiling the Example Project](#compiling-an-example-project)  
  - [Run an Example Project](#run-an-example-project)  
  - [Enabling or Disabling the TX and RX Prints](#enabling-or-disabling-the-tx-and-rx-prints)

#### 32 bit i386 Build Guide for Debian or Ubuntu 64 bit Systems

The following steps describe how to build and verify a 32‑bit binary on a 64‑bit Debian/Ubuntu system.

##### Enable Multiarch and Install Toolchain (once per machine)

Run the following commands.

`sudo dpkg --add-architecture i386`

`sudo apt update`

`sudo apt install -y build-essential gcc-multilib g++-multilib libc6-dev-i386 libc6:i386 libstdc++6:i386`

##### Add 32‑bit Flags to your Build System

Open the `linux.mk` file present in the linux platform path (for example, `<wiseconnected_sdk>/platform/linux/linux.mk`) and make the following changes.

`CFLAGS      += -m32`

`LINKER_FLAGS += -m32` **(If your build uses LDFLAGS, use LDFLAGS += -m32)**

Then build using the following command.

`make linux`

##### Verify the Binary

Verify if the binary is 32-bit by using following command:

`file path/to/your/binary` (for example, file **<wiseconnected_sdk>/examples/snippets/wlan/station_ping**)

![Check the Binary](/wifibt-wc-getting-started-with-usb/0.3/images/check-the-binary.png)

> **Note!**
> 
> Expect: ELF 32-bit LSB executable, Intel 80386, ...file

#### Download the WiSeConnect™ Software Driver Package

Download or clone the [WiSeConnect Software Driver Package](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/) from the [Silicon Labs GitHub](https://www.github.com/SiliconLabs) space.

#### Update the RS9116W Firmware

When you first receive a RS9116 EVK, or when updating to a new version of the WiSeConnect Software Driver Package, we recommend updating the RS9116W firmware to the latest available version. There are several ways to update firmware, but the recommended method to get started is outlined in the section, [Updating RS9116W Firmware](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/update-evk-firmware).

> **Note!**<br />Disconnect the RS9116W EVK from the host MCU board before updating the firmware. The host MCU connections might interfere with the update process.

#### Connect the RS9116W EVK to the Linux PC

Connect the RS9116 EVK module and Host Linux PC as illustrated in the following picture:

![Linux Host to RS9116W EVK Connections](/wifibt-wc-getting-started-with-usb/0.3/images/linux-host-to-rs9116w-evk-connections.png)

**STEP 1.** Set the ISP switch on the RS9116W EVK to the OFF position.

**STEP 2.** Connect the Linux PC using a USB to Mini USB connector on the RS9116W EVK as shown above.

Complete hardware details of the RS9116 EVK can be found in the [RS9116 EVK User's Guide](https://www.silabs.com/documents/login/user-guides/ug453-rs9116x-evk-hw-users-guide.pdf).

#### Enable the USB interface for SAPI Execution

Open `linux.mk` file present in the linux platform path (for example, `<wiseconnected_sdk>/platform/linux/linux.mk`).

- Enable `RSI_USB_INTERFACE` macro.
- Disable `RSI_UART_INTERFACE` macro.

#### Compile and Insert the USB Driver Module

##### For TCP-IP Stack Driver

**STEP 1.** Open the file `rsi_config.h` present in the path, `<wiseconnect_sdk>/platforms/linux/driver/common/include`.

**STEP 2.** Change `RSI_INTERFACE` define to `RSI_USB`.

**STEP 3.** Disable the `RSI_TCP_IP_BYPASS` macro in `rsi_config.h`.

**STEP 4.** Navigate to USB driver path (for example, `<wiseconnect_sdk>/platforms/linux/driver/usb/src`) and compile the USB driver.

**STEP 5.** Compile the USB driver using `make clean; make` command.

**STEP 6.** Insert the USB driver module using `sudo insmod rpsusb.ko` command.

##### For TCP-IP Bypass Driver

**STEP 1.** Open the file `rsi_config.h` present in the path, `<wiseconnect_sdk>/platforms/linux/driver/common/include`.

**STEP 2.** Change `RSI_INTERFACE` define to `RSI_USB`.

**STEP 3.** Enable `RSI_TCP_IP_BYPASS` macro in `rsi_config.h`.

**STEP 4.** Navigate to USB driver path (for example, `<wiseconnect_sdk>/platforms/linux/driver/usb/src`) and compile the USB driver.

**STEP 5.** Compile the USB driver using `make clean; make` command.

**STEP 6.** Insert the USB driver module using `sudo insmod rpsusb.ko` command.

![Insert USB Driver Module](/wifibt-wc-getting-started-with-usb/0.3/images/insert-usb-driver-module.png)

#### Open an Example Project on Linux Terminal

The WiSeConnect SDK includes a number of ready-made example projects for the Linux development environment. A list of examples and documentation detailing the operation of each example can be found in: [WiSeConnect Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/).

- Navigate to any of the example path (for example, `<wiseconnect_sdk>/examples/snippets/wlan/station_ping`).  
  - Make the necessary changes like `SSID` and `PASSWORD`.

#### Compiling an Example Project

Compile the application using command `make linux`. The binary will be generated in the same path.

#### Run an Example Project

Run the application using `./application_name` (for example, In the above case `./station_ping`).

![Application Execusion](/wifibt-wc-getting-started-with-usb/0.3/images/application-execusion.png)

#### Enabling or Disabling the TX and RX Prints

Navigate to SAPI path and Open `sapi.mk` file. (for example, `<wiseconnect_sdk>/sapi/sapi.mk`).

- Enable the macro `RSI_ENABLE_DEBUG_PRINT` to enable the TX and RX prints.
- Disable the macro `RSI_ENABLE_DEBUG_PRINT` to disable the TX and RX prints.

### Getting Started with a PC

#### Getting Started with PC using AT Commands

The fastest way to get started with the WiSeConnect™ software is to use a [RS9116 Evaluation Kit (EVK)]({docSpace}/{docSpaceVersion}/wifibt-rs9116x-evk/) and PC with a terminal application such as [Tera Term](https://github.com/TeraTermProject/teraterm).

To get started with app development on a host MCU instead, see [Getting Started with a EFx32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/) or [Getting Started with a STM32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-stm32/).

![Getting Started with PC Block Diagram](/wifibt-wc-getting-started-with-pc/0.26/images/getting-started-terminal.png)

Using AT-Commands and a Tera Term example script, your EVK will be connected to a wireless network in minutes.

There's just a few steps involved:

- [Download WiSeConnect™ software](#download-wi-se-connect)
- [Connect the EVK](#connect-the-evk)
- [Verify the RS9116 firmware version](#verify-the-rs9116-firmware-version)
- [Run Tera Term example scripts](#run-tera-term-example-scripts)

##### Download WiSeConnect™

The software package is available directly in Simplicity Studio for Silicon Labs EFx32 hosts.  See [Getting Started with a EFx32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/#explore-the-wi-se-connect-software-driver-package).  For other MCU hosts or if you are not using Simplicity Studio, the software package can be downloaded directly from the [Silicon Labs GitHub](https://www.github.com/SiliconLabs) space.

- [Download the latest **WiSeConnect™ Software Driver Package**](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)

**Additional Software Requirements**

The terminal program [Tera Term](https://github.com/TeraTermProject/teraterm) is **required** to complete the steps in this guide.  Other terminal programs can be used to control the RS9116W however the example scripts used in this guide will only work with Tera Term. [Download Tera Term for PC](http://en.sourceforge.jp/projects/ttssh2/releases/).

##### Connect the EVK

**STEP 1.** Connect the EVK to a PC using the USB interface labeled **UART** as identified below.

![RS9116 EVK UART Port](/wifibt-wc-getting-started-with-pc/0.26/images/rs9116-sb-evk-uart.jpg)

There are several USB connectors on the RS9116 EVK.  For the purposes of basic evaluation using a PC, the UART port is recommended due to its low power consumption.  Alternatively, the USB-CDC interface can be used to achieve higher throughput.  When using the USB-CDC interface the basic operation outlined on this page remains the same.

**STEP 2.** If this is the first time connecting the EVK to your PC, verfy that it is properly detected by the PC.  The EVK will appear to the PC as a COM port labeled **USB Serial Port (COMx)**.  If the EVK is not properly detected you may need to [download and install the FTDI Virtual COM Port (VCP) driver](https://www.ftdichip.com/Drivers/VCP.htm).

![Windows Device Manager](/wifibt-wc-getting-started-with-pc/0.26/images/device-manager-com-port.png)

**STEP 3.** Configure your terminal application with the following settings:

- Configure the serial port settings to **115200 baud / 8-bit data / No parity / 1 stop bit**
- Enable **local echo**
- Set receive and transmit new-line characters to **CR+LF**

See, [Tera Term setup instructions.](tera-term-setup)

##### Verify the RS9116 Firmware Version

If this is the first time using the RS9116 EVK or if you recently downloaded a new version of the WiSeConnect™ Software Driver Package, the firmware that is currently installed on the EVB may be outdated and may require updating. The instructions below describe how to load and check the firmware version.  For instructions on how to update the firmware see, [Updating the RS9116W EVK Firmware](update-evk-firmware)

**STEP 1.** After power-up or reset, enter the bootloader as follows (this sequence sends the key combination **`|U`**).

- press and hold **`Shift`**
- press then release **`|`** (the 'vertical line' or 'pipe' character)
- press then release **`u`**
- release **`Shift`**

The console displays the bootloader menu after the characters `|UU` as shown in the following example.

```sh
WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware   
A Load Wireless Firmware (Image No : 0-f)   
B Burn Wireless Firmware (Image No : 0-f)   
5 Select Default Wireless Firmware (Image No : 0-f)   
K Check Wireless Firmware Integrity (Image No : 0-f)   
7 Enable GPIO Based Bypass Mode   
8 Disable GPIO Based Bypass Mode   
Q Update KEY   
Z JTAG Selection   
```

---

**Note!**
The bootloader menu does not appear automatically on boot because the device waits to perform Auto Baud Rate Detection (ABRD).  The character sequence **`Shift + |`** followed by **`Shift + u`** initiates ABRD causing the device to enter bootloader mode.  For more details on ABRD and the bootloader, see the [RS9116W Programming Reference Manuals]({docSpace}/{docSpaceVersion}/wifibt-wc-programming-reference-manuals/).

---

**STEP 2.** Press **`1`** to load the default firmware.  The console displays **`Loading...`** followed by **`Loading Done`** as shown in the example below. Note that **`1`** is shown twice as in **`11`** because both Tera Term and the RS9116 bootloader echo any character typed.

```sh
|UU   
   
WELCOME TO REDPINE SIGNALS   
   
BootLoader Version 1.0   
   
1 Load Default Wireless Firmware   
A Load Wireless Firmware (Image No : 0-f)   
B Burn Wireless Firmware (Image No : 0-f)   
5 Select Default Wireless Firmware (Image No : 0-f)   
K Check Wireless Firmware Integrity (Image No : 0-f)   
7 Enable GPIO Based Bypass Mode   
8 Disable GPIO Based Bypass Mode   
Q Update KEY   
Z JTAG Selection   
  
11   
Loading...   
Loading Done   
```

---

**Note!**

- The bootloader automatically loads the default firmware after 20 seconds if a selection is not made.
- If the console only displays **`Loading...`** without **`Loading Done`**, the device may be in legacy binary mode. See, [Switching between legacy binary mode and AT-command mode](switch-binary-modes).
- The device can be configured in 'Bootloader Bypass Mode' as described in the [RS9116W Programming Reference Manuals]({docSpace}/{docSpaceVersion}/wifibt-wc-programming-reference-manuals/).

---

**STEP 3.** Query the version of the firmware by typing the command **`at+rsi_fwversion?`** as shown in the following console example.

```sh
...   
  
Loading...   
Loading Done   

at+rsi_fwversion?   
OK1610.2.4.0.0036    
```

**STEP 4.** If the firmware version does not match the firmware image provided with the WiSeConnect™ SDK, then a firmware update is required. The firmware image is found in the WiSeConnect software package at the path `<SDK>/firmware`.  The firmware version is specified as part of the file name.  For update instructions see, [Updating the RS9116W EVK Firmware](update-evk-firmware).

##### Run Tera Term Example Scripts

The WiSeConnect™ SDK includes several Tera Term example scripts that use AT-Commands to demonstrate basic RS9116W functionality.  The scripts are found in the WiSeConnect™ SDK in the folder `<SDK>/examples/at_commands/teraterm`

When using these examples to evaluate power consumption please use the UART interface as described in [Connect the EVK](#connect-the-evk).

A complete list of examples and and instructions on running each example can be found in [AT Command Examples]({docSpace}/{docSpaceVersion}/wifibt-wc-at-command-examples/).

It is recommended that you start with the [Wi-Fi Station Mode Example]({docSpace}/{docSpaceVersion}/wifibt-wc-at-command-examples/station-mode-readme).

#### Setting up Tera Term for use with the RS9116 EVK

To communicate with the RS9116 EVK, the terminal program should be configured to COM parameters 115200 8N1, local echo should be enabled and New-line characters should be set to CR+LF.  The steps below show how perform this setup using Tera Term.  The procedure may differ for other terminal programs.

**STEP 1.** Open Tera Term and bring up the New Connection dialog using the menu option **File -> New Connection**. Select the COM port that matches the EVK.

![Tera Term new connection](/wifibt-wc-getting-started-with-pc/0.26/images/tera-term-new-connection.png)

**STEP 2.** Open the Terminal setup dialog using the menu option **Setup -> Terminal...** then configure the Receive and Transmit New-line characters to **CR+LF** and enable **Local echo**.

![Tera Term terminal setup](/wifibt-wc-getting-started-with-pc/0.26/images/tera-term-terminal-setup.png)

**STEP 3.** Open the Serial port setup and connection dialog using the menu option **Setup -> Serial port...** then configure the serial port parameters.

![Tera Term serial port setup](/wifibt-wc-getting-started-with-pc/0.26/images/tera-term-serial-port-setup.png)

---

**Note!**
Tera Term settings can be saved by selecting the menu option **Setup -> Save setup...**.  If the default file `teraterm.ini` is used, the configured settings will be restored each time Tera Term is opened.

---

#### Updating RS9116W Firmware

The steps below assume that the RS9116 EVK is connected to the PC and [Tera Term](https://github.com/TeraTermProject/teraterm) is setup to communicate with the board as described in: [Getting Started with RS9116 EVK and WiSeConnect™]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/)

---

**Note!**
Faster firmware upload speeds can be acheived by using the RS9116 EVK's USB-CDC interface instead of the UART interface.

---

**STEP 1.** After power-up or reset, enter the bootloader as follows (this sequence sends the key combination **`|U`**).

- press and hold **`Shift`**
- press then release **`|`** (the 'vertical line' or 'pipe' character)
- press then release **`u`**
- release **`Shift`**

The console displays the bootloader menu after the characters `|UU` as shown in the following example.

```sh
|UU

WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware
A Load Wireless Firmware (Image No : 0-f)
B Burn Wireless Firmware (Image No : 0-f)
5 Select Default Wireless Firmware (Image No : 0-f)
K Check Wireless Firmware Integrity (Image No : 0-f)
7 Enable GPIO Based Bypass Mode
8 Disable GPIO Based Bypass Mode
Q Update KEY
Z JTAG Selection
```

**STEP 2.** Press **`B`** to write new firmware, a console prompt appears **`Enter Wireless Image No (0-f)`**.  Press **`0`** to select the first image.  The console then prompts for the firmware image as shown in the following example. Characters appear twice because both Tera Term and the RS9116 bootloader echo any character typed.

```sh
|UU

WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware
A Load Wireless Firmware (Image No : 0-f)
B Burn Wireless Firmware (Image No : 0-f)
5 Select Default Wireless Firmware (Image No : 0-f)
K Check Wireless Firmware Integrity (Image No : 0-f)
7 Enable GPIO Based Bypass Mode
8 Disable GPIO Based Bypass Mode
Q Update KEY
Z JTAG Selection

BB 

Enter Wireless Image No (0-f)
00

Send RS9116.NBZ.WC.GENR.x.x.x.rps  
```

---

**Note!**
The RS9116 bootloader has the ability to load multiple firmware images, depending on the size of the images.  It is not typical for multiple images to be required therefore, for the purposes of this documentation, image 0 is always used.

---

**STEP 3.** In the Tera Term menu select **`File -> Transfer -> Kermit -> Send...`**.

![Tera Trem Kermit send menu](/wifibt-wc-getting-started-with-pc/0.26/images/file-transfer-kermit-send.png)

**STEP 4.** Navigate to the firmware image to be loaded.

---

**Note!**
The latest firmware image is provided in the RS9116 WiSeConnect software package at the path `<SDK>/firmware`.

---

A progress bar appears during the transfer as shown in the following example.

![Tera Term progress bar](/wifibt-wc-getting-started-with-pc/0.26/images/firmware-upgrade-loading.png)

**STEP 5.** Once the update is complete, the device prompts to enter another bootloader command.  Press **`1`** to load the default firmware.  The console displays **`Loading...`** followed by **`Loading Done`** as shown in the following example.

```sh
...

Loading...
Loading Done
```

---

**Note!**
The bootloader automatically loads the default firmware after 20 seconds if a selection is not made beforehand.

---

**STEP 6.** Verify the new firmware version by typing the command **`at+rsi_fwversion?`** as shown below.

```sh
...

at+rsi_fwversion?
OK1610.2.4.0.0036
```

#### Switching from Legacy Binary Mode to AT-Command Mode

The RS9116W legacy binary mode is no longer supported.

The steps below describe how to switch the RS9116W interface from legacy binary mode to AT-Command mode.  For more details, see [RS9116W Programming Reference Manuals]({docSpace}/{docSpaceVersion}/wifibt-wc-programming-reference-manuals/).

**STEP 1.** Reset the RS9116 Evaluation Kit (EVK) by pressing the reset button or by power-cycling the board.

**STEP 2.** Enter the bootloader by pressing `Shift + |` followed by `Shift + u`; the bootloader menu is displayed.

```sh
|UU

WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware
A Load Wireless Firmware (Image No : 0-f)
B Burn Wireless Firmware (Image No : 0-f)
5 Select Default Wireless Firmware (Image No : 0-f)
K Check Wireless Firmware Integrity (Image No : 0-f)
7 Enable GPIO Based Bypass Mode
8 Disable GPIO Based Bypass Mode
Q Update KEY
Z JTAG Selection
```

---

**Note!**
The bootloader menu does not appear automatically on boot because the device waits to perform Auto Baud Rate Detection (ABRD).  The character sequence **`Shift + |`** followed by **`Shift + u`** initiates ABRD causing the device to enter bootloader mode.  For more details on ABRD and the bootloader, see the [RS9116W Programming Reference Manuals]({docSpace}/{docSpaceVersion}/wifibt-wc-programming-reference-manuals/).

---

**STEP 3.** To confirm the device is in legacy binary mode, try loading the firmware by pressing **`1`**.  If the device is in legacy binary mode, the console displays **Loading...** followed a garbled sequence of characters as shown in the example console output below (alternately, if the device is in AT-Command mode, the console displays **Loading...** followed by **Loading Done**).

```sh
|UU

WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware
A Load Wireless Firmware (Image No : 0-f)
B Burn Wireless Firmware (Image No : 0-f)
5 Select Default Wireless Firmware (Image No : 0-f)
K Check Wireless Firmware Integrity (Image No : 0-f)
7 Enable GPIO Based Bypass Mode
8 Disable GPIO Based Bypass Mode
Q Update KEY
Z JTAG Selection

UU
Configuration Saved...
Enter Next Command

Loading...
&#533;&#236;?&#533;@
```

**STEP 4.** Press **`U`** to switch from legacy binary mode to AT-Command mode.

**STEP 5.** To confirm AT Command mode, follow Steps 1 through 3 described above and check the device prints **Loading Done** after the firmware loads as shown in the following example.

```sh
|UU

WELCOME TO REDPINE SIGNALS

BootLoader Version 1.0

1 Load Default Wireless Firmware
A Load Wireless Firmware (Image No : 0-f)
B Burn Wireless Firmware (Image No : 0-f)
5 Select Default Wireless Firmware (Image No : 0-f)
K Check Wireless Firmware Integrity (Image No : 0-f)
7 Enable GPIO Based Bypass Mode
8 Disable GPIO Based Bypass Mode
Q Update KEY
Z JTAG Selection

11
Configuration Saved...
Enter Next Command

Loading...
Loading Done
```

### Getting Started with EFx32

#### Getting Started with the EFR32

EFR32 is a family of Wireless Gecko System-on-Chip (SoC) devices from Silicon Labs, designed for low-power wireless communication in various IoT applications. These SoCs integrate a high-performance ARM Cortex-M processor with a wide range of wireless protocols such as Wi-Fi, Bluetooth, Zigbee, Thread, and proprietary RF, making them ideal for applications that require reliable wireless connectivity.

The following processors are supported with the EFR32 host.

> - RS9116W - To get started with an RS9116W with EFR32, see the [Starting with RS9116W with an EFR32 Host](getting-started-with-rs9116w-with-efr32) section.
> - RS916ACx - To get started with an RS916ACx with EFR32, see the [Starting with RS916ACx with an EFR32 Host](./getting-started-with-rs916acx-with-efr32) section.

#### Getting Started with RS9116W and an EFx32 Host

This guide describes how to get started developing a RS9116W application on an EFx32 embedded host MCU using the WiSeConnect™ Simple Application Programming Interface (SAPI).  For quick evaluation using only the EVK and a PC instead see [Getting Started with PC using AT Commands]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/).

![Getting Started MCU Block Diagram](/wifibt-wc-getting-started-with-efx32/0.27/images/getting-started-mcu.png)

Getting started with application development on an EFx32 involves the following steps:

- [Getting Started with RS9116W and an EFx32 Host](#getting-started-with-rs9116w-and-an-efx32-host)  
  - [Download and Install Simplicity Studio](#download-and-install-simplicity-studio)  
  - [Choose a host MCU Development Board](#choose-a-host-mcu-development-board)  
  - [Update the RS9116W Firmware](#update-the-rs9116w-firmware)  
  - [Connect the RS9116W EVK to the host MCU development board](#connect-the-rs9116w-evk-to-the-host-mcu-development-board)    
    - [For EFR32MG21 host MCU](#for-efr32mg21-host-mcu)      
      - [Power Save GPIO Connections](#power-save-gpio-connections)    
    - [For EFM32GG11 host MCU](#for-efm32gg11-host-mcu)      
      - [SDIO Pin Configuration Table :](#sdio-pin-configuration-table-)      
      - [Power Save GPIO Connections](#power-save-gpio-connections-1)  
  - [Open a Featured Example Project in Simplicity Studio](#open-a-featured-example-project-in-simplicity-studio)  
  - [Build, Run and Debug an Example Project on the Development Kit](#build-run-and-debug-an-example-project-on-the-development-kit)  
  - [Explore the WiSeConnect™ Software Driver Package](#explore-the-wiseconnect-software-driver-package)    
    - [Example Project Types](#example-project-types)  
  - [Import Snippet Example Projects into Simplicity Studio](#import-snippet-example-projects-into-simplicity-studio)    
    - [For EFR32MG21 host MCU](#for-efr32mg21-host-mcu-1)    
    - [For EFM32GG11 Host MCU](#for-efm32gg11-host-mcu-1)

##### Download and Install Simplicity Studio

Simplicity Studio is available for download at [www.silabs.com/simplicity-studio](https://www.silabs.com/simplicity-studio).  The steps outlined in this getting started guide require Simplicity Studio version 5.1.2 or later.

During installation, be sure to install the Technology Type: `32-Bit Microcontrollers`.  More details can be found at [Simplicity Studio Installation Instructions](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-getting-started/install-ss-5-and-software)

---

**Note!**
The WiSeConnect™ Software Driver Package is automatically downloaded by Simplicity Studio.  More details can be found in the section, [Explore the WiSeConnect™ Software Driver Package](#explore-the-wi-se-connect-software-driver-package).

---

##### Choose a host MCU Development Board

The example projects provided with the WiSeConnect™ Software Driver Package are designed to work out-of-the-box with the [EFR32MG21 Wireless Starter Kit (SLWSTK6006A)](https://www.silabs.com/development-tools/wireless/efr32xg21-wireless-starter-kit) or [EFM32GG11 Starter Kit (SLSTK3701A)](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit) and the [RS9116W Wi-Fi + Bluetooth Development Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-db-evk-development-kit).  Project files are provided for both the EFR32MG21 radio board version A (BRD4180A) and version B (BRD4180B), EFM32GG11 radio board version (BRD2204A)

The WiSeConnect™ driver software also works with other embedded host MCUs.  Details on porting the driver to other host MCUs can be found in the [RS9116W SAPI Porting Guide](https://www.silabs.com/documents/login/reference-manuals/rs9116w-sapi-porting-guide.pdf).

##### Update the RS9116W Firmware

When you first receive a RS9116 EVK, or when updating to a new version of the WiSeConnect™ Software Driver Package, we recommend updating the RS9116W firmware to the latest available version. There are several ways to update firmware, but the recommended method to get started is outlined in the section, [Updating RS9116W Firmware](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/update-evk-firmware).

---

**Note!**<br />Disconnect the RS9116W EVK from the host MCU board before updating the firmware, the host MCU connections may interfere with the update process.

---

##### Connect the RS9116W EVK to the host MCU development board

###### For EFR32MG21 host MCU

Connect the EFR32 Starter Kit, EXP adapter board and RS9116 EVB as illustrated in the following picture:

![EFR32 STK to RS9116W EVK Connections](/wifibt-wc-getting-started-with-efx32/0.27/images/efr32-rs9116evk-connections.png)

---

**Note!**
The EXP adapter board is included in the RS9116 Evaluation Kit.  If you have an older RS9116 Evaluation Kit that does not include the EXP adapter board, please request one through your [local sales representative](https://www.silabs.com/about-us/contact-sales?view=map).

---

**STEP 1.** Connect the EXP adapter board to the EFR32 starter kit EXP header.

**STEP 2.** Connect the EXP adapter board to the **SPI connector** of the RS9116 EVK using the 10-pin ribbon cable provided with the RS9116 EVK.

**STEP 3.** Connect the **RST_PS** pin on the RS9116 EVK to the pin labeled **11** on the **J4** header of the EXP adapter board using a jumper wire.

**STEP 4.** Set the **ISP** switch on the RS9116 EVK to the **OFF** position.

**STEP 5.** Connect the RS9116 EVK to a PC using the USB interface labeled **POWER**.  Note that this connection only provides power to the EVK.  There is no USB communication over this connection.

**STEP 6.** Connect the EFR32 Starter Kit to a PC using the Mini USB connector on the EFR32 Starter Kit.

Complete hardware details of the RS9116 EVK can be found in the [RS9116 EVK User's Guide](https://www.silabs.com/documents/login/user-guides/ug453-rs9116x-evk-hw-users-guide.pdf).

###### Power Save GPIO Connections (heading level 7)

The instructions above enable basic operation between the host MCU and RS9116.  Some low power examples require additional connections of the Ultra Low Power (ULP) GPIOs as detailed in the table below.  These details are valid for any example provided in the WiSeConnect™ SDK unless otherwise noted in the readme documentation of a particular example.

|Signal Name|EXP Adapter Board|RS9116 EVK|Notes|
|---|---|---|---|
|UULP_0 / UULP_3|J4 Pin 9|J9 Pin 5|If using a RS9116 EVK version 1.4 or newer connect UULP_0.  Otherwise connect UULP_3|
|UULP_2|J4 Pin 7|J9 Pin 4| |

###### For EFM32GG11 host MCU

Connect the EFM32 Starter Kit and RS9116 EVB as illustrated in the following picture:

![EFM32 STK to RS9116 EVK Connections](/wifibt-wc-getting-started-with-efx32/0.27/images/efm32-rs9116evk-connections.png)

**STEP 1.** Connect one end of the **SDIO connector** to EFM32 board using the **SDIO Pin Configuration Table** given below.

**STEP 2.** Connect the other end of **SDIO connector** to the RS9116 EVK.

**STEP 3.** Connect the **RST_PS** pin on the RS9116 EVK to the PIN11 on EFM32 board using a jumper wire.

**STEP 4.** Set the **ISP** switch on the RS9116 EVK to the **OFF** position.

**STEP 5.** Connect the RS9116 EVK to a PC using the USB interface labeled **POWER**.  Note that this connection only provides power to the EVK.  There is no USB communication over this connection.

**STEP 6.** Connect the EFM32 Starter Kit to a PC using the Mini USB connector on the EFM32 Starter Kit.

Complete hardware details of the RS9116 EVK can be found in the [RS9116 EVK User's Guide](https://www.silabs.com/documents/login/user-guides/ug453-rs9116x-evk-hw-users-guide.pdf).

###### SDIO Pin Configuration Table : (heading level 7)

|Pins on EFM32|On Expansion Header|Pins on RS9116 EVK|
|---|---|---|
|**PIN#**|**Signal**|**PIN#**|
|14|SDIO_DAT2|9|
|12|SDIO_DAT3|1|
|8|SDIO_CMD|2|
|10|SDIO_CLK|5|
|6|SDIO_DAT0|7|
|4|SDIO_DAT1|8|
|1|GND|3|
|20|3V3|4|

###### Power Save GPIO Connections (heading level 7)

The instructions above enable basic operation between the host MCU and RS9116.  Some low power examples require additional connections of the Ultra Low Power (ULP) GPIOs as detailed in the table below.  These details are valid for any example provided in the WiSeConnect™ software package unless otherwise noted in the readme documentation of a particular example.

|RS9116W PWR SAVE GPIOs peripheral J9 Header Pin|EFM32 Pin#|Function|Comment|
|---|---|---|---|
|UULP_0 / UULP_3|5|GPIO|If using a RS9116W EVK version 1.4 or newer connect UULP_0.  Otherwise connect UULP_3|
|UULP_2|3|GPIO| |

##### Open a Featured Example Project in Simplicity Studio

The WiSeConnect™ SDK includes a number of examples that are featured in Simplicity Studio.  A list of the featured examples along with documentation detailing the operation each example can be found in: [Featured Examples](example-applications-featured-index).  More details on the contents of the software package can be found in: [Explore the WiSeConnect™ Software Driver Package](#explore-the-wi-se-connect-software-driver-package).

**STEP 1.** Open Simplicity Studio and navigate to the [Launcher perspective](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-launcher).

![Simplicity Studio Launcher](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-launcher.png)

**STEP 2.** Under [My Products](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-launcher/my-products) add the `RS9116 Evaluation Kit with EFR32MG21` by typing `RS9116` then selecting the kit.

![Simplicity Studio My Products](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-my-products-rs9116.png)

The RS9116W Overview page should now display information about the RS9116W and EFR32MG21 kits.

![Simplicity Studio Kit Overview](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-overview-rs9116.png)

**STEP 3.** With the product `RS9116 Evaluation Kit with EFR32MG21` selected, navigate to the example projects by clicking on `Example Projects & Demos` then filter by the `RS9116 RS9116 SDK` as shown below.

![Simplicity Studio Example Products](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-example-projects-rs9116.png)

---

**Note!**
The `RS9116 Evaluation Kit with EFR32MG21` that was added in the previous step specifies the EFR32MG21 radio board version B (BRD4180B).  If instead you are using a EFR32MG21 radio board version A (BRD4180A) then, prior to selecting an example project, you must select the board under [Debug Adapters](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-launcher/debug-adapters) as shown below.

---

![Simplicity Studio Debug Adapter BRD4180A](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-debug-adapters-brd4180a.png)

**STEP 4.** Click the `Create` button for the project that you wish to open.  This will display the `New Project Wizard` which will allow you to rename your project, choose the location of your project and select whether you want the project files linked to the original location or copied into the new project location.  Typically, the default settings should be used for all options.  Click `Finish` to exit the wizard and create the new project.

![Simplicity Studio New Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-new-project-fw-update.png)

---

**Note!**
The mention of "SDK" in the `New Project Wizard`and in the Simplicity IDE refers to the EFR32 platform SDK known as the Gecko SDK (GSDK) and not the RS9116 WiSeConnect™ SDK.

---

**STEP 5.** After creating the project, Simplicity Studio will launch the [Simplicity IDE](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/) allowing you to build, run and debug the project.

![Simplicity Studio IDE with New Project](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-ide-fw-update.png)

##### Build, Run and Debug an Example Project on the Development Kit

![Simplicity Studio Build Debug Program Toolbar](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-toolbar-debug-build-program.png)

You can flash, run and debug the newly created example project simply by clicking on the `Debug` icon in the [Simplicity IDE toolbar](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/user-interface-review#toolbar).  This will build the project, flash it onto the attached STK and open the [Debugger Perspective](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-testing-and-debugging/using-the-debugger#debug-perspective).  Unless configured otherwise, the debugger will automatically break execution at the beginning of `main` allowing the user to step, run, or otherwise debug the application.  More details on using the debugger tools can be found at: [Using the Debuggers](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-testing-and-debugging/using-the-debugger).

To build the project without flashing and executing it, simply click on the `Build` icon in the [Simplicity IDE toolbar](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/user-interface-review#toolbar).  This will build the selected default configuration (debug or release).

A pre-built image can be programmed onto a device using the [Flash Programmer](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-building-and-flashing/flashing#flash-programmer) which is available by clicking the `Program` icon in the [Simplicity IDE toolbar](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/user-interface-review#toolbar).

Example specific details such as how to configure and operate the example can be found in [Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/).  The same information is also available in the `readme` file available with the example project source code.

##### Explore the WiSeConnect™ Software Driver Package

Simplicity Studio automatically downloads the official [WiSeConnect™ SDK repository](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/) from the [Silicon Labs GitHub](https://www.github.com/SiliconLabs) space. Therefore no action is required to integrate the software into Simplicity Studio.

For advanced situations, the integration between Simplicity Studio and the The WiSeConnect™ SDK GitHub repository can be managed using the `External Repos` settings in Simplicity Studio.  To view or edit the external repos settings go to `Preferences > Simplicity Studio > External Repos` as shown below. Here you can add, edit, update, or remove repos.  You can also select a specific branch, tag or a commit that you would like to use.

![Simplicity Studio External Repo Settings](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-external-repo-settings.png)

Once downloaded, Simplicity Studio will store the repository in the Simplicity Studio installation folder under `./developer/repos`.  On a Windows PC this is typicall found at `C:\SiliconLabs\SimplicityStudio\v5\developer\repos`.  You can explore the WiSeConnect™ SDK here.

---

**Note!**
Simplicity Studio will not download the full contents of the WiSeConnect™ SDK GitHub repo until the user opens one of the features example projects as described in: [Open a Featured Example Project in Simplicity Studio](#open-a-featured-example-project-in-simplicity-studio)

---

The WiSeConnect™ SDK is organized into the main folders described below.

|Folder|Description|
|---|---|
|`examples`|Contains host MCU example projects.  The example projects are divided into `featured`, `snippets` and `at_commands` as described below in [Example Project Types](#example-project-types).|
|`firmware`|Contains RS9116 firmware image|
|`platforms`|Contains platform specific source code for various available platforms.  Other platforms can be supported by following the [RS9116W SAPI Porting Guide](https://www.silabs.com/documents/login/reference-manuals/rs9116w-sapi-porting-guide.pdf).|
|`resources`|Contains various resources for the example projects and sapi including device certificates and scripts.|
|`sapi`|Contains the source code files for the [WiSeConnect™ Simple Application Programming Interface (SAPI)]({docSpace}/{docSpaceVersion}/wifibt-wc-sapi-reference/).|
|`third party`|Contains third party source code and tools such as freeRTOS, AWS SDK and more.|
|`utilities`|Contains varous utilities useful for evaluation and application developent.|

###### Example Project Types

The examples included in the WiSeConnect™ SDK are divided into the following types:

- **Featured** - Full featured projects that perform a key aspect of RS9116W evaluation or use-case.  Featured examples are available directly from Simplicity Studio.  Using a featured example is described in :[Open a Featured Example Project in Simplicity Studio](#open-a-featured-example-project-in-simplicity-studio)
- **Snippets** - Smaller projects that focus on one particular feature or API.  Snippets can be easily imported into Simplcity Studio as described in: [Import Snippet Example Projects into Simplicity Studio](#import-snippet-example-projects-into-simplicity-studio).
- **AT commands** - Pre-built Tera Term scripts used for evaluating the RS9116W directly from a PC.  More details can be found in: [Getting Started with RS9116 EVK and WiSeConnect™]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/).

##### Import Snippet Example Projects into Simplicity Studio

Snippet example projects are available in the WiSeConnect™ SDK in the subfolder folder `./examples/snippets`.  More information about the location of the WiSeConnect™ SDK, the folder structure and the example types can be found in: [Explore the WiSeConnect™ Software Driver Package](#explore-the-wi-se-connect-software-driver-package).

Snippet example projects can be easily imported into Simplicity Studio using the steps below:

###### For EFR32MG21 host MCU

**STEP 1.** Select `File > Import ...` from the Simplicity Studio menu.

**STEP 2.** Click `Browse` and navigate to the `projects` folder in the snippet example that you are wanting to import.  In this example we are using the `WLAN Station Ping` example found at `C:\SiliconLabs\SimplicityStudio\v5\developer\repos\wiseconnect\examples\snippets\wlan\station_ping\projects`.

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet.png)

**STEP 3.** The project names include the EFR32 board number associated with the project (e.g. brd4180a).  Select the project associated with the the board you are using and click `Next`.

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet-3.png)

**STEP 4.** Ensure there are no unresolved settings then click `Next`

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet-2.png)

**STEP 5.** Click `Finish`.  The [Simplicity IDE](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/) will be displayed with the imported project.  You can now [build, run and debug the project](#build-run-and-debug-an-example-project-on-the-development-kit).

![Simplicity Studio IDE with Imported Project](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-ide-station-ping.png)

###### For EFM32GG11 Host MCU

**STEP 1.** Select `File > Import ...` from the Simplicity Studio menu.

**STEP 2.** Click `Browse` and navigate to the `projects` folder in the snippet example that you are wanting to import.  In this example we are using the `WLAN Station Ping` example found at `C:\SiliconLabs\SimplicityStudio\v5\developer\repos\wiseconnect\examples\snippets\wlan\station_ping\projects`.

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet-efm.png)

**STEP 3.** The project names include the EFM32 board number associated with the project (e.g. brd2204a).  Select the project associated with the the board you are using and click `Next`.

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet-3-efm.png)

**STEP 4.** Ensure there are no unresolved settings then click `Next`

![Simplicity Studio Import Project Wizard](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-import-snippet-2-efm.png)

**STEP 5.** Click `Finish`.  The [Simplicity IDE](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-about-the-simplicity-ide/) will be displayed with the imported project.  You can now [build, run and debug the project](#build-run-and-debug-an-example-project-on-the-development-kit).

![Simplicity Studio IDE with Imported Project](/wifibt-wc-getting-started-with-efx32/0.27/images/ss-5-ide-station-ping-efm.png)

#### Getting Started with RS916ACx and an EFx32 Host

This guide describes how to get started with developing an application for the RS916ACx Expansion Board.

##### Prerequisites

###### Software

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Development Environment  
  - For EFR32, use [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/)
- [Iperf Application](https://iperf.fr/iperf-download.php) version 2.0.9 or later
- [Tera Term](https://osdn.net/projects/ttssh2/releases/) version 4.106 or later

> **NOTE:** Follow the [Simplicity Studio User Guide](https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-getting-started/install-ss-5-and-software)  to install Simplicity Studio IDE and the preferred  location for Simplicity Studio installation is C drive.

###### Hardware

- The guide can been executed with any one of the following Host MCUs.  
  - EFR32xG21 Starter Kit with Wireless Gecko (SLSWSTK6006A Baseboard: BRD4001A, Radio board: BRD4180a or BRD4180b)  
  - STM32 - STM32F411RE
- The guide can been executed with any one of the following ACx boards.  
  - BRD8037A - RS916AC0 Expansion board  
  - BRD8037B - RS916AC1 Expansion board
- Windows PC with a USB port
- Type C USB cable compatible with the computer's USB port (for e.g., type C to type A if the computer has a type A USB port).
- Wi-Fi Access Point (802.11 ax/b/g/n)

##### Update the RS916ACx Firmware

The steps for firmware update in RS916ACx expansion boards are as follows:

> **NOTE:** If the firmware upgrade does not work or the module does not respond, press the reset button on the board and try upgrading the firmware.

1. Before flashing the firmware onto RS916ACx, make sure the Mode selection switch is towards USB-UART and set the AEM or LDO power switch towards the LDO.
2. Connect the RS916ACx expansion to a PC using a Micro-USB to Type A as shown below.  
   ![Firmware Update Setup](/wifibt-wc-getting-started-with-efx32/0.27/images/firmware-update-setup.png)
3. Open the teraterm.ini file present in the Tera Term installation path (for example, **C:\Program Files (x86)\teraterm**).
4. Find the KmtLongPacket setting and update it to on if not already set.  
   ```c  
   KmtLongPacket=on  
   ```  
   > **NOTE:** Enabling the **Transmit/Receive Extended-length Packets** feature (KmtLongPacket) reduces the firmware update time from approximately 6 minutes 5 seconds to approximately 1 minute 2 seconds along with the baud rate settings described in the following steps.
5. Set up Tera Term or any Kermit application on your PC.
6. Open Tera Term and bring up the New Connection dialog using the menu option **File → New Connection**. Select the COM port that matches the EVK as shown in the following image.  
   ![Teraterm Setup](/wifibt-wc-getting-started-with-efx32/0.27/images/teraterm-setup.png)
7. Open the Serial port setup using the menu option **Setup → Serial port...**  
   ![Serial Port Selection](/wifibt-wc-getting-started-with-efx32/0.27/images/serial-port-selection.png)
8. To set baud rate, select the speed as **115200** and click on **New setting**  
   ![Baud Rate Selection](/wifibt-wc-getting-started-with-efx32/0.27/images/baud-rate-selection.png)  
   > **NOTE:** Tera Term settings can be saved by selecting the menu option **Setup → Save setup...** If the default file teraterm.ini is used, the configured settings will be restored each time Tera Term is opened.
9. Enter the characters **|U** while holding down the **Shift** button.
10. The bootloader menu is displayed.  
    ![Bootloader Menu](/wifibt-wc-getting-started-with-efx32/0.27/images/bootloader-menu.png)
11. Enter **B** to burn the firmware, then enter **0** to make the section in flash to upgrade the image.  
    ![Burn Flash Fw](/wifibt-wc-getting-started-with-efx32/0.27/images/burn-flash-fw.png)
12. Navigate to **File → Transfer → Kermit →Send** and select the image to upgrade.  
    ![Kermit Send](/wifibt-wc-getting-started-with-efx32/0.27/images/kermit-send.png)
13. To select the image, go to the **<wiseconnect_sdk> → firmware** and select **RS916W.x.x.x.0.x.rps**.  
    ![Fware Path](/wifibt-wc-getting-started-with-efx32/0.27/images/fware-path.png)
14. The process takes a few minutes to update the firmware.  
    ![Update Fware](/wifibt-wc-getting-started-with-efx32/0.27/images/update-fware.png)
15. Once sending the firmware file is completed, the bootloader starts to upgrade the firmware on to the actual location on the RS916ACx expansion board  
    ![Fware Upgrade Inprogress](/wifibt-wc-getting-started-with-efx32/0.27/images/fware-upgrade-inprogress.png)
16. Once the process is completed, a message appears saying **Upgradation Successful**. Enter **1** to load the updated firmware. (Even if you don’t enter 1, the firmware will be automatically loaded.)  
    ![Upgradation Success](/wifibt-wc-getting-started-with-efx32/0.27/images/upgradation-success.png)

> **NOTE:** With the increased baud rate, the firmware will be flashed and loaded in approximately 1 minute 2 seconds, with a firmware file of approximately 1.68 MB.

##### Connect the RS916ACx expansion board to the host MCU development board

![Setup](/wifibt-wc-getting-started-with-efx32/0.27/images/setup.png)

1. Connect the RS916ACx expansion header to the EFR32 starter kit, and make sure that the radio board is connected on the EFR32 starter kit
2. Connect the EFR32 starter kit to a PC using the mini-USB cable
3. Move the AEM or LDO power switch to AEM.
4. Move the Mode Selection switch to the EXP-UART side.

##### Simplicity Studio IDE setup

The following section details explain how to set up Simplicity IDE in Windows Operating System.

1. Connect the EFR32xG21 and RS916ACx expansion board to your PC using USB cable.
2. Launch Simplicity Studio on your PC.
3. Enter a workspace path (for example, **C:\Silicon labs**) used as Workspace and click **“Launch”.**  
   ![Workspace](/wifibt-wc-getting-started-with-efx32/0.27/images/workspace.png)
4. When the EFR32 is connected to PC, the detected radio board detection is displayed as shown below:  
   ![Radio Board Deduction](/wifibt-wc-getting-started-with-efx32/0.27/images/radio-board-deduction.png)

> **NOTE:** Based on radio board version select the project accordingly while importing:
> 
> - For **BRD4180A** or **BRD4181A**, select the project related to **brd4180a**.
> - For **BRD4180B** or **BRD4181B**, select the project related to **brd4180b**.

##### Create a Project

This section provides the steps for importing the project into theSimplicity IDE.

1. Go to **File** and select **Import** and click on **Browse**.  
   ![Import Project Step1](/wifibt-wc-getting-started-with-efx32/0.27/images/import-project-step1.png)
2. Navigate to the path, _**<wiseconnect_sdk> → examples → featured → wlan_throughput → projects**_ and click on **Select Folder**.  
   ![Import Project Step2](/wifibt-wc-getting-started-with-efx32/0.27/images/import-project-step2.png)
3. Select the appropriate project as per the detected board variant.  
   > **wlan_throughput_brd4180a-mg21** → **BRD4180A**  
   >   
   > **wlan_throughput_brd4180b-mg21** → **BRD4180B**.
4. Click on Next → Next.  
   ![Import Project Step3](/wifibt-wc-getting-started-with-efx32/0.27/images/import-project-step3.png)
5. Now click on Finish.  
   ![Import Project Step4](/wifibt-wc-getting-started-with-efx32/0.27/images/import-project-step4.png)
6. Once the project is successfully imported, the project name appears in the Project Explorer tab.

> **NOTE:** If Project Explorer tab is not seen by default, Go to Window→ Show View→ Project Explorer.

##### Configure an Application

Configure the settings for your example, as described in the **Application Build Environment** section in the README page of your example:

Wi-Fi - Throughput (NCP) - [Application Build Environment](https://github.com/SiliconLabs/wiseconnect/tree/master/examples/featured/wlan_throughput#application-build-environment)

##### Build an Application

1. Launch Simplicity Studio and log in.
2. In the **Project Explorer** pane, right-click the project name and select **Build Project**.  
   - You can also click the **Build** button with a hammer icon on the Simplicity IDE perspective toolbar.  
   ![Build Project](/wifibt-wc-getting-started-with-efx32/0.27/images/build-project.png)
3. If there are **no errors**, during the build process you can proceed with **flashing** the code into EFR32xG21.

> **NOTE:** Make sure the Setup (EFR32, RS916ACx expansion) is connected to PC, before flashing.

##### Console Output

1. Install the Tera Term software using the link in the Prerequisites. We chose Tera term to see the application debug prints (You can use any serial terminal of your choice).
2. Select the COM port of **EFR32xG21(J-Link CDC UART Port)**. In the following example, EFR32xG21(J-Link CDC UART Port) is detected as COM9.  
   ![Port](/wifibt-wc-getting-started-with-efx32/0.27/images/port.png)

##### Flash an Application

1. Build the application as described in the [Build an Application](#build-an-application) section.
2. In the Project Explorer pane, right-click on your project name and select **Run As → Silicon Labs ARM Program.**  
   ![Run As](/wifibt-wc-getting-started-with-efx32/0.27/images/run-as.png)
3. The application binary will be flashed on the radio board and the application will start running.
4. Before running the project, set up the [Tera Term](#tera-term-for-serial-prints) for monitoring the debug prints from EFR32.
5. To view the output prints. Refer to the [Application Prints](#application-prints) section.
6. Once you flash the example, you can refer to the Test the Application section of its README page to explore its output.  
   - Wi-Fi - Throughput (NCP) - [Test the Application](https://github.com/SiliconLabs/wiseconnect/tree/master/examples/featured/wlan_throughput#test-the-application)
7. The other sections of the README like the Purpose/Scope section and Overview section (where available) provide more information about the example.
8. See the Examples page to explore all available examples and view their README pages.

##### Debug an Application

1. In the **Project Explorer** pane, right-click on your project name and select **Debug As → Silicon Labs ARM Program.**  
   ![Debug](/wifibt-wc-getting-started-with-efx32/0.27/images/debug.png)
2. Studio will switch to debug mode and halt execution at the **main()** function in your application.
3. Add a break point in the desired location of the code and click the **Resume** button (having an icon with a rectangular bar and play button).
4. Execution will halt at the break point.
5. Use the following debug functions to direct the execution of the code:  
   - **Step In** button (having an icon with a arrow pointing between two dots).  
   - **Step Over** button (having an icon with an arrow going over a dot).  
   - **Step Out** button (having an icon with an arrow pointing out from between two dots).  
   ![Main](/wifibt-wc-getting-started-with-efx32/0.27/images/main.png)

> **NOTE:**
> 
> 1. If the EFR32xG21 has an older SE firmware, the following warning may pop up. Click **Yes** to continue.
>    ![Yes](/wifibt-wc-getting-started-with-efx32/0.27/images/yes.png)
> 2. If you have connected any other radio board other than 20dbm on EFR32xG21, Simplicity studio will not be able to detect the device and gives the below pop-up window for **Device Selection**. Select the device displayed and click **OK**.
>    ![Ok](/wifibt-wc-getting-started-with-efx32/0.27/images/ok.png)
>    - A pop-up window can be seen as shown above for 20dBm radio card as well, click **OK**.
> 3. If you connected BRD4181B radio board, you might see the below pop-up. Click **Yes.**
>    ![Notify Popup](/wifibt-wc-getting-started-with-efx32/0.27/images/notify-popup.png)

##### Application Prints

![Application_Prints](/wifibt-wc-getting-started-with-efx32/0.27/images/output-stm32.png)

### Getting Started with STM32

#### Getting Started with the STM32

STM32 is a family of 32-bit microcontrollers from ST Microelectronics that are based on ARM Cortex-M processors. They are designed for high performance, real-time capabilities, and low-power operation. They are used in a variety of applications, including industrial and consumer electronics.

The following processors are supported with the STM32 host.

> - RS9116W - To get started with an RS9116W with STM32, see the [Starting with RS9116W with STM32 Host](getting-started-with-rs9116w-with-stm32) section.
> - RS916ACx - To get started with an RS916ACx with STM32, see the [Starting with RS916ACx with STM32 Host](getting-started-with-rs916acx-with-stm32) section.

#### Getting Started with RS9116W and STM32 Host

This guide describes how to get started developing a RS9116W application on an STM32 embedded host MCU using the WiSeConnect™ Simple Application Programming Interface (SAPI).  For quick evaluation using only the EVK and a PC instead see [Getting Started with PC using AT Commands]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/).

![Getting Started MCU Block Diagram](/wifibt-wc-getting-started-with-stm32/0.28/images/getting-started-mcu.png)

Getting started with application development on an STM32 involves the following steps:

- [Getting Started with RS9116W and STM32 Host](#getting-started-with-rs9116w-and-stm32-host)  
  - [Download the WiSeConnect™ Software Driver Package](#download-the-wiseconnect-software-driver-package)  
  - [Choose a host MCU development board and tools](#choose-a-host-mcu-development-board-and-tools)  
  - [Update the RS9116W Firmware](#update-the-rs9116w-firmware)  
  - [Connect the RS9116 EVK to the STM32 MCU Development Board](#connect-the-rs9116-evk-to-the-stm32-mcu-development-board)    
    - [Power Save GPIO Connections](#power-save-gpio-connections)    
    - [Reset Connection](#reset-connection)  
  - [Open an Example Project in the Keil IDE](#open-an-example-project-in-the-keil-ide)  
  - [Run an Example Project on the Development Kit](#run-an-example-project-on-the-development-kit)

##### Download the WiSeConnect™ Software Driver Package

Download or clone the [**WiSeConnect™ Software Driver Package**](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/) repository from GitHub.

##### Choose a host MCU development board and tools

The example projects provided with the WiSeConnect™ Software Driver Package are designed to work out-of-the-box with the STM32F411RE Nucleo-64 Development Kit from [ST Microelectroncis](http://www.st.com) and the [Keil MDK](http://www.keil.com) development environment.  Before continuing with this guide, download and install the Keil MDK.

![STM32 EVB and Keil IDE](/wifibt-wc-getting-started-with-stm32/0.28/images/stm32-keil.png)

The WiSeConnect™ driver software can also be run on many other embedded host MCU's.  To run example projects on a Silicon Labs EFM32/EFR32 host see: [Getting Started with a EFx32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/).  Details on porting the driver to other non-Silicon Labs platforms can be found in the [RS9116W SAPI Porting Guide](https://www.silabs.com/documents/login/reference-manuals/rs9116w-sapi-porting-guide.pdf).

##### Update the RS9116W Firmware

When you first receive a RS9116W EVK or when upgrading to a new version of the WiSeConnect™ Software Driver Package, we recommend you update the RS9116W firmware.  There are several update methods available when just getting started it is best to follow the method outlined in [Updating RS9116W Firmware]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/update-evk-firmware)

---

**Note!**
Be sure to disconnect the RS9116 EVK from the host MCU board before updating the firmware using the method described in [Updating RS9116W Firmware]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/update-evk-firmware)

---

##### Connect the RS9116 EVK to the STM32 MCU Development Board

**STEP 1.** Connect the RS9116 EVK reset pin `RST_PS` to the STM32F11RE development board CN10 pin 6 to enable the STM32 to reset the RS9116W.

**STEP 2.** Connect the STM32F411RE board to the **SDIO/SPI connector** of the RS9116 EVK using the 10-pin ribbon cable provided with the RS9116 EVK.

![STM32 EVB and RS9116 EVK connections](/wifibt-wc-getting-started-with-stm32/0.28/images/stm32-rs9116evk-connections.png)

The pinout of the SPI cable is shown in the image below.

![SPI ribbon cable](/wifibt-wc-getting-started-with-stm32/0.28/images/spi-ribbon-cable.png)

The following table summarizes the connections between the RS9116 EVK SDIO/SPI connector (J4) and the STM32F411RE development board connector (CN10).

|Signal Name|RS9116 EVB (J4 - SDIO/SPI)|STM32F411 Board (CN10)|
|---|---|---|
|`NC`|`10`|No Connect|
|`SPI_INTR  `|`9 `|`21`|
|`SPI_MISO  `|`8 `|`13`|
|`SPI_MOSI  `|`7 `|`15`|
|`GND       `|`6 `|No Connect|
|`SPI_CLK   `|`5 `|`11`|
|`VDD       `|`4 `|`7`|
|`GND       `|`3 `|`9`|
|`SPI_CS    `|`2 `|`17`|
|`NC`|`1 `|No Connect|

**STEP 3.** Set the **ISP** switch on the RS9116 EVK to the **OFF** position.

**STEP 4.** Connect the RS9116 EVK to a PC using the USB interface labeled **POWER**.  Note that this connection only provides power to the EVK.  There is no USB communication over this connection.

**STEP 5.** Connect the STM32 development board to a PC using the Mini USB connector on the STM32F411RE board.

Complete hardware details of the RS9116 EVK can be found in the [RS9116 EVK User's Guide](https://www.silabs.com/documents/login/user-guides/ug453-rs9116x-evk-hw-users-guide.pdf).

###### Power Save GPIO Connections

The instructions above enable basic operation between the host MCU and RS9116.  Some low power examples require additional GPIO configuration to enable Low Power (LP) or Ultra Low Power (ULP) operation.  These details are valid for any example provided in the WiSeConnect™ SDK unless otherwise noted in the readme documentation for a particular example.

**Connections for Ultra-Low Power (ULP) Operation**

|Signal Name|STM32F411 Board (CN10)|RS9116 EVK|Notes|
|---|---|---|---|
|`UULP_2`|`2`|`J9` Pin `4`| |
|`UULP_0` (`UULP_3`)|`4`|`J9` Pin `5`|Only use `UULP_3` for RS9116 EVK v1.3 or earlier|

**Connections for Low Power (LP) Operation**

|Signal Name|STM32F411 Board (CN10)|RS9116 EVK|Notes|
|---|---|---|---|
|`UULP_5`|`2`|`J9` Pin `4`| |
|`UULP_0` (`UULP_3`)|`4`|`J9` Pin `5`|Only use `UULP_3` for RS9116 EVK v1.3 or earlier|

###### Reset Connection

|Signal Name|STM32F411 Board (CN10)|RS9116 EVK|Notes|
|---|---|---|---|
|`RST_PS`|`6`|`J9` Pin `2`|An STM32 GPIO is used to reset the RS9116|

##### Open an Example Project in the Keil IDE

The WiSeConnect™ SDK includes a number of ready-made example projects for the STM32F411RE Nucleo-64 Development Kit and the Keil MDK development environment. A list of examples and documentation detailing the operation of each example can be found in: [WiSeConnect™ Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/) .

For the steps below, the Keil MDK development environment must be installed on the PC that is connected to the STM32F411RE development board.  Refer to the [Keil website](http://www.keil.com) for details on downloading and installing the development environment.

**STEP 1.** Open the Keil µVision IDE

![Keil uVision](/wifibt-wc-getting-started-with-stm32/0.28/images/keil-uvision.png)

**STEP 2.** Click the menu item `Project > Open Project...`

**STEP 3.** Navigate to the `examples` folder in the downloaded WiSeConnect™ Software Driver Package and choose the µVision project file of the example you would like to open.  Every example contains a `projects` folder containing various project files.  For example, the path to the firmware update featured example project can be found in the following path:

`<SDK>/examples/featured/firmware_update/projects/firmware_update-nucleo-f411re.uvprojx`.

![Open Prject File](/wifibt-wc-getting-started-with-stm32/0.28/images/open-fw-update-project.png)

**STEP 4.** Opening the project will result in a fully functional project in the IDE that can be built, run and debugged.

![Firmware Update Project in IDE](/wifibt-wc-getting-started-with-stm32/0.28/images/ide-fw-update-project.png)

##### Run an Example Project on the Development Kit

You can build, run and debug the newly opened example project simply using the standard toolbar and menu items in the Keil µVision IDE.  Refer to the [Keil](www.keil.com) documentation for more details.

For instructions to configure and use each, see [Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/).  The same information is also available in the `readme.md` file available with the example project source code.

#### Getting Started with RS916ACx and STM32 Host

This section describes how to get started developing a RS916ACx application on an STM32 embedded host MCU using the WiSeConnect™ Simple Application Programming Interface (SAPI).

![Image25](/wifibt-wc-getting-started-with-stm32/0.28/images/image25.png)

##### Download the WiSeConnect™ Software Driver Package

Download or clone the [WiSeConnect™ Software Driver Package](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/).

##### Choose host MCU development board and tools

The example projects provided with the WiSeConnect™ Software Driver Package are designed to work out-of-the-box with the STM32F411RE Nucleo-64 Development Kit from [ST Microelectroncis](https://www.st.com/content/st_com/en.html) and the [Keil MDK](https://www.keil.com/) development environment. Before continuing with this guide, download and install the Keil MDK.

![Development Board](/wifibt-wc-getting-started-with-stm32/0.28/images/development-board.png)

The WiSeConnect™ driver software can also be run on many other embedded host MCU's. To run example projects on a Silicon Labs EFM32/EFR32 host, see [Getting Started with a EFx32 Host](../wifibt-wc-getting-started-with-efx32/).

##### Update the RS916ACx Firmware

When you first receive a RS916ACx or when upgrading to a new version of the WiSeConnect™ Software Driver Package, we recommend you update the RS916ACx firmware. There are several update methods available. When first getting started, we recommend following the method described in the `Update the RS916ACx Firmware` section of [Updating RS916ACx Firmware](../wifibt-wc-getting-started-with-efx32/getting-started-with-rs916acx-with-efr32#update-the-rs916-a-cx-firmware)

**NOTE:** Be sure to disconnect the RS916ACx Expansion board from the host MCU board before updating the firmware using the method described in [Updating RS916ACx Firmware](../wifibt-wc-getting-started-with-efx32/getting-started-with-rs916acx-with-efr32#update-the-rs916-a-cx-firmware)

---

##### Connect the RS916ACx to the STM32 MCU Development Board

1. The pinout of the expansion header is shown in the following image.  
   ![Expansion Header](/wifibt-wc-getting-started-with-stm32/0.28/images/expansion-header.png)
2. The following table summarizes the connections between the RS916ACx SPI connector and the STM32F411RE development board connector (CN10).  
   ![SPI Connector](/wifibt-wc-getting-started-with-stm32/0.28/images/spi-connections.png)  
   ![Pin Configuration](/wifibt-wc-getting-started-with-stm32/0.28/images/pin-configration.png)
3. The image below shows the hardware setup and describes the communication interface between the devices.  
   ![Setup Diagram](/wifibt-wc-getting-started-with-stm32/0.28/images/setup-diagram.png)  
   **NOTE** : While running the application, AEM or LDO power should be towards LDO position and Mode selection should be towards EXP-UART.  
   ![Exp Acx](/wifibt-wc-getting-started-with-stm32/0.28/images/exp-acx.png)

##### Open an Example Project in the Keil IDE

The WiSeConnect™ SDK includes a number of ready-made example projects for the STM32F411RE Nucleo-64 Development Kit and the Keil MDK development environment. A list of examples and documentation detailing the operation of each example can be found in: [WiSeConnect™ Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/) .

For the steps below, the Keil MDK development environment must be installed on the PC that is connected to the STM32F411RE development board.  Refer to the [Keil website](http://www.keil.com) for details on downloading and installing the development environment.

**STEP 1.** Open the Keil µVision IDE.

![Keil uVision](/wifibt-wc-getting-started-with-stm32/0.28/images/keil-uvision.png)

**STEP 2.** Click the menu item `Project > Open Project...`

**STEP 3.** Navigate to the `examples` folder in the downloaded WiSeConnect™ Software Driver Package and choose the µVision project file of the example you would like to open. Every example contains a `projects` folder containing various project files. For example, the path to the firmware update featured example project can be found in the following path:

`<SDK>/examples/featured/firmware_update/projects/firmware_update-nucleo-f411re.uvprojx`

![Open Project File](/wifibt-wc-getting-started-with-stm32/0.28/images/open-fw-update-project.png)

**STEP 4.** Opening the project will result in a fully functional project in the IDE that can be built, run, and debugged.

![Firmware Update Project in IDE](/wifibt-wc-getting-started-with-stm32/0.28/images/ide-fw-update-project.png)

##### Run an Example Project on the Development Kit

You can build, run, and debug the newly opened example project simply using the standard toolbar and menu items in the Keil µVision IDE.  Refer to the [Keil](www.keil.com) documentation for more details.

For instructions to configure and use each, see [Example Applications]({docSpace}/{docSpaceVersion}/wifibt-wc-example-applications-overview/).  The same information is also available in the `readme.md` file available with the example project source code.

##### Troubleshooting

1. If the firmware upgrade does not work or the module does not respond, click on the reset button on the board and try upgrading the firmware.
2. If device init fails while running any example using STM32 as the host, make sure the connections are configured correctly or not.

### RS9116 Evaluation Kit

#### Getting Started with the RS9116 and RS916ACx Evaluation kits

- RS9116W - To get started with an RS9116 Evaluation Kit, see the [RS9116W Evaluation Kit](rs9116w-expansion-board) section.
- RS916ACx - To get started with an RS916ACx Expansion Board, see the [RS916ACx Expansion Board](rs916acx-expansion-board) section.

#### RS9116 Evaluation Kit

The RS9116 Evaluation Kit (EVK) includes everything necessary to [Get Started with PC using AT Commands]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/) or to connect to a host MCU (not included) as described in [Getting Started with EFx32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/) or [Getting Started with STM32 Host]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-stm32/).

![RS9116 EVK](/wifibt-rs9116x-evk/0.26/images/rs9116-sb-evk.jpg)

The RS9116 EVK is available in several varieties as listed below.  Unless otherwise noted, the software support and operational instructions are the same for all varieties.

- [RS911X-DB-EVK1 - Dual Band Wi-Fi + Bluetooth Evaluation Kit with CC1 Module](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-db-evk-development-kit)
- [RS911X-SB-EVK1 - Single Band Wi-Fi + Bluetooth Evaluation Kit with QMS SoC](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- [RS911X-SB-EVK2 - Single Band Wi-Fi + Bluetooth Evaluation Kit with B00 Module](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk2-development-kit)

Complete details of the EVKs are available in the [RS9116 EVK User's Guide](https://www.silabs.com/documents/login/user-guides/ug453-rs9116x-evk-hw-users-guide.pdf).

#### RS916ACx Expansion Board

The RS916ACx expansion board has two UART ports: one for communication and the other one is for debugging. It also supports other host interfaces such as SPI and SDIO. This board has an expansion header for connecting to Silicon Labs WSTK/WPK board or a Raspberry pi Header. To measure the Tx power, U. FL connector is available on the RS916ACx expansion board. You can connect an external antenna using the U. FL connector.

> **NOTE:** The following image illustrates using the SPI interface. Based on the interface used the Mode selection should be adjusted.
> 
> - For an SPI interface, move the switch towards SPI.
> - For an SDIO interface, move the switch towards SDIO.

![RS916ACx Expansion Board](/wifibt-rs9116x-evk/0.26/images/exp-acx.png)

##### Expansion Header for WSTK/WPK - Pin Configuration

|**Pin No.**|**EXP Header name**|**Pin Functionality**|**Pin Description**|
|---|---|---|---|
|P1.1|GND|GND|Ground|
|P1.2|VMC_EXP|VMCU_EXP|3V3 Power supply from WSTK/WPK board. Unused for other Host board.|
|P1.3|EXP_HEADER3|SDIO_SPI_CTRL|Selection of either SDIO or SPI host interface. 0 – SPI, 1 – SDIO|
|P1.4|EXP_HEADER4|SPI_COPII/SDIO_D1|Connected to SPI_MOSI/SDIO_D1 of RS916ACx Module|
|P1.5|EXP_HEADER5|EXP_HEADER5|Test Point (Not Used)|
|P1.6|EXP_HEADER6|SPI_MISO/SDIO_D0|Connected to SPI_MISO/SDIO_D0 of RS916ACx Module|
|P1.7|EXP_HEADER7|SLEEP_IND_FROM_DEV|Connected to UULP_VBAT_GPIO_0 pin of RS916ACx Module|
|P1.8|EXP_HEADER8|SPI_CLK/SDIO_CMD|Connected to SPI_CLK/SDIO_CMD of RS916ACx Module|
|P1.9|EXP_HEADER9|HOST_BYP_ULP_WAKEUP|Connected to UULP_VBAT_GPIO_2 pin of RS916ACx Module|
|P1.10|EXP_HEADER10|SPI_CSN/SDIO_CLK|Connected to SPI_CSN/SDIO_CLK of RS916ACx Module|
|P1.11|EXP_HEADER11|EXP_RESETn|Reset signal for RS916ACx Module|
|P1.12|EXP_HEADER12|UART1_TX/SDIO_D3|Connected to UART1_TX/SDIO_D3 pin of RS916ACx Module|
|P1.13|EXP_HEADER13|SDIO_D2/SPI_INTR|Connected to SDIO_D2/SPI_INTR pin of RS916ACx Module|
|P1.14|EXP_HEADER14|UART1_RX/SDIO_D2|Connected to UART1_RX/SDIO_D2 of RS916ACx Module|
|P1.15|EXP_HEADER15|I2C_SCL|Connection to I2C SCL pin of RS916ACx Module|
|P1.16|EXP_HEADER16|I2C_SDA|Connection to I2C SDA pin of RS916ACx Module|
|P1.17|EXP_HEADER17|Board_ID_SCL|Board ID EEPROM. Identification of EXP Board whenever it is connected to WSTK/WPK board|
|P1.18|EXP_HEADER18|5V_EXP_RPI|5V power supply to EXP Board|
|P1.19|EXP_HEADER19|Board_ID_SDA|Board ID EEPROM. Identification of EXP Board whenever it is connected to WSTK/WPK board|
|P1.20|EXP_HEADER20|3V3_EXP|Not used.|

###### Power measurement on the RS916ACx Expansion board

The current measurement point is at the bottom side of the ACx expansion board. Remove the R644 (0 ohms) resistor. Connect the positive and negative terminals of the current measurement point to a current meter through appropriate connecting wires as shown below.

![Terminals](/wifibt-rs9116x-evk/0.26/images/terminals.png)

![Power Measurement Setup](/wifibt-rs9116x-evk/0.26/images/power-measurement-setup.png)

> **NOTE:** To use the power save functionality with the ACx expansion board, the following macro has to be enabled. While using the ACx expansion board, the `EXP_BOARD=1` preprocessor symbol should be added to the list of defined symbols in the preprocessor menu in the project settings.
> 
> 1. Open the project in Simplicity Studio
> 2. Right click on the project and choose 'Properties'
> 3. Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Preprocessor' and add the macro `EXP_BOARD=1`. Click 'OK'.
> 4. Select 'Apply' and 'Apply and Close' to save the settings.

![Expansion Board](/wifibt-rs9116x-evk/0.26/images/exp-board.png)

## Simple API Reference

### SAPI Overview

The RS9116W Simple API (SAPI) is a comprehensive collection of Wireless, Network Applications, BSD Socket APIs, and RS9116 driver code along with different HALs for mapping to platform interface on which the library may be ported.

This documentation in this section describes the RS9116 WiSeConnect SAPI (Simple API) library, including:

- Brief descriptions about the RS9116 WiSeConnect SAPI Architecture
- Details about the APIs and configurations available in the SAPI library
- Recent updates of the SAPI library changes

SAPI is intended to run on a host MCU with/without RTOS. Use the given APIs without any modifications to make upgrading to future releases easier. Make sure you also update SAPI with the RS9116 device firmware.

RS9116 device includes Wi-Fi, TCP/IP Networking stack with SSL/TLS support up to TLS 1.2, HTTP/HTTPS, Web sockets, DHCP, MQTT client, and Bluetooth 5 stacks embedded. This device requires a separate application processor, which acts as a host. Host can communicate with RS9116 device using one of the interfaces listed below.

RS9116 supports the following interfaces for host interaction:

- SPI
- UART
- SDIO
- USB-CDC

SAPI enables easy migration into any platform with its uniform APIs. This library simplifies application development on the host. Users can develop application software without learning the underlying peripheral register interface and other details.

RS9116W release consists of two main components, Firmware and SAPI Library. Both components have the same revision number as they are tightly coupled. Latest releases might have bug fixes, enhancements, and new features in SAPI and/or Firmware. Most of the new features have associated APIs, which are available in the latest SAPI release only. It is recommended to always update SAPI and Firmware to same release version.

![RS9116W Block Diagram with SAPI components](/wifibt-wc-sapi-reference/2.14.0/images/rs9116w.png)

##### Features

- Platform-independent, interrupt-driven drivers written in C.
- Drivers provide a simpler, functional interface and eliminate the need to manage the low-level host interface protocol.
- Common APIs for four host interfaces (SPI, UART, SDIO, USB-CDC), which enables easy migration to different host interfaces.
- Supports bare metal and FreeRTOS OS by default. Other RTOS can be supported through OS Abstraction changes.
- May be used with Simplicity Studio, Keil uVision and IAR IDEs. The SAPI driver can also be ported for use with other IDEs that use GCC or ARM compiler toolchains.

### RS9116W Features

#### Wi-Fi

- Supports Wi-Fi Station, Access Point features, and Concurrent mode (STA + AP) features.

#### Wi-Fi Station

- Security Types  
  - Open mode  
  - WPA2  
  - WPA3 Personal Mode  
  - WPA3 Personal Transition mode  
  - Mixed mode  
  - EAP (TLS1.2, TLS1.0, TTLS, PEAP)  
  - WPS 2.0 push button
- Supports auto rate, dual band, re-join, 802.11j, 802.11d, selective scan, RSSI support.
- Supports BSD socket interface.
- Supports crypto hardware accelerators for ECDH, DH, SHA, AES.

#### Access Point

- Supports Open security mode, WPA2 security mode and hidden SSID mode.

#### Firmware Upgrade Options

- via bootloader, Host/MCU and Wireless (OTA).

#### Network Stack

- IPV4, ICMP, ARP, UDP, TCP, IGMP, DHCP Client, DHCP Server, HTTP Client, HTTPs Client, HTTP Server, ping from host, TCP/IP bypass, FTP Client, SSL/TLS1.2(Client and server), SNTP, MQTT Client, Web sockets Client.
- Supports dynamic feature Enable/Disable through opermode command during the initialization.

#### BT Features

- Master, Slave, BT Dual mode and Role switch support.
- BDR1, BDR2, BDR3 etc.
- ACL Data, Encryption, Slot offset, Adaptive frequency hopping, AFH channel classification, Enhanced data rate ACL, Simple pairing.
- Role switch (Master/Slave), sniff mode, RSSI support.
- SSP (secure pairing) support.
- Profiles: GAP, SDP, L2CAP, SPP, RFCOMM, A2DP, AVRCP, HID (only in AT commands).

#### BLE Features

- Bluetooth Dual mode support.
- BLE Peripheral, BLE Central with multiple peripheral support.
- Advertising, Scanning, Connection interval.
- 32-bit UUID support in LE, LE secure connections, Data length extensions.
- LE 2Mbps, LE long range, LE channel classification.
- Profiles: GATT, GAP, BPM (Blood pressure monitor), PXP (proximity), HOGP HID over GATT
- BLP Blood pressure profile & service, HTS/HTP health thermometer profile & service, HRP/HRS Heart rate profile& service, CGMP/CGMS continuous glucose monitoring profile & service

#### Operating Modes

Supports the following operating modes:

- WLAN STATION
- WLAN AP
- WLAN STATION + BLE
- WLAN STATION + BT
- WLAN STATION + BT + BLE <br />

#### Power Save

- GPIO based power save, Message-based power save.
- Host based wakeup, WoWLAN, packet pending interrupt for UART and SPI. <br />

#### Co-Existence

- PTA 3-wire Co-Existence Support for Wi-Fi only mode

### SAPI Architecture

SAPI APIs are designed in layers, where each layer is independent and uses services of the underlying layers.

![WiSeConnect API Architecture Diagram](/wifibt-wc-sapi-reference/2.14.0/images/wiseconnect-architecture-diagram.png)

**Application Layer.** Application layer contains application specific functionality. Application layer calls SAPI to configure and operate the device.

**BSD Socket API.** This layer contains BSD Socket API compliant wrapper and supports some of the basic BSD Socket API calls. These APIs can be called from application to initialize and configure the embedded TCP/IP stack and perform data transfers.

**WLAN API.** This layer contains set of APIs called by the application to initialize and configure Wi-Fi Device. User is recommended to use the given APIs without any modification in order to facilitate upgrading to future releases.

**Network API.** This layer contains APIs related to network applications like HTTP/HTTPS, SSL/TLS-1.0/1.1/1.2, DHCP, MQTT, DNS, SNTP and WebSockets.

**BT/BLE API.** This layer contains set of APIs called from application to initialize and configure BT/BLE . User is recommended to use the given APIs without any modification in order to facilitate upgrading to future releases.

**WiSeConnect Driver.** WiSeConnect Driver software framework contains core functions for state machine maintenance, command preparation, and command response parsing.

**Interface Layer.** The device supports different host interfaces such as SPI, USB, UART, SDIO, USB-CDC. These APIs are collection of functions specific to a particular interface. The interface functions between the Driver API Layer and the Interface Specific API Layer are independent of the Host interface used. This allows the user to migrate to different interfaces without any change in the application layer.

**HAL.** Hardware Abstraction Layer APIs are platform specific APIs. The users need to implement or modify these APIs according to their platforms.

#### Reference Applications

The RS9116 SDK contain reference applications that operate the device in different modes. Users can use these applications as a reference or customize these applications as per their requirements.

#### SAPI Sample Flow

The flow diagram below shows sample API flow for Wi-Fi using the SAPI library.

![Wi-Fi SAPI Flow](/wifibt-wc-sapi-reference/2.14.0/images/wi-fi-sapi-flow.png)

### SAPI Host Interfaces

The RS9116 WiSeConnect device supports SPI, UART, SDIO and USB interfaces. This section describes the serial interfaces supported by WiSeConnect for the RS9116 device including features, protocols, and commands.

Serial Interfaces available include:

- SPI Interface
- UART Interface
- SDIO Interface
- USB Interface

#### SPI Interface

This section describes the RS9116 SPI interface and includes the commands and processes to operate the device via SPI.

#### Features

The features are as follows:

- 8-bit and 32-bit data mode
- Flow control

#### Hardware Interface

The SPI interface on the RS9116-WiSeConnect works in secondary mode. It is a 4-wire interface. In addition to the SPI interface, the device provides an additional interrupt pin to signal events to the host. <br />
 The interrupt is raised by the device in SPI mode for the following condition. When the device has data in its output buffer, it indicates host by raising the active high signal on the interrupt pin.

The interrupt from the device is active high, which means that the host has to configure the interrupt in level trigger mode. The RS9116W also supports edge-triggered interrupts, provided the host is configured to handle these appropriately. Note that this is generic and does not entail any specific implementation. The host must check for pending interrupts before clearing/acknowledging an interrupt to avoid missing interrupts and data.

---

**Note!** By default, the interrupt from the device is active high, however it can be configured active low in the bootloader menu.

---

#### SPI Signals

SPI Interface is a full duplex serial Host interface, which supports 8-bit and 32-bit data mode. The SPI interface of the device consists of the following signals:

- SPI_MOSI (Input) - Serial data input for the device.
- SPI_MISO (Output) - Serial data output for the device.
- SPI_CS (Input) - Active low secondary select signal. This should be low when SPI transactions are to be carried out.
- SPI_CLK (Input) - SPI clock. The maximum value allowed is 80 MHz.
- INTR (Output) - Active high (Default), Active low, level interrupt output from the device.

The device acts as an SPI secondary only, while the Host is the SPI main. Following parameters should be in the host SPI interface.

- CPOL (clock polarity) = 0,
- CPHA (clock phase) = 0.

#### Interrupt

The device's INTERRUPT output signal should be connected to the interrupt input of the Host MCU. The INTERRUPT signal is an active high and level triggered signal. It is raised by the device in the following cases:

1. When the device needs to indicate to the Host that it has received data from the remote terminal and the data needs to be read by the Host.
2. When the device needs to indicate to the Host that a response to a command sent by the Host is ready to be read from the device.
3. To indicate to the Host that it should read a CARD READY message from the device. This operation is described in the subsequent sections.
4. An interrupt will be raised for asynchronous RX packets also.

#### SPI Interface Initialization

This section explains the initialization of the SPI secondary interface in the device. These are the SPI initialization steps:

1. A host sends SPI initialization command: 0x12, 0x4A, 0x5C, 0x00 bytes sequence to the device.
2. On successful initialization, the device sends 0x58 (SPI success) to the host or the device sends 0x54 (SPI busy) or 0x52 (SPI failure).

**NOTE:** Initiating the SPI interface in low-speed mode is recommended, aligning the host's SPI clock frequency with the specified range in the RS9116W chipset datasheet. For more information on SPI interface initialization, refer to [RS9116W SPI Protocol App Note](https://www.silabs.com/documents/login/application-notes/an1285-rs9116w-spi-protocol-application-note.pdf).

#### Operations through SPI

RS9116-WiSeConnect can be configured and operated from the Host by sending commands through the SPI interface. The SPI interface is programmed to perform a transfer using commands C1, C2, C3 and C4 and an optional 32-bit address. For all Commands and Addresses, the Host is configured to transmit data with the 8-bit mode. At the end of all the Commands and Addresses, the Host is reconfigured to transmit data with 8-bit or 32-bit mode depending on the commands issued. The Device responds to all the commands with a certain response pattern. C1, C2, C3, and C4 commands indicate to the SPI interface for all the aspects of the transfer. The command descriptions are as follows:

![Spi Command Description](/wifibt-wc-sapi-reference/2.14.0/images/spi-command-description.png)
 Command Description

The SPI interface responds with a set of unique responses.

#### SPI Response

RS9116 WiSeConnect gives responses to the host SPI command requests through the SPI interface, as follows:

- A success/failure response at the end of receiving the command. This response is driven with 8-bit mode during the Command and Address phase and is then switched to 8-bit or 32-bit mode during the Data phase as per the command issued.  
  - Success: `0x58`  
  - Failure: `0x52`
- An 8-bit or 32-bit start token is transmitted after the four commands (C1, C2, C3, C4) indicating a read request are received and the Device is ready to transmit data. The start token is immediately followed by the read data.  
  - Start Token: `0x55`
- An 8-bit or 32-bit busy response is initiated for a new transaction while the previous transaction is still pending from the secondary side.  
  - Busy Response: `0x54`

#### Bit Ordering of SPI Transactions

##### 8-bit Mode

For a sequence of bytes `<B3[7:0]> <B2[7:0]> <B1[7:0]> <B0[7:0]>` where `B3` is interpreted as the most significant byte, the sequence of transmission is as follows: 

> B0[7] B0[6] .. B0[0] -> B1[7] B1[6] .. B1[0] -> B2[7] B2[6] .. B2[0] -> B3[7] B3[6] .. B3[0]

`B0` is sent first, then `B1`, then `B2`, and so on. In each of the bytes, the MSB is sent first. For example, when `B0` is sent, `B0[7]` is sent first, then `B0[6]`, then `B0[5]`, and so on. The same principle is true while receiving data. In this example, `B0[7]` is expected first by the receiver, then `B0[6]`, and so on. Also, data changes value at the falling edge and is latched at the rising edge, as shown in the image below

![8 Bit Mode](/wifibt-wc-sapi-reference/2.14.0/images/8-bit-mode.png)

##### 32-bit Mode

For a sequence of 32-bit words `<W3[31:0]> <W2[31:0]> <W1[31:0]> <W0[31:0]>` where `W3` is interpreted as the most significant word, the sequence of transmission is as follows: 

> W0[31] W0[30] .. W0[0] -> W1[31] W1[30] .. W1[0] -> W2[31] W2[30] .. W2[0] -> W3[31] W3[30] ..W3[0]

`W0` is sent first, then `W1`, then `W2`, and so on. In each of the 32-bit words, the MSB is sent first. For example, when W0 is sent, `W0[31]` is sent first, then `W0[30]`, then `W0[29]`, and so on. The same principle is true when receiving data. In this example, `W0[31]` is expected first by the receiver, then `W0[30]`, and so on. Also, data changes value at the falling edge and is latched at the rising edge, as shown in the image below.

![32 Bit Mode](/wifibt-wc-sapi-reference/2.14.0/images/32-bit-mode.png)

#### Bit Ordering of SPI Response

The bit ordering is same as explained in Device bit Ordering of SPI Transmission/Reception. For example, a `0x58` response for 8-bit success is sent as `0->1->0->1->1->0->0->0`. That is, 0 is sent first, then 1, then 0, then 1, and so on.

#### Device SPI Interface Initialization

The Initialization command is given to the device to initialize the SPI interface. The SPI interface remains nonfunctional to all commands before initialization and responds only after successful initialization. Initialization should be done only once after the power is on. The device treats the subsequent initialization of any command before it is reset as an error. SPI initialization is a 24-bit command (`0x124A5C`) followed by 8 bits of dummy data. The 24-bit SPI Initialization command should be sent in a sequence of `0x12`, `0x4A`, `0x5C` bytes. The status response from the SPI Interface is driven during the transmission of the dummy data i.e., after the transfer of 8-bits of command `C1`.

![Int Host Module](/wifibt-wc-sapi-reference/2.14.0/images/int-host-module.png)

#### Host Interactions Using SPI Command

This section describes procedures for the Host to interact with the RS9116 WiSeConnect using SPI commands. The Host interactions to the device can be categorized as shown in the following table.

|Command|Bit Number|Description|
|---|---|---|
|`C1`|`[7:6]`|**Command Type.** Initialization = `00`, Read/Write = `01`– Reserved = `1x`|
||`5`|**Read/Write.** Read = `0`, Write = `1`|
||`4`|**Register/(Memory/Frame) R/W Access.** Register R/W = `0`, Memory/Frame R/W = `1`|
||`3`|**Memory/Frame Access.** Memory R/W = `0`, Frame R/W = `1`|
||`2`|**2-bit or 16-bit transfer length.** 2-bit length = `0`, 16-bit length = `1`|
||`1:0`|**Transfer length in bytes (valid only if bit 2 is cleared).** 1 Byte = `01`, 2 Bytes = `10`, 3 Bytes = `11`, 4 Bytes = `00`|
|`C2`|`7:6`|**8-bit or 32-bit mode.** Indicates the granularity of R/W data. Note: The SPI commands (`C1`, `C2`, `C3`, `C4`) and addresses (`A1`, `A2`, `A3`, `A4`) will always be 8-bit irrespective of this value. 8-bit mode = `00`, 32-bit mode = `01`, Reserved - `1x`|
||`5:0`|**Register address.** If `C1[4]` is cleared (i.e. register R/W selected)|
|`C3`|`7:0`|**LS Byte of the transfer length.** Bytes `[7:0]` when `C1[2]` is set. This command is skipped if `C1[2]` is cleared. i.e. if a 2-bit length is selected.|
|`C4`|`7:0`|**MS Byte of the transfer Length.** Bytes `[15:8]` when `C1[2]` is set. This command is skipped if `C1[2]` is cleared i.e. if a 2-bit length is selected.|

#### SPI Command Description

##### Memory Write

The host needs access to the memory/registers of the RS9116 WiSeConnect for configuration and operation. To write data into a memory/register address, the memory write command must be framed as described in the figure below. If a "busy" or "failure" response is sent from the device, the host should either resend the command or reset the device.

![Memory Write](/wifibt-wc-sapi-reference/2.14.0/images/memory-write.png)

![Interaction Pi](/wifibt-wc-sapi-reference/2.14.0/images/interaction-pi.png)

---

**Note!** This structure is similar for all following read/write operations.

---

The host needs to follow the procedures below.

1. Send the commands `C1` and `C2`.
2. Read the response from the Device. The response appears as described in the section, SPI Response. Status `0x58` indicates the device is ready.
3. The host should send the commands `C3` and `C4`, followed by the 4-byte address (corresponding to the memory/register address) and data. Status `0x54` indicates that the device is busy and the host has to retry. Status `0x52` indicates a failure response.

The commands `C1`, `C2`, `C3`, and `C4` are sent in the following sequence: `C1` first, then `C2`, `C3`, and finally `C4`. The bit ordering is as follows: 

> C1[7] C1[6] ... C1[0] -> C2[7] C2[6] ... C2[0] -> C3[7] C3[6] ... C3[0] -> C4[7] C4[6] ... C4[0]

`C1[7]` is sent first, then `C1[6]`, and so on.

Total data payload size should be 1 byte, or 2 bytes, or multiples of 4 bytes in this operation. For example, if 5 bytes needs to be sent, it should be padded with 3 more dummy bytes to make up 8 bytes (multiple of 4) before sending.

Original data 

> <W0[7:0]> <W1[7:0]> <W2[7:0]> <W3[7:0]> <W4[7:0]>

Padded data 

> <W0[7:0]> <W1[7:0]> <W2[7:0]> <W3[7:0]> <W4[7:0]> <X5[7:0]> <X6[7:0]> <X7[7:0]>

... where `X[7:0]` is the dummy data.

The first byte sent is `W0`, the second byte sent is `W1`, and so on, see Bit Ordering of SPI Transactions.

##### Frame Write

The sequence of command transactions (with no failure from the device) for a Frame Write is shown in the following figure. The operations are similar to memory write except that `C1[3]` is set and the Address phase (`A0`, `A1`, `A2`, `A3`) is skipped.

![Frame Write](/wifibt-wc-sapi-reference/2.14.0/images/frame-write.png)

The procedure to be followed by the Host is:

1. Prepare and send the commands `C1`, `C2` together as described for Frame write.
2. Read the response from the Device.
3. Status `0x58` indicates the Device is ready. The Host can then send the commands `C3` and `C4`, followed by the data. Status `0x54` indicates the device is busy and the host must retry. Status `0x52` indicates a failure response.

Total data payload size should be 1 byte, or 2 bytes, or multiples of 4 bytes in this operation. For example, if 5 bytes needs to be sent, it should be padded with 3 more dummy bytes to make up 8 bytes (multiple of 4) before sending.

Original data 

> <W0[7:0]> <W1[7:0]> <W2[7:0]> <W3[7:0]> <W4[7:0]>

Padded data 

> <W0[7:0]> <W1[7:0]> <W2[7:0]> <W3[7:0]> <W4[7:0]> <X5[7:0]> <X6[7:0]> <X7[7:0]>

... where `X[7:0]` is the dummy data.

The first byte sent is `W0`, the second byte sent is `W1`, and so on, see Bit Ordering of SPI Transactions.

##### Memory Read

To read data from a memory/register address, the host must send a Memory Read command. The following figure describes the flow for memory reads between the Host and the Device.

![Memory Read](/wifibt-wc-sapi-reference/2.14.0/images/memory-read.png)

![Memory Read At Pi](/wifibt-wc-sapi-reference/2.14.0/images/memory-read-at-pi.png)

To perform a memory read, the host must follow the procedure below.

1. Prepare and send the commands `C1` and `C2`.
2. Read the response from the Device.
3. Status `0x58` indicates the secondary is ready. The host should next send the commands `C3`, `C4`, which indicate the length of the data to be read, followed by the address of the memory location to be read.
4. After sending/receiving `C3`, `C4` commands/response and the addresses, the host should wait for a start token `0x55`. The host writes a stream of dummy bytes to read the data from the device each time. The Host should also read this data until the start token is received. Data following the start token should be interpreted as the frame of a specified length that is read from the Device.
5. Status `0x54`, after `C1` and `C2` bytes, indicates that the device is busy; the host should resend the read command.
6. Status `0x52`, after `C1` and `C2` bytes, indicates a failure response from the Device.

Dummy data is sent during a variable wait period. After this period, a start token is transmitted from the Device to the Host and is followed by valid data. The start token indicates the beginning of valid data to the Host. To read out the valid data, the host must send dummy data i.e., [`D0`, `D1`, `D2` ... `D(N-1)`]. Where `N` is the number of 8-bit or 32-bit dummy words (based on the mode selected), which the host needs to send to receive a specified length of valid data from the device. The commands `C1`, `C2`, `C3` and `C4` are sent in the following sequence: `C1` first, then `C2`, `C3`, and finally `C4`. See, Bit Ordering of SPI Transactions for details.

The bit ordering is 

> C1[7] C1[6] ... C1[0] -> C2[7] C2[6] ... C2[0] -> C3[7] C3[6] ... C3[0] -> C4[7] C4[6] ... C4[0]

That is, `C1[7]` bit is sent first, then `C1[6]` and so on.

If `<D3[7:0]> <D2[7:0]> <D1[7:0]> <D0[7:0]>` is the data read, then `D0` is sent from device first, then `D1` and so on as follows: 

> D0[7] D0[6] ... D0[0] -> D1[7] D1[6] ... D1[0] -> D2[7] D2[6] ... D2[0] -> D3[7] D3[6] ... D3[0]

##### Frame Read

Frame read is the same as Memory read, except that `C1[3]` is set and the Address phase is skipped. The sequence of command transactions (with no failure from the Device) for a Frame Read is described in the figure below.

![Frame Read](/wifibt-wc-sapi-reference/2.14.0/images/frame-read.png)

To perform a Frame Read, the host must follow the procedure below.

1. Prepare and send the commands `C1` and `C2`, as described for the Frame Read.
2. Read the response from the RS9116-WiSeConnect.
3. Status `0x58` indicates that the Device is ready. The host should send the commands `C3` and `C4`, which indicate the length of the data to be read.
4. After sending/receiving `C3` and `C4` commands/response, the host should wait for a start token `0x55`. Data follows the start token. The host writes a dummy byte to read the data from the device each time. The Host should read this data until the start token is received. Data following the start token should be interpreted as the frame of a specified length that is read from the Device. Status `0x54`, after `C1` and `C2` bytes, indicates that the device is busy and the host must retry. Status `0x52`, after `C1` and `C2` bytes, indicates a failure response from the device.

The commands `C1`, `C2`, `C3`, and `C4` are sent in the following sequence: `C1` first, then `C2`, `C3`, and finally `C4`. See, Bit Ordering of SPI Transactions for details. The bit ordering is 

> C1[7] C1[6] ... C1[0] -> C2[7] C2[6] ... C2[0] -> C3[7] C3[6] ... C3[0] -> C4[7] C4[6] ... C4[0]

That is, `C1[7]` bit is sent first, then `C1[6]` and so on.

If `<D3[7:0]> <D2[7:0]> <D1[7:0]> <D0[7:0]>` is the data read, then `D0` is sent from device first, then `D1` and so on as follows: 

> D0[7] D0[6] ... D0[0] -> D1[7] D1[6] ... D1[0] -> D2[7] D2[6] ... D2[0] -> D3[7] D3[6] ... D3[0]

##### Register Read

Register Read commands are used to read the registers in the device using the internal register address. Register read commands, such as `C1` and `C2` are only needed to send to the device (i.e., `C3`, `C4`, and address phases are skipped). The `C2` command bits `[5:0]` should be the SPI internal address of the register. To read data from the registers, follow the sequence below: ![Register Read](/wifibt-wc-sapi-reference/2.14.0/images/register-read.png)

##### Register Writes

Register write commands are used to write data to the registers in the device by using the internal register address. To write registers, the host needs to send `C1` and `C2` followed by the data to the device (i.e., `C3`, `C4`, and address phases are skipped). The `C2` command bits `[5:0]` should be the SPI internal address of the register. To write to registers, follow the sequence shown below:

![Register Write](/wifibt-wc-sapi-reference/2.14.0/images/register-write.png)

|Register|Address|
|---|---|
|SPI_HOST_INTR|0x00|

Device registers can be accessed from the host by using register read / write commands.

###### SPI Host Interrupt Register

|Bit|Access|Function|Default Value|Description|
|---|---|---|---|---|
|[7:0]|Read only|SPI_HOST_INTR|0x00|These bits indicate the interrupt status value Bit 0: If '1', Buffer Full condition reached. When this bit is set, the host shouldn't send data packets . This bit has to be polled before sending each packet Bit 1: Reserved Bit 2: Reserved Bit 3: If '1', indicates data packet or response to Management frames are pending. This is a self-clearing bit, which is cleared after the packet is read by host. Bit 4: Reserved Bit 5: Reserved Bit 6: Reserved|

##### Software Protocol

This section explains the procedure the host needs to follow to send Wi-Fi commands to the device and to receive responses from the device.

###### TX Operation

The Host uses TX Operations to send:

1. management commands to the device from the Host.
2. data to the device, which will be transmitted onto the air.

The host should follow the steps below to send the command frames to the Device:

- Check the buffer full condition by reading the interrupt status register using register read.
- If the buffer full bit is not set in the interrupt status register, send the Command frame in two parts:  
  - First, send the 16-byte Frame descriptor using the Frame write.  
  - Second, send the optional Frame body using the Frame write.

---

**Note!** Frame write is an API provided to the host as part of the SDK.

---

![Host Interrupt Reg](/wifibt-wc-sapi-reference/2.14.0/images/host-interrupt-reg.png)

Management / Data Frame Descriptor and Frame body of command frames are sent to the device by using two separate frame writes, as shown below:

![Host Module Tx Operation](/wifibt-wc-sapi-reference/2.14.0/images/host-module-tx-operation.png)

###### RX Operation

The Host uses this operation:

![Rx Frame Format](/wifibt-wc-sapi-reference/2.14.0/images/rx-frame-format.png)

If the payload offset is `x`, `x-4` dummy bytes are added before the Frame Descriptor.

The host should follow the steps below to read the frame from the Device:

1. If any Data / Management packet is pending from the device, the device raises an interrupt to the Host.
2. The Host checks the reason for the interrupt by reading the interrupt status register using the register read.
3. If the data pending bit is set in the interrupt status register, follow the steps below:  
   - Read 4 bytes using the Frame read.  
   - Decode the total payload length and payload offset.

Read the remaining payload by sending the Frame to read with (total payload length - 4 bytes), discard Dummy bytes, and decode the Frame descriptor and Frame Body.

![Rx Op Module Host](/wifibt-wc-sapi-reference/2.14.0/images/rx-op-module-host.png)

![Rx Op Host Module](/wifibt-wc-sapi-reference/2.14.0/images/rx-op-host-module.png)

#### UART Interface

This section describes RS9116-WiSeConnect UART interface, including the commands and processes to operate the device via UART. The UART on the Device is used as a host interface to configure the device and to send data and also to receive data.

** Features **

- Hardware flow control (RTS/CTS)
- Baud rates  
  - 9600 bps  
  - 19200 bps  
  - 38400 bps  
  - 57600 bps  
  - 115200 bps  
  - 230400 bps  
  - 460800 bps  
  - 921600 bps

---

**Note!** For baud rates greater than 115200, it is mandatory to enable UART hardware flow control.

---

##### Hardware Interface

RS9116W uses TTL serial UART at an operating voltage of 3.3 V. Host UART device must be configured with the following settings:

- Data bits - 8
- Stop bits - 1
- Parity - None
- Flow control - None

##### Software Protocol

This section explains the procedure that the host needs to follow to send commands frames to the device and to receive responses from the device.

###### TX Operation

The Host uses TX operations as follows:

1. To send management commands to the device from the Host.
2. To send actual data to the device, which will be transmit onto the air.
3. If the host receives error code indicating packet dropped, the host must wait for a while and send the next command /data.
4. The host should send next data packet only if it receives ACK frame for the previous one.

The host should follow the steps below to send the command frames to the Device:

1. First, send the 16-byte Frame descriptor using the Frame write.
2. Second, send the optional Frame body using the Frame write.

###### RX Operation

The device responds with a frame of the same frame type (with or without an error code in the error code field). The Host uses this operation:

- Device respond, for the commands.
- To read data received by device from remote peer.
- Receive asynchronous information from RS9116W device.

Device send/receive data to/from Host with the following format:

![Rx Frame Format](/wifibt-wc-sapi-reference/2.14.0/images/rx-frame-format.png)

If the Payload offset is `x`, `x-4` dummy bytes are added before the Frame Descriptor.

Host should follow the steps below to read the frame from the Device: Read 4 bytes using the Frame read.

1. Decode the total payload length and payload offset.
2. Read the remaining payload by sending the Frame to read with (total payload length - 4 bytes), discard Dummy bytes and then decode the Frame descriptor and Frame Body.

#### SDIO Interface

WiSeConnect SDIO interface, including commands and processes to operate the module via SDIO. RS9116-WiSeConnect supports SDIO interface which allows host to configure and send/receive data through the module via SDIO port.

#### Features

- Full throughput with SDIO 1.2 as well as with SDIO 2.0
- Supports up to 50MHz
- Supports full-speed and high speed modes
- Supports SD-1 bit, SD-4 bit and SPI modes
- Supports up to five functions
- Supports interrupt for both SD and SPI modes
- Supports single as well as multiple block transfers for CMD53 access
- Supports CMD52 while CMD53 data transfer is in progress
- Supports CMD52 Abort
- SDIO mode uses standard SDIO 2.0 interface.

#### Software Protocol

This section explains the procedure to configure and send the Wi-Fi commands to module and receive response from module using SDIO. RS9116 WiSeConnect supports SDIO mode by using the SDIO interface.

#### Functional Description

The SDIO bus has a single master (Host), multiple slaves (I/O cards), synchronous star topology . Clock and power signals are common to all cards. Command (CMD) and data (DAT0 - DAT3) signals are dedicated to each card providing continues point to point connection to all the cards. During initialization process commands are sent to each card individually, allowing the application to detect the cards and assign logical addresses to the physical slots. Data is always sent (received) to (from) each card individually. Addressing information is provided in the command packet. SD bus allows dynamic configuration of the number of data lines. After power up, by default, the SDIO Card will use only DAT0 for data transfer. After initialization the host can change the bus width (number of active data lines).

![Sdio Host Connection To Two 4 Bit Sdio Cards](/wifibt-wc-sapi-reference/2.14.0/images/sdio-host-connection-to-two-4-bit-sdio-cards.png)

#### SDIO Mode

The Secure Digital I/O (SDIO) Slave module implements the functionality of the SDIO card based on the SDIO specifications version 2.0, released by SD Association. During the normal initialization and interrogation of the card by the host, the card identifies itself as an SDIO card. The host software then obtains the card information in a tuple (linked list) format and determines if that card's I/O function(s) are acceptable to activate. This decision is based on such parameters as power requirements or the availability of appropriate software drivers. If the card is acceptable, it is allowed to power up fully and start the I/O function(s) built into it. The salient SDIO slave features are described in the following section.

In SDIO mode the transfer of command/data packets from the host to the module (Tx packet) required headroom as shown in the figure below:

![Command Data Packet Format From Module To Host In Sdio Mode](/wifibt-wc-sapi-reference/2.14.0/images/command-data-packet-format-from-module-to-host-in-sdio-mode.png)

Note: Head room size 256 bytes.

In receive path first 4 bytes contain total packet length and descriptor offset. Frame Descriptor starts at descriptor offset location from packet start.

![Command Data Packet Format From Host To Module In Sdio Mode](/wifibt-wc-sapi-reference/2.14.0/images/command-data-packet-format-from-host-to-module-in-sdio-mode.png)

#### Operations through SDIO interface:

This section explains the procedure to be followed by the host to send Wi-Fi command frame to module and to receive response from module.

#### A. TX operation

Following are sequence of steps to send command frame to module through SDIO interface.

- Prepare command frame with headroom as shown in below flow diagram: Command/Data Packet format from host to the module in SDIO mode.
- Forward packet to the module. The figures below illustrate the flow diagrams to be followed by the host driver to send a packet to the SDIO slave in non-block mode and block mode.

![Sdio Writing Packet In Block Mode](/wifibt-wc-sapi-reference/2.14.0/images/sdio-writing-packet-in-block-mode.png)

#### B. RX operation

Following are sequence of steps to be followed in order to receive a response from the module.

- Send an empty buffer from the host.
- After receiving the packet from the module, extract the frame by ignoring the process of the Frame Descriptor and Frame Body accordingly.

The following figure illustrates the flow diagrams to be followed by the Host Driver for reading packets from the SDIO slave in block mode.

![Sdio Reading Packet In Block Mode](/wifibt-wc-sapi-reference/2.14.0/images/sdio-reading-packet-in-block-mode.png)

#### USB Interface

This section describes RS9116-WiSeConnect USB interface, including the commands and processes to operate the device via USB. The USB on the Device is used as a host interface to configure the device and to send data and also to receive data.

#### Features

USB 2.0 (USB-HS core)

- USB 2.0 offers the user a longer bandwidth with increasing data throughput.
- USB 2.0 supports additional data rate of 480 Mbits/Sec in addition to 1.5Mbits/Sec and 12 Mbits/Sec.

#### Hardware Interface

USB mode uses the standard USB 2.0 interface.

#### Software Protocol

This section explains the procedure of how to configure and send the Wi-Fi commands to the module and receive response from the module using USB.

##### USB Mode

In USB mode all Wi-Fi command frame formats (Frame Descriptor), Command ID's / response ID's and Error codes are exactly same as Wi-Fi SPI commands.

RS9116-WiSeConnect USB interface support 2 endpoints:

- Control endpoint: control endpoint used during enumeration process.
- Bulk endpoint: Bulk endpoint used to send / receive data between host and module through USB interface.

In USB mode the transfer of command / data packets from host to the module (Tx packet) required headroom as shown in the figure below:

![Usb Command Data Packet Format From Host To Module](/wifibt-wc-sapi-reference/2.14.0/images/usb-command-data-packet-format-from-host-to-module.png)
 Packet format from host to module

---

**Note!** Head room size 256 bytes.

---

In receive path first 4 bytes contain total packet length and descriptor offset. Frame Descriptor starts at descriptor offset location from packet start.

![Usb Command Data Packet Format From Module To Host](/wifibt-wc-sapi-reference/2.14.0/images/usb-command-data-packet-format-from-module-to-host.png)
 Packet format from module to host

#### Operations through USB interface

This section explains the procedure to be followed by the host to send Wi-Fi command frame to the module and to receive response from the module.

##### A. TX operation

Following are the sequence of steps to be followed to send command frame to the module through USB interface.

- Prepare command frame with headroom as shown in figure - Command/Data Packet format from host to module in USB mode.
- Forward packet to module.

##### B. RX operation

Following are the sequence of steps to be followed in order to receive response from the module.

- Send an empty buffer from host.
- After receiving packet from the module, extract the frame by ignoring the process of the Frame Descriptor and Frame Body accordingly.

### Opermode Parameters

In [rsi_wireless_init()](common#rsi-wireless-init) API, configured feature bitmaps are internally processed and sent to firmware. Default configurations (for reference) are available in [rsi_wlan_common_config.h](rsi-wlan-common-config-8h-source#rsi-wlan-common-config-8h-source). Based on the features required for a specific example, modify the rsi_wlan_config.h provided in the respective example folder. The following configuration parameters are used to configure feature bitmaps.

#### RSI_FEATURE_BIT_MAP

This bitmap is used to enable the following WLAN features. 

|feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`feature_bit_map[0]`|`FEAT_SECURITY_OPEN`|Open mode feature|Disable|Enable|This feature supports open security type in client mode|
|`feature_bit_map[1]`|`FEAT_SECURITY_PSK`|PSK security|Disable|Enable|This feature supports WPA/WPA2 security type in client mode|
|`feature_bit_map[2]`|`FEAT_AGGREGATION`|Aggregation|Disable|Enable|This feature enables support for packet aggregation. The FEAT_AGGREGATION option in the SDK enables WLAN-level frame aggregation for both transmission (TX) and reception (RX), as specified in the 802.11 standard. When enabled, this feature allows the WLAN driver or firmware to combine multiple smaller frames into a single larger frame at the MAC layer before wireless transmission. This aggregation reduces protocol overhead, increases throughput, and improves overall network efficiency. Additionally, enabling this macro can help reduce power consumption.|
|`feature_bit_map[3]`|`FEAT_LP_GPIO_BASED_HANDSHAKE`|LP GPIO hand shake|Disable|Enable|This feature allows the device to perform handshake operations using GPIO signals while operating in low-power mode. **Note!** This feature is not supported.|
|`feature_bit_map[4]`|`FEAT_ULP_GPIO_BASED_HANDSHAKE`|ULP GPIO hand shake|Disable|Enable|This feature enables the device to perform handshake operations using GPIO signals while consuming extremely low power. For the GPIO signals info, refer to power save application note. - [https://www.silabs.com/documents/login/application-notes/an1280-rs9116w-power-save-application-note.pdf](https://www.silabs.com/documents/login/application-notes/an1280-rs9116w-power-save-application-note.pdf)|
|`feature_bit_map[5]`|`FEAT_DEV_TO_HOST_ULP_GPIO_1`|Reserved|Reserved|Reserved|This feature configures ULP (Ultra Low Power) GPIO 1 to serve as a wake-up indication signal from the device to the host.|
|`feature_bit_map[6]`|`FEAT_RF_SUPPY_VOL_3_3_VOLT`|Reserved|Reserved|Reserved||
|`feature_bit_map[7]`|`FEAT_WPS_DISABLE`|WPS support|Enable|Disable|This feature disables Wi-Fi Protected Setup (WPS) functionality in Client and Access Point (AP) mode.|
|`feature_bit_map[8]`|`FEAT_EAP_LEAP_IN_COEX`|To support EAP/LEAP in Wi-Fi + BT Coex mode|Disable|Enable|This feature enables support for Extensible Authentication Protocol - Lightweight Extensible Authentication Protocol (EAP-LEAP) in coexistence mode.|
|`feature_bit_map[9]`|`FEAT_HIDE_PSK_CREDENTIALS`|To hide PSK, PMK and EAP credentials from the user|Disable|Enable|This feature hides sensitive information such as Pre-Shared Key (PSK), Pairwise Master Key (PMK), and EAP credentials from the user.|
|`feature_bit_map[11]`|`TLS_PATH_LENGTH_SUPPORT`|To support certificate pathlength|Disable|Enable|This feature should be enabled when the pathLenConstraint field is present in the certificate. The pathLenConstraint specifies the maximum number of non-self-issued intermediate certificates that may follow this certificate in a valid certification path. A pathLenConstraint value of zero indicates that no non-self-issued intermediate CA certificates are allowed to follow in the certification path.|
|`feature_bit_map[12:25]`|-|Reserved. Should be set to `0`||||
|`feature_bit_map[26]`|`FEAT_ROBUST_MODE_ENABLE`|Robust mode (CRC-32 integrity) over UART|Disable|Enable|This feature enables CRC-32 protected framing on the UART host interface between the Host MCU and the RS9116. Applicable only when the host interface is UART. After opermode, the host must call `rsi_robust_drv_start_handshake()` to activate CRC framing.|
|`feature_bit_map[27:31]`|-|Reserved. Should be set to `0`||||

---

**Note!**`feature_bit_map[0]`, `feature_bit_map[1]` are valid only in Wi-Fi Client mode.

**Note!**`feature_bit_map[11]` This is not enabled by default, because this feature can't be used along with window scaling or certificate bypass features as these are mutually exclusive.

---

#### RSI_TCP_IP_FEATURE_BIT_MAP

To enable TCP/IP related features. 

|tcp_ip_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`tcp_ip_feature_bit_map[0]`|`TCP_IP_FEAT_BYPASS`|TCP/IP bypass|Disable|Enable|When this feature is enabled, the TCP/IP stack processing is bypassed, allowing raw Ethernet frames to be sent and received. This is useful for applications that require direct control over Ethernet frames or for implementing custom network protocols, This is defined as a bit flag that can be set in the feature configuration to enable the TCP/IP bypass.|
|`tcp_ip_feature_bit_map[1]`|-|Reserved|||Set to `0`|
|`tcp_ip_feature_bit_map[2]`|`TCP_IP_FEAT_DHCPV4_CLIENT`|DHCPv4 client|Disable|Enable|This feature allows the device to obtain an IPv4 address, subnet mask, default gateway, and DNS server from a DHCP server.|
|`tcp_ip_feature_bit_map[3]`|`TCP_IP_FEAT_DHCPV6_CLIENT`|DHCPv6 client|Disable|Enable|This feature allows the device to obtain an IPv6 address, and other network configuration details from a DHCPv6 server.|
|`tcp_ip_feature_bit_map[4]`|`TCP_IP_FEAT_DHCPV4_SERVER`|DHCPv4 server|Disable|Enable|This feature allows the device to act as a DHCPv4 server, providing IPv4 addresses and network configuration to DHCPv4 clients on the network.|
|`tcp_ip_feature_bit_map[5]`|`TCP_IP_FEAT_DHCPV6_SERVER`|DHCPv6 server|Disable|Enable|This feature allows the device to act as a DHCPv6 server, providing IPv6 addresses and network configuration to DHCPv6 clients on the network.|
|`tcp_ip_feature_bit_map[6]`|`TCP_IP_FEAT_JSON_OBJECTS`|Dynamic update of web pages (JSON objects)|Disable|Enable|This feature allows the device to handle JSON (JavaScript Object Notation) objects, which can be used for data interchange in web applications.|
|`tcp_ip_feature_bit_map[7]`|`TCP_IP_FEAT_HTTP_CLIENT`|HTTP client|Disable|Enable|This feature allows the device to send HTTP requests and receive HTTP responses from web servers, enabling web-based communication.|
|`tcp_ip_feature_bit_map[8]`|`TCP_IP_FEAT_DNS_CLIENT`|DNS client|Disable|Enable|This feature allows the device to resolve domain names to IP addresses using the Domain Name System (DNS), enabling communication with servers by hostname.|
|`tcp_ip_feature_bit_map[9]`|`TCP_IP_FEAT_SNMP_AGENT`|SNMP agent|Disable|Enable|This feature allows the device to act as an SNMP (Simple Network Management Protocol) agent, enabling network management and monitoring.|
|`tcp_ip_feature_bit_map[10]`|`TCP_IP_FEAT_SSL`|SSL/TLS|Disable|Enable|This feature allows the device to use SSL (Secure Sockets Layer) for secure communication over the network, providing encryption and authentication.|
|`tcp_ip_feature_bit_map[11]`|`TCP_IP_FEAT_ICMP`|PING from device (ICMP)|Disable|Enable|This feature allows the device to use ICMP (Internet Control Message Protocol) for network diagnostics, such as sending ping requests.|
|`tcp_ip_feature_bit_map[12]`|-|Reserved|||Set to `0`|
|`tcp_ip_feature_bit_map[13]`|-|Set to `0`||||
|`tcp_ip_feature_bit_map[14]`|`TCP_IP_FEAT_SEND_CONFIGS_TO_HOST`|Sending configuration data to the host|Disable|Enable|This feature allows the device to send web page configuration data to the host system from the wireless configuration page.|
|`tcp_ip_feature_bit_map[15]`|`TCP_IP_FEAT_FTP_CLIENT`|FTP client|Disable|Enable|This feature allows the device to act as an FTP (File Transfer Protocol)client, enabling file transfers to and from FTP servers.|
|`tcp_ip_feature_bit_map[16]`|`TCP_IP_FEAT_SNTP_CLIENT`|SNTP client|Disable|Enable|This feature allows the device to synchronize its clock with an SNTP(Simple Network Time Protocol) server, ensuring accurate timekeeping.|
|`tcp_ip_feature_bit_map[17]`|`TCP_IP_FEAT_IPV6`|IPv6 mode|Disable|Enable|This feature allows the device to use IPv6 (Internet Protocol version 6),providing a larger address space and improved routing capabilities,IPv6 will also be enabled if the DHCPv6 client or DHCPv6 server feature is enabled, regardless of the `tcp_ip_feature_bit_map[17]` setting.|
|`tcp_ip_feature_bit_map[18]`|`TCP_IP_FEAT_RAW_DATA`|RAW Socket feature|Disable|Enable|This feature allows the device to handle raw data frames, bypassing the TCP/IP stack. It is supported only in AP mode and requires the TCP_BYPASS feature to be disabled. If any packet from the host with frame type 0x1 is received by the firmware, the packet will be sent on air without TCP/IP stack processing. ARP and broadcast packets (other than DHCP packets) received on air will be sent to the host.|
|`tcp_ip_feature_bit_map[19]`|`TCP_IP_FEAT_MDNSD`|To MDNS and DNS-SD|Disable|Enable|This feature allows the device to use Multicast DNS (mDNS) for local network service discovery, enabling devices to find each other without a central DNS server.|
|`tcp_ip_feature_bit_map[20]`|`TCP_IP_FEAT_SMTP_CLIENT`|SMTP client|Disable|Enable|This feature allows the device to act as an SMTP (Simple Mail Transfer Protocol) client, enabling it to send emails.|
|`tcp_ip_feature_bit_map[21:24]`|`TCP_IP_TOTAL_SOCKETS_1 TCP_IP_TOTAL_SOCKETS_2 TCP_IP_TOTAL_SOCKETS_3 TCP_IP_TOTAL_SOCKETS_4 TCP_IP_TOTAL_SOCKETS_5 TCP_IP_TOTAL_SOCKETS_6 TCP_IP_TOTAL_SOCKETS_7 TCP_IP_TOTAL_SOCKETS_8 TCP_IP_TOTAL_SOCKETS_9 TCP_IP_TOTAL_SOCKETS_10`|To select no of sockets|||Defined to maintain the socket related info on firmware side|
|`tcp_ip_feature_bit_map[25]`|`TCP_IP_FEAT_SINGLE_SSL_SOCKET`|Single SSL/TLS socket|Disable|Enable|This feature allows the device to use a single SSL socket for secure communication.|
|`tcp_ip_feature_bit_map[26]`|`TCP_IP_FEAT_LOAD_PUBLIC_PRIVATE_CERTS`|Private & Public certificate|Disable|Enable|If a secure handshake is to be done using only a CA-certificate, then loading of private and public keys can be disabled, and these certificates can be erased from the flash using the load_cert API. If secure handshake verification of private and public keys is needed, then loading of these keys must be enabled.|
|`tcp_ip_feature_bit_map[27]`|`TCP_IP_FEAT_LOAD_CERTS_INTO_RAM`|SSL/TLS certificate on to the RAM|Disable|Enable|This feature allows the device to load SSL certificates into RAM for faster access during secure communications.|
|`tcp_ip_feature_bit_map[28]`|Not defined|TCP-IP data packet Dump on UART2|Disable|Enable||
|`tcp_ip_feature_bit_map[29]`|`TCP_IP_FEAT_POP3_CLIENT`|POP3 client|Disable|Enable|This feature allows the device to act as a POP3 (Post Office Protocol version 3) client, enabling it to retrieve emails from a POP3 server.|
|`tcp_ip_feature_bit_map[30]`|`TCP_IP_FEAT_OTAF`|Enable OTAF (Over-the-Air Firmware) update.|Disable|Enable|This feature allows the device to perform over-the-air firmware (OTAF)updates, enabling it to download and install firmware updates remotely.|
|`tcp_ip_feature_bit_map[31]`|`TCP_IP_FEAT_EXTENSION_VALID`|`tcp_ip_ext_feature_bitmap` validity|Disable|Enable|This feature allows the device to use extended TCP/IP features, providing additional functionality and capabilities.|

---

**Note!** A feature selection spreadsheet is provided in the WiSeConnect SDK. The device supports the selected combination of features only if it is feasible as per WiSeConnect_TCPIP_Feature_Selection_vx.x.x.xlsx.

---

#### RSI_CUSTOM_FEATURE_BIT_MAP

This bitmap is used to enable following custom features. 

|custom_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`custom_feature_bit_map[0]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[1]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[2]`|`CUSTOM_FEAT_DISABLE_GATEWAY_IN_RSI_AP`|Disables gateway config sent to STA from RSI AP|Disable|Enable|If this bit is set to `1`, the DHCP server behavior changes when the device is in AP mode. The DHCP server, when it assigns IP addresses to the client nodes, does not send out a Gateway address, and sends only the assigned IP and Subnet values to the client. It is highly recommended to keep this value at '0' as the changed behavior is required in only very specialized use cases and not in normal AP functionality. The default value of this bit is '0'.|
|`custom_feature_bit_map[3]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[4]`|`CUSTOM_FEAT_SOC_CLK_CONFIG_160MHZ`|To run NWP (Network Processor) at Higher clock frequency (160 MHz)|Disable|Enable|Need to set pll_mode to '1' in the feature frame command to configure the clock for NWP SOC to 160Mhz. If higher performance is needed, such as high throughput, then this configuration is required.|
|`custom_feature_bit_map[5]`|`CUSTOM_FEAT_AP_IN_HIDDEN_MODE`|Hidden SSID in AP mode|Disable|Enable|This bit is only valid in AP mode. If set, the AP will be created in hidden mode.|
|`custom_feature_bit_map[6]`|`CUSTOM_FEAT_DNS_SERVER_IN_DHCP_OFFER`|DNS server IP address in DHCP offer response in AP mode.|Disable|Enable|This bit is valid only AP mode, DNS server IP address in DHCP offer response in AP mode|
|`custom_feature_bit_map[7]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[8]`|`CUSTOM_FEAT_DFS_CHANNEL_SUPPORT`|DFS channel passive scan support|Disable|Enable|it's mandatory to set region before scanning DFS channel.|
|`custom_feature_bit_map[10]`|`CUSTOM_FEAT_ASYNC_CONNECTION_STATUS`|Asynchronous messages to host to indicate the device state.|Disable|Enable|If this bit is enabled,module indicates the host the wlan connection status asynchronously This bit is valid in case of Wifi client mode|
|`custom_feature_bit_map[11]`|`CUSTOM_FEAT_WAKE_ON_WIRELESS`|Packet pending wake on wireless indication in UART mode|Disable|Enable|If this bit is enabled,Wake on wireless indication in UART mode|
|`custom_feature_bit_map[12]`|`CUSTOM_FEAT_ENABLE_AP_BLACKLIST`|Bypass AP Blacklist in client mode|Disable|Enable|By default client maintains AP blacklist internally to avoid some access points. To bypass AP blacklist feature in client mode during roaming or rejoin, this feature should be enabled.|
|`custom_feature_bit_map[17]`|`CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULLDATA`|Selects between de-authentication or null data (with power management bit set) for roaming.|Disable|Enable|To select between de-authentication or null data (with power management bit set) based roaming. Depending on selected method station, it will send de-auth or Null data to the connected AP when roaming from connected AP to the newly selected AP.|
|`custom_feature_bit_map[18]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[19]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[20]`|`CUSTOM_FEAT_TRIGGER_AUTO_CONFIG`|Trigger Auto Configuration|Disable|Enable||
|`custom_feature_bit_map[21]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[22]`|`CUSTOM_FEAT_LIMIT_PACKETS_PER_STA`|Limits the number of packets buffered per STA in Access Point (AP) mode.|Disable|Enable|In AP mode, if the bit is set, only two packets per Station (STA) would be buffered when the STA is in Power Save (PS) mode. This helps manage buffer usage and ensures efficient packet handling.|
|`custom_feature_bit_map[23]`|`CUSTOM_FEAT_HTTP_HTTPS_AUTH`|HTTP/HTTPs authentication|Disable|Enable||
|`custom_feature_bit_map[24]`|`CUSTOM_FEAT_SOC_CLK_CONFIG_120MHZ`|To run the network processor on the device at a Higher clock frequency (120 MHz)|Disable|Enable|Need to set pll_mode to `1` in feature frame command|
|`custom_feature_bit_map[25]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[26]`|`CUSTOM_FEAT_REJECT_CONNECT_REQ_IMMEDIATELY`|To accept or reject new connection request when maximum clients are connected in case of LTCP.|Disable|Enable|By default this bit value is zero. When `BIT[26] = 0`: For a LTCP socket when maximum clients are connected if a new connection request is received, then this connection request will not be rejected. Instead device will maintain this connection request in LTCP pending list. This request will be served when any of the connected client is disconnected. When `BIT[26] = 1`: For a LTCP socket when maximum clients are connected if a new connection request is received, then this connection request will be rejected immediately. Device will not maintain this connection request in LTCP pending list.|
|`custom_feature_bit_map[27]`|`CUSTOM_FEAT_DUAL_BAND_ROAM_VCSAFD`|Dual-band roaming and VCSAFD (Virtual Channel Scan and Frequency Avoidance Detection) feature|Disable|Enable|This bit enables support for dual-band roaming and VCSAFD, which enhances the module’s ability to switch between different frequency bands and avoid interference.|
|`custom_feature_bit_map[28]`|`CUSTOM_FEAT_RTC_FROM_HOST`|Real time clock from host|Disable|Enable||
|`custom_feature_bit_map[29]`|`CUSTOM_FEAT_BT_IAP`|IAP support in BT mode|Disable|Enable||
|`custom_feature_bit_map[30]`|-|Reserved|||Set to `0`|
|`custom_feature_bit_map[31]`|`FEAT_CUSTOM_FEAT_EXTENTION_VALID`|ext_custom_feat_bitmap validity|Disable|Enable||

#### RSI_EXT_CUSTOM_FEATURE_BIT_MAP

This feature bitmap is an extension of `custom_feature_bit_map` and is valid only if `custom_feature_bit_map[31] = 1`. This enables the following features. 

|ext_custom_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`ext_custom_feature_bit_map[0]`|Reserved|Reserved|Disable|Enable||
|`ext_custom_feature_bit_map[1]`|`EXT_FEAT_RSA_KEY_WITH_4096_SUPPORT`|Reserves memory for EAP certificates with 4096 bit RSA keys.|Disable|Enable|This bit is required to be set for 4096 bit RSA key support. This bit does not denote feature enable/disable, i.e., eap connection with 4096 key certs may establish even though this bit is disabled if memory is available due to any reason. If key size is 4096 bit, device will use software routine for exponentiation, so connection time will increase.|
|`ext_custom_feature_bit_map[2]`|-|Reserved||||
|`ext_custom_feature_bit_map[3]`|`EXT_FEAT_SSL_CERT_WITH_4096_KEY_SUPPORT`|SSL/TLS certificate with 4096 bit key support|Disable|Enable||
|`ext_custom_feature_bit_map[4]`|`EXT_FEAT_AP_BROADCAST_PKT_SND_B4_DTIM`|This bit is applicable only in AP and concurrent AP mode. If this bit is set, the device will send broadcast data (if any) immediately without waiting for DTIM.|Disable (AP sends broadcast packet at DTIM only.)|Enable (Enable sending broadcast without waiting for DTIM)|If this bit is enable then connected client who is in power save may miss the packet.|
|`ext_custom_feature_bit_map[5]`|`EXT_FEAT_FCC_LOW_PWR`|Pre authentication Support.|Disable|Enable|Extended custom bitmap to support FCC (currently not supported)|
|`ext_custom_feature_bit_map[6]`|-|Reserved||||
|`ext_custom_feature_bit_map[7:8]`|-|Reserved||||
|`ext_custom_feature_bit_map[9]`|`EXT_HTTP_SKIP_DEFAULT_LEADING_CHARACTER`|`EXT_HTTP_SKIP_DEFAULT_LEADING_CHARACTER`. To skip default leading character ("\") in resource name|||Extended feature bit map to skip default leading character '\' in HTTP header|
|`ext_custom_feature_bit_map[10]`|-|Reserved||||
|`ext_custom_feature_bit_map[11]`|`EXT_FEAT_ENABLE_11R_OTA`|802.11R Over the Air Roaming Support|Disable|Enable|1. Resource Request Support is not Present. 2. If both BIT[11] and BIT[16] are not enabled then it will select as Legacy Roaming. **Note!** This feature is not supported.|
|`ext_custom_feature_bit_map[12]`|`EXT_FEAT_IEEE_80211J`|802.11J support.|Disable|Enable|If this bit is enable, set region command is mandatory with setting it to Japan region and band value must be 1 (5GHz).|
|`ext_custom_feature_bit_map[13]`|`EXT_FEAT_IEEE_80211W`|802.11W support.|Disable|Enable|This bit must be set for enabling WPA3 Personal Mode and WPA3 Personal Transition mode.|
|`ext_custom_feature_bit_map[14]`|`EXT_FEAT_SSL_VERSIONS_SUPPORT`|TLS Multiple versions Support in SSL.|Disable|Enable|To enable the Multiverion TCP over SSL support|
|`ext_custom_feature_bit_map[15]`|`EXT_FEAT_16th_STATION_IN_AP_MODE`|Support 16 Stations in AP Mode.|||If this bit is enable then 16 stations can connect in AP mode otherwise Maximum of 8 stations can connect.|
|`ext_custom_feature_bit_map[16]`|`EXT_FEAT_ENABLE_11R_ODS`|802.11R Over the Distributed System Roaming Support|||1. Resource Request Support is not Present. 2. If both BIT[11] and BIT[16] are not enabled then it will select as Legacy Roaming. **Note!** This feature is not supported.|
|`ext_custom_feature_bit_map[17:18]`|-|Reserved||||
|`ext_custom_feature_bit_map[19]`|`EXT_FEAT_LOW_POWER_MODE`|Low power mode in GPIO based or M4 based ULP power save||||
|`ext_custom_feature_bit_map[20:21]`|`EXT_FEAT_320K_MODE EXT_FEAT_256K_MODE BIT EXT_FEAT_384K_MODE`|Default memory configuration (RAM) is 192KB. User can set these bits to change the memory configuration as below:![Memory Configuration](/wifibt-wc-sapi-reference/2.14.0/images/memory-configuration.png)<br/> 384k memory configuration is applicable only in WiSeConnect product mode.||||
|`ext_custom_feature_bit_map[22:23]`|`EXT_FEAT_XTAL_CLK_ENABLE`|To configure sleep clock source selection, either crystal clock or RC clock![Sleep Clock Ta](/wifibt-wc-sapi-reference/2.14.0/images/sleep-clock-ta.png)|||If `BIT[23] = 1` and `BIT[22] = 0` in ext_custom_feature_bit_map, then user has to use `UULP_GPIO_0` for sleep indication to host.|
|`ext_custom_feature_bit_map[24]`|`EXT_FEAT_HOMEKIT_WAC_ENABLED`|Reserved||||
|`ext_custom_feature_bit_map[25]`|`EXT_FEAT_1P8V_SUPPORT`|To enable 1.8v supply for TA|Disable|Enable|To enable 1.8v support for TA|
|`ext_custom_feature_bit_map[26]`|Not defined|To enable 3.3v supply for TA|Disable|Enable||
|`ext_custom_feature_bit_map[27]`|`EXT_FEAT_UART_SEL_FOR_DEBUG_PRINTS`|To select UART port for the device network Processor debug prints|Disable (Enable debug prints on `UART2`)|Enable (Enable debug prints on `UART1` and is applicable only if Host Interface is not UART)|By default all the debug prints from device network processor will be coming on UART2 if this bit is not enabled. `UART1` pins are mapped to the following pins w.r.t to the device network processor. User needs to ensure that these pins are not used in MCU applications in SoC mode to avoid conflicts of pins usage based on the requirement. This bit is valid only if `BIT[28]` in ext_custom_feature_bit_map is set to `0`. `UART1-TX: GPIO_9 UART1-RX: GPIO_8 UART2-TX: GPIO_6 UART2-RX: GPIO_10` There is no functionality on rx pins for debug prints.|
|`ext_custom_feature_bit_map[28]`|`EXT_FEAT_DISABLE_DEBUG_PRINTS`|UART debug prints from device network processor|Disable (Enable debug prints)|Enable (Disable debug prints on either `UART1` or `UART2`)|To select UART debug prints pin selection,If BIT(27) is enabled,Debug prints are supported on UART1, If BIT(27) is disabled,Debug prints are supported on UART2|
|`ext_custom_feature_bit_map[29:30]`|-|Reserved||||
|`ext_custom_feature_bit_map[31]`|Not defined|BT and BLE Feature_Bit_Map validity|Disable|Enable||

#### RSI_EXT_TCPIP_FEATURE_BITMAP

|ext_tcp_ip_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`ext_tcp_ip_feature_bit_map[1]`|`EXT_TCP_FEAT_DHCP_OPT77`|DHCP USER CLASS|Disable|Enable|This feature enable the DHCP option 77|
|`ext_tcp_ip_feature_bit_map[2]`|-|Reserved|||Set to `0`|
|`ext_tcp_ip_feature_bit_map[3]`|`EXT_TCP_IP_BI_DIR_ACK_UPDATE`|Correcting the ACK sequence number in the TCP packet retransmission path|Disable|Enable|Need to enable this bit if user wants to run the bi-directional data transfer.|
|`ext_tcp_ip_feature_bit_map[4]`|`EXT_TCP_IP_WINDOW_DIV`|To enable TCP ACK division factor feature|Disable|Enable|This feature enable window divsion factor for tcp socket|
|`ext_tcp_ip_feature_bit_map[5]`|`EXT_TCP_IP_CERT_BYPASS`|Reserved.||||
|`ext_tcp_ip_feature_bit_map[6]`|`EXT_TCP_IP_SSL_16K_RECORD`|Support for SSL/TLS 16K record size|Disable|Enable|When the TLS/SSL record size of Cloud Server is more than 8 KB, this feature should be enabled|
|`ext_tcp_ip_feature_bit_map[7]`|`EXT_TCP_IP_DNS_CLIENT_BYPASS`|To enable DNS_CLIENT_BYPASS by host|Disable|Enable||
|`ext_tcp_ip_feature_bit_map[8]`|`EXT_TCP_IP_WINDOW_SCALING`|To enable TCP window scaling feature|Disable|Enable|If this feature is not enabled, then the maximum possible rx window size is 64 KB. If user wants to use more than 64KB window size, `tcp_rx_window_size_cap` in [rsi_socket_config()](network5#rsi-socket-config) is used to increase the window size.|
|`ext_tcp_ip_feature_bit_map[9]`|`EXT_TCP_IP_DUAL_MODE_ENABLE`|To enable Dual Mode feature|Disable|Enable|Enabling this feature allows to use both bypass and non bypass modes simultaneously.|
|`ext_tcp_ip_feature_bit_map[10]`|`EXT_TCP_IP_ETH_WIFI_BRIDGE`|To enable Ethernet wifi bridge feature|Disable|Enable|This feature enable Ethernet wifi bridge feature|
|`ext_tcp_ip_feature_bit_map[11]`|`EXT_DYNAMIC_COEX_MEMORY`|To enable the dynamic coex memory|Disable|Enable|To enable or disable the coex and update TCP RX window accordingly.|
|`ext_tcp_ip_feature_bit_map[12:15]`|`EXT_TCP_IP_TOTAL_SELECTS_1 EXT_TCP_IP_TOTAL_SELECTS_2 EXT_TCP_IP_TOTAL_SELECTS_3 EXT_TCP_IP_TOTAL_SELECTS_4 EXT_TCP_IP_TOTAL_SELECTS_5 EXT_TCP_IP_TOTAL_SELECTS_6 EXT_TCP_IP_TOTAL_SELECTS_7 EXT_TCP_IP_TOTAL_SELECTS_8 EXT_TCP_IP_TOTAL_SELECTS_9 EXT_TCP_IP_TOTAL_SELECTS_10`|Configures the number of selects|Disable|Enable|This feature allows Configure the number of selects modules|
|`ext_tcp_ip_feature_bit_map[16]`|`EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE`|To enable socket wait close|Disable|Enable|If it is set socket will not be closed until the shutdown is called from host. Refer to [rsi_shutdown()](network5#rsi-shutdown). It is recommended to enable this bit when using TCP sockets.|
|`ext_tcp_ip_feature_bit_map[17]`|`EXT_EMB_MQTT_ENABLE`|To enable MQTT feature|Disable|Enable|If user wants to use AT command for MQTT, enable this bit in the Opermode Command|
|`ext_tcp_ip_feature_bit_map[18]`|`EXT_TCP_IP_FEAT_SSL_HIGH_PERFORMANCE`|To enable HTTP OTAF Feature|Disable|Enable|To do firmware upgrade with HTTP this bit should be enabled|
|`ext_tcp_ip_feature_bit_map[19:20]`|-|Reserved||||
|`ext_tcp_ip_feature_bit_map[21]`|`EXT_TCP_IP_FEAT_CERTIFICATE_INDEX_3`|To enable storing root CA certificate at index 3|Disable|Enable|By enabling certificate index 3, Webpage feature is disabled as these are mutually exclusive to each other. Index 3 certificate loading is valid only for storing the certificate on to flash. Though we can store 4 root CA certificates with this bitmap, the maximum number of SSL sockets supported in the system is only 3.|
|`ext_tcp_ip_feature_bit_map[22:28]`|-|Reserved||||
|`ext_tcp_ip_feature_bit_map[29]`|`EXT_TCP_IP_FEAT_SSL_THREE_SOCKETS`|Enable three SSL/TLS sockets|Disable|Enable|Set `tcp_ip_feature_bit_map[31]` and `ext_tcp_ip_feature_bit_map[29]` to open 3 TLS sockets|
|`ext_tcp_ip_feature_bit_map[30]`|`EXT_TCP_IP_FEAT_SSL_MEMORY_CLOUD`|To configure additional memory for SSL/TLS connection typically to a cloud server|Disable|Enable|If user connects to a cloud server using two SSL/TLS connections then it is required to set this bit to avoid 0xD2 error|
|`ext_tcp_ip_feature_bit_map[31]`|`CONFIG_FEAT_EXTENTION_VALID`|config_feature_bit_map validity|Disable|Enable||

---

**Note!**

1. The three SSL/TLS socket feature is only supported in Opermode WLAN.
2. The total number of TLS sockets opened includes sockets opened by the host application and internal sockets.

---

#### RSI_BT_FEATURE_BITMAP

This bitmap is valid only if `BIT[31]` of extended custom feature bit map is set to `1`.

|bt_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`bt_feature_bit_map[0]`|`BT_BDR_MODE_ENABLE`|BT Mode Enable|Disable|Enable|This feature enables or disables the BT mode. If this bit is set, the controller will send/receive packets in 1Mbps mode. Otherwise, the controller will be operable in both BR/EDR mode.|
|`bt_feature_bit_map[1]`|`BT_BDR_MODE_LP_CHAIN_ENABLE`|BT Mode LP Chain Enable|Disable|Enable||
|`bt_feature_bit_map[2]`|`BT_PWR_CTRL`|BT Power Control Disable|Enable|Disable|To make Fixed/Adaptive Power|
|`bt_feature_bit_map[3:7]`|Not defined|Reserved||||
|`bt_feature_bit_map[8]`|`BT_EDR_3MBPS_DISABLE`|BT EDR 3Mbps Feature Disable|Enable|Disable|3Mbps Disable means using 2Mbps DataRate|
|`bt_feature_bit_map[9]`|`BT_EDR_2MBPS_DISABLE`|BT EDR 2Mbps Feature Disable|Enable|Disable|2Mbps Disable means using 3Mbps DataRate|
|`bt_feature_bit_map[10]`|`BT_5_SLOT_PACKETS_DISABLE`|BT 5 Slot Packet Feature Disable|Enable|Disable|Disabling 5 Slot Packets|
|`bt_feature_bit_map[11]`|`BT_3_SLOT_PACKETS_DISABLE`|BT 3 Slot Packet Feature Disable|Enable|Disable|Disabling 3 Slot Packets|
|`bt_feature_bit_map[12]`|Not defined|Noise Figure Feature|Disable|Enable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[13]`|Not defined|SNIFF Feature Disable|Enable|Disable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[14]`|`TA_BASED_ENCODER_ENABLE`|TA based encoder|Disable|Enable|To Enable/Disable SBC Encoder in Firmware. **Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[15]`|Not defined|HFP profile bit enable|Disable|Enable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[16:19]`|Not defined|Reserved for future use||||
|`bt_feature_bit_map[20:22]`|Not defined|number of secondaries supported by BT|||Maximum no of bt secondaries : 1|
|`bt_feature_bit_map[23]`|`A2DP_PROFILE_ENABLE`|A2DP profile bit enable|Disable|Enable||
|`bt_feature_bit_map[24]`|`A2DP_SOURCE_ROLE_ENABLE`|A2DP profile role selection|Disable|Enable||
|`bt_feature_bit_map[25]`|`A2DP_ACCELERATOR_MODE_ENABLE`|A2DP accelerated mode selection|Disable|Enable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[26]`|Not defined|A2DP i2s mode selection|Disable|Enable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[27]`|`BT_BLE_CP_BUFF_SIZE`|enable Buffer Alignment for Test Mode|Disable|Enable|This feature enables buffer alignment for Test Mode. By enabling this feature, the `bt_feature_bit_map[27]` and `BT_BLE_CP_BUFF_SIZE` will be modified to allow obtaining 512 bytes from the common pool. If this feature is disabled, the fixed buffer size will be 320 bytes.|
|`bt_feature_bit_map[28]`|Not defined|Reserved||||
|`bt_feature_bit_map[29]`|Not defined|Att Over Classic Enable|Disable|Enable|**Note!** This feature is not supported in the current release|
|`bt_feature_bit_map[30]`|`BT_RF_TYPE`|RF Type selection|Disable|Enable|Enable to use Internal Antenna and Disable to use External Antenna|
|`bt_feature_bit_map[31]`|`ENABLE_BLE_PROTOCOL`|ble_feature_bit_map is valid only when this bit is set|Disable|Enable|This macro is used to enable the BLE (Bluetooth Low Energy) protocol|

#### RSI_BLE_FEATURE_BIT_MAP

This bitmap is valid only if BIT[31] of bt_feature_bit_map is set.

|ble_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`ble_feature_bit_map[0:7]`|`RSI_BLE_MAX_NBR_ATT_REC`|BLE number of attributes|||The maximum number of BLE attributes is 124, refer NOTE given below for more info|
|`ble_feature_bit_map[8:11]`|`RSI_BLE_MAX_NBR_ATT_SERV`|BLE number of GATT services|||The maximum number of services is 10, refer NOTE given below for more info|
|`ble_feature_bit_map[12:15]`|`RSI_BLE_MAX_NBR_SLAVES`|BLE number of peripherals|||The maximum number of BLE peripherals is 8, refer NOTE given below for more info|
|`ble_feature_bit_map[16:23]`|`RSI_BLE_PWR_INX`|BLE Tx power index|||Sets the BLE Tx power index value. Default value for BLE Tx Power Index is 31.Range for the BLE Tx Power Index is 1 to 127 (0, 32 index is invalid).1 - 31: BLE - 0dBm Mode, 33 - 63: BLE - 10dBm Mode, 64 - 127: BLE - HP Mode.|
|`ble_feature_bit_map[24:26]`|`RSI_BLE_PWR_SAVE_OPTIONS`|BLE powersave options `BLE_DISABLE_DUTY_CYCLING(0) BLE_DUTY_CYCLING BIT(24) BLR_DUTY_CYCLING BIT(25) BLE_4X_PWR_SAVE_MODE BIT(26)`|||Default `BLE_DISABLE_DUTY_CYCLING`**Note!** This feature is not supported in the current release|
|`ble_feature_bit_map[27:28]`|`RSI_BLE_MAX_NBR_MASTERS`|Number of Masters|||The maximum number of BLE Masters is 2. refer to the note below for more info.|
|`ble_feature_bit_map[29]`|`RSI_BLE_GATT_ASYNC_ENABLE`|GATT ASYNC BIT|Disable|Enable|Default is disabled. When enabled, the response structure will be filled in the Event, which will come later, not in sync with the response for the query command.|
|`ble_feature_bit_map[30]`|Not defined|Reserved|Disable|Enable||
|`ble_feature_bit_map[31]`||ble_custom_ext_feature_bit_map is valid only when this bit is set|Disable|Enable||

#### RSI_BLE_CUSTOM_EXT_FEATURE_BIT_MAP

This bitmap is valid only if BIT[31] of ble_feature_bit_map map is set.

|ble_custom_ext_feature_bit_map|Macro defined in SAPI|Functionality|Set to `0`|Set to `1`|Additional Notes|
|---|---|---|---|---|---|
|`ble_custom_ext_feature_bit_map[0:4]`|`RSI_BLE_NUM_CONN_EVENTS`|BLE number of Connection Events|||Describes the number of buffers that need to be allocated for BLE on the opermode.By default, each role (central/peripheral) will be allocated with 1 buffer for the notify/write command.Increasing the buffer capacity for the notify/write commands helps achieve the best throughput. See [rsi_ble_set_wo_resp_notify_buf_info()](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info) to set more buffers for the notify/write commands.|
|`ble_custom_ext_feature_bit_map[5:12]`|`RSI_BLE_NUM_REC_BYTES`|BLE record size in 16-byte blocks (n)|||Specifies the number of Attribute 'Value' fields maintained in TA in multiples of 16 bytes.<br />**Note!**`n*16 : (n=64, Default 1024 bytes(1K))`<br /><br/>It includes following Attribute types :<br /><br/>* All Include Declaration Attribute(0x2802) 'Value' fields (Start Handle, End Handle, UUID)<br /><br/>* All Charateristic declaration Attribute(0x2803) 'Value' fields (Properties + Value Handle + UUID)<br /><br/>* All Characteristic Value Attribute((0x2A00 - 0xFFFF) 'Value' fields (Value) that are maintained in TA.|
|`ble_custom_ext_feature_bit_map[13]`|`RSI_BLE_GATT_INIT`|`GATT INIT`( GATT initialization mode)|||- 0 : GATT Init in Firmware. Both the GAP service and GATT service will be maintained by the firmware. 1: GATT Init in Host. The GAP service and GATT service should be created by the APP/Host/User, and the ATT transactions like read, write, notify, and indicate shall be handled by the APP/Host/User Default : GATT Init in Firmware|
|`ble_custom_ext_feature_bit_map[14]`|`RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST`|Indication response from APP|Disable|Enable|Default Disabled **Note!** As per the ATT protocol, every indication received from the server should be acknowledged (indication response) by the client.If this bit is disabled, the firmware will send the acknowledgment (indication response).If this bit is enabled, the APP/Host/User needs to send the acknowledgment (indication response).|
|`ble_custom_ext_feature_bit_map[15]`|`RSI_BLE_MTU_EXCHANGE_FROM_HOST`|MTU Exchange request initiation from APP|Disable|Enable|Default Disabled. - If this bit is disabled, the firmware will initiate the MTU request to the remote device on a successful connection. If the peer initiates an MTU exchange request, the firmware will send an Exchange MTU Response in reply to the received Exchange MTU Request.If this bit is enabled, the APP/Host/User needs to initiate the MTU request using the [rsi_ble_mtu_exchange_event](bt-low-energy3#rsi-ble-mtu-exchange-event) API.If the peer initiates an MTU exchange request, the APP/Host/User shall send an Exchange MTU Response using the [rsi_ble_mtu_exchange_resp](bt-low-energy3#rsi-ble-mtu-exchange-resp) API.|
|`ble_custom_ext_feature_bit_map[16]`|`RSI_BLE_SET_SCAN_RESP_DATA_FROM_HOST`|Set SCAN Resp Data from APP|Disable|Enable|Default Disabled .The device will maintain some default scan response data to be used in the scan_response controller frame.Enabling this bit will make the default data Null (empty).|
|`ble_custom_ext_feature_bit_map[17]`|`RSI_BLE_DISABLE_CODED_PHY_FROM_HOST`|Disable Coded PHY from APP|Disable|Enable|Default Disabled. The device supports the LE-coded PHY feature (i.e., LR - 125kbps and 500kbps) by default.If this bit is enabled, the device will not support the LE-coded PHY rates.|
|`ble_custom_ext_feature_bit_map[18:31]`|Not defined|Reserved||||

---

**Note!** If `bt_feature_bit_map[31] = 1`:

1. User can enter maximum of 8 BLE peripherals.
2. User can enter maximum of 2 BLE centrals.
3. Maximum of 10 services in total can exist out of which two services namely GAP and GATT are added by default. So if this bitmap has value 10 user can add upto 8 services.
4. Maximum of 124 attributes in total can exist out of which nine attributes of GAP and GATT are added by default. So if this bitmap has value 124 user can add upto 115 attributes.
5. `RSI_BLE_NUM_CONN_EVENTS >= RSI_BLE_MAX_NBR_SLAVES + RSI_BLE_MAX_NBR_MASTERS`.

If `bt_feature_bit_map[31] = 0`:

1. Default number of BLE peripherals supported is 3.
2. Default number of BLE centrals supported is 1.
3. Maximum of 5 services in total can exist out of which two services namely GAP and GATT are added by default. So user can add upto 3 services.
4. Maximum of 20 attributes in total can exist out of which ten attributes of GAP and GATT are added by default. So user can add upto 10 attributes.

---

#### RSI_CONFIG_FEATURE_BITMAP

This bitmap is valid only if `ext_tcp_ip_feature_bit_map[31]` is set. 

|config_feature_bit_map|Macro defined in SAPI|Functionality|Set to 0|Set to 1|Note and info|
|---|---|---|---|---|---|
|`config_feature_bit_map[0]`|`RSI_FEAT_SLEEP_GPIO_SEL_BITMAP`|To select wakeup indication to host. If it is disabled `UULP_GPIO_3` is used as a wakeup indication to host. If it is enabled `UULP_GPIO_0` is used as a wakeup indication to host.|Disable|Enable||
|`config_feature_bit_map[5:2]`|`RSI_FEAT_DVS_SEL_CONFIG_1 RSI_FEAT_DVS_SEL_CONFIG_2 RSI_FEAT_DVS_SEL_CONFIG_3 RSI_FEAT_DVS_SEL_CONFIG_4`|![Dynamic Voltage Selection](/wifibt-wc-sapi-reference/2.14.0/images/dynamic-voltage-selection.png)|||These bits are used for dynamic voltage selection|
|`config_feature_bit_map[9:6]`|`RSI_EXTERNAL_PMU_GOOD_TIME_100us RSI_EXTERNAL_PMU_GOOD_TIME_200us RSI_EXTERNAL_PMU_GOOD_TIME_300us RSI_EXTERNAL_PMU_GOOD_TIME_400us RSI_EXTERNAL_PMU_GOOD_TIME_500us RSI_EXTERNAL_PMU_GOOD_TIME_600us RSI_EXTERNAL_PMU_GOOD_TIME_700us RSI_EXTERNAL_PMU_GOOD_TIME_800us RSI_EXTERNAL_PMU_GOOD_TIME_900us RSI_EXTERNAL_PMU_GOOD_TIME_1000us RSI_EXTERNAL_PMU_GOOD_TIME_1100us RSI_EXTERNAL_PMU_GOOD_TIME_1200us RSI_EXTERNAL_PMU_GOOD_TIME_1300us RSI_EXTERNAL_PMU_GOOD_TIME_1400us RSI_EXTERNAL_PMU_GOOD_TIME_1500us`|![External Pmu Good Time](/wifibt-wc-sapi-reference/2.14.0/images/external-pmu-good-time.png)|||These bits are used to select external PMU good time.1 to 15 means 100usec to 1500usec (in 100usec granularity)|
|`config_feature_bit_map[11:10]`|`RSI_FEAT_EXTERNAL_LDO_SEL BIT RSI_FEAT_EXTERNAL_LDO_VOL`|![External Ldo](/wifibt-wc-sapi-reference/2.14.0/images/external-ldo.png)|||These bits are used for External LDO selection External PMU : 1.In case of External PMU, User has to set EXTERNAL_PMU_GOOD_TIME_CONFIGURATION value to external PMU good time, If this is zero then it indicates using Internal PMU. 2. Incase of External PMU 1.0v or 1.05v, User has to set both the bits config_feature_bit_map[11] & config_feature_bit_map[10].|
|`config_feature_bit_map[13:12]`|Not defined|![Uulp Gpio 0](/wifibt-wc-sapi-reference/2.14.0/images/uulp-gpio-0.png)|||If these bits are not set, then by default UULP_GPIO_0 will be used.|
|`config_feature_bit_map[14]`|`RSI_FEAT_EAP_TLS_V1P0`|To select EAP TLS 1.0 version|Disable|Enable||
|`config_feature_bit_map[15]`|`RSI_FEAT_EAP_TLS_V1P2`|To select EAP TLS 1.2 version|Disable|Enable||
|`config_feature_bit_map[16]`|Not defined|Active high or low interrupt mode selection for wake on wireless operation If it is disabled active low interrupt is used in wake on wireless operation. If it is enabled active high interrupt is used in wake on wireless operation.|Disable|Enable||
|`config_feature_bit_map[17]`|`FEAT_CONC_STA_AP_DYN_SWITCH_SEL`|Reserved||||
|`config_feature_bit_map[18]`|`ULP_GPIO9_FOR_UART2_TX`|To select `ULP_GPIO_9` as `UART2` port for device network processor debug prints|Disable|Enable|If this bit is not set, then by default `UART2-TX GPIO_6` will be used.|
|`config_feature_bit_map[19]`|`RSI_FEAT_DISABLE_MCS_5_6_7_DATARATES`|To disable `MCS-5,6,7` data rates|Disable|Enable||
|`config_feature_bit_map[20]`|`RSI_FEAT_DISABLE_SHORT_GI`|To disable Short-GI|Disable|Enable||
|`config_feature_bit_map[21]`|`PTA_3WIRE_EN`|To enable PTA-3WIRE|Disable|Enable|Should be set to enable and use the PTA 3 wire feature followed by available configurations|
|`config_feature_bit_map[23:22]`|`PTA_3WIRE_CONFIG_SEL`|To choose PTA-3WIRE config1 config2 config3|Configurability options for config selection among 1,2 & 3|![Pta 3wire Options](/wifibt-wc-sapi-reference/2.14.0/images/pta-3wire-options.png)|Config 0 kept reserved for future. 3wire used at dut as ULP_GPIO_0(Grant pin driven by dut), ULP_GPIO_1(Request i/p pin for dut) and ULP_GPIO_6(Priority i/p pin for dut)![Pta 3wire Options Def](/wifibt-wc-sapi-reference/2.14.0/images/pta-3wire-options-def.png)|
|`config_feature_bit_map[25:24]`|`RSI_XTAL_GOODTIME_1000us RSI_XTAL_GOODTIME_2000us RSI_XTAL_GOODTIME_3000us RSI_XTAL_GOODTIME_600us`|Configurability options for 40 MHz XTAL good time in us.![Xtal Good Time](/wifibt-wc-sapi-reference/2.14.0/images/xtal-good-time.png)|||These bits are used to select XTAL good time. These changes are available from Release 2.3.0 onwards. Release prior to 2.3.0 these config_feature_bitmap[31:17] are reserved. Its only applicable for customers using chip not the device. Contact Support for more details Default value is 1000 us.|
|`config_feature_bit_map[26]`|`ENABLE_ENHANCED_MAX_PSP`|To enable Enhanced Max PSP|Disable|Enable|Enabling this and setting psp_type to Fast PSP will enable Enhanced Max PSP.|
|`config_feature_bit_map[31:27]`|-|Reserved for LMAC||||

---

**Note!** 32KHz external clock connection and power save pins

From May 2019, the 32KHz external clock and the power save pins connections changed. To keep software compatibility between initial designs and new designs, there are currently 2 options for connecting the 32KHz external clock and the power save pins:

**Option 1** External 32KHz clock connection pins : XTAL_32KHZ_P & XTAL_32KHZ_N Power Save connection pins : HOST_BYP_ULP_WAKEUP & UULP_VBAT_GPIO_3

**Option 2** External 32KHz clock connection pin : UULP_VBAT_GPIO_3 Power Save connection pins : HOST_BYP_ULP_WAKEUP & UULP_VBAT_GPIO_0

Option 2 must be used for External 32KHz external clock and Power save connections in new designs.

---

#### Other Configuration Parameters

##### Scan Parameters

|Macro|Usage|
|---|---|
|`RSI_SCAN_CHANNEL_BIT_MAP_2_4`|To select channels in 2.4GHz band for selective channel scan. This macro is valid only if channel 0 is selected in rsi_wlan_scan API.|
|`RSI_SCAN_CHANNEL_BIT_MAP_5`|To select channels in 5GHz band to do selective channel scan. This macro is valid only if channel 0 is selected in rsi_wlan_scan API.|
|`RSI_SCAN_FEAT_BITMAP`|`RSI_ENABLE_QUICK_SCAN` - If enabled, module scans for the AP given in scan API and posts the scan results immediately to the host after finding the access point.<br /><br/> This bit is valid only if specific channel and ssid to scan is given.<br />`RSI_SCAN_RESULTS_TO_HOST` - if enabled additional scan results are given to host, but after getting scan results host has to issue another scan request with this bit disabled before join.|

##### AP Mode Parameters

|Macro|Usage|
|---|---|
|`RSI_AP_KEEP_ALIVE_ENABLE`|To Enable keep alive functionality in AP mode.|
|`RSI_AP_KEEP_ALIVE_TYPE`|`RSI_NULL_BASED_KEEP_ALIVE` – To perform keep alive by sending Null data packet to stations <br />`RSI_DEAUTH_BASED_KEEP_ALIVE` – To perform keep alive based on packets received from stations within time out.|
|`RSI_AP_KEEP_ALIVE_PERIOD`|To configure keep alive period.|
|`RSI_MAX_STATIONS_SUPPORT`|To configure maximum stations supported.|

##### Radio_Config Parameters

##### Description

These parameters are used in rsi_send_feature_frame API to select internal RF type or external RF type and clock frequency.

**pll_mode (1 byte)**

- `0` - `PLLMODE`. To run Network Processor (NWP) at 80 MHz Clock frequency.
- `1` - `PLLMODE`. To run Network Processor (NWP) at 120/160 MHz Clock frequency.
- `2` - `PLLMODE`. Reserved

**Note!**

- Higher NWP Clock frequency may produce the higher throughput.  
  - To run NWP at 120 MHz Clock, enable BIT(24) in custom feature bitmap - [https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-custom-feature-bit-map](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-custom-feature-bit-map).  
  - To run NWP at 160 MHz Clock, enable BIT(4) in custom feature bitmap - [https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-custom-feature-bit-map](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/opermode#rsi-custom-feature-bit-map).  
  - 160 Mhz should not be used in WLAN + BLE coex mode.

**rf_type (1 byte)**

- `1` - Internal RF (Reserved). This should always be set to 1.

**wireless_mode (1 byte)**

- `0` - LP chain disable (default)
- `12` - Enable LP chain for PER mode

**enable_ppp (1 byte)**

- Always set to 0 (Reserved).

**afe_type (1 byte)**

- `1` - Internal AFE (Reserved). This should always be set to 1.

**feature_enables (4 bytes)**

- `BIT[0]` - To Enable Preamble duty cycling.
- `BIT[4]` - To Enable LP chain.
- `BIT[5]` - To Enable hardware beacon drop.
- Above 3 parameters are valid only in Standby Associated Power Save mode.
- `BIT[1]` to `BIT[3]` and `BIT[6]` to `BIT[31]` are not user configurable

---

**Note!**

##### - 40 MHz bandwidth is not supported.

##### US Domain Regulations

|Rule No|Band|First Channel|#channels|Last Channel|Max power in dBm|Scan type|
|---|---|---|---|---|---|---|
|1|2.4GHz|1|11|11|27|Active|
|2|5GHz|36|4|48|16|Active|
|3|5GHz|52|4|64|23|Passive|
|4|5GHz|100|5|116|23|Passive|
|5|5GHz|132|3|140|23|Passive|
|6|5GHz|149|5|165|29|Active|

##### Europe Domain Regulations

|Rule No|Band|First Channel|#channels|Last Channel|Max power in dBm|Scan type|
|---|---|---|---|---|---|---|
|1|2.4GHz|1|13|13|20|Active|
|2|5GHz|36|4|48|23|Active|
|3|5GHz|52|4|64|23|Passive|
|4|5GHz|100|10|140|30|Passive|
|5|5GHz|149|5|165|13|Active|

##### Japan Domain Regulations

|Rule No|Band|First Channel|#channels|Last Channel|Max power in dBm|Scan type|
|---|---|---|---|---|---|---|
|1|2.4GHz|1|13|13|20|Active|
|2|5GHz|36|4|48|20|Active|
|3|5GHz|52|4|64|20|Passive|
|4|5GHz|100|10|140|30|Passive|

##### Korea Domain Regulations

|Rule No|Band|First Channel|#channels|Last Channel|Max power in dBm|Scan type|
|---|---|---|---|---|---|---|
|1|2.4GHz|1|13|13|20|Active|
|2|5GHz|36|4|48|20|Active|
|3|5GHz|52|4|64|20|Passive|
|4|5GHz|100|11|140|30|Passive|
|5|5GHz|149|5|165|30|Active|

##### Set Region Parameters

|Macro|Usage|
|---|---|
|`RSI_SET_REGION_SUPPORT`|Enable to send set region command during Wi-Fi client connection.|
|`RSI_SET_REGION_FROM_USER_OR_BEACON`|1 - region configurations taken from user. <br /><br/> 0 - region configurations taken from beacon.|
|`RSI_REGION_CODE`|0 - Default Region domain <br /><br/> 1 - `US`<br /><br/> 2 - `EUROPE`<br /><br/> 3 - `JAPAN`<br /><br/> 4 - `WORLDWIDE`<br /><br/> 5 - `KOREA`|

---

**Note!**

- For RS9116AC0 and RS9116AC1 module as STA :-  
  - Region configuration from user is not allowed.  
  - In 2.4GHz, USA is configuerd as default country domain and in addition to this, channels 12 and 13 are passively scanned.  
  - Country inforamtion is updated as per connecting AP's beacon before authentication.  
  - Upon disconnection with the AP, STA will switch to USA domain along with channels 12 and 13 are passively scanned.  
  - While doing passive scan (channel 12 and 13) if any beacon is found in that channel STA will switch to active scan.

##### - If there is no country IE in the beacon of the AP to which STA is going to connect, STA will switch to USA/EU country based on the channel in which the AP exists. For example if the AP in channel between 1 to 11, STA will configure to USA else if the current channel number is 12 or 13 STA will be configured to EU.

##### Set Region AP Parameters

|Macro|Usage|
|---|---|
|`RSI_SET_REGION_AP_SUPPORT`|Enable to send set region AP command during AP start.|
|`RSI_SET_REGION_AP_FROM_USER`|1 - region configurations taken from user. <br /><br/> 0 - region configurations taken from firmware.|
|`RSI_COUNTRY_CODE`|Country code which is supposed to be in Upper case. If the first parameter is 1, the second parameter should be one of the these 'US','EU','JP','KR' country codes|

---

**Note!**

- If the country code's length is two characters, then the 3rd character should be a <space>.
- For RS9116AC0/RS9116AC1 module as AP:-  
  - In AP alone mode USA is configured as default country.

##### - In concurrent mode, country domain is configured to that of AP's country domain to which the STA has connected.

##### Rejoin Parameters

|Macro|Usage|
|---|---|
|`RSI_REJOIN_PARAMS_SUPPORT`|Enable to send rejoin parameters command during Wi-Fi client connection.|
|`RSI_REJOIN_MAX_RETRY`|To set number of retries to be attempted.<br />**Note:**<br /><br/> If this macro is 0, rejoin is retried infinite times.|
|`RSI_REJOIN_SCAN_INTERVAL`|To set periodicity of rejoin attempt. <br />**Note:**<br /><br/> Rejoin scan interval is in seconds.|
|`RSI_REJOIN_BEACON_MISSED_COUNT`|To set the number of beacons missed before triggering rejoin process. <br />**Note:**<br /><br/> Default beacon missed count is 40. <br /><br/> A unicast probe request will be sent from the midpoint of the given beacon missed count. <br /><br/> For example, if the beacon count is 40, the unicast probe request will be sent from the module to the AP at the midpoint, which is the 21st beacon. This will also occur at the 31st beacon count.|
|`RSI_REJOIN_FIRST_TIME_RETRY`|`ENABLE` or `DISABLE` retry for the first time join failure.|

---

**Note!**

##### - By default, the rejoin feature is turned off. However, it will still be triggered once, even when disabled.

| `RSI_REJOIN_SCAN_INTERVAL`| To set periodicity of rejoin attempt.| | `RSI_REJOIN_BEACON_MISSED_COUNT`| To set the number of beacons missed before triggering rejoin process.| | `RSI_REJOIN_FIRST_TIME_RETRY` | `ENABLE` or `DISABLE` retry for the first time join failure. <br />**Note:**<br />
 Recommended to enable RSI_REJOIN_FIRST_TIME_RETRY to minimize join failures, especially in scenarios such as abnormal connection termination caused by a module reset.|

##### BG Scan Parameters

|Macro|Usage|
|---|---|
|`RSI_BG_SCAN_SUPPORT`|Enable to send BG scan command after Wi-Fi client connection.|
|`RSI_BG_SCAN_ENABLE`|To enable or disable BG Scan.|
|`RSI_INSTANT_BG`|Enable or disable instant BG scan.|
|`RSI_BG_SCAN_THRESHOLD`|This is the threshold in dBm to trigger the BG scan.|
|`RSI_RSSI_TOLERANCE_THRESHOLD`|This is the minimum difference between the last RSSI of connected AP and the current RSSI of connected AP to trigger a BG scan irrespective of BG scan periodicity.<br /><br/> Here, last `RSSI` is the `RSSI` calculated at the last beacon received and current RSSI is the RSSI calculated at current beacon received.|
|`RSI_BG_SCAN_PERIODICITY`|To set the periodicity of BG scan in seconds.|
|`RSI_ACTIVE_SCAN_DURATION`|This is the active scan duration per channel in milli seconds.|
|`RSI_PASSIVE_SCAN_DURATION`|This is the passive scan duration per DFS channel in 5GHz in milli seconds.|
|`RSI_MULTIPROBE`|If it is set to one, then module will send two probe request - one with specific SSID provided during join command and other with NULL SSID (to scan all the access points).|

##### Roaming Parameters

|Macro|Usage|
|---|---|
|`RSI_ROAMING_SUPPORT`|Enable to send roaming command after Wi-Fi client connection.|
|`RSI_ROAMING_THRESHOLD`|If connected AP, `RSSI` falls below this then module will search for new AP from background scanned list.|
|`RSI_ROAMING_HYSTERISIS`|If module found new AP with same configuration (SSID, Security etc) and if (connected_AP_RSSI – Selected_AP_RSSI ) is greater than `RSI_ROAMING_HYSTERISIS` then it will try to roam to the new selected AP.|

---

**Note!**

1. `WLAN` - `RS9116` supports Wi-Fi L2 roaming. <br />
2. Selection of 'sending de authentication' or 'informing Power save' to the connected AP while roaming can be done by `CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULLDATA` flag in `RSI_CUSTOM_FEATURE_BIT_MAP` bitmap. By default de authentication will be sent.

---

##### HT capabilities

|Macro|Usage|
|---|---|
|`RSI_MODE_11N_ENABLE`|Enable to send Ht capabilities command during AP start.|
|`RSI_HT_CAPS_BIT_MAP`|Bit map corresponding to high throughput capabilities. <br /><br/> ht_caps_bit_map[10:15]: All set to '0' <br /><br/> ht_caps_bit_map[8:9]:Rx STBC support <br /><br/> 00- Rx `STBC` support disabled <br /><br/> 01- Rx `STBC` support enabled <br /><br/> ht_caps_bit_map[6:7]: Set to '0'<br /><br/> ht_caps_bit_map[5]: short GI for 20Mhz support <br /><br/> 0- short GI for 20Mhz support disabled <br /><br/> 1- short GI for 20Mhz support enabled <br /><br/> ht_caps_bit_map[4]: Green field support <br /><br/> 0 -Green field support disabled <br /><br/> 1 -Green field support enabled <br /><br/> ht_caps_bit_map[0:3]:Set to '0'|

##### Enterprise Mode Parameters

|Macro|Usage|
|---|---|
|`RSI_EAP_METHOD`|Should be one among `TLS`, `TTLS`, `FAST` or `PEAP`. It should be `ASCII` character string.|
|`RSI_EAP_INNER_METHOD`|This field is valid only in `TTLS/PEAP`. In case of `TTLS/PEAP`, the supported inner methods are `MSCHAP/MSCHAPV2`. <br /><br/> In case of `TLS/FAST`, it should be fixed to `MSCHAPV2`.|

##### Join Parameters

|Macro|Usage|
|---|---|
|`RSI_POWER_LEVEL`|This fixes the Transmit Power level of the module. This value can be set as follows: <br /><br/> At 2.4GHz <br /><br/> 0– Low power (7+/-1) dBm <br /><br/> 1– Medium power (10 +/-1) dBm <br /><br/> 2– High power (18 + /- 2) dBm <br /><br/> At 5 GHz<br /><br/> 0– Low power (5+/-1) dBm<br /><br/> 1– Medium power (7 +/-1) dBm <br /><br/> 2– High power (12 +/- 2) dBm|
|`RSI_JOIN_FEAT_BIT_MAP`|BIT[0]: To enable b/g only mode in station mode, host has to set this bit. <br /><br/> 0 – b/g/n mode enabled in station mode. <br /><br/> 1 – b/g only mode enabled in station mode <br /><br/> BIT[1]: To take listen interval from join command.<br /><br/> 0 – Listen interval invalid <br /><br/> 1 – Listen interval valid <br /><br/> BIT[2]: To enable/disable quick join feature. <br /><br/> 1 - To enable quick join feature. <br /><br/> 0 - To disable quick join feature. <br /><br/> BIT[3]: Set this bit enable CCXV2 extension for client to work with cisco APs. <br /><br/> BIT[4]: Host sets this bit to join an AP based on BSSID. <br /><br/> BIT[5]: Host sets this bit to enable Management Frame Protection Capable feature. <br /><br/> BIT[6]: Set this bit to enable Management Frame Protection Required feature.<br /><br/> BIT[7]: To configure listen interval from rsi_wlan_power_save_with_listen_interval SAPI.|
|`RSI_JOIN_FEAT_BIT_MAP_AP`|This feature bit map is for AP join parameters in Concurrent mode only. The bit map description is same as `RSI_JOIN_FEAT_BIT_MAP`|
|`RSI_LISTEN_INTERVAL`|This is valid only if BIT (1) in join_feature_bit_map is set. This value is given in Time units (1024 microsecond). This parameter is used to configure maximum sleep duration in power save.|
|`RSI_DATA_RATE`|To select Auto or Fixed data rate. Recommended to use Auto rate. <br />`RSI_DATA_RATE_AUTO`: Auto rate|

##### Curve IDs Supported

|Curve ID|Description|Support|
|---|---|---|
|15|secp160k1|Yes|
|16|secp160r1|Yes|
|17|secp160r2|Yes|
|18|secp192k1|Yes|
|19|secp192r1|Yes|
|20|secp224k1|Yes|
|21|secp224r1|Yes|
|22|secp256k1|Yes|
|23|secp256r1|Yes|
|24|secp384r1|Yes|
|25|secp521r1|Yes|
|26|brainpoolP256r1|Yes|
|27|brainpoolP384r1|Yes|
|28|brainpoolP512r1|Yes|

##### Power Save Parameters

|Macro|Usage|
|---|---|
|`RSI_HAND_SHAKE_TYPE`|To set handshake type of power mode `MSG_BASED`/`GPIO_BASED`|
|`RSI_SELECT_LP_OR_ULP_MODE`|0 - `LP`, 1- `ULP` mode with `RAM` retention and 2 - `ULP` without `RAM` retention|
|`RSI_DTIM_ALIGNED_TYPE`|set `DTIM` alignment required <br /><br/> 0 - module wakes up at beacon which is just before or equal to listen_interval. <br /><br/> 1 - module wakes up at `DTIM` beacon which is just before or equal to listen_interval.|
|`RSI_MONITOR_INTERVAL`|Monitor interval for the `FAST PSP` mode. <br /><br/> Default is 50 ms, and this parameter is valid for `FAST PSP` only.|
|`RSI_WMM_PS_ENABLE`|To set wmm enable or disable.|
|`RSI_WMM_PS_TYPE`|To set wmm type <br /><br/> 0 - `TX BASED`<br /><br/> 1 - `PERIODIC`|
|`RSI_WMM_PS_WAKE_INTERVAL`|To set wmm wake up interval.|
|`RSI_WMM_PS_UAPSD_BITMAP`|To set wmm `UAPSD` bitmap|
|`RSI_NUM_OF_DTIM_SKIP`|If this macro is n then module will wake up at (n+1)th `DTIM`.|

##### Configure 10 TCP Sockets when Device is in AP mode

|Macro|Usage|
|---|---|
|`HIGH_PERFORMANCE_ENABLE`|To make `RSI_ENABLE` or `RSI_DISABLE` high performance sockets.|
|`TOTAL_SOCKETS`|To Set total number of Sockets - `TCP_TX + TCP_RX + UDP_TX + UDP_RX`<br /><br/> 10 - To Open 10 Sockets in total|
|`TOTAL_TCP_SOCKETS`|To Set total `TCP` Sockets - `TCP_TX + TCP_RX`<br /><br/> 10 - To open 10 `TCP` Sockets|
|`TOTAL_UDP_SOCKETS`|To Set total `UDP` Sockets <br /><br/> 0 - Disable <br /><br/> 1 - Enable|
|`TCP_TX_ONLY_SOCKETS`|To Set total `TCP TX` only Sockets - `TCP TX`|
|`TCP_RX_ONLY_SOCKETS`|To Set `TCP RX` only Sockets - `TCP RX`<br /><br/> 10 - To Open 10 `TCP_RX` sockets|
|`UDP_TX_ONLY_SOCKETS`|To Set `UDP TX` only Sockets - `UDP TX`<br /><br/> 0 - Disable <br /><br/> 1 - Enable|
|`UDP_RX_ONLY_SOCKETS`|To Set `UDP RX` only Sockets - `UDP RX`<br /><br/> 0 - Disable <br /><br/> 1 - Enable|
|`TCP_RX_HIGH_PERFORMANCE_SOCKETS`|To Set `TCP_RX` high performance Sockets <br /><br/> 10 - To open 10 `TCP_RX_HIGH_PERFORMANCE_SOCKETS`|
|`TCP_RX_WINDOW_SIZE_CAP`|To Set `TCP RX` window size <br /><br/> 10 - To make the `TCP RX` window size to 10|
|`TCP_RX_WINDOW_DIV_FACTOR`|To Set `TCP_RX` window division factor <br /><br/> 10 - To make `TCP RX` window division factor to 10|
|`RSI_NUMBER_OF_LTCP_SOCKETS`|To Set the number of `LTCP` sockets <br /><br/> 10 - To open 10 `LTCP` sockets|
|`RSI_NUMBER_OF_SOCKETS`|Default number of Sockets supported. Set this to, 10 + `RSI_NUMBER_OF_LTCP_SOCKETS`|

**Note!** Need to call [rsi_socket_config](network5#rsi-socket-config) API to configure the above parameters. Used to increase the TCP receive window based on available buffers

##### IP Parameters

|Macro|Usage|
|---|---|
|`RSI_DHCP_HOST_NAME`|Define this macro in config file to set DHCP client host name - A 31-byte string|

##### Chip Version

User can get the chip version using the `rsi_mem_rd` API by reading one byte of data at the address 0x04000437 into the buffer pointed by *buf. `rsi_mem_rd(0x04000437, 1, buf)`

|Chip version|Read data|
|---|---|
|1.4|0x14|
|1.5|0x15|

##### SSL/TLS Version

- If `BSD_COMPATIBILITY` is defined then SSL/TLS version can be chosen using [rsi_setsockopt()](network5#rsi-setsockopt) API option_name parameter.  
  - The option_name passes SO_SSL_ENABLE to open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.0, they should use the `SO_SSL_V_1_0_ENABLE` macro.  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.1, they should use the `SO_SSL_V_1_1_ENABLE` macro.  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.2, they should use the `SO_SSL_V_1_2_ENABLE` macro.
- In case if the `BSD_COMPATIBILITY` is not defined, add [rsi_socket()](network5#rsi-socket) protocol parameter is used to choose TLS versions  
  - The protocol passes PROTOCOL_DFLT_VERSION to open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2.  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.0, they should use the `PROTOCOL_TLS_1_0` macro.  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.1, they should use the `PROTOCOL_TLS_1_1` macro.  
  - When the user wants to open an SSL/TLS connection over TCP socket with TLS version 1.2, they should use the `PROTOCOL_TLS_1_2` macro.

### SSL/TLS Cipher Selection

#### SSL Parameters

|Macro|Meaning|
|---|---|
|`RSI_SSL_RELEASE_2_0`|`RSI_ENABLE` - Use all ciphers configured by `SSL_RELEASE_2_0_ALL_CIPHERS`|
||`RSI_DISABLE` - Only use ciphers supported by TLS 1.2|
|`RSI_SSL_CIPHERS`|If `RSI_SSL_RELEASE_2_0` is enabled, `SSL_RELEASE_2_0_ALL_CIPHERS` specifies the set of supported ciphers.|

- The `RSI_SSL_CIPHERS` and `RSI_SSL_RELEASE_2_0` macros are defined in the `/sapi/include/rsi_wlan_common_config.h` file of the SDK.
- If RSI_SSL_RELEASE_2_0 macro is enabled, the `SSL_RELEASE_2_0_ALL_CIPHERS` macro shall be defined. This macro represents a set of fourteen ciphers (defined by `SSL_DEFAULT_CIPHERS`) along with the following six user-configurable ciphers. **user-configurable ciphers**  
  |Bit Position|Macro|  
  |---|---|  
  |`BIT(0)`|`BIT_TLS_RSA_WITH_AES_256_CBC_SHA256`|  
  |`BIT(1)`|`BIT_TLS_RSA_WITH_AES_128_CBC_SHA256`|  
  |`BIT(2)`|`BIT_TLS_RSA_WITH_AES_256_CBC_SHA`|  
  |`BIT(3)`|`BIT_TLS_RSA_WITH_AES_128_CBC_SHA`|  
  |`BIT(4)`|`BIT_TLS_RSA_WITH_AES_128_CCM_8`|  
  |`BIT(5)`|`BIT_TLS_RSA_WITH_AES_256_CCM_8`|

|Macro|Meaning|
|---|---|
|`SSL_RELEASE_2_0_ALL_CIPHERS`|`BIT_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256`|
||`BIT_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256`|
||`BIT_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`|
||`BIT_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`|
||`BIT_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`|
||`BIT_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`|
||`BIT_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`|
||`BIT_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`|
||`BIT_TLS_DHE_RSA_WITH_AES_256_CBC_SHA`|
||`BIT_TLS_DHE_RSA_WITH_AES_128_CBC_SHA`|
||`BIT_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`|
||`BIT_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA`|
||`BIT_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA`|
||`BIT_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA`|
||`BIT_TLS_RSA_WITH_AES_256_CBC_SHA256`|
||`BIT_TLS_RSA_WITH_AES_128_CBC_SHA256`|
||`BIT_TLS_RSA_WITH_AES_256_CBC_SHA`|
||`BIT_TLS_RSA_WITH_AES_128_CBC_SHA`|
||`BIT_TLS_RSA_WITH_AES_128_CCM_8`|
||`BIT_TLS_RSA_WITH_AES_256_CCM_8`|

If `RSI_SSL_RELEASE_2_0`macro is disabled, enabling the `SSL_NEW_CIPHERS` bit is mandatory, and the following ciphers are enabled for use. 

|Macro|Meaning|
|---|---|
|`BIT_DHE_RSA_GCM`|`DHE_RSA` in combination with GCM secure ciphers ...|
||> `BIT_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256`|
||> `BIT_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384`|
|`BIT_ECDHE_RSA_GCM`|`ECDHE_RSA` in combination with GCM secure ciphers ...|
||> `BIT_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`|
||> `BIT_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`|
|`BIT_DHE_RSA_CBC`|`DHE_RSA` in combination with CBC secure ciphers ...|
||> `BIT_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256`|
||> `BIT_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256`|
|`BIT_ECDHE_RSA_CBC`|`ECDHE_RSA` in combination with CBC secure ciphers ...|
||> `BIT_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`|
||> `BIT_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`|
|`BIT_ECDHE_ECDSA_CBC`|`ECDHE_ECDSA` in combination with CBC secure ciphers ...|
||> `BIT_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`|
||> `BIT_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`|
|`SSL_NEW_CIPHERS`|To enable more secure newly added ciphers|

To use individual ciphers other than the default configurations shown above, configure the following macros under `RSI_SSL_CIPHERS`

|Bit Position|Macro|
|---|---|
|`BIT(0)`|`BIT_TLS_RSA_WITH_AES_256_CBC_SHA256`|
|`BIT(1)`|`BIT_TLS_RSA_WITH_AES_128_CBC_SHA256`|
|`BIT(2)`|`BIT_TLS_RSA_WITH_AES_256_CBC_SHA`|
|`BIT(3)`|`BIT_TLS_RSA_WITH_AES_128_CBC_SHA`|
|`BIT(4)`|`BIT_TLS_RSA_WITH_AES_128_CCM_8`|
|`BIT(5)`|`BIT_TLS_RSA_WITH_AES_256_CCM_8`|
|`BIT(6)`|Reserved|
|`BIT(7)`|Reserved|
|`BIT(8)`|`BIT_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256`|
|`BIT(9)`|`BIT_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384`|
|`BIT(10)`|`BIT_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256`|
|`BIT(11)`|`BIT_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`|
|`BIT(12)`|Reserved|
|`BIT(13)`|Reserved|
|`BIT(14)`|`BIT_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256`|
|`BIT(15)`|`BIT_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256`|
|`BIT(16)`|`BIT_TLS_DHE_RSA_WITH_AES_256_CBC_SHA`|
|`BIT(17)`|`BIT_TLS_DHE_RSA_WITH_AES_128_CBC_SHA`|
|`BIT(18)`|`BIT_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384`|
|`BIT(19)`|`BIT_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256`|
|`BIT(20)`|`BIT_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA`|
|`BIT(21)`|`BIT_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA`|
|`BIT(22)`|`BIT_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384`|
|`BIT(23)`|`BIT_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256`|
|`BIT(24)`|`BIT_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA`|
|`BIT(25)`|`BIT_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA`|
|`BIT(26)`|`BIT_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA`|
|`BIT(27)`|`BIT_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA`|
|`BIT(28)`|Reserved|
|`BIT(29)`|Reserved|
|`BIT(30)`|Reserved|
|`BIT(31)`|`SSL_NEW_CIPHERS`|

---

**Note!** The RS9116W does not include hardware support for GCM based ciphers. Use of these ciphers may impact performance since related crypto operations are performed by software.

- `SSL_NEW_CIPHERS` should not be set alone. User is required to set the other corresponding bits in the bitmap along with SSL_NEW_CIPHERS to enable the cipher selection.

##### - e.g. (SSL_NEW_CIPHERS | BIT_TLS_RSA_WITH_AES_256_CBC_SHA256 | BIT_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256)

### Timeout Indication and Recovery

For every SAPI command response-timeout error, `0xFFFFFFE2` is returned. This error indicates the device exceeded the configured timeout in the SAPI driver.

If a timeout error occurs, the application has to reset the device and driver state as an error recovery mechanism.

Similarly, timeout error indication is added in the driver. For this, a callback needs to be registered. For callback registering, it is necessary to call the [rsi_register_wait_timeout_error_callbacks()](common#rsi-register-wait-timeout-error-callbacks) (Handler) API in the application and callback will have the error value `RSI_ERROR_RESPONSE_TIMEOUT` and cmd_type(Common,wlan,nwk,socket,tx,rx,BT,PROP_PROTOCOL) as the parameters.

**Syntax of callback**

> void rsi_register_wait_timeout_error_callbacks(void (*callback_handler_ptr)(uint32_t status, uint32_t cmd_type));

Timeouts are configurable in the SAPI driver with multiplication or addition factor in the file `rsi_user.h`. The configurable default values are provided below for reference:

**Mutiplication Factor**

> #define WIFI_INTERNAL_TIMEOUT_SF 1 #define WIFI_WAIT_TIMEOUT_SF 1 <br />
>  #define WIFI_BLOCKED_TIMEOUT_SF 1

**Addition Factor**

> #define TX_WAIT_TIME 0

Under Multiplication factor, total timers available are divided into three categories. Based on the value configured, the timers are multiplied. i.e in the above mentioned Multiplication factor, if the value configured is changed to 2, all the timers under that category will be doubled.

Under Addition factor, if user wants to increase all the timers then all timers will be increased by configured `TX_WAIT_TIME` value. For every command issued from SAPI to 9116, will wait for `TX_EVENT_WAIT_TIME` to receive a response from the device.

Generally, the default `TX_EVENT_WAIT_TIME` and `RX_EVENT_WAIT_TIME` are configured with 30 milliseconds.

For example, if we take a rejoin case, every retransmission takes a maximum time of 5 seconds. <br />

> rejoin_duration = (scan-to-scan_duration(4sec default, can be configurable in rsi_config.h)) + <br />
>  (active_channels_to_scan * 100ms) + (passive_channels_to_scan * 400ms)

So, in this case, before `TX_EVENT_WAIT_TIME` out buffer is full will occur if data transfer is there. So, in that case we need to increase the `TX_EVENT_WAIT_TIME`. This can be increased by configuring `TX_WAIT_TIME`. That is, if `TX_WAIT_TIME` is configured to `30000`, then `TX_EVENT_WAIT_TIME` will become `60000 ms` i.e. `TX_WAIT_TIME` + `DEFAULT_TX_EVENT_WAIT_TIME`.

### Error Codes

#### SAPI Generic Error Codes

|Error Codes|Error codes in hexadecimal format|Description|
|---|---|---|
|`-1`|`0xffffffff`|Host Time out error|
|`-2`|`0xfffffffe`|Invalid parameter|
|`-3`|`0xfffffffd`|Command given in wrong state|
|`-4`|`0xfffffffc`|Packet allocation failure|
|`-5`|`0xfffffffb`|Command not supported|
|`-6`|`0xfffffffa`|Insufficient buffer|
|`-7`|`0xfffffff9`|Error in OS Operation|
|`-8`|`0xfffffff8`|Error due to Invalid Memory|
|`-9`|`0xfffffff7`|Boot_up Options not saved|
|`-10`|`0xfffffff6`|Boot up Options check sum fail|
|`-11`|`0xfffffff5`|Boot loader Version not Match|
|`-12`|`0xfffffff4`|Waiting for Board Ready|
|`-13`|`0xfffffff3`|Invalid Address|
|`-14`|`0xfffffff2`|Valid Firmware not present|
|`-15`|`0xfffffff1`|Invalid option|
|`-16`|`0xfffffff0`|Maximum Callbacks are Exceeded|
|`-17`|`0xffffffef`|Set_Timer error|
|`-18`|`0xffffffee`|SIGACTION error|
|`-19`|`0xffffffed`|Not in Connected state|
|`-20`|`0xffffffec`|Not in IP Config state|
|`-21`|`0xffffffeb`|SPI busy error|
|`-22`|`0xffffffea`|SPI fail error|
|`-23`|`0xffffffe9`|SPI Timeout error|
|`-24`|`0xffffffe8`|Card ready timeout error|
|`-25`|`0xffffffe7`|Board ready timeout error|
|`-26`|`0xffffffe6`|Invalid Packet error|
|`-27`|`0xffffffe5`|Firmware Upgrade timeout error|
|`-28`|`0xffffffe4`|Firmware Load or Upgrade timeout error|
|`-29`|`0xffffffe3`|GPIO wakeup timeout error|
|`-30`|`0xffffffe2`|`RSI_ERROR_RESPONSE_TIMEOUT`|
|`-31`|`0xffffffe1`|BLE buffer full error|
|`-32`|`0xffffffe0`|Network command in progress|
|`-33`|`0xffffffdf`|Socket command in progress|
|`-34`|`0xffffffde`|WLAN command in progress|
|`-35`|`0xffffffdd`|Common command in progress|
|`-36`|`0xffffffdc`|PROP_PROTOCOL Buffer full error|
|`-37`|`0xffffffdb`|BT or BLE command in progress|
|`-38`|`0xffffffda`|BLE Attribute command in progress|
|`-39`|`0xffffffd9`|ATT command in progress|
|`-40`|`0xffffffd8`|Memory not aligned error|
|`-41`|`0xffffffd7`|Semaphore Creation Failed|
|`-42`|`0xffffffd6`|Semaphore Destroy Failed|
|`-43`|`0xffffffd5`|Error in WLAN command|
|`-44`|`0xffffffd4`|Rx Buffer check|
|`-45`|`0xffffffd3`|Parameter Length exceeds max length|
|`-46`|`0xffffffd2`|Error in common command|
|`-47`|`0xffffffd1`|Tx Buffer full|
|`-48`|`0xffffffd0`|SDIO Timeout|
|`-49`|`0xffffffcf`|SDIO write fail|
|`-50`|`0xffffffce`|Invalid config flag set|
|`-51`|`0xffffffcd`|BLE device Buffer in progress|
|`-52`|`0xffffffcc`|RSI_SET_REGION_SUPPORT is disabled|
|`-53`|`0xffffffcb`|callback_id exceeds maximun callbacks or callback already registered|
|`-54`|`0xffffffca`|callback_id exceeds maximun callbacks or callback already registered|
|`-55`|`0xffffffc9`|Using Legacy and AE commands simultaneously|
|`-56`|`0xffffffc8`|Entropy is returning a duplicate entropy|
|`-57`|`0xffffffc7`|RPS header is corrupted|

#### Bluetooth Generic Error Codes

|Error Code|Description|
|---|---|
|`0x4E01`|Unknown HCI command|
|`0x4E02`|Unknown Connection Identifier|
|`0x4E03`|Hardware failure|
|`0x4E04`|Page timeout|
|`0x4E05`|Authentication failure|
|`0x4E06`|Pin missing|
|`0x4E07`|Memory capacity exceeded|
|`0x4E08`|Connection timeout|
|`0x4E09`|Connection limit exceeded|
|`0x4E0A`|SCO limit exceeded|
|`0x4E0B`|ACL Connection already exists|
|`0x4E0C`|Command disallowed|
|`0x4E0D`|Connection rejected due to limited resources|
|`0x4E0E`|Connection rejected due to security reasons|
|`0x4E0F`|Connection rejected for BD address|
|`0x4E10`|Connection accept timeout|
|`0x4E11`|Unsupported feature or parameter|
|`0x4E12`|Invalid HCI command parameter|
|`0x4E13`|Remote user terminated connection|
|`0x4E14`|Remote device terminated connection due to low resources|
|`0x4E15`|Remote device terminated connection due to power off|
|`0x4E16`|Local device terminated connection|
|`0x4E17`|Repeated attempts|
|`0x4E18`|Pairing not allowed|
|`0x4E19`|Unknown LMP PDU|
|`0x4E1A`|Unsupported remote feature|
|`0x4E1B`|SCO offset rejected|
|`0x4E1C`|SCO interval rejected|
|`0x4E1D`|SCO Air mode rejected|
|`0x4E1E`|Invalid LMP parameters|
|`0x4E1F`|Unspecified|
|`0x4E20`|Unsupported LMP Parameter|
|`0x4E21`|Role change not allowed|
|`0x4E22`|LMP response timeout|
|`0x4E23`|LMP transaction collision|
|`0x4E24`|LMP PDU not allowed|
|`0x4E25`|Encryption mode not acceptable|
|`0x4E26`|Link key cannot change|
|`0x4E27`|Requested QOS not supported|
|`0x4E28`|Instant passed|
|`0x4E29`|Pairing with unit key not supported|
|`0x4E2A`|Different transaction collision|
|`0x4E2B`|Reserved 1|
|`0x4E2C`|QOS parameter not acceptable|
|`0x4E2D`|QOS rejected|
|`0x4E2E`|Channel classification not supported|
|`0x4E2F`|Insufficient security|
|`0x4E30`|Parameter out of mandatory range|
|`0x4E31`|Reserved 2|
|`0x4E32`|Role switch pending|
|`0x4E33`|Reserved 3|
|`0x4E34`|Reserved slot violation|
|`0x4E35`|Role switch failed|
|`0x4E36`|Extended Inquiry Response too large|
|`0x4E37`|Extended SSP not supported|
|`0X4E38`|Host busy pairing|
|`0x4E39`|Wrong BD Address|
|`0x4E3E`|Connection Failed to be Established|
|`0x4F01`|Invalid Gain table payload length|
|`0x4F02`|Invalid Region|
|`0x4F03`|Invalid Gain Table offset request type|
|`0x4F04`|Invalid Node ID|
|`0x4FF8`|BT Invalid Command|
|`0x0101`|Invalid Args|
|`0x0102`|Unknown|
|`0x0103`|Firmware Timeout|
|`0x0104`|Memory alloc fail|
|`0x0106`|I/O fail|
|`0x0108`|Unsupported|
|`0x0109`|Short buf|
|`0x010A`|Buf overflow|
|`0x010B`|Too large buf|
|`0x010C`|I/O abort|
|`0x010D`|File open fail|
|`0x1010`|OS task invalid priority|
|`0x1011`|OS task prio exists|
|`0x1012`|OS task not stopped|
|`0x1020`|OS sem max value|
|`0x1021`|OS sem not available|
|`0x1022`|OS sem reset|
|`0x1030`|OS mutex not owner|
|`0x1031`|OS mutex not locked|
|`0x1032`|OS mutex lock failed|
|`0x1033`|OS mutex try lock failed|
|`0x1040`|OS msg queue full|
|`0x1041`|OS message queue empty|
|`0x1050`|Pipe empty|
|`0x1051`|Pipe full|
|`0x1052`|Invalid len|
|`0x1053`|Pipe read in use|
|`0x1054`|Pipe write in use|
|`0x1060`|OS timer expired|
|`0x1061`|OS timer state running|
|`0x1070`|OS cannot wait|
|`0x1080`|OS mem pool empty|
|`0x1081`|OS mem pool size short|

#### BT Core Error Codes

|Error Code|Description|
|---|---|
|0xFF|BT Activity Pending|
|`0x4040`|I/O Fail|
|`0x4041`|Unknown|
|`0x4042`|HW Busy|
|`0x4043`|Max Sock|
|`0x4044`|Short Buf|
|`0x4045`|Max Name Size|
|`0x4046`|Invalid Args|
|`0x4047`|Sock open fail|
|`0x4048`|Timeout|
|`0x4049`|Socket state invalid|
|`0x404A`|Bad bd address|
|`0x404B`|Acl packet error|
|`0x404C`|Pool alloc fail|
|`0x404D`|Tx fail|
|`0x404E`|Connection refused|
|`0x404F`|Confirmation result|
|`0x4050`|Remote user disconnected|
|`0x4051`|Remote device not responding|
|`0x4052`|Invalid command|
|`0x4053`|Unsupported feature param value|
|`0x4054`|Thread create fail|
|`0x4055`|Sem wait fail|
|`0x4056`|Pool full|
|`0x4057`|Hw buffer overflow|
|`0x4058`|Tx buffer empty|
|`0x4059`|HCI connection fail|
|`0x405A`|Operation incomplete|
|`0x405B`|Operation cancel|
|`0x405C`|BSP error|
|`0x405D`|HW Buffer Overflow Timeout|
|`0x4060`|Sco connection fail|
|`0x4061`|No HCI connection|
|`0x4062`|Socket disconnected|
|`0x4063`|Socket timeout|
|`0x4064`|HCI connection encrypt fail|
|`0x4065`|Max acl packet buffer length|
|`0x4066`|Max nbr acl packets|
|`0x4067`|Invalid state|
|`0x4069`|Remote name fail|
|`0x406A`|Invalid response|
|`0x4071`|Invalid psm|
|`0x4072`|Psm in use|
|`0x4073`|Invalid hci connection handle|
|`0x4074`|Invalid cid|
|`0x4075`|Invalid pkt|
|`0x4080`|Scn is in use|
|`0x4081`|Max acl connections|
|`0x4082`|Sock already exists|
|`0x4100`|Invalid pdu|
|`0x4101`|Invalid pdu data element|
|`0x4102`|Sdp service not found|
|`0x4103`|Sdp attribute not found|
|`0x4104`|Sdp max service attribute|
|`0x4105`|Sdp PnP Service Already Exists|
|`0x4200`|Max RF communication channels|
|`0x4201`|RF communication disconnected|
|`0x4202`|RF communication channel not found|
|`0x4203`|RF communication invalid packet|
|`0x4204`|RF communication remote credits zero|
|`0x4205`|RF communication invalid state|
|`0x4206`|RF communication fcoff|
|`0x4207`|No service connection|
|`0x4300`|HCI connection already exists|
|`0x4301`|Max hci connection|
|`0x4302`|SCO invalid state|
|`0x4400`|OBEX unsupported args|
|`0x4401`|OBEX end of object|
|`0x4500`|SPP Not Connected|
|`0x4501`|SPP Not Initialized|
|`0x4502`|SPP Payload Limit Exceeds|
|`0x4510`|A2DP Not Initialized|
|`0x4511`|A2DP Connection Already Exists|
|`0x4512`|A2DP Not Streaming|
|`0x4513`|A2DP SBC Same Codec Params|
|`0x4514`|A2DP Reconfig Cmd Timeout|
|`0x4520`|PBAP not initialized|
|`0x4540`|AVRCP Not Initialized|
|`0x4541`|AVRCP Non Valid Capability ID|
|`0x4542`|AVRCP Non Valid Event ID|
|`0x4543`|AVRCP Reg Notification Resp Timeout|
|`0x4544`|AVRCP set abs vol resp Timeout|
|`0x4545`|AVRCP reg notification cmd in progress|
|`0x4546`|AVRCP set abs vol cmd in progress|
|`0x4547`|AVRCP conn already exists|
|`0x454E`|AVRCP Invalid Response|
|`0x454F`|AVRCP Command Not Implemented|
|`0x4550`|L2CAP Not Connected|
|`0x4551`|L2CAP Not Initialized|
|`0x4552`|L2CAP Data Length Exceeds Remote MTU|
|`0x4553`|L2CAP Socket Not Available|
|`0x4700`|AG Not Connected|
|`0x4800`|BT Pkt Unknown|
|`0x4900`|OBEX Max Buff Len|
|`0x4901`|OBEX HDR Not found|
|`0x4902`|OBEX HDR set length|
|`0x4903`|OBEX HDR ID invalid|
|`0x4904`|OBEX pkt invalid|
|`0x4906`|OBEX state invalid|
|`0x4907`|OBEX short buff|
|`0x4908`|OBEX Invalid args|
|`0x4909`|OBEX timeout|
|`0x4910`|OBEX MTU len|
|`0x4911`|OBEX Data len|
|`0x4912`|OBEX Tx Fail|
|`0x4913`|OBEX MTU too small|
|`0x4914`|OBEX resp fail|
|`0x4915`|OBEX Abort|
|`0x4921`|Remote Device Allocation Fail|
|`0x4922`|Audio Conn already exists|
|`0x4923`|BT Audio Fail|
|`0x4A00`|AVDTP Invalid Packet|
|`0x4A01`|AVDTP Closed|
|`0x4A02`|AVDTP Max Caps Length|
|`0x4A03`|AVDTP Invalid State|
|`0x4A04`|AVDTP Max Local Seps|
|`0x4B00`|BT CQUEUE Full|
|`0x4B01`|BT CQUEUE Empty|
|`0x4C00`|AVRCP Function Busy|
|`0x4C01`|AVRCP CMD Rejected|
|`0x4C02`|AVRCP CMD Attribute Not Found|
|`0x4FF9`|Inquiry cancel command is given when device is not in Inquiry State|
|`0x4604`|SPP Tx FAIL|

#### BT Event Queue Error Codes

|Error Code|Description|
|---|---|
|`0x1090`|OS Event queue full|
|`0x1091`|OS Event not available|
|`0x1092`|OS Event not created|
|`0x1093`|OS Event prio not created|
|`0x1094`|OS Event no event created|

#### BLE Generic Error Codes

|Error Code|Description|
|---|---|
|`0x4E3C`|Directed Advertising Timeout|
|`0x4E3D`|Connection terminated due to MIC failure|
|`0x4E60`|Invalid Handle Range|
|`0x4E61`|Memory is not sufficient|
|`0x4E62`|Invalid Parameters|
|`0x4E63`|BLE Buffer Count Exceeded|
|`0x4E64`|BLE Buffer already in use|
|`0x4E65`|Invalid Attribute Length When Small Buffer Mode is Configured|
|`0x4E66`|Invalid Name length when set to more than 16 bytes|

#### BLE Mode Error Codes

|Error Code|Description|
|---|---|
|`0x4A01`|Invalid Handle|
|`0x4A02`|Read not permitted|
|`0x4A03`|Write not permitted|
|`0x4A04`|Invalid PDU|
|`0x4A05`|Insufficient authentication|
|`0x4A06`|Request not supported|
|`0x4A07`|Invalid offset|
|`0x4A08`|Insufficient authorization|
|`0x4A09`|Prepare queue full|
|`0x4A0A`|Attribute not found|
|`0x4A0B`|Attribute not Long|
|`0x4A0C`|Insufficient encryption key size|
|`0x4A0D`|Invalid attribute value length|
|`0x4A0E`|Unlikely error|
|`0x4A0F`|Insufficient encryption|
|`0x4A10`|Unsupported group type|
|`0x4A11`|Insufficient resources|
|`0x4A80`|GATT Timeout|
|`0x4AFF`|Data Maintained in Host|
|`0x4B01`|SMP Passkey entry failed|
|`0x4B02`|SMP OOB not available|
|`0x4B03`|SMP Authentication Requirements|
|`0x4B04`|SMP confirm value failed|
|`0x4B05`|SMP Pairing not supported|
|`0x4B06`|SMP Encryption key size insufficient|
|`0x4B07`|SMP command not supported|
|`0x4B08`|SMP pairing failed|
|`0x4B09`|SMP repeated attempts|
|`0x4B0A`|SMP Invalid parameters|
|`0x4B0B`|SMP DH Key check failed|
|`0x4B0C`|SMP Numeric Comparison Failed|
|`0x4BFD`|SMP Invalid Keys Generated|
|`0x4BFE`|SMP Identical Public Key|
|`0x4C02`|PSM Conn Failed|
|`0x4D00`|BLE Remote device found|
|`0x4D01`|BLE Remote device not found|
|`0x4D02`|BLE Remote device structure full|
|`0x4D03`|Unable to change state|
|`0x4D04`|BLE not Connected|
|`0x4D05`|BLE socket not available.|
|`0x4D06`|Attribute record not found|
|`0x4D07`|Attribute entry not found|
|`0x4D08`|Profile record full|
|`0x4D09`|Attribute record full|
|`0x4D0A`|BLE profile not found (profile handler invalid)|
|`0x4D0B`|BLE Attribute Buffer Full|
|`0x4D10`|BLE Connection Sock not Available|
|`0x4D11`|BLE Remote Credits not Available|
|`0x4D14`|Parameter is outoff the manadatory range|

#### WLAN Error Codes

|Error Codes in hexadecimal format|Description|
|---|---|
|`0x0002`|Scan command issued while device is already associated with an Access Point|
|`0x0003`|No AP found|
|`0x0004`|Wrong PSK is issued while the device client tries to join an Access Point with WEP security enabled|
|`0x0005`|Invalid band|
|`0x0006`|Association not done or in unassociated state|
|`0x0008`|De-authentication received from AP|
|`0x0009`|Failed to associate to Access Point during "Join"|
|`0x000A`|Invalid channel|
|`0x000E`|1. Authentication failure during "Join" 2. Unable to find AP during join which was found during scan.|
|`0x000F`|Missed beacon from AP during join|
|`0x0013`|Non-existent MAC address supplied in "Disassociate" command|
|`0x0014`|EAP configuration is not done|
|`0x0015`|Memory allocation failed|
|`0x0016`|Information is wrong or insufficient in Join command|
|`0x0017`|Not a AP interface|
|`0x0018`|Push button command given before the expiry of previous push button command|
|`0x0019`|Scan results do not match with the network profile configured|
|`0x001A`|Frequency not supported|
|`0x001B`|Invalid opermode|
|`0x001C`|EAP configuration failed|
|`0x001D`|P2P configuration failed|
|`0x001E`|Unable to start Group Owner negotiation|
|`0x0020`|Join timeout|
|`0x0021`|1. Command given in incorrect state 2. SNTP client did not receive a response from server for time update|
|`0x0022`|Query GO parameters issued in incorrect operating mode|
|`0x0023`|Unable to form Access Point|
|`0x0024`|Wrong Scan input parameters supplied to "Scan" command|
|`0x0025`|Command issued during re-join in progress|
|`0x0026`|Wrong parameters the command request|
|`0x0027`|Provision discovery failed in P2P|
|`0x0028`|PSK length less than 8 bytes or more than 63 bytes|
|`0x0029`|Failed to clear or to set the Enterprise Certificate (Set Certificate)|
|`0x002A`|P2P Go negotiation failed|
|`0x002B`|Association between nodes failed in P2P WPS mode due to timeout|
|`0x002C`|If a command is issued by the Host when the device is internally executing auto-join or auto-create|
|`0x002D`|WEP key is of wrong length|
|`0x002E`|ICMP request timeout error|
|`0x002F`|ICMP data size exceeds maximum limit|
|`0x0030`|Send data packet exceeded the limit or length that is mentioned (or) MQTT publish data and publish data length mismatched (or) MQTT Send data packet exceeded the limit.|
|`0x0031`|ARP Cache entry not found|
|`0x0032`|UART command timeout happened|
|`0x0033`|Fixed data rate is not supported by connecting AP|
|`0x0036`|Maximum length exceeded of Username/password/Client_ID/Topic in MQTT|
|`0x0037`|Wrong WPS PIN|
|`0x0038`|Wrong WPS PIN length|
|`0x0039`|Wrong PMK length|
|`0x003a`|SSID not present for PMK generation|
|`0x003b`|SSID incorrect for PMK generation(more than 32 bytes)|
|`0x003C`|Band not supported|
|`0x003D`|User store configuration invalid length|
|`0x003E`|Error in length of the command (Exceeds number of characters is mentioned in the PRM)|
|`0x003F`|Data packet dropped|
|`0x0040`|WEP key not given|
|`0x0041`|Error in length of store config profile|
|`0x0042`|PSK or PMK not given|
|`0x0043`|Security mode given in join command is invalid|
|`0x0044`|Beacon miscount reaches max beacon miscount (De-authentication due to beacon miss)|
|`0x0045`|De-authentication received from supplicant|
|`0x0046`|De-authentication received from AP after channel switching|
|`0x0047`|Synchronization missed|
|`0x0048`|Authentication timeout occurred|
|`0x0049`|Association timeout|
|`0x004A`|BG scan in given channels is not allowed|
|`0x004B`|Scanned SSID and SSID given in Join are not matching|
|`0x004C`|Given number of clients exceeded max number of stations supported|
|`0x004D`|Given HT capabilities are not supported|
|`0x004E`|Uart Flow control not supported|
|`0x004F`|ZB/BT/BLE packet received and protocol is not enabled|
|`0x0050`|MGMT pkt dropped|
|`0x0051`|Invalid RF current mode|
|`0x0052`|Power save support is not present for a given interface|
|`0x0053`|Concurrent AP in connected state|
|`0x0054`|Connected AP or Station channel mismatch|
|`0x0055`|IAP co processor error|
|`0x0056`|WPS not supported in current operating mode|
|`0x0057`|Concurrent AP doesn't have same channel as connected station channel|
|`0x0058`|PBC session overlap error|
|`0x0059`|BT feature bit map invalid|
|`0x005A`|4/4 confirmation of 4 way handshake failed|
|`0x005B`|MAC address not present in MAC based join|
|`0X005C`|Concurrent mode, both AP and Client should UP, to enable configuration|
|`0x005D`|Certificate load not allowed in flash|
|`0x005E`|Certificate load not allowed in RAM|
|`0x005F`|Certificate load failed due to wrong inx|
|`0x0060`|AP HT caps not enabled|
|`0x0061`|Address family not supported by protocol.|
|`0x0062`|Invalid beacon interval or DTIM period provided.|
|`0x0063`|Invalid range of the configuration provided|
|`0x0064`|RTS THRESHOLD Config type is invalid.|
|`0x0065`|Error with MQTT command|
|`0x0066`|listen interval in power save is greater than the join listen interval|
|`0x0067`|Wlan radio deregistered|
|`0x0069`|SAE failure due to multiple confirm frames from AP|
|`0x006A`|AP does not support the EC-group set by station|
|`0x006C`|Store configuration not available|
|`0x0086`|Disconnected due to Security Association Query Timeout|
|`0x00AF`|Duplicate entry exists in DNS server table|
|`0x00B1`|Memory Error: No memory available|
|`0x00B2`|Invalid characters in JSON object|
|`0x00B3`|Update Commands: No such key found|
|`0x00B4`|No such file found: Re-check filename|
|`0x00B5`|No corresponding Web page exists with same filename|
|`0x00B6`|Space unavailable for new file|
|`0x00C1`|Invalid input data, Re-check filename, lengths etc|
|`0x00C2`|Space unavailable for new file|
|`0x00C3`|Existing file overwrite: Exceeds size of previous file. Use erase and try again|
|`0x00C4`|No such file found. Re-check filename|
|`0x00C5`|Memory Error: No memory available|
|`0x00C6`|Received more web-page data than the total length initially specified|
|`0x00C7`|Error in set region command|
|`0x00C8`|Web-page current chunk length is incorrect|
|`0x00CA`|Error in AP set region command|
|`0X00CB`|Error in AP set region command parameters|
|`0x00CC`|Region code not supported|
|`0x00CD`|Error in extracting country region from beacon|
|`0x00CE`|Device does not have selected region support|
|`0x00D1`|SSL/TLS Context Create Failed|
|`0x00D2`|SSL/TLS Handshake Failed. Socket will be closed|
|`0x00D3`|SSL/TLS Max sockets reached. Or FTP client is not connected|
|`0x00D4`|Cipher set failure|
|`0x00F1`|HTTP credentials maximum length exceeded|
|`0x00F2`|SNI/TLS extension not specified for TLS connection establishment|
|`0x00F7`|Feature not supported|
|`0x00F8`|Unable to write to flash OR Flash data verification failed|
|`0x00F9`|Calibration data verification failed|
|`0x0100`|SNMP internal error|
|`0x0104`|SNMP invalid IP protocol error|
|`0xBB01`|No data received or receive timeout|
|`0xBB08`|Insufficient data for converting NTP time to mm-dd-yy time format|
|`0xBB0A`|Invalid SNTP server address|
|`0xBB0B`|SNTP client not started|
|`0xBB10`|SNTP server not available, Client will not get any time update service from current server|
|`0xBB15`|SNTP server authentication failed|
|`0xBB0E`|Internal error|
|`0xBB16`|Entry not found for multicast IP address|
|`0xBB17`|No more entries found for multicast|
|`0xBB21`|IP address error|
|`0xBB22`|Socket already bound|
|`0xBB23`|Port not available|
|`0xBB27`|Socket is not created|
|`0xBB29`|ICMP request failed|
|`0xBB33`|Maximum listen sockets reached|
|`0xBB34`|DHCP duplicate listen|
|`0xBB35`|Port Not in close state|
|`0xBB36`|Socket is closed or in process of closing|
|`0xBB37`|Process in progress|
|`0xBB38`|Trying to connect non-existing TCP server socket|
|`0xBB3E`|Error in length of the command(Exceeds number of characters is mentioned in the PRM)|
|`0xBB40`|Wrong Packet Info|
|`0xBB41`|Corrupted RPS encountered during firmware update|
|`0xBB42`|Socket is still bound|
|`0xBB45`|No free port|
|`0xBB46`|Invalid port|
|`0xBB49`|Corrupted RPS header encountered during firmware update|
|`0xBB4B`|Feature not supported|
|`0xBB50`|Socket is not in connected state. Disconnected from server. In case of FTP, user need to give destroy command after receiving this error|
|`0xBB87`|POP3 session creation failed / POP3 session got terminated|
|`0xBB9C`|DHCPv6 Handshake failure|
|`0xBB9D`|DHCP invalid IP response|
|`0xBBA0`|SMTP Authentication error|
|`0xBBA1`|No DNS server was specified, SMTP over size mail data|
|`0xBBA2`|SMTP invalid server reply|
|`0xBBA3`|DNS query failed, SMTP internal error|
|`0xBBA4`|Bad DNS address, SMTP server error code received|
|`0xBBA5`|SMTP invalid parameters|
|`0xBBA6`|SMTP packet allocation failed|
|`0xBBA7`|SMTP GREET reply failed|
|`0xBBA8`|Parameter error, SMTP Hello reply error|
|`0xBBA9`|SMTP mail reply error|
|`0xBBAA`|SMTP RCPT reply error|
|`0xBBAB`|SMTP message reply error|
|`0xBBAC`|SMTP data reply error|
|`0xBBAD`|SMTP authentication reply error|
|`0xBBAE`|SMTP server error reply|
|`0xBBAF`|DNS duplicate entry.|
|`0xBBB1`|SMTP oversize server reply|
|`0xBBB2`|SMTP client not initialized|
|`0xBBB3`|DNS IPv6 not supported|
|`0xBBC5`|Invalid mail index for POP3 mail retrieve command|
|`0xBBD2`|SSL/TLS handshake failed|
|`0xBBD3`|FTP client is not connected or disconnected with the FTP server|
|`0xBBD4`|FTP client is not disconnected|
|`0xBBD5`|TLS RX Length Exceeded / Insufficient TLS Buffer Memory for handling TLS records or FTP file is not opened|
|`0xBBD6`|SSL/TLS handshake timeout or FTP file is not closed|
|`0xBBD9`|Expected [1XX response from FTP server but not received]|
|`0xBBDA`|Expected [2XX response from FTP server but not received]|
|`0xBBDB`|Expected [22X response from FTP server but not received]|
|`0xBBDC`|Expected [23X response from FTP server but not received]|
|`0xBBDD`|Expected [3XX response from FTP server but not received]|
|`0xBBDE`|Expected [33X response from FTP server but not received]|
|`0xBBE1`|HTTP Timeout|
|`0xBBE2`|HTTP Failed|
|`0xBBE7`|HTTP Timeout for HTTP PUT client|
|`0xBBEB`|Authentication Error|
|`0xBBED`|Invalid packet length, content length and received data length is mismatching|
|`0xBBEF`|Server responds before HTTP client request is complete|
|`0xBBF0`|HTTP/HTTPS password is too long|
|`0xBBF1`|MQTT ping time out error|
|`0xBBF2`|MQTT command sent in incorrect state|
|`0XBBF3`|MQTT ACK time out error|
|`0xBBFF`|POP3 error for invalid mail index|
|`0XFFFF`|Listening TCP socket in device is not connected to the remote peer, or the LTCP socket is not yet opened in the device|
|`0xFFFE`|Sockets not available. The error comes if the Host tries to open more than 10 sockets.|
|`0xFFFD`|HTTP OTAF invalid packet|
|`0xFFFC`|TCP_IP initialization failed|
|`0xFFFB`|Cannot create IP in same interface in concurrent mode|
|`0xFFF4`|HTTP OTAF incomplete packet|
|`0xFFF5`|Store configuration profile type mismatch or Invalid profile type|
|`0xFFF6`|MQTT REMOTE TERMINATE ERROR|
|`0xFFF7`|Byte stuffing error in AT mode|
|`0xFFF8`|1. Invalid command (e.g. parameters insufficient or invalid in the command). Invalid operation (e.g. power save command with the same mode given twice, accessing wrong socket, creating more than allowed sockets )|
|`0xFFF9`|HTTP OTAF no packet|
|`0XFFFA`|TCP socket is not connected|
|`0xFFC5`|Station count exceeded max station supported|
|`0xFFC4`|Unable to send TCP data|
|`0xFFBC`|Socket buffer too small|
|`0xFFBB`|Invalid content in the DNS response to the DNS Resolution query|
|`0xFFBA`|DNS Class error in the response to the DNS Resolution query|
|`0xFFB8`|DNS count error in the response to the DNS Resolution query|
|`0xFFB7`|DNS Return Code error in the response to the DNS Resolution query|
|`0xFFB6`|DNS Opcode error in the response to the DNS Resolution query|
|`0xFFB5`|DNS ID mismatch between DNS Resolution request and response|
|`0xFFAB`|An invalid input to the DNS Resolution query|
|`0xFF42`|DNS response was timed out|
|`0xFFA1`|ARP request failure|
|`0xFF91`|Unable to update TCP Window|
|`0xFF9D`|DHCP lease time expired|
|`0xFF9C`|DHCP handshake failure|
|`0xFF88`|This error is issued when WebSocket creation failed|
|`0xFF87`|This error is issued when device tried to connect to a non-existent TCP server socket on the remote side|
|`0xFF86`|This error is issued when tried to close non-existent socket. or invalid socket descriptor|
|`0xFF85`|Invalid socket parameters|
|`0xFF82`|Feature not supported|
|`0xFF81`|Socket already open|
|`0xFF80`|Attempt to open more than the maximum allowed number of sockets|
|`0XFF7E`|Data length exceeds mss|
|`0XFF75`|DUT unable to configure IP Address due to IP conflict|
|`0xFF74`|Feature not enabled|
|`0xFF73`|DHCP server not set in AP mode|
|`0xFF71`|Error in AP set region command parameters|
|`0xFF70`|SSL/TLS not supported|
|`0xFF6F`|JSON not supported|
|`0xFF6E`|Invalid operating mode|
|`0xFF6D`|Invalid socket configuration parameters|
|`0xFF6C`|Web socket creation timeout|
|`0xFF6B`|Parameter maximum allowed value is exceeded|
|`0xFF6A`|Socket read timeout|
|`0xFF69`|Invalid command in sequence|
|`0xFF42`|DNS response timed out|
|`0xFF41`|HTTP socket creation failed|
|`0xFF40`|TCP socket close command is issued before getting the response of the previous close command|
|`0xFF36`|Wait On Host feature not enabled|
|`0xFF35`|Store configuration checksum validation failed|
|`0xFF33`|TCP keep alive timed out|
|`0xFF2D`|TCP ACK failed for TCP SYN-ACK|
|`0xFF2C`|Memory limit exceeded in a given operating mode|
|`0xFF2A`|Memory limit exceeded in operating mode during auto join/create|
|`0xCC2F`|PUF Operation is blocked|
|`0xCC31`|PUF Activation code invalid|
|`0xCC32`|PUF input parameters invalid|
|`0xCC33`|PUF in error state|
|`0XCC34`|PUF Operation not allowed|
|`0XCC35`|PUF operation Failed|
|`0x5a5a`|Auto join or user store configuration going on.|
|`0xFFE1`|Improper RSNIE from AP to station|
|`0xFF5F`|Reached maximum SNTP Invalid attempts|
|`0x00FC`|Frequency offset sent is zero|
|`0x00FB`|Frequency offset specified goes beyond the upper limit or lower limit and indicates that frequency offset cannot be changed further|

#### BSD Socket Error Codes

|Error Code|Error code (Hex format)|Description|
|---|---|---|
|`RSI_ERROR_EPERM`|`0x0001`|Operation not permitted|
|`RSI_ERROR_E_MIN`|`0x0001`|Minimum Socket/IO error|
|`RSI_ERROR_ENOENT`|`0x0002`|No such file or directory|
|`RSI_ERROR_ESRCH`|`0x0003`|No such process|
|`RSI_ERROR_EINTR`|`0x0004`|Interrupted system call|
|`RSI_ERROR_EIO`|`0x0005`|I/O error|
|`RSI_ERROR_ENXIO`|`0x0006`|No such device or address|
|`RSI_ERROR_E2BIG`|`0x0007`|Argument list too long|
|`RSI_ERROR_ENOEXEC`|`0x0008`|Exec format error|
|`RSI_ERROR_EBADF`|`0x0009`|Bad file number|
|`RSI_ERROR_ECHILD`|`0x000A`|No child processes|
|`RSI_ERROR_EAGAIN`|`0x000B`|Try again|
|`RSI_ERROR_ENOMEM`|`0x000C`|Out of memory|
|`RSI_ERROR_EACCES`|`0x000D`|Permission denied|
|`RSI_ERROR_EFAULT`|`0x000E`|Bad address|
|`RSI_ERROR_ENOTBLK`|`0x000F`|Block device required|
|`RSI_ERROR_EBUSY`|`0x0010`|Device or resource busy|
|`RSI_ERROR_EEXIST`|`0x0011`|File exists|
|`RSI_ERROR_EXDEV`|`0x0012`|Cross-device link|
|`RSI_ERROR_ENODEV`|`0x0013`|No such device|
|`RSI_ERROR_ENOTDIR`|`0x0014`|Not a directory|
|`RSI_ERROR_EISDIR`|`0x0015`|Is a directory|
|`RSI_ERROR_EINVAL`|`0x0016`|Invalid argument|
|`RSI_ERROR_ENFILE`|`0x0017`|File table overflow|
|`RSI_ERROR_EMFILE`|`0x0018`|Too many open files|
|`RSI_ERROR_ENOTTY`|`0x0019`|Not a typewriter|
|`RSI_ERROR_ETXTBSY`|`0x001A`|Text file busy|
|`RSI_ERROR_EFBIG`|`0x001B`|File too large|
|`RSI_ERROR_ENOSPC`|`0x001C`|No space left on device|
|`RSI_ERROR_ESPIPE`|`0x001D`|Illegal seek|
|`RSI_ERROR_EROFS`|`0x001E`|Read-only file system|
|`RSI_ERROR_EMLINK`|`0x001F`|Too many links|
|`RSI_ERROR_EPIPE`|`0x0020`|Broken pipe|
|`RSI_ERROR_EDOM`|`0x0021`|Math argument out of domain of func|
|`RSI_ERROR_ERANGE`|`0x0022`|Math result not representable|
|`RSI_ERROR_EDEADLK`|`0x0023`|Resource deadlock would occur|
|`RSI_ERROR_ENAMETOOLONG`|`0x0024`|File name too long|
|`RSI_ERROR_ENOLCK`|`0x0025`|No record locks available|
|`RSI_ERROR_ENOSYS`|`0x0026`|Function not implemented|
|`RSI_ERROR_ENOTEMPTY`|`0x0027`|Directory not empty|
|`RSI_ERROR_ELOOP`|`0x0028`|Too many symbolic links encountered|
|`RSI_ERROR_EWOULDBLOCK`|`0x0029`|Operation would block|
|`RSI_ERROR_ENOMSG`|`0x002A`|No message of desired type|
|`RSI_ERROR_EIDRM`|`0x002B`|Identifier removed|
|`RSI_ERROR_ECHRNG`|`0x002C`|Channel number out of range|
|`RSI_ERROR_EL2NSYNC`|`0x002D`|Level 2 not synchronized|
|`RSI_ERROR_EL3HLT`|`0x002E`|Level 3 halted|
|`RSI_ERROR_EL3RST`|`0x002F`|Level 3 reset|
|`RSI_ERROR_ELNRNG`|`0x0030`|Link number out of range|
|`RSI_ERROR_EUNATCH`|`0x0031`|Protocol driver not attached|
|`RSI_ERROR_ENOCSI`|`0x0032`|No CSI structure available|
|`RSI_ERROR_EL2HLT`|`0x0033`|Level 2 halted|
|`RSI_ERROR_EBADE`|`0x0034`|Invalid exchange|
|`RSI_ERROR_EBADR`|`0x0035`|Invalid request descriptor|
|`RSI_ERROR_EXFULL`|`0x0036`|Exchange full|
|`RSI_ERROR_ENOANO`|`0x0037`|No anode|
|`RSI_ERROR_EBADRQC`|`0x0038`|Invalid request code|
|`RSI_ERROR_EBADSLT`|`0x0039`|Invalid slot|
|`RSI_ERROR_EBFONT`|`0x003B`|Bad font file format|
|`RSI_ERROR_ENOSTR`|`0x003C`|Device not a stream|
|`RSI_ERROR_ENODATA`|`0x003D`|No data available|
|`RSI_ERROR_ETIME`|`0x003E`|Timer expired|
|`RSI_ERROR_ENOSR`|`0x003F`|Out of streams resources|
|`RSI_ERROR_ENONET`|`0x0040`|Machine is not on the network|
|`RSI_ERROR_ENOPKG`|`0x0041`|Package not installed|
|`RSI_ERROR_EREMOTE`|`0x0042`|Object is remote|
|`RSI_ERROR_ENOLINK`|`0x0043`|Link has been severed|
|`RSI_ERROR_EADV`|`0x0044`|Advertise error|
|`RSI_ERROR_ESRMNT`|`0x0045`|Srmount error|
|`RSI_ERROR_ECOMM`|`0x0046`|Communication error on send|
|`RSI_ERROR_EPROTO`|`0x0047`|Protocol error|
|`RSI_ERROR_EMULTIHOP`|`0x0048`|Multihop attempted|
|`RSI_ERROR_EDOTDOT`|`0x0049`|RFS specific error|
|`RSI_ERROR_EBADMSG`|`0x004A`|Not a data message|
|`RSI_ERROR_EOVERFLOW`|`0x004B`|Value too large for defined data type|
|`RSI_ERROR_ENOTUNIQ`|`0x004C`|Name not unique on network|
|`RSI_ERROR_EBADFD`|`0x004D`|File descriptor in bad state|
|`RSI_ERROR_EREMCHG`|`0x004E`|Remote address changed|
|`RSI_ERROR_ELIBACC`|`0x004F`|Can not access a needed shared library|
|`RSI_ERROR_ELIBBAD`|`0x0050`|Accessing a corrupted shared library|
|`RSI_ERROR_ELIBSCN`|`0x0051`|.lib section in a.out corrupted|
|`RSI_ERROR_ELIBMAX`|`0x0052`|Attempting to link in too many shared libraries|
|`RSI_ERROR_ELIBEXEC`|`0x0053`|Cannot exec a shared library directly|
|`RSI_ERROR_EILSEQ`|`0x0054`|Illegal byte sequence|
|`RSI_ERROR_ERESTART`|`0x0055`|Interrupted system call should be restarted|
|`RSI_ERROR_ESTRPIPE`|`0x0056`|Streams pipe error|
|`RSI_ERROR_EUSERS`|`0x0057`|Too many users|
|`RSI_ERROR_ENOTSOCK`|`0x0058`|Socket operation on non-socket|
|`RSI_ERROR_EDESTADDRREQ`|`0x0059`|Destination address required|
|`RSI_ERROR_EMSGSIZE`|`0x005A`|Message too long|
|`RSI_ERROR_EPROTOTYPE`|`0x005B`|Protocol wrong type for socket|
|`RSI_ERROR_ENOPROTOOPT`|`0x005C`|Protocol not available|
|`RSI_ERROR_EPROTONOSUPPORT`|`0x005D`|Protocol not supported|
|`RSI_ERROR_ESOCKTNOSUPPORT`|`0x005E`|Socket type not supported|
|`RSI_ERROR_EOPNOTSUPP`|`0x005F`|Operation not supported on transport endpoint|
|`RSI_ERROR_EPFNOSUPPORT`|`0x0060`|Protocol family not supported|
|`RSI_ERROR_EAFNOSUPPORT`|`0x0061`|Address family not supported by protocol|
|`RSI_ERROR_EADDRINUSE`|`0x0062`|Address already in use|
|`RSI_ERROR_EADDRNOTAVAIL`|`0x0063`|Cannot assign requested address|
|`RSI_ERROR_ENETDOWN`|`0x0064`|Network is down|
|`RSI_ERROR_ENETUNREACH`|`0x0065`|Network is unreachable|
|`RSI_ERROR_ENETRESET`|`0x0066`|Network dropped connection because of reset|
|`RSI_ERROR_ECONNABORTED`|`0x0067`|Software caused connection abort|
|`RSI_ERROR_ECONNRESET`|`0x0068`|Connection reset by peer|
|`RSI_ERROR_ENOBUFS`|`0x0069`|No buffer space available|
|`RSI_ERROR_EISCONN`|`0x006A`|Transport endpoint is already connected|
|`RSI_ERROR_ENOTCONN`|`0x006B`|Transport endpoint is not connected|
|`RSI_ERROR_ESHUTDOWN`|`0x006C`|Cannot send after transport endpoint shutdown|
|`RSI_ERROR_ETOOMANYREFS`|`0x006D`|Too many references: cannot splice|
|`RSI_ERROR_ETIMEDOUT`|`0x006E`|Connection timed out|
|`RSI_ERROR_ECONNREFUSED`|`0x006F`|Connection refused|
|`RSI_ERROR_EHOSTDOWN`|`0x0070`|Host is down|
|`RSI_ERROR_EHOSTUNREACH`|`0x0071`|No route to host|
|`RSI_ERROR_EALREADY`|`0x0072`|Operation already in progress|
|`RSI_ERROR_EINPROGRESS`|`0x0073`|Operation now in progress|
|`RSI_ERROR_ESTALE`|`0x0074`|Stale NFS file handle|
|`RSI_ERROR_EUCLEAN`|`0x0075`|Structure needs cleaning|
|`RSI_ERROR_ENOTNAM`|`0x0076`|Not a XENIX named type file|
|`RSI_ERROR_ENAVAIL`|`0x0077`|No XENIX semaphores available|
|`RSI_ERROR_EISNAM`|`0x0078`|Is a named type file|
|`RSI_ERROR_EREMOTEIO`|`0x0079`|Remote I/O error|
|`RSI_ERROR_EDQUOT`|`0x007A`|Quota exceeded|
|`RSI_ERROR_ENOMEDIUM`|`0x007B`|No medium found|
|`RSI_ERROR_EMEDIUMTYPE`|`0x007C`|Wrong medium type|
|`RSI_ERROR_ECANCELED`|`0x007D`|Operation Canceled|
|`RSI_ERROR_ENOKEY`|`0x007E`|Required key not available|
|`RSI_ERROR_EKEYEXPIRED`|`0x007F`|Key has expired|
|`RSI_ERROR_EKEYREVOKED`|`0x0080`|Key has been revoked|
|`RSI_ERROR_EKEYREJECTED`|`0x0081`|Key was rejected by service|
|`RSI_ERROR_EOWNERDEAD`|`0x0082`|Owner died - for robust mutexes|
|`RSI_ERROR_ENOTRECOVERABLE`|`0x0083`|State not recoverable|
|`RSI_ERROR_ERFKILL`|`0x0084`|Operation not possible due to RF-kill|

### Logging User Guide

This section describes the logging framework used to push important information on target logging interface in a compressed format.

The logging framework is designed to provide standard `printf()` like experience to the developers without overloading the debug target(UART by default) with redundant information. The framework compresses the amount of log data that is pushed on to the target.

In order to achieve this compression,

- SAPI and FW Logs follows strict Syntax rules.
- A pre-build analyzer tool converts all static information(read-only component of SAPI and FW logs) in log description file placed in the build system.
- A C framework embedded within SAPI and FW emits the dynamic components of logs along with an identifier and compressed timestamp(conditionally).
- The compressed logs are processed offline by a decoder to regenerate the human readable log data.

##### Compression Numbers in different scenarios

|Scenario|Number of bytes emitted|
|---|---|
|No Debug Arguments, first 32 Debug IDs|1 Byte|
|No Debug Arguments, 32-4096 Debug IDs|2 bytes|
|Cost of Timestamp|1 byte if temporal spacing between two consecutive logs is more than 1ms. 2 bytes if temporal spacing between two consecutive logs is more than 127ms|
|Cost of each fixed length argument|Number of bytes in argument|
|Cost of string|Length of string(Null terminated)|

#### SAPI Logging

##### Enable/Disable SAPI Logs

Compile time switch `SAPI_LOGGING_ENABLE` should be enabled for SAPI logs to be active. If the compile switch `SAPI_LOGGING_ENABLE` is not present, SAPI log instances are considered as void statements and shall not generate any code.

##### Syntax for SAPI Logging calls

The calls to SAPI Logs should strictly follow below syntax. 

> SL_PRINTF(DEBUG_ELEMENT, COMPONENT, LOG_LEVEL, Format, <Arguments>);

###### DEBUG_ELEMENT

The `DEBUG_ELEMENT` is the unique identifier for a logging call. In order to add a new logging call, user is just required to mention a new DEBUG_ELEMENT in the fucntion call, user is not required to define this new DEBUG_ELEMENT. A pre-processing tool shall search for all occurences of `SL_PRINTF` calls in the source files and prepare an enum with all unique `DEBUG_ELEMENTS`.

###### COMPONENT

The component the module to which the debug log belongs to. Currently supported list of components is:

- BLE
- BLUETOOTH
- COMMON
- CRYPTO
- DRIVER
- FW_UPDATE
- NETWORK
- WLAN

###### Log Levels

The level of active logs can be controlled through compile switch `CONFIG_DEBUG_LEVEL` present in `rsi_user.h`. The compile switch define can be initialized with one of four possible enum values:

- LOG_OFF
- LOG_ERROR
- LOG_WARNING
- LOG_INFO

As the enums suggest, `LOG_OFF` turns off logging, `LOG_ERROR` provides minimum logging and `LOG_INFO` provides maximum logging.

e.g. Suppose the user configures `CONFIG_DEBUG_LEVEL` to LOG_ERROR then only `SL_PRINTF` calls having debug level as LOG_ERROR will be processed. Similarly, if the user configures `CONFIG_DEBUG_LEVEL` to LOG_WARNING then `SL_PRINTF` calls with LOG_ERROR and LOG_WARNING debug levels will be processed.

>**Note!** It is not intended to use LOG_OFF as a debug level in any SL_PRINTF call.

###### Format

Format defines how additional arguments in the logging call should be treated. The format is parsed by the pre-processing tool and information is stored in build system. The format information is latter used to display the decoded logs.

Important rules:

- Each argument defination should be separated by ','
- Each Argument defination should comprise of a Display Name and properties, separated by ':'
- The display name is what will be visible in decoded output log against each argument.
- sign should be used only to identify debug argument property. Number of % signs denotes number of arguments that are being pased in the debug log.
- b stands for 1 byte argument which should be displayed in decimal format.
- w stands for 2 byte argument which should be displayed in decimal format.
- d stands for 4 byte argument which should be displayed in decimal format.
- s stands for a variable length string which should always be terminated by NULL character.
- %1x stands for 1 byte argument which should be displayed in Hexadecimal format.
- %2x stands for 2 byte argument which should be displayed in Hexadecimal format.
- %4x stands for 4 byte argument which should be displayed in Hexadecimal format.

The format is also used by pre-processing tool to identify number of arguments in given debug call and define `SL_PRINTF` call for given `DEBUG_ELEMENT` accordingly. There is no limit to number of times logging call is made with same `DEBUG_ELEMENT` but the format should remain the same for each of these calls. The pre-processor tool shall throw error if any descripancy is found in format.

###### Arguments

For a fixed length argument, parameters shall be passed by value. For strings, parameters shall be passed by reference.

>**Note!** The format and arguments fields are optional. `SL_PRINTF` call shall have only three mandatory arguments(`DEBUG_ELEMENT`, `COMPONENT` and `LOG_LEVEL`) if an argument is not required in the call.

##### Pre-Processing tool

The `advanced_logs_generator.py` is a pre-processing python script present at the path: `<SDK>\utilities\advanced_logging\app_logging`. This tool is used to generate the `debug_auto_gen.h` file at the path: `<SDK>\sapi\include`. The `debug_auto_gen.h` comprises all the enumerations of all `DEBUG_ELEMENTS` and declarations required for the logging framework.

Whenever the user wants to add a new SAPI logging call, a new `debug_auto_gen.h` needs to be generated using the `advanced_log_generator.py` pre-processing tool.

>**Note!** The pre-processing tool should be invoked mandatorily if a new(unique) SAPI logging call is introduced. The autogenerated files are already updated as part of the release package for all existing SAPI logging calls.

Given below is an example of adding the new SAPI logging call and execution of the `advanced_log_generator.py`.

e.g. Let's add a new SL_PRINTF call similar to an existing error case SL_PRINTF call present in the `rsi_config_ipaddress` API.

![After_adding_call](/wifibt-wc-sapi-reference/2.14.0/images/after-adding-sapi-logging-call.png)

Now let's execute the `advanced_log_generator.py` to get the new SAPI logging elements and declarations in [debug_auto_gen.h](debug-auto-gen-8h-source#debug-auto-gen-8h-source) file

![Preprocessing_tool_execution](/wifibt-wc-sapi-reference/2.14.0/images/sapi-logging-alg-execution.png)

>**Note!** For successful execution of advanced_log_generator.py or sapi_log_decoder.py python scripts, it is recommended to use Python version 3.9 or higher.

![Python_Version](/wifibt-wc-sapi-reference/2.14.0/images/sapi-logging-python-version.png)

Upon execution of the tool, changes like those shown below take place in the `debug_auto_gen.h` & `manifest.json` files.

In `debug_auto_gen.h`,

![debug_auto_gen_1](/wifibt-wc-sapi-reference/2.14.0/images/new-sapi-call-debug-auto-gen-1.png)

![debug_auto_gen_2](/wifibt-wc-sapi-reference/2.14.0/images/new-sapi-call-debug-auto-gen-2.png)

![debug_auto_gen_3](/wifibt-wc-sapi-reference/2.14.0/images/new-sapi-call-debug-auto-gen-3.png)

and in `manifest.json`,

![entry_in_manifest](/wifibt-wc-sapi-reference/2.14.0/images/new-sapi-call-entry-manifest-json.png)

There is another file named `manifest.json` which is present in the same folder. This JSON file comprises metadata corresponding to all SAPI logging calls required at the time of decoding the logs.

##### Decoding SAPI Logs

The decoder tool `sapi_log_decoder.py` is a python tool present in the `utilities\advanced_logging\app_logging` folder. The decoder tool takes the encoded logs as the input and searches for `#@$` in the start of line. The tool expects the rest of the line to have heaxdecimal numbers which are then decoded to generate human readable text file.

Given below is an example of the SAPI logs, before and after decoding.

![Before_Decoding](/wifibt-wc-sapi-reference/2.14.0/images/sapi-logging-debug-prints.png)

![After_Decoding](/wifibt-wc-sapi-reference/2.14.0/images/sapi-logging-decoded-prints.png)

#### Firmware Logging

##### Enable/Disable Firmware Logs

Compile time switch `FW_LOGGING_ENABLE` should be enabled for firmware logs to be active. If the compile switch `FW_LOGGING_ENABLE` is not present, firmware log instances are considered as void statements and shall not generate any code. The level of active firmware logs can be controlled using `sl_set_fw_component_log_levels` followed by `sl_fw_log_configure` calls. User is required to add `sl_fw_logging.c` and `firmware_logging_util.c` to the project. The latter file has a reference implementation to manage the received firmware logging messages. Refer to the code snippet below to configure firmware logging.

```c
//! Set log levels for firmware components
sl_set_fw_component_log_levels(&fw_component_log_level);

//! Configure firmware logging
status = sl_fw_log_configure(FW_LOG_ENABLE,
                             FW_TSF_GRANULARITY_US,
                             &fw_component_log_level,
                             FW_LOG_BUFFER_SIZE,
                             sl_fw_log_callback);
if (status != RSI_SUCCESS) {
  LOG_PRINT("\r\n Firmware Logging Init Failed\r\n");
} else {
  LOG_PRINT("\r\n Firmware Logging Init success\r\n");
}

```

>**Note!** For more details can refer `tcp_logging_stats`

##### Firmware Log Components

The component to which the debug log belongs to. Current supported list of components is:

- COMMON - common section among all protocols
- CM_PM - Coex manager and power manager logs are used to debug issues involving multi protocols and power save.
- WLAN_LMAC - LMAC logs are used to debug Transmit/Receive related issues
- WLAN_UMAC - UMAC logs are used to debug Supplicant, SME, APME layers issues
- WLAN_NETSTACK - Network stack logs are used to debug TCP/IP and application layers issues
- BT_BLE_CTRL - Bluetooth and Bluetooth Low Power controller logs are used to debug issues in controller
- BT_BLE_STACK - Bluetooth and Bluetooth Low Power controller logs are used to debug issues in stack

##### Firmware Logging Parameters

Applications for which firmware logging has been enabled, contain parameters that can be configured according to the users requirements and constraints. 

###### Component Log Levels

The level of active logs of individual firmware components can be controlled through compile switches in application configuration files. The compile switch define can be initialized with one of five possible values:

- FW_LOG_OFF
- FW_LOG_ERROR
- FW_LOG_WARN
- FW_LOG_TRACE
- FW_LOG_INFO

###### Log Buffer Size

Determines the size of log packet recieved from firmware. The log buffer size can vary from a minimum of 2048 bytes to a maximum of 4096 bytes. The size can be varied with increments of 512 bytes. Any size below the minimum size or more than maximum size will be replaced with corresponding limits.

###### Log Queue Size

Determines the number of elements in the firmware log queue. The log queue ensures that debug logs arriving from firmware are not lost when previously received logs are being processed. For a larger queue size, more debug logs can be stored in the queue. It has a minimum value of 1. 

> Increasing the log queue size increases the memory required by the firmware logging framework, during application initialization.

##### Decoding Firmware Logs

The decoder tool `fw_log_decoder.py` is a python tool present in the `utilities\advanced_logging\firmware_logging` folder.

The decoder tool takes the encoded logs as the input and searches for `&^$` in the start of line. The tool expects the rest of the line to have heaxdecimal numbers which are then decoded to generate human readable text file. Given below is an example of the firmware logs, before and after decoding. ![Before_Decoding](/wifibt-wc-sapi-reference/2.14.0/images/fw-logging-debug-prints.png)

![After_Decoding](/wifibt-wc-sapi-reference/2.14.0/images/fw-logging-decoded-prints.png)

### SAPI Changelog

This section describes details of changes and enhancements in the RS9116W SAPI library that are likely to impact backward compatibility. A novel compressed logging framework is added to provide debug information to developers. This framework is developed in June 2022 included in WiSeConnect 2.6 SDK release. A list of additional changes for previous releases is also provided.

#### SAPI Changelog

##### Folder/Filename Changes for Release: 2.4

The SAPI directory in the root folder of the SDK has been changed from `sapis` to `sapi`. The changes listed in the following table were made to files and sub-folders inside the `sapi` directory.

|Previous Name|New Name|Notes|
|---|---|---|
|`bt_ble`|`bluetooth`|Renamed|
|||Moved `bt_ble/rsi_audio_codec` to root level `third_party/sbc_audio_codec`|
|||Moved `rsi_bt_sbc_codec.c` from root level `third_party/sbc_audio_codec` to the `sapi/bluetooth` directory|
|||Removed various unsupported source files for profiles including hfp, hid, iap, sdp and l2cap|
|`build`|-|Removed|
|`drivers`|`drivers`|No change|
|||Renamed `drivers/intf` to `drivers/device_interface`|
|||Removed various unsupported source files from the package including `rsi_zb.c`, `rsi_zb-utility.c`, `rsi_iap.c`|
|`examples`|-|Moved to the root directory of the SDK|
|`hal`|-|Moved into root level `platforms` directory|
|`nwk`|`network`|Renamed|
|||Renamed `sapis/nwk/applications` to `sapi/network/protocols`|
|||Moved `mqtt_client` from `sapis/nwk/applications` to root level `third_party/mqtt_client`. In the `mqtt_client/src` directory, renamed `MQTT_Wrappers.c` to `MQTT_sapi_wrappers.c`|
|||Moved `aws_sdk` from `sapis/nwk/applications` to root level `third_party/aws_sdk`|
|`os`|`rtos`|Renamed|
|||Renamed `os/free_rtos` to `rtos/freertos_wrapper`|
|||Moved `sapis/os/amazon-freertos` to root level `third_party/amazon-freertos`|
|`puf`|-|No longer included in the SDK|
|`rom`|-|No longer included in the SDK|

##### Modifications for Release: 2.6

|Wi-Fi APIs|Notes|Resolution for Backward Compatibility|
|---|---|---|
|[rsi_wlan_scan()](wlan#rsi-wlan-scan)|Added DFS channels and 4.9GHz channels|NA|
|sl_fw_log_configure()|Sends the configurable parameters for firmware logging framework|NA|
|sl_set_fw_component_log_levels()|Sets debug log levels for firmware components|NA|
|sl_fw_log_init()|Initializes the firmware logging feature|NA|
|sl_fw_queue_init()|Creates a queue for firmware log messages|NA|
|sl_fw_log_enqueue()|Enqueues a log message node to the firmware log message queue|NA|
|sl_fw_log_dequeue()|Dequeues a log message node from the firmware log message queue|NA|
|sl_fw_log_pool_init()|Creates log pool from the provided buffer|NA|
|sl_fw_log_node_alloc()|Allocates a log node from given log pool|NA|
|sl_fw_log_node_free()|Frees the given log node|NA|
|sl_fw_log_print()|Prints the log message from firmware|NA|

##### Modifications for Release: 2.5

|Wi-Fi APIs|Notes|Resolution for Backward Compatibility|
|---|---|---|
|[rsi_destroy_driver_task_and_driver_deinit()](common#rsi-destroy-driver-task-and-driver-deinit)|Need to call after the driver initialization|NA|
|[rsi_set_config()](common#rsi-set-config)|Configure XO Ctune value from host|NA|
|[rsi_gpio_pininit()](common#rsi-gpio-pininit)|Configure TA GPIOs using Command from host.This is a non-blocking API.|Added new parameter "gpio_type"|
|[rsi_gpio_writepin()](common#rsi-gpio-writepin)|Drive the Module GPIOs high or low using command from host. This is a non-blocking API.|Added new parameter "gpio_type"|
|[rsi_gpio_readpin()](common#rsi-gpio-readpin)|Read status of TA GPIOs using Command from host. This is a non-blocking API.|Added new parameter "gpio_type"|
|[rsi_gpio_read()](common#rsi-gpio-read)|Read status of TA GPIOs using Command from host. This is a non-blocking API.|NA|
|[rsi_gpio_write()](common#rsi-gpio-write)|Drive the TA GPIOs high or low using command from host. This is a non-blocking API.|NA|
|is_power_of_two()|Checking input parameter is power of two or not. This is a non-blocking API.|NA|
|[rsi_mutex_lock_from_isr()](rtos#rsi-mutex-lock-from-isr)|Take the mutex from ISR context|NA|
|[rsi_mutex_unlock_from_isr()](rtos#rsi-mutex-unlock-from-isr)|Give the mutex from ISR context|NA|

|Bluetooth APIs|Notes|Resolution for Backward Compatibility|
|---|---|---|
|[rsi_ble_indicate_value_sync()](bt-low-energy4#rsi-ble-indicate-value-sync)|Indicate the local value to the remote device|NA|
|[rsi_ble_mtu_exchange_resp()](bt-low-energy3#rsi-ble-mtu-exchange-resp)|Sent in reply to a received Exchange MTU Request|NA|
|[rsi_bt_cmd_update_gain_table_offset_or_max_pwr()](bt-ble#rsi-bt-cmd-update-gain-table-offset-or-max-pwr)|Update gain table offset/max power|NA|
|rsi_ble_on_mtu_exchange_info_t|Callback function to indicate MTU size and who initated MTU Exchange Request|NA|

##### Modifications for Release: 2.4

###### Timeout Error Indication and Recovery Mechanism

All SAPI command response-timeout errors return `0xFFFFFFE2` if the firmware takes more time than the configured timeout. If a timeout error occurs, the application must reset the device and driver state to recover from the error.

|Wi-Fi APIs|Notes|
|---|---|
|[rsi_sort_scan_results_array_based_on_rssi()](wlan#rsi-sort-scan-results-array-based-on-rssi)|Sort the Scan results in the order of RSSI. The application should call this API to get the scan result in sorted order.|

|Bluetooth APIs|Notes|
|---|---|
|[rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init)|Initialize A2DP profile with either user defined audio codec parameters or default stack audio codec params. This is a blocking API.|
|[rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init)|Set the AVRCP profile mode and also enable the media player selection feature, if required. This is a blocking API|
|[rsi_bt_avrcp_set_addr_player_resp()](bt-classic2#rsi-bt-avrcp-set-addr-player-resp)|Send Addressed player response from the Target to Controller. This is a blocking API|
|[rsi_bt_avrcp_get_folder_items_resp()](bt-classic2#rsi-bt-avrcp-get-folder-items-resp)|Send Folder items response from Target to Controller. This is a Blocking API|
|[rsi_bt_avrcp_get_tot_num_items_resp()](bt-classic2#rsi-bt-avrcp-get-tot-num-items-resp)|Send the response for the total number of items from the Target to Controller. This is a blocking API.|
|[rsi_bt_request_authentication()](bt-classic3#rsi-bt-request-authentication)|The Authentication procedure usually starts from the stack itself after the PHY Level Connection completes, however if authentication is disabled after PHY Level Connection, and Authentication is needed, then firstly enable Authentication then call this API. This is a blocking API.|
|[rsi_bt_encryption_enable_or_disable()](bt-classic3#rsi-bt-encryption-enable-or-disable)|Usually Encryption procedure will start from stack itself once PHY Level Connection and authentication is completed, however the user can decide whether to enable/disable encryption from the host. This is a blocking API.|
|[rsi_bt_per_cw_mode()](bt-classic5#rsi-bt-per-cw-mode)|Keep the device in continuous wave mode. It is not necessary to call this API if `transmit_mode` is set to `CONTINUOUS_WAVE_MODE` in `rsi_bt_tx_per_params_s` structure.|
|[rsi_bt_vendor_ar_enable()](bt-classic5#rsi-bt-vendor-ar-enable)|Issue vendor specific command for setting AutoRate in controller on given inputs. This is a blocking API. A received event `rsi_bt_on_ar_stats_t` has AutoRate Stats.|
|[rsi_bt_vendor_dynamic_pwr()](bt-classic5#rsi-bt-vendor-dynamic-pwr)|Issue vendor specific command for setting `dynamic_tx_power_index` in controller on given inputs. This is a blocking API.|
|rsi_bt_vendor_avdtp_stats_enabled()|Issue vendor specific command for setting avdtp stats enable in controller, to receive the stats. This is a blocking API. A received event `rsi_bt_on_avdtp_stats_t` has AVDTP stats.|

|System APIs|Notes|
|---|---|
|[rsi_send_freq_offset()](wlan#rsi-send-freq-offset)|Application to provide feedback of frequency error in KHz. This is a blocking API.|
|[rsi_calib_write()](wlan#rsi-calib-write)|RF Calibration Process. This API commands the firmware to update the existing FLASH/EFuse calibration data. This is a blocking API.|
|[rsi_send_feature_frame_dyn()](common#rsi-send-feature-frame-dyn)|Select internal or external RF type and clock frequency to pass Feature enables dynamically. This is a blocking API.|
|[rsi_register_wait_timeout_error_callbacks()](common#rsi-register-wait-timeout-error-callbacks)|Register SAPI wait timeout handler. This is non-blocking API.|

##### Modifications for Release: 2.3

|Wi-Fi/Network APIs|Notes|Resolution for Backward Compatibility|
|---|---|---|
|[rsi_wlan_get_status()](wlan#rsi-wlan-get-status), [rsi_wlan_socket_get_status()](network5#rsi-wlan-socket-get-status)|Description: Added support for Socket ID based return status for Socket APIs.|No changes required. By default, both [rsi_wlan_get_status()](wlan#rsi-wlan-get-status) and [rsi_wlan_socket_get_status()](network5#rsi-wlan-socket-get-status) return the actual status of Socket APIs.|
||Purpose: To get socket ID based return status for socket APIs. This change is an enhancement.||
||1.x.x: [rsi_wlan_get_status()](wlan#rsi-wlan-get-status) is used to get the return status of any SAPI command in case of a failure. The same API was used to get socket API status as well.||
||2.x.x: [rsi_wlan_socket_get_status()](network5#rsi-wlan-socket-get-status) added to get return status for socket APIs based on socket ID input. Latest SAPI driver stores response for each socket id||
||Impact: In multi-threaded applications using [rsi_wlan_get_status()](wlan#rsi-wlan-get-status), may not return exact Socket ID based status, as it may get over-written. Applications should use [rsi_wlan_socket_get_status()](network5#rsi-wlan-socket-get-status) instead of [rsi_wlan_get_status()](wlan#rsi-wlan-get-status) for getting actual return status for Socket APIs, especially in muti-threaded applications.||
||
|Enable 'socket wait close' configuration if using TCP Sockets in Application.|If TCP sockets is used in an application, enable `EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE` in `RSI_EXT_TCPIP_FEATURE_BITMAP`. For enabling `RSI_EXT_TCPIP_FEATURE_BITMAP`, need to enable `TCP_IP_FEAT_EXTENSION_VALID` in `RSI_TCP_IP_FEATURE_BIT_MAP`. These macros are defined in `rsi_wlan_config.h`|See [rsi_shutdown()](network5#rsi-shutdown) for details.|

|Bluetooth APIs|Notes|Resolution for Backward Compatibility|
|---|---|---|
|384kB memory requirement|It is mandatory to configure 384kB memory when using BT Classic, BLE and COEX. RS9116W firmware, from 2.X.X release supports only this mode.|In `rsi_wlan_config.h` set `RSI_EXT_CUSTOM_FEATURE_BIT_MAP` = `EXT_FEAT_384K_MODE`. To enable `RSI_EXT_CUSTOM_FEATURE_BIT_MAP`, set `RSI_CUSTOM_FEATURE_BIT_MAP` = `FEAT_CUSTOM_FEAT_EXTENTION_VALID`. If `EXT_FEAT_256K_MODE` is used, the device may fail to work.|
|-|-|-|
|Support for HEX based input BD address in SAPI applications|Purpose: To avoid input BD address conversion from ASCII to HEX as RS9116W expect BD address in HEX format. This change is an enhancement.|Backward compatibility is achieved by `BD_ADDR_IN_ASCII` in `rsi_bt_config.h` and `rsi_ble_config.h`. Enable `BD_ADDR_IN_ASCII` to take input Bluetooth Address (Device Address) in ASCII format in SAPI based applications. Disable `BD_ADDR_IN_ASCII` to take input Bluetooth Address (Device Address) in 6 bytes HEX format in SAPI based applications. By default, `BD_ADDR_IN_ASCII` is not defined in RS9116W SAPI examples and library. Existing users should enable `BD_ADDR_IN_ASCII` in their applications to ensure SAPI library supports ASCII based BD address input.|
||1.1.x: RS9116W expects BD address in 6 bytes of HEX as input. But existing SAPI applications expect BD address input in ASCII and coverts it into HEX (internally in SAPI core) and then passes it to RS9116W|
||2.x: Added support to take the input as a 6 bytes of HEX value which avoids ASCII to HEX conversion.||
||Impact: Existing designs which are developed with ASCII based BD address input will not work.||
|-|-|-|
|BLE data flow mechanism to support flow control and multiple connections|Purpose: To maintain multiple BLE connections and serve them independently, RS9116W firmware and SAPI are enhanced with support for connection based buffer management and flow control between host (application) and RS9116W (firmware). This is an enhancement.|The app needs to use the APIs as described to check for buffer full response from RS9116W device. Device returns `RSI_ERROR_BLE_DEV_BUF_FULL` to host whenever all buffers associated to that particular connection are occupied. When this error is observed, application should clear `RSI_DATA_TRANSMIT_EVENT` for that particular connection and should not call the API again until buffers in the device are freed. Once buffers are freed, RS9116W device sends an asynchronous request to host application to indicate device is ready to accept more data from host application. `RSI_BLE_MORE_DATA_REQ_EVT` is the asynchronous event sent by the device. Upon receiving this event, host application should set `RSI_DATA_TRANSMIT_EVENT` and resume API calls. For following APIs this flow should be implemented, `rsi_ble_get_profiles_async()``rsi_ble_get_profile_async()``rsi_ble_get_char_services_async()``rsi_ble_get_att_value_async()``rsi_ble_set_att_value_async()``rsi_ble_set_att_cmd()``rsi_ble_indicate_value()``rsi_ble_notify_value()``rsi_ble_set_att_value()``rsi_ble_set_att_value_async()`|
||1.1.x: In earlier design, connection based buffer management was not supported. This effects data throughput, connectivity and simultaneous connections in different ways. In this design, when there is a data write request to remote BLE device from application, RS9116W provides response only after receiving the response from the remote device. There was no flow control mechanism in this case and one connection can consume all the buffers in RS9116W impacting other connection's control and data flows.||
||2.x: In the new design, connection based buffer management is implemented (using dedicated buffers for each connected device ). If there are no buffers available in the RS9116W device, it returns an error to the host with that particular device address, stating that buffers are not available for that connection. Once the buffer are freed (device serves pending events), then the device will send an event (more data request) to the host requesting to send the data||
||New API/Event: `ble_on_le_more_data_req_event`||
||Impact: All existing applications which use attribute write, long write or prepare write should be changed as per the new design, otherwise will not work. This impacts only BLE data flows. Not applicable for BT-Classic.|

### Revision History

**Revision History**

|Version Number|Date|Changes|
|---|---|---|
|1.0|Nov 2017|Advance version|
|1.2|Jun 2018|Added [rsi_wlan_filter_broadcast()](wlan#rsi-wlan-filter-broadcast) API description|
|||Added command type for multicast|
|||Clarified the differences between WiSeConnect/WiSeMCU|
|1.3|Jun 2018|Alignment issues are resolved|
|1.4|Jul 2018|Structural issues are resolved|
|1.5|Jun 2019|Added [rsi_get_ram_log()](common#rsi-get-ram-log) API|
|1.51|Sep 2019|Modified the BLE CBFC API's and other missed API's Parameters.|
|||Modified the `rsi_ble_gap_register_callbacks` structure and added the new events.|
|||Updated missing API's for BT Classic|
|1.6|Oct 2019|Added SAPI error codes|
|1.7|Nov 2019|Added SAPI error codes|
|1.8|Jan 2020|Added MITM params info for BLE section. Modified the GATT Write event structure|
|1.9|Feb 2020|Added async behaviour note for [rsi_connect()](network5#rsi-connect) API|
|1.10|Apr 2020|Added WLAN STATS in [rsi_wlan_get()](wlan#rsi-wlan-get) API.|
|||Added Weekday in set and get rtc timer.|
|||Added new [rsi_bt_set_bd_addr()](bt-ble#rsi-bt-set-bd-addr) API and its related information|
|2.0|Sep 2020|**Documentation changes including ...**|
|||New sections for API categories: Driver APIs, NWK APIs, API Configuration, Mechanism Changes and Enhancements' which describes major changes in SAPI library from previous release|
|||Moved 'BSD Socket API' section from WLAN APIs to 'NWK APIs' section|
|||Moved 'Network Application Protocol' section from WLAN APIs to 'NWK APIs' section.|
|||Moved 'WLAN API call sequence examples' from WLAN APIs to 'Appendix A: WLAN API Call Sequence Examples'.|
|||Renamed 'RS9116 Connectivity Resources' section to 'RS9116W Resources'|
|||Removed sections: RS9116 Connectivity Resources, BT-Classic and BT-LE Common Features|
|||Added description for the bits `BIT(5)`, `BIT(6)` and `BIT(7)` in `FLAGS` parameter in all the `HTTP_CLIENT` related API's.|
|||Added supported bits information of MODE argument in [rsi_config_ipaddress()](wlan#rsi-config-ipaddress)|
|||Added note in [rsi_wireless_init()](common#rsi-wireless-init), regarding coex mode memory configuration|
|||Update BT Classic and BLE APIs|
|||Removed WMCU references|
|||Corrected maximum length of SSID to 32 bytes from 34 bytes|
|||Added EMB_MQTT_APIs|
|||Updated description, response parameters and parameters for some APIs|
|||Added description for parameter payload length in [rsi_wlan_update_gain_table()](wlan#rsi-wlan-update-gain-table) API|
|||Added missing APIs from SAPI library|
|||Added the information required for the support of 3 SSL_Certificates loaded to FLASH in [rsi_wlan_set_certificate_index()](wlan#rsi-wlan-set-certificate-index) API|
|||Modified the parameters of MODE argument in [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API|
|||Added description for the bits `BIT(2)`, `BIT(3)` and `BIT(4)` in 'FLAGS' parameter in all the `HTTP_CLIENT` related API's|
|||Added note points for corresponding parameters of [rsi_wlan_get()](wlan#rsi-wlan-get) API in Master WLAN API|
|||Removed PBAP API, HFP, PBAP register callbacks, AVRCP register callbacks from Master Bluetooth classic APIs|
|||Added precondition for rsi_mqtt_poll_for_recv_data API in NWK API section|
|||Added a note in rsi_socket API in NWK APIs section|
|||Updated the [rsi_wlan_scan()](wlan#rsi-wlan-scan) in WLAN APIs section|
|||Added a note WLAN_STATS only support in AP and STATION mode in WLAN API section|
|||Added note about 384K in wireless_init() API|
|||USB and SDIO Interfaces Host Interfaces section, as they are supported|
|||Modified ‘Socket create command response’ structure according to the source code|
|||Modified NOTE for 40MHz limitation|
|||Added Operating modes in Features section|
|||Added information for GPIO based power save handshake mechanism in `rsi_wlan_power_save_profile` section|
|||Added recommended api flow for restarting RS9116W module from host in `rsi_wireless_deinit` section|
|||Added supported Curve IDs for Ciphers in section 'Configure SSL parameters'|
|||**Newly added WLAN APIs ...**|
|||`int32_t rsi_wlan_socket_get_status(int32_t sockID)`|
|||`int32_t rsi_wlan_get_nwk_status(void)`|
|||`int32_t rsi_wlan_scan_with_bitmap_options(int8_t *ssid, uint8_t chno, rsi_rsp_scan_t *result,uint32_t length,uint32_t scan_bitmap)`|
|||`int32_t rsi_wlan_scan_async_with_bitmap_options(int8_t *ssid, uint8_t chno,uint32_t bitmap`|
|||`void (*scan_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))`|
|||`int32_t rsi_wlan_power_save_with_listen_interval(uint8_t psp_mode, uint8_t psp_type,uint16_t listen_interval)`|
|||`static int rsi_load_bootup_params(strruct rsi_common *common)`|
|||`int32_t rsi_set_rtc_timer(module_rtc_time_t *timer)`|
|||`int32_t rsi_get_rtc_timer(module_rtc_time_t *response)`|
|||`int32_t rsi_efuse_write(rsi_efuse_write_t *efuse_write_p)`|
|||`int32_t rsi_efuse_read(rsi_efuse_read_t *efuse_read_p, uint8_t *buf, uint32_t length)`|
|||`int32_t rsi_flash_mem_wr(rsi_flash_write_t *write_req)`|
|||`int32_t rsi_reset_mac()`|
|||`uint8_t translate_channel(uint8_t channelNum)`|
|||`int32_t rsi_radio_caps(uint8_t operating_channel)`|
|||`int32_t rsi_get_ram_dump(uint32_t addr, uint16_t length, uint8_t *buf)`|
|||`int32_t rsi_certificate_valid(uint16_t valid, uint16_t socket_id)`|
|||`void rsi_select_set_status(int32_t status,int32_t selectid)`|
|||`int32_t rsi_select_get_status(int32_t selectid)`|
|||`int rsi_fd_isset(uint32_t fd, struct rsi_fd_set_s *fds_p)`|
|||`void rsi_set_fd(uint32_t fd, struct rsi_fd_set_s *fds_p)`|
|||`void rsi_fd_clr(uint32_t fd, struct rsi_fd_set_s *fds_p)`|
|||**Newly added BT/BLE APIs ...**|
|||`int32_t rsi_ble_start_scanning_with_values(void *rsi_ble_scan_params)`|
|||`int32_t rsi_ble_set_local_irk_value (uint8_t *l_irk)`|
|||`int32_t rsi_ble_set_wo_resp_notify_buf_info (uint8_t *dev_addr,uint8_t buf_mode,uint8_t buf_cnt)`|
|||`int32_t rsi_ble_gatt_write_response(uint8_t *dev_addr,uint8_t type)`|
|||`int32_t rsi_ble_gatt_prepare_write_response(uint8_t *dev_addr,uint16_t handle,uint16_t offset,uint16_t length,uint8_t *data)`|
|||`int32_t rsi_bt_change_pkt_type(uint8_t *remote_dev_addr, uint16_t pkt_type)`|
|||`int32_t rsi_bt_set_bd_addr(uint8_t *dev_addr)`|
|||`int32_t rsi_memory_stats_enable (uint8_t protocol, uint8_t memory_stats_enable, uint32_t memory_stats_interval_ms)`|
|||`void update_modified_mtu_size (uint16_t rem_mtu_size)`|
|||`int32_t rsi_bt_per_cw_mode(struct rsi_bt_per_cw_mode_s *bt_cw_mode)`|
|||**Newly added Driver APIs ...**|
|||`uint32_t rsi_bt_get_timeout(uint16_t cmd_type, uint16_t protocol_type)`|
|||`void (*rsi_bt_async_callback_handler) (rsi_bt_cb_t *cb, uint16_t type, uint8_t *data, uint16_t length) )`|
|||`void rsi_ble_update_le_dev_buf(rsi_ble_event_le_dev_buf_ind_t *rsi_ble_event_le_dev_buf_ind)`|
|||`void rsi_add_remote_ble_dev_info(rsi_ble_event_enhance_conn_status_t *remote_dev_info)`|
|||`void rsi_remove_remote_ble_dev_info(rsi_ble_event_disconnect_t *remote_dev_info)`|
|||`void rsi_bt_pkt_change_events_register_callbacks (rsi_bt_pkt_change_stats_t bt_pkt_change_stats_event)`|
|||`void rsi_bt_on_chip_memory_status_callbacks_register (rsi_bt_on_chip_memory_stats_handler_t bt_on_chip_memory_stats_event)`|
|||`int32_t rsi_check_and_update_cmd_state(uint8_t cmd_type,uint8_t cmd_state)`|
|||`int32_t rsi_atoi(const int8_t* str)`|
|||`uint64_t ip_to_reverse_hex(char *ip)`|
|||`int16_t rsi_nlink_pkt_rd(uint8_t *buf, uint16_t total_len)`|
|||`int32_t rsi_get_ram_log(uint32_t addr, uint32_t length)`|
|||`int32_t rsi_get_fw_version(uint8_t *response, uint16_t length)`|
|||`int32_t rsi_common_debug_log(int32_t assertion_type, int32_t assertion_level)`|
|||`int32_t rsi_driver_deinit(void)`|
|||`int32_t rsi_device_deinit(void)`|
|||`int8_t asciihex_2_num(int8_t ascii_hex_in)`|
|||`int8_t rsi_charhex_2_dec ( int8_t *cBuf)`|
|||`void rsi_ascii_mac_address_to_6bytes(uint8_t *hexAddr, int8_t *asciiMacAddress)`|
|||`void rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress)`|
|||`int32_t rsi_gpio_pininit(uint8_t pin_num, uint8_t configuration)`|
|||`int32_t rsi_gpio_writepin(uint8_t pin_num, uint8_t value)`|
|||`int32_t rsi_gpio_readpin(uint8_t pin_num,uint8_t *gpio_value)`|
|2.1|Feb 2021|Modified [rsi_ble_setphy()](bt-low-energy1#rsi-ble-setphy) and [rsi_ble_readphy()](bt-low-energy1#rsi-ble-readphy) API parameters description as per spec|
|||Specified that region-based user Gain values in 2GHz has to be doubled before loading [rsi_wlan_update_gain_table()](wlan#rsi-wlan-update-gain-table) API.|
|||Modified the macro RSI_TIMEOUT_BIT_MAP to `4` and added its description|
|||Added the API note for [rsi_ble_set_local_att_value()](bt-low-energy5#rsi-ble-set-local-att-value) and [rsi_ble_get_local_att_value()](bt-low-energy5#rsi-ble-get-local-att-value)|
|||Added the appropriate return values and their description in [rsi_recvfrom()](network5#rsi-recvfrom), [rsi_recv()](network5#rsi-recv) API's.|
|||Modified SO_TCP_KEEP_ALIVE in [rsi_setsockopt()](network5#rsi-setsockopt) value into seconds.|
|||Added Description of Power Save Modes in WLAN APIs.|
|||Enhanced the API note for [rsi_ble_set_local_att_value()](bt-low-energy5#rsi-ble-set-local-att-value)|
|||Enhanced the API notes for [rsi_ble_set_local_att_value()](bt-low-energy5#rsi-ble-set-local-att-value) and [rsi_ble_notify_value()](bt-low-energy5#rsi-ble-notify-value)|
|||Modified the description for return values in [rsi_socket()](network5#rsi-socket) API|
|||Added description for resp parameters (`enc_enabled`) for `rsi_ble_on_encrypt_started_t` callback function|
|||Added description for few missing structure members for the following callbacks ...|
|||> rsi_ble_on_adv_report_event_t (report type)|
|||> `rsi_ble_on_enhance_connect_t`|
|||> `rsi_ble_on_smp_passkey_display_t`|
|||> `rsi_ble_on_sc_passkey_t`|
|||> `rsi_ble_on_le_ltk_req_event_t`|
|||> `rsi_ble_on_le_security_keys_t`|
|||Modified the following callbacks and corrected spelling errors for structure name and variables ...|
|||> `rsi_ble_on_disconnect_t`|
|||> `rsi_ble_on_encrypt_started_t`|
|||> `rsi_ble_on_char_services_resp_t`|
|||> `rsi_ble_on_inc_services_resp_t`|
|||> `rsi_ble_on_read_resp_t`|
|||> `rsi_ble_on_gatt_write_event_t`|
|||> `rsi_ble_on_gatt_prepare_write_event_t`|
|||Added the following missing callback functions ...|
|||> `rsi_ble_on_remote_conn_params_request_t`|
|||> `rsi_ble_on_smp_response_t`|
|||> `rsi_ble_on_smp_response_t` (for central)|
|||> `rsi_ble_on_sc_method_t`|
|||> `rsi_ble_on_event_indicate_confirmation_t`|
|||Changed the names for the following GAP register callbacks ...|
|||> `rsi_ble_event_write_t`|
|||> `rsi_ble_event_prepare_write_t`|
|||> `rsi_ble_execute_write_t`|
|||> `rsi_ble_event_mtu_t`|
|||Added information about modifying the MACROs in `CONFIG_FEATURE_BITMAP` of `rsi_wlan_common_config.h` file.|
|||Added a note about [rsi_wlan_enable_auto_config()](wlan#rsi-wlan-enable-auto-config) in WLAN APIs|
|||Added BITs information in `auth_req` parameter in [rsi_ble_set_smp_pairing_cap_data()](bt-low-energy1#rsi-ble-set-smp-pairing-cap-data) API|
|||Added [rsi_send_freq_offset()](wlan#rsi-send-freq-offset) API|
|||Added [rsi_calib_write()](wlan#rsi-calib-write) API under section|
|||Added information about `RSI_SSL_CIPHERS` in configure SSL parameters|
|||Added a note "Maximum number of SSL sockets to be opened is including user opened sockets and internal sockets" before Configure scan parameters.|
|||Updated Modified SAPI's, [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init), [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init), [rsi_bt_avrcp_target_register_callbacks()](bt-classic6#rsi-bt-avrcp-target-register-callbacks)|
|||Added vendor specific API rsi_ble_vendor_dynamic_pwr()|
|2.4|Jun 2021|Noted error code 0xFF5F, at return values of the API [rsi_sntp_client_create_async()](network12#rsi-sntp-client-create-async) under section Network API's.|
|||Replaced the appropriate define `RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB` in the note for [rsi_connect()](network5#rsi-connect) API under section, BSD Socket API|
|||Updated the parameters and added note for the following APIs ...|
|||[rsi_ble_get_profiles_async()](bt-low-energy4#rsi-ble-get-profiles-async)|
|||[rsi_ble_get_profile_async()](bt-low-energy4#rsi-ble-get-profile-async)|
|||[rsi_ble_get_char_services_async()](bt-low-energy4#rsi-ble-get-char-services-async)|
|||[rsi_ble_get_inc_services_async()](bt-low-energy4#rsi-ble-get-inc-services-async)|
|||[rsi_ble_get_char_value_by_uuid_async()](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async)|
|||[rsi_ble_get_att_descriptors_async()](bt-low-energy4#rsi-ble-get-att-descriptors-async)|
|||[rsi_ble_get_att_value_async()](bt-low-energy4#rsi-ble-get-att-value-async)|
|||[rsi_ble_get_multiple_att_values_async()](bt-low-energy4#rsi-ble-get-multiple-att-values-async)|
|||[rsi_ble_get_long_att_value_async()](bt-low-energy4#rsi-ble-get-long-att-value-async)|
|||Added information about `at+rsi_tcp,at+rsi_tcp6,at+rsi_ltcp,at+rsi_ltcp6,at+rsi_ludp,at+rsi_ludp6` Response Structure and Examples in [SAPI Changelog](changelog)|
|||Added roaming configuration (Power save based/De-authentication based details in `RSI_CUSTOM_FEATURE_BIT_MAP` in [Wi-Fi APIs](wlan)|
|||Added [rsi_sort_scan_results_array_based_on_rssi()](wlan#rsi-sort-scan-results-array-based-on-rssi) API in [Wi-Fi APIs](wlan)|
|||Added an error code `0x4E66 - Invalid Name length` when set to more than 16 bytes|
|||Added suggested roaming configuration in [Wi-Fi APIs](wlan) APIs section|
|||Added BSD socket error codes under BSD socket API in NWK API's|
|||Added note for set local name|
|||Added Note for latency parameter in [rsi_ble_connect_with_params()](bt-low-energy1#rsi-ble-connect-with-params) API and `rsi_ble_on_conn_update_complete_t` event parameter description|
|||Changed the timeout values for [rsi_wlan_scan()](wlan#rsi-wlan-scan), [rsi_wlan_scan_async()](wlan#rsi-wlan-scan-async) and [rsi_wlan_connect()](wlan#rsi-wlan-connect) API's|
|||Added a note [rsi_wlan_enable_auto_config()](wlan#rsi-wlan-enable-auto-config) in [Wi-Fi APIs](wlan) APIs|
|||Added detailed description about `FEAT_LP_GPIO_BASED_HANDSHAKE` and `FEAT_ULP_GPIO_BASED_HANDSHAKE` under section Configuration parameters in [Wi-Fi APIs](wlan) API's|
|||Added note about MQTT with SSL under section [Network APIs](network) API's|
|||Added Enhanced MAX PSP configuration info in [Wi-Fi APIs](wlan) APIs section|
|||Added SAPI Timeout error indication recovery mechanism|
|||Removed the BT and BLE alone opermodes and updated the Note for the [rsi_wireless_init()](common#rsi-wireless-init) API|
|||Added a note regarding [rsi_transmit_test_start()](wlan#rsi-transmit-test-start) power parameter|
|||Added a note in rsi_ap_start() for channel parameter|
|||Added [rsi_calib_write()](wlan#rsi-calib-write), [rsi_send_freq_offset()](wlan#rsi-send-freq-offset) APIs to perform chip calibration|
|||Added a bit `ENABLE_ENHANCED_MAX_PSP` in `RSI_CONFIG_FEATURE_BITMAP` in [Opermode Parameters](opermode) to enable enhanced max PSP for Power save.|
|||Added feature for loading firmware via HTTP(s) using [rsi_http_fw_update()](firmware#rsi-http-fw-update) API|
|||Added API [rsi_tcp_window_update()](network16#rsi-tcp-window-update) for updating TCP window dynamically|
|||Added a bit `RSI_FEAT_DISABLE_MCS_5_6_7_DATARATES` in `RSI_CONFIG_FEATURE_BITMAP` in [Opermode Parameters](opermode) for disabling higher MCS rates(i.e., MCS5, MCS6, MCS7) from host|
|||Added a bit `RSI_FEAT_DISABLE_SHORT_GI` in `RSI_CONFIG_FEATURE_BITMAP` in [Opermode Parameters](opermode) for disabling Short GI from host|
|||Added a bit `EXT_TCP_IP_FEAT_SSL_HIGH_PERFORMANCE` in `RSI_EXT_TCPIP_FEATURE_BITMAP` in [Opermode Parameters](opermode) for enabling high performace socket in SSL data transfer|
|||Added API [rsi_register_wait_timeout_error_callbacks()](common#rsi-register-wait-timeout-error-callbacks) in host for registering SAPI wait timeout|
|||Added API [rsi_assert()](common#rsi-assert) to indicating the assertion value to host in case of assertion|
|||Added API [rsi_sort_scan_results_array_based_on_rssi()](wlan#rsi-sort-scan-results-array-based-on-rssi) to sort the list of scan_results based on RSSI|
|||Added API [rsi_send_feature_frame_dyn()](common#rsi-send-feature-frame-dyn) for configuring feature enables dynamically|
|||Added a flag `RSI_HTTP_USER_DEFINED_CONTENT_TYPE` in [rsi_http_client_put_start()](network9#rsi-http-client-put-start) API for user defined content type in extended header of HTTP Put request|
|||Added bits for selecting specific cipher in SSL [SSL/TLS Cipher Selection](ssl-ciphers-selection)|
|||Added a bit `ULP_GPIO9_FOR_UART2_TX` in `RSI_CONFIG_FEATURE_BITMAP` in [Opermode Parameters](opermode) for selecting `ULP_GPIO_9` as `UART2` port for NWP (Network Processor) debug prints|
|||Added Opermode Command Parameters section for feature selection [Opermode Parameters](opermode)|
|||Added SAPI Timeout Error Indication and Recovery Mechanism section [SAPI Changelog](changelog)|
|||Updated SAPI Directory Structure section with new folder structure. Refer folder structure changes information in the document WiSeConnect release folder structure chang|
|||Replaced the appropriate define `RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB`, in the note point of for [rsi_connect()](network5#rsi-connect) API under section [BSD Sockets](network5)|
|||Added a bit `CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULLDATA` in `RSI_CUSTOM_FEATURE_BIT_MAP` in [Opermode Parameters](opermode) for roaming configuration (Powersave-based Deauthentication)|
|||Added a BSD socket error codes under BSD socket API [Error Codes](error-codes)|
|||Updated the timeout values for [rsi_wlan_scan()](wlan#rsi-wlan-scan), [rsi_wlan_scan_async()](wlan#rsi-wlan-scan-async) and [rsi_wlan_connect()](wlan#rsi-wlan-connect) APIs|
|||Added a note for [rsi_wlan_enable_auto_config()](wlan#rsi-wlan-enable-auto-config) API|
|||Updated info about `FEAT_LP_GPIO_BASED_HANDSHAKE` and `FEAT_ULP_GPIO_BASED_HANDSHAKE` in `RSI_FEATURE_BIT_MAP`[Opermode Parameters](opermode)|
|||Added a note for MQTT over SSL in [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API|
|||Added a note about power parameter in [rsi_transmit_test_start()](wlan#rsi-transmit-test-start) API|
|||Added a note about channel parameter in [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start) API|
|2.5|Dec 2021|Added new command [rsi_ble_indicate_value_sync()](bt-low-energy4#rsi-ble-indicate-value-sync)|
|||Added new command [rsi_ble_mtu_exchange_resp()](bt-low-energy3#rsi-ble-mtu-exchange-resp)|
|||Added new command [rsi_bt_cmd_update_gain_table_offset_or_max_pwr()](bt-ble#rsi-bt-cmd-update-gain-table-offset-or-max-pwr)|
|||Added new callback rsi_ble_on_mtu_exchange_info_t|
|||Added new API [rsi_destroy_driver_task_and_driver_deinit()](common#rsi-destroy-driver-task-and-driver-deinit)|
|||Added new API [rsi_set_config()](common#rsi-set-config)|
|||Added new parameter "gpio_type" in existing API [rsi_gpio_pininit()](common#rsi-gpio-pininit)|
|||Added new parameter "gpio_type" in existing API [rsi_gpio_writepin()](common#rsi-gpio-writepin)|
|||Added new parameter "gpio_type" in existing API [rsi_gpio_readpin()](common#rsi-gpio-readpin)|
|||Added new API [rsi_gpio_read()](common#rsi-gpio-read)|
|||Added new API [rsi_gpio_write()](common#rsi-gpio-write)|
|||Added new API is_power_of_two()|
|||Added new API [rsi_mutex_lock_from_isr()](rtos#rsi-mutex-lock-from-isr)|
|||Added new API [rsi_mutex_unlock_from_isr()](rtos#rsi-mutex-unlock-from-isr)|
|||Added new feature PTA 3-wire Co-Existence Support for Wi-Fi only mode CoExistence Support|
|||Added PTA_3WIRE_EN configuration in Opermode Parameters|
|||Adeed PTA_3WIRE_CONFIG_SEL configuration in Opermode parameters|
|||Added new feature Enhanced Max PSP with CoEx|
|||Added ENABLE_ENHANCED_MAX_PSP configuration in Opermode parameters|
|||Added new feature FAST PSP support|
|||Added new feature A2DP with CoEx Support|
|2.6|June 2022|Added new SNTP error code(0xBB08) in WLAN error codes|
|||Added DFS channels and 4.9GHz channels in [rsi_wlan_scan()](wlan#rsi-wlan-scan) API|
|||Modified description for [rsi_sendto()](network5#rsi-sendto), [rsi_send()](network5#rsi-send), [rsi_sendto_async()](network5#rsi-sendto-async) API's.|
|||Modified pre-condition in [rsi_select()](network5#rsi-select) API.|
|||Modified description in [rsi_wlan_enable_auto_config()](wlan#rsi-wlan-enable-auto-config) API, Hided profile based configurations.|
|||Added the description about RSI_CFG_SAVE and RSI_CFG_STORE in [rsi_wlan_set()](wlan#rsi-wlan-set) API.|
|||Added private label for [rsi_req_wireless_fwup()](firmware#rsi-req-wireless-fwup) API, currently this feature is not supported.|
|||Added declaration for [ip_to_reverse_hex()](driver12#ip-to-reverse-hex) and [rsi_wlan_power_save_with_listen_interval()](wlan#rsi-wlan-power-save-with-listen-interval) API's.|
|||Added US, Europe, Japan and Korea Domain tables.|
|||Moved SSID note point after parameters description and modified SSID parameter description in [rsi_wlan_scan_async()](wlan#rsi-wlan-scan-async) API.|
|||Added new API [rsi_get_intr_status()](common#rsi-get-intr-status).|
|||Added note point in [rsi_req_wireless_fwup()](firmware#rsi-req-wireless-fwup) API.|
|||Added new error code '0xFF75'.|
|||Added new API 'sl_fw_log_configure' and modified input parameter name.|
|||Added new API 'sl_set_fw_component_log_levels'.|
|||Added new API 'sl_fw_log_init'.|
|||Added new API 'sl_fw_queue_init'.|
|||Added new API 'sl_fw_log_deinit'.|
|||Added new API 'sl_fw_log_enqueue' and added input parameter description.|
|||Added new API 'sl_fw_log_dequeue' and added input parameter description.|
|||Added new API 'sl_fw_log_pool_init'.|
|||Added new API 'sl_fw_log_node_alloc'.|
|||Added new API 'sl_fw_log_node_free'.|
|||Added new API 'sl_fw_log_print' and added input parameters description.|
|||Moved 'rsi_wlan_update_gain_table' under WLAN API's group.|
|||Added note point in [rsi_spi_high_speed_enable()](driver2#rsi-spi-high-speed-enable) API description.|
|||Modified PER modes descriprion in [rsi_transmit_test_start()](wlan#rsi-transmit-test-start) API.|
|||Added FEAT_HIDE_PSK_CREDENTIALS bit in feature_bit_map.|
|||Moved 'rsi_wlan_set_certificate' under WLAN API's group and added note points in API description.|
|||Added support in embedded mqtt for topic length upto 200 bytes and username length upto 120 bytes.|

### SAPI Reference

This section provides an overview of SAPI modules.

- [Bluetooth APIs](bluetooth) to initialize and configure Bluetooth features.
- [Common APIs](common) to initialize the driver and to handle common features, which are independent of device configuration mode.
- [Crypto APIs](crypto) to perform cryptographic operations.
- [Driver APIs](driver) to initialize the driver and also to handle the events.
- [Network APIs](network) for protocols including MQTT, FTP, HTTP, SMTP, SNTP, DHCP, POP3 and WebSockets.
- [RTOS APIs](rtos) to manage tasks, mutexes, semaphores etc.
- [Wi-Fi APIs](wlan) to initialize and configure Wi-Fi features.

#### Blocking vs. Non-blocking APIs

SAPI functions are divided into two categories: blocking and non-blocking.

##### Blocking APIs

Blocking APIs wait on a semaphore after sending a command to the device. The API waits until the semaphore is posted or it times out. SAPI driver posts the semaphore once the response from the device is received for that command. Every blocking API has a timeout configured in SAPI. If a semaphore wait times out, the API will get error an response code `0xFFE2` which is a command timeout error. For more information about API timeout errors please, see SAPI Timeout Error Indication and Recovery Mechanism

##### Non-Blocking APIs

Non-blocking APIs do not wait for any event after sending the command to the device, they return immediately. When using non-blocking APIs, a callback must be registered to process the response for the command. Refer to [Wi-Fi APIs](wlan) for more information on the callbacks.

---

**Note!** A return value is provided for every API as follows

- for success, the return value is `RSI_SUCCESS`
- for failure, the return is a negative value from the SAPI driver or the device. Common driver error codes are `RSI_ERROR_INVALID_PARAM`, `RSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE`, `RSI_ERROR_PKT_ALLOCATION_FAILURE`, `RSI_ERROR_SPI_TIMEOUT`). For errors returned from the device, see [Error Codes](error-codes)). Not all API's have an error returned from the device.

---

#### Modules

[Bluetooth APIs](bluetooth)

[Common APIs](common)

[Crypto APIs](crypto)

[Driver APIs](driver)

[Firmware Update APIs](firmware)

[Network APIs](network)

[RTOS APIs](rtos)

[Wi-Fi APIs](wlan)

#### Common APIs

This section describes the Common APIs 

##### Variables

###### buffer_addr

```
uint8_t* buffer_addr
```

**Description:** Initialize WiSeConnect driver. This is a non-blocking API. Designate memory to all driver components from the buffer provided by the application. ...........Initilize Scheduler, Events, and Queues needed.

**Details:** **Returns**

- **Success** - Returns the memory used, which is less than or equal to buffer length provided. <br />**Failure** - Non-Zero values<br />  
  ```c  
          **RSI_ERROR_TIMEOUT**         -    If UART initialization fails in SPI / UART mode   \n  
    
          **RSI_ERROR_INVALID_PARAM**   -    If maximum sockets is greater than 10  
    
  ```

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit) and [rsi_driver_init](common#rsi-driver-init)

##### Functions

###### rsi_common_get_status

`int32_t rsi_common_get_status(void)`

**Description:** Return the common control block status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_device_init()](common#rsi-device-init) API should be called before this API

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb) and [rsi_common_cb_s::status](rsi-common-cb-s#status)

**Referenced by:** [rsi_wireless_init](common#rsi-wireless-init)

###### rsi_common_set_status

`void rsi_common_set_status(int32_t status)`

**Description:** Set the common control block status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status of common control block|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb) and [rsi_common_cb_s::status](rsi-common-cb-s#status)

**Referenced by:** [rsi_bt_callbacks_handler](driver14#rsi-bt-callbacks-handler), [rsi_common_packet_transfer_done](driver5#rsi-common-packet-transfer-done), [rsi_driver_process_common_recv_cmd](driver5#rsi-driver-process-common-recv-cmd), [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore) and [rsi_wait_on_common_semaphore](driver5#rsi-wait-on-common-semaphore)

###### rsi_driver_init

`int32_t rsi_driver_init(uint8_t *buffer, uint32_t length)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|N/A|buffer||
|uint32_t|N/A|length||

**References:** [buffer_addr](common#buffer-addr), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_common_cb_s::common_tx_pool](rsi-common-cb-s#common-tx-pool), [rsi_driver_cb_s::crypto_cb](rsi-driver-cb-s#crypto-cb), [rsi_driver_cb_s::event_list](rsi-driver-cb-s#event-list), [rsi_common_cb_init](driver5#rsi-common-cb-init), [rsi_driver_memory_estimate](common#rsi-driver-memory-estimate), [rsi_pkt_pool_init](driver5#rsi-pkt-pool-init), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_driver_cb_s::rx_pool](rsi-driver-cb-s#rx-pool) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wireless_init

`int32_t rsi_wireless_init(uint16_t opermode, uint16_t coex_mode)`

**Description:** Configure the WLAN/Coex operating mode and also configures features based on bitmaps available in rsi_wlan_config.h. In case of failure, appropriate error code is returned to the application. Default configurations (for reference) are available in [rsi_wlan_common_config.h](rsi-wlan-common-config-8h-source#rsi-wlan-common-config-8h-source). Based on the features required for a specific example, modify the rsi_wlan_config.h provided in the respective example folder. For more information about the bitmaps, refer Opermode-Parameters This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|opermode|- WLAN Operating mode <br /><br/> 0 - Client mode <br /><br/> 2 - Enterprise security client mode <br /><br/> 6 - Access point mode <br /><br/> 8 - Transmit test mode <br /><br/> 9 - Concurrent mode|
|uint16_t|[in]|coex_mode|- Coexistence mode 0 - WLAN only mode <br /><br/> 1 - WLAN <br /><br/> 5 - WLAN + Bluetooth <br /><br/> 9 - WLAN + Dual Mode (Bluetooth and BLE) <br /><br/> 13- WLAN + BLE <br />|

- [rsi_device_init()](common#rsi-device-init) API needs to be called before this API.

**Note**

- **Precondition** - [rsi_device_init()](common#rsi-device-init) API needs to be called before this API
- WLAN operating mode 1 - WiFi-Direct mode is not supported.
- Coex modes are supported only in 384K memory configuration.
- Coex mode 4(Bluetooth classic), 8 (Dual mode), and 12(BLE mode) are not supported.
- To achieve the same functionality, use coex mode 5, 9, and 13 respectively instead of coex mode 4, 8, and 12.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021,0x0025,0xFF73,0x002C,0xFF6E,0xFF6F, 0xFF70,0xFFC5) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::auto_config_state](rsi-wlan-cb-s#auto-config-state), [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_driver_cb_non_rom::device_state](rsi-driver-cb-non-rom#device-state), [rsi_common_cb_s::ps_coex_mode](rsi-common-cb-s#ps-coex-mode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_common_get_status](common#rsi-common-get-status), [rsi_init_timer](driver11#rsi-init-timer), [rsi_scheduler](driver15#rsi-scheduler), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_wait_on_common_semaphore](driver5#rsi-wait-on-common-semaphore), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_wlan_get_status](wlan#rsi-wlan-get-status), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem) and [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap)

###### rsi_cmd_uart_flow_ctrl

`int32_t rsi_cmd_uart_flow_ctrl(uint8_t uartflow_en)`

**Description:** Enable or disable UART flow control. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|uartflow_en|- Enable or Disable UART hardware flow control <br /><br/> 1/2 - Enable and Pin set to be used to for RTS/CTS purpose. <br /><br/> 0 - Disable <br /><br/> If the parameter is given as 1 or 2, then UART hardware flow control is enabled and Pin set to be used <br /><br/> If parameter is given as 1: Pin set used for RTS/CTS functionality is: <br /><br/> UART_CTS: GPIO - 11 <br /><br/> UART_RTS: GPIO - 7 <br /><br/> If parameter is given as 2: Pin set used for RTS/CTS functionality is: <br /><br/> UART_CTS: GPIO - 15 <br /><br/> UART_RTS: GPIO - 12|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Hardware flow control feature is not supported in Auto-Join/Auto-Create mode. <br />  
   In such a case, the feature has to be enabled separately.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_cmd_to_wr_comm_flash

`int32_t rsi_cmd_to_wr_comm_flash(uint32_t wr_addr, uint8_t *write_data, uint16_t wr_data_len, uint8_t flash_sector_erase_enable)`

**Description:** To write content on TA flash from M4. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|wr_addr|- address at which data will be written on TA flash memory|
|uint8_t *|[in]|write_data|- Input data|
|uint16_t|[in]|wr_data_len|- total length|
|uint8_t|N/A|flash_sector_erase_enable||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_cmd_m4_ta_secure_handshake

`int32_t rsi_cmd_m4_ta_secure_handshake(uint8_t sub_cmd_type, uint8_t input_len, uint8_t *input_data, uint8_t output_len, uint8_t *output_data)`

**Description:** Secure handshake. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|sub_cmd_type|- Sub command|
|uint8_t|[in]|input_len|- Input data|
|uint8_t *|[in]|input_data|- Length length|
|uint8_t|[in]|output_len|- Output length|
|uint8_t *|[in]|output_data|- Output data|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wireless_deinit

`int32_t rsi_wireless_deinit(void)`

**Description:** Resets the module to a state that was before execution of [rsi_wireless_init](common#rsi-wireless-init) To choose the new configuration(operating mode) [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called after this API. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- To restart the RS9116W module from the host, the application needs to call [rsi_driver_deinit()](common#rsi-driver-deinit) followed by [rsi_driver_init()](common#rsi-driver-init) and [rsi_device_init()](common#rsi-device-init). For OS cases, additionally needs to call rsi_task_destroy(driver_task_handle) to delete the driver task before calling [rsi_driver_deinit()](common#rsi-driver-deinit) and should create again, after [rsi_device_init()](common#rsi-device-init) using [rsi_task_create()](rtos#rsi-task-create)
- Refer to [Error Codes](error-codes) for the description of above error codes. <br />

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wireless_antenna

`int32_t rsi_wireless_antenna(uint8_t type, uint8_t gain_2g, uint8_t gain_5g)`

**Description:** Select antenna type on the device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- 0 : RF_OUT_2/Internal Antenna is selected <br /><br/> 1 : RF_OUT_1/uFL connector is selected.|
|uint8_t|[in]|gain_2g|- Currently not supported|
|uint8_t|[in]|gain_5g|- Currently not supported|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffc, 0x0025, 0x002C) <br />

**Note**

- **Precondition** - [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_send_feature_frame_dyn

`int32_t rsi_send_feature_frame_dyn(uint32_t feature_enables)`

**Description:** Select internal or external RF type, clock frequency and to pass Feature enables dynamically. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|feature_enables|- Feature enables <br /><br/> BIT[0] - Enable Preamble duty cycling. <br /><br/> BIT[4] - Enable LP chain for stand-by associate mode. <br /><br/> BIT[5] - Enable hardware beacon drop during power save. <br /><br/> Remaining bits are reserved.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** -0xfffffffe, 0xfffffffd, 0xfffffffc, 0x0021, 0xFF74) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_send_feature_frame

`int32_t rsi_send_feature_frame(void)`

**Description:** Select internal or external RF type and clock frequency. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0x0021, 0xFF74) <br />  
   If return value is less than 0 <br />

**Note**

- **Precondition** - [rsi_wireless_init](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_get_fw_version

`int32_t rsi_get_fw_version(uint8_t *response, uint16_t length)`

**Description:** Get firmware version present in the device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|response|- Length of the response buffer in bytes to hold result.|
|uint16_t|[out]|length|- Response of the requested command.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0xfffffffa, 0x0021, 0x0025, 0x002c) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_init_timer](driver11#rsi-init-timer), [rsi_scheduler](driver15#rsi-scheduler), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

**Referenced by:** [rsi_wlan_get](wlan#rsi-wlan-get)

###### rsi_robust_drv_start_handshake

`int32_t rsi_robust_drv_start_handshake(void)`

**Description:** Activates Robust Mode (CRC-32 integrity) on the UART host interface by performing a one-time handshake between the host driver and the module. After this API returns success, every command, response, and event frame exchanged over UART is protected by a sequence number and a CRC-32, and any corrupted or out-of-sequence frame is rejected. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- [rsi_driver_init()](common#rsi-driver-init) and [rsi_wireless_init()](common#rsi-wireless-init) must have completed successfully.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_robust_drv_cb_s::enabled](rsi-robust-drv-cb-s#enabled), [rsi_driver_cb_non_rom::robust_drv_cb](rsi-driver-cb-non-rom#robust-drv-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_robust_drv_cb_s::rx_sn](rsi-robust-drv-cb-s#rx-sn), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_robust_drv_cb_s::state](rsi-robust-drv-cb-s#state) and [rsi_robust_drv_cb_s::tx_sn](rsi-robust-drv-cb-s#tx-sn)

###### rsi_get_module_type

`int32_t rsi_get_module_type(uint8_t *response)`

**Description:** Get module type. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|response|- Response of the requested command. <br /><br/> 0 - B8 <br /><br/> 1 - Q7 (QMS) <br /><br/> 2 - Q7 + EXT FLASH <br /><br/> 3 - DB_T <br /><br/> 4 - SB <br /><br/> 5 - M7DB (CC0) <br /><br/> 6 - M4SB (B00) <br /><br/> 7 - B6F <br /><br/> 8 - B8SDB <br /><br/> 9 - W2 <br /><br/> 10 - WMS <br />|

- Need to call after the device initialization, [rsi_device_init](common#rsi-device-init) API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If return value is less than 0 <br />  
   -3: Command given in wrong state <br />  
   -4: Buffer not available to serve the command <br />  
   -6: Insufficient input buffer given <br />  
   If return value is greater than 0 <br />  
   0x0021, 0x0025, 0x002c

**Note**

- Refer to Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::module_type_id](rsi-driver-cb-non-rom#module-type-id), [rsi_driver_cb_non_rom::module_type_valid](rsi-driver-cb-non-rom#module-type-valid), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_init_timer](driver11#rsi-init-timer), [rsi_scheduler](driver15#rsi-scheduler), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_common_debug_log

`int32_t rsi_common_debug_log(int32_t assertion_type, int32_t assertion_level)`

**Description:** Debug prints on UART interfaces 1 and 2. Host can get 5 types of debug prints based on the assertion level and assertion type. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|assertion_type|- Assertion_type (Possible values 0 - 15) <br /><br/> 0000 - LMAC core <br /><br/> 0001 - SME <br /><br/> 0010 - UMAC <br /><br/> 0100 - NETX <br /><br/> 1000 - Enables assertion indication and provides ram dump in critical assertion. <br />|
|int32_t|[in]|assertion_level|- Assertion_level (Possible values 0 - 15) <br /><br/> 1 is least value/only specific prints <br /><br/> 15 is the highest level/Enable all prints. <br /><br/> 0000 - Assertion required <br /><br/> 0010 - Recoverable <br /><br/> 0100 - Information <br />|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure (**Possible Error Codes** - 0xfffffffe)<br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.
- To minimize the debug prints host is supposed to give the same API with assertion type and assertion level as 0.
- Baud rate for UART 2 on host application side should be 460800.
- Enable few feature bit maps for getting debug logs on UART: <br />  
   (#define RSI_CUSTOM_FEATURE_BIT_MAP FEAT_CUSTOM_FEAT_EXTENTION_VALID) and <br />  
   (#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP EXT_FEAT_UART_SEL_FOR_DEBUG_PRINTS)

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_switch_proto

`int32_t rsi_switch_proto(uint8_t type, void(*callback)(uint16_t mode, uint8_t *bt_disabled_status))`

**Description:** To enable or disable BT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- Type|
|void(*)(uint16_t mode, uint8_t *bt_disabled_status)|[in]|callback|- Indicate BT enable or disable based on mode value|
||[out]|mode|- Indicate BT enable or disable|
||[out]|bt_disabled_status|- BT disabled status either success or failure to host|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xFF)

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_wireless_driver_task

`void rsi_wireless_driver_task(void)`

**Description:** Handles driver events. Called in application main loop for non-OS platforms. <br />
 With OS, this is a blocking API and without OS this API is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- None

**References:** [rsi_scheduler](driver15#rsi-scheduler), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_driver_deinit

`int32_t rsi_driver_deinit(void)`

**Description:** De-Initialize driver components by clearing all the memory given for driver operations through [rsi_driver_init()](common#rsi-driver-init) API. With OS case, you need to take care of OS variables initialized in [rsi_driver_init()](common#rsi-driver-init). This API must be called by the thread/task/master thread that it is not dependent on the OS variables allocated/initialized in [rsi_driver_init()](common#rsi-driver-init) API. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_driver_init](common#rsi-driver-init) API needs to be called before this API.

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_driver_cb_s::bt_ble_stack_cb](rsi-driver-cb-s#bt-ble-stack-cb), [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_cmd_sem](rsi-bt-cb-s#bt-cmd-sem), [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_driver_cb_s::bt_common_tx_q](rsi-driver-cb-s#bt-common-tx-q), [rsi_bt_cb_s::bt_sem](rsi-bt-cb-s#bt-sem), [rsi_driver_cb_s::bt_single_tx_q](rsi-driver-cb-s#bt-single-tx-q), [rsi_bt_cb_s::bt_tx_pool](rsi-bt-cb-s#bt-tx-pool), [buffer_addr](common#buffer-addr), [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_cmd_sem](rsi-driver-cb-non-rom#common-cmd-sem), [rsi_driver_cb_non_rom::common_cmd_send_sem](rsi-driver-cb-non-rom#common-cmd-send-sem), [rsi_common_cb_s::common_mutex](rsi-common-cb-s#common-mutex), [rsi_common_cb_s::common_sem](rsi-common-cb-s#common-sem), [rsi_common_cb_s::common_tx_pool](rsi-common-cb-s#common-tx-pool), [rsi_driver_cb_s::common_tx_q](rsi-driver-cb-s#common-tx-q), [rsi_driver_cb_non_rom::debug_prints_mutex](rsi-driver-cb-non-rom#debug-prints-mutex), [rsi_driver_cb_non_rom::device_state](rsi-driver-cb-non-rom#device-state), [rsi_driver_cb_non_rom::nwk_cmd_send_sem](rsi-driver-cb-non-rom#nwk-cmd-send-sem), [rsi_driver_cb_non_rom::nwk_sem](rsi-driver-cb-non-rom#nwk-sem), [rsi_pkt_pool_s::pkt_sem](rsi-pkt-pool-s#pkt-sem), [rsi_driver_cb_s::prop_protocol_cb](rsi-driver-cb-s#prop-protocol-cb), [rsi_driver_cb_s::prop_protocol_tx_q](rsi-driver-cb-s#prop-protocol-tx-q), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex), [rsi_check_pkt_queue_and_dequeue](driver5#rsi-check-pkt-queue-and-dequeue), [rsi_driver_memory_estimate](common#rsi-driver-memory-estimate), [rsi_mutex_destroy](rsi-os-h#rsi-mutex-destroy), [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore), [rsi_semaphore_destroy](rsi-os-h#rsi-semaphore-destroy), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_vport_enter_critical](rtos#rsi-vport-enter-critical), [rsi_vport_exit_critical](rtos#rsi-vport-exit-critical), [rsi_driver_cb_s::rx_pool](rsi-driver-cb-s#rx-pool), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_non_rom::tx_mutex](rsi-driver-cb-non-rom#tx-mutex), [rsi_common_cb_s::wakeup_gpio_sem](rsi-common-cb-s#wakeup-gpio-sem), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem), [rsi_driver_cb_non_rom::wlan_cmd_send_sem](rsi-driver-cb-non-rom#wlan-cmd-send-sem), [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex), [rsi_wlan_cb_s::wlan_sem](rsi-wlan-cb-s#wlan-sem), [rsi_wlan_cb_s::wlan_tx_pool](rsi-wlan-cb-s#wlan-tx-pool), [rsi_driver_cb_s::wlan_tx_q](rsi-driver-cb-s#wlan-tx-q), [rsi_driver_cb_s::zigb_cb](rsi-driver-cb-s#zigb-cb) and [rsi_driver_cb_s::zigb_tx_q](rsi-driver-cb-s#zigb-tx-q)

**Referenced by:** [rsi_destroy_driver_task_and_driver_deinit](common#rsi-destroy-driver-task-and-driver-deinit)

###### rsi_destroy_driver_task_and_driver_deinit

`int32_t rsi_destroy_driver_task_and_driver_deinit(rsi_task_handle_t *task_handle)`

**Description:** In OS case, delete driver task before calling [rsi_driver_deinit()](common#rsi-driver-deinit) API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t *|[in]|task_handle|- Task handle/instance to be deleted|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_driver_init](common#rsi-driver-init) API needs to be called before this API.

**References:** [rsi_driver_deinit](common#rsi-driver-deinit), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_task_destroy](rtos#rsi-task-destroy), [SL_PRINTF](bt-classic1#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_driver_version

`int32_t rsi_driver_version(uint8_t *request)`

**Description:** Get current driver version. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|request|- Pointer to fill driver version|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [memcpy](bt-classic1#memcpy), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_set_rtc_timer

`int32_t rsi_set_rtc_timer(module_rtc_time_t *timer)`

**Description:** Set the host rtc timer. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[module_rtc_time_t](module-rtc-time-s) *|[in]|timer|- Pointer to fill RTC time. second --> seconds [0-59] <br /><br/> minute --> minutes [0-59] <br /><br/> hour --> hours since midnight [0-23] <br /><br/> day --> day of the month [1-31] <br /><br/> month --> months since January [0-11] <br /><br/> year --> year since 1990. <br /><br/> Weekday--> Weekday from Sunday to Saturday [1-7] <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API
- This API is not supported when power save mode is enabled
- Hour is 24-hour format only (valid values are 0 to 23). Valid values for Month are 0 to 11 (January to December).

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [module_rtc_time_s::tm_hour](module-rtc-time-s#tm-hour), [module_rtc_time_s::tm_mday](module-rtc-time-s#tm-mday), [module_rtc_time_s::tm_min](module-rtc-time-s#tm-min), [module_rtc_time_s::tm_mon](module-rtc-time-s#tm-mon), [module_rtc_time_s::tm_sec](module-rtc-time-s#tm-sec) and [module_rtc_time_s::tm_wday](module-rtc-time-s#tm-wday)

###### rsi_get_ram_log

`int32_t rsi_get_ram_log(uint32_t addr, uint32_t length)`

**Description:** Get ram log on UART/UART2. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address in RS9116 module|
|uint32_t|[in]|length|- Chunk length to read from RS9116 module|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0x0021, 0x003E) <br />

**Note**

- [rsi_wireless_init()](common#rsi-wireless-init) needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_driver_memory_estimate

`int32_t rsi_driver_memory_estimate(void)`

**Description:** Provide the memory required by the application. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Driver pool size

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit) and [rsi_driver_init](common#rsi-driver-init)

###### rsi_uregister_events_callbacks

`void rsi_uregister_events_callbacks(void(*callback_handler_ptr)(uint32_t event_num))`

**Description:** De-register event handler for the given event. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void(*)(uint32_t event_num)|[out]|callback_handler_ptr|- Event number|

**Returns**

- 0 - Success <br />
- Non-Zero Value- Failure <br />

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::unregistered_event_callback](rsi-driver-cb-s#unregistered-event-callback)

###### rsi_register_wait_timeout_error_callbacks

`void rsi_register_wait_timeout_error_callbacks(void(*callback_handler_ptr)(int32_t status, uint32_t cmd_type))`

**Description:** Register SAPI wait timeout handler. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void(*)(int32_t status, uint32_t cmd_type)|[out]|callback_handler_ptr|- Status|
||[out]|cmd_type|- Command|

**Returns**

- 0 - Success <br />
- Non-Zero - Failure <br />

**References:** [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_get_rtc_timer

`int32_t rsi_get_rtc_timer(module_rtc_time_t *response)`

**Description:** Fetch current time from hardware Real Time Clock. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[module_rtc_time_t](module-rtc-time-s) *|[out]|response|- Response of the requested command. <br /><br/> Response parameters: <br /><br/> second --> Current real time clock seconds. <br /><br/> minute --> Current real time clock minute. <br /><br/> hour --> Current real time clock hour. <br /><br/> day --> Current real time clock day. <br /><br/> month --> Current real time clock month. <br /><br/> year --> Current real time clock year. <br /><br/> weekday--> Current real time clock Weekday. <br />|

- [rsi_set_rtc_timer()](common#rsi-set-rtc-timer) API needs to be called before this API. Also this API needs to be called only after [rsi_wlan_scan()](wlan#rsi-wlan-scan) API or [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021, 0x0025) <br /><br />

**Note**

- **Precondition** - [rsi_set_rtc_timer()](common#rsi-set-rtc-timer) API needs to be called before this API. <br />
- [rsi_wireless_init()](common#rsi-wireless-init) needs to be called before this API.
- This API is not supported when power save mode is enabled.
- Hour is 24-hour format only (valid values are 0 to 23). Valid values for Month are 0 to 11 (January to December).
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_set_config

`int32_t rsi_set_config(uint32_t code, uint16_t value)`

**Description:** This function sets the configuration for the Network Processor based on configuration code.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>code</td>
      <td>- Configuration code. The possible values are as below:

- XO_CTUNE_FROM_HOST: used to configure NWP's XO Ctune value.
- SET_XTAL_GOOD_TIME_FROM_HOST: used to configure XTAL(crystal) good time.
- SET_PMU_GOOD_TIME_FROM_HOST: used to configure PMU good time.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>value</td>
      <td>- Value to be configured 

|Code|Value Range|
|---|---|
|XO_CTUNE_FROM_HOST|0 - 255|
|SET_XTAL_GOOD_TIME_FROM_HOST|2000µs - 10000µs|
|SET_PMU_GOOD_TIME_FROM_HOST|1100µs - 2000µs|</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) should to called before this API. <br />
- **Precondition** - To set XTAL and PMU good time from host, call this API before setting the opermode in [rsi_wireless_init()](common#rsi-wireless-init). <br />

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_ecdsa_256_verify_hash

`int32_t rsi_ecdsa_256_verify_hash(uint8_t *signature, uint16_t signature_length, uint8_t *digest, uint16_t digest_length, uint8_t *key, uint16_t key_length)`

**Description:** Verifies ECDSA 256 digital signature. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|signature|- The signature buffer|
|uint16_t|[in]|signature_length|- Length of the signature|
|uint8_t *|[in]|digest|- Digest of the message that needs to be verified|
|uint16_t|[in]|digest_length|- Total digest length|
|uint8_t *|[in]|key|- The public key used to verify hash.|
|uint16_t|[in]|key_length|- Total key length|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_assert

`int32_t rsi_assert(void)`

**Description:** Trigger an assert. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_gpio_pininit

`int32_t rsi_gpio_pininit(uint8_t gpio_type, uint8_t pin_num, uint8_t configuration)`

**Description:** Configure TA GPIOs from host. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|gpio_type|- GPIO types : <br /><br/> 0 - TA_GPIO <br /><br/> 1 - ULP_GPIO <br /><br/> 2 - UULP_GPIO <br />|
|uint8_t|[in]|pin_num|- GPIO Number : <br /><br/> Valid values 0 - 63, if gpio_type is TA_GPIO. <br /><br/> Valid values 0 - 15, if gpio_type is ULP_GPIO. <br /><br/> Valid values 0 and 2, if gpio_type is UULP_GPIO. <br />|
|uint8_t|[in]|configuration|- BIT[0 - 1] : Drive strength <br /><br/> 0 - 2mA <br /><br/> 1 - 4mA <br /><br/> 2 - 8mA <br /><br/> 3 - 12mA <br /><br/> BIT[2] : Reserved <br /><br/> BIT[3] : Reserved <br /><br/> BIT[4] : I/O mode <br /><br/> 1 - Input mode <br /><br/> 0 - Output mode <br /><br/> BIT[5] : Reserved <br /><br/> BIT[6 - 7] : Type <br /><br/> 0 - Hi-Z <br /><br/> 1 - Pull-up <br /><br/> 2 - Pull-down <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- It is not recommended to configure ULP_GPIO_6 as it is used for WoW feature
- You need to define the CONFIGURE_GPIO_FROM_HOST to enable this API

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_gpio_writepin

`int32_t rsi_gpio_writepin(uint8_t gpio_type, uint8_t pin_num, uint8_t value)`

**Description:** Drive the module GPIOs high or low from host. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|gpio_type|- GPIO types : <br /><br/> 0 - TA_GPIO <br /><br/> 1 - ULP_GPIO <br /><br/> 2 - UULP_GPIO <br />|
|uint8_t|[in]|pin_num|- GPIO Number : <br /><br/> Valid values 0 - 63, if gpio_type is TA_GPIO. <br /><br/> Valid values 0 - 15, if gpio_type is ULP_GPIO. <br /><br/> Valid values 0 and 2, if gpio_type is UULP_GPIO. <br />|
|uint8_t|[in]|value|- Value to be driven on GPIO <br /><br/> 1 - High <br /><br/> 0 - Low <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**Note**

- It is not recommended to configure ULP_GPIO_6 as it is used for WoW feature
- You need to define the CONFIGURE_GPIO_FROM_HOST to enable this API

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_gpio_readpin

`int32_t rsi_gpio_readpin(uint8_t gpio_type, uint8_t pin_num, uint8_t *gpio_value)`

**Description:** Read status of TA GPIOs from host. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|gpio_type|- GPIO types : <br /><br/> 0 - TA_GPIO <br /><br/> 1 - ULP_GPIO <br /><br/> 2 - UULP_GPIO <br />|
|uint8_t|[in]|pin_num|- GPIO Number : <br /><br/> Valid values 0 - 63, if gpio_type is TA_GPIO. <br /><br/> Valid values 0 - 15, if gpio_type is ULP_GPIO. <br /><br/> Valid values 0 and 2, if gpio_type is UULP_GPIO. <br />|
|uint8_t *|[in]|gpio_value|- Address of variable to store the value|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**Note**

- It is not recommended to configure ULP_GPIO_6 as it is used for WoW feature.
- You need to define the CONFIGURE_GPIO_FROM_HOST to enable this API.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### rsi_gpio_read

`int32_t rsi_gpio_read(uint8_t gpio_num)`

**Description:** Read status of NWP GPIOs from host. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|gpio_num|- GPIO Number : <br /><br/> Valid values 0 - 15 for ULP <br /><br/> Valid values 0 - 63 for SOC <br /><br/> Valid values 0 - 3 for UULP <br />|

**Returns**

- 0 - Status of NWP GPIO is LOW <br />
- 1 - status of NWP GPIO is HIGH <br />
- Non-Zero Value (< 0) - Failure <br />

**References:** [rsi_mem_rd](driver1#rsi-mem-rd) and [rsi_mem_wr](driver1#rsi-mem-wr)

###### rsi_gpio_write

`int32_t rsi_gpio_write(uint8_t gpio_num, uint8_t write)`

**Description:** Drive the NWP GPIOs from host. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|gpio_num|- GPIO Number : <br /><br/> Valid values 0 - 15 for ULP <br /><br/> Valid values 0 - 63 for SOC <br /><br/> Valid values 0 - 3 for UULP <br />|
|uint8_t|[in]|write|- Value to be driven on GPIO <br /><br/> 1 - High <br /><br/> 0 - Low <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**Note**

- You need to define the CONFIGURE_GPIO_FROM_HOST to enable this API

**References:** [rsi_mem_wr](driver1#rsi-mem-wr)

###### rsi_set_region

`int32_t rsi_set_region(void)`

**Description:** set/change the region on user based configuration

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_device_init

`int32_t rsi_device_init(uint8_t select_option)`

**Description:** Power cycle the module and set the firmware image type to be loaded. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|select_option|- LOAD_NWP_FW : To load Firmware image <br /><br/> LOAD_DEFAULT_NWP_FW_ACTIVE_LOW : To load active low Firmware image. <br /><br/> Active low firmware will generate active low interrupts to indicate that packets are pending on the <br /><br/> module, instead of the default active high. <br />|

**Returns**

- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_driver_init()](common#rsi-driver-init) must be called before this API.
- Add the ENABLE_POC_IN_TOGGLE macro in the preprocessor to enable toggling of the POC_IN pin if it is controlled by the host to power cycle the module. For STM32 and EFM32 hosts, pins have been configured to drive the POC_IN pin. For EFR32, a pin has to be configured by the user to drive the POC_IN pin. <br />

**Returns**

- **Success** - RSI_SUCCESS <br />
- **Failure** - Non-Zero Value

**References:** [rsi_driver_cb_non_rom::device_state](rsi-driver-cb-non-rom#device-state), [rsi_bl_module_power_cycle](driver6#rsi-bl-module-power-cycle), [rsi_bl_select_option](driver6#rsi-bl-select-option), [rsi_bl_waitfor_boardready](driver6#rsi-bl-waitfor-boardready), [rsi_init_timer](driver11#rsi-init-timer), [rsi_sdio_iface_init](driver1#rsi-sdio-iface-init), [rsi_set_fast_fw_up](driver5#rsi-set-fast-fw-up), [rsi_set_intr_type](driver2#rsi-set-intr-type), [rsi_spi_high_speed_enable](driver2#rsi-spi-high-speed-enable), [rsi_spi_iface_init](driver2#rsi-spi-iface-init), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_uart_iface_int](driver3#rsi-uart-iface-int) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_device_deinit

`int32_t rsi_device_deinit(void)`

**Description:** De-Initialize the module and reset the module. <br />
 Reset is driven to the module by asserting the reset pin for some duration and releasing it. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_power_save_s::current_ps_mode](rsi-power-save-s#current-ps-mode), [rsi_driver_cb_non_rom::device_state](rsi-driver-cb-non-rom#device-state), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_bl_module_power_cycle](driver6#rsi-bl-module-power-cycle), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_power_save_profile](wlan#rsi-wlan-power-save-profile), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_get_intr_status

`uint8_t rsi_get_intr_status()`

**Description:** Get the interrupt status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|NA||

**Returns**

- 1 - when there is an interrupt <br />
- 0 - when there is no interrupt

**Referenced by:** [rsi_get_event_non_rom](driver15#rsi-get-event-non-rom) and [rsi_rx_event_handler](driver5#rsi-rx-event-handler)

###### rsi_bl_upgrade_firmware

`int16_t rsi_bl_upgrade_firmware(uint8_t *firmware_image, uint32_t fw_image_size, uint8_t flags)`

**Description:** Upgrade the firmware in the module from the host. The firmware file is given in chunks to this API. <br />
 Each chunk must be a multiple of 4096 bytes unless it is the last chunk. <br />
 This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|firmware_image|- This is a pointer to firmware image buffer|
|uint32_t|[in]|fw_image_size|- This is the size of firmware image|
|uint8_t|[in]|flags|- 1 - RSI_FW_START_OF_FILE, set for the first chunk <br /><br/> 2 - RSI_FW_END_OF_FILE, set for the last chunk <br /><br/> 0 - for all other chunks <br />|

**Note**

- In [rsi_bootloader_instructions()](driver5#rsi-bootloader-instructions) API, by default the RSI_HAL_MAX_WR_BUFF_LEN macro (Max supported write buffer size) is 4096 bytes. You can reduce this buffer size (minimum value of 1600 bytes is expected) as per HAL memory availability at the cost of the increase in execution time of this API. <br />  
   This macro can be configured in [rsi_user.h](rsi-user-8h-source#rsi-user-8h-source) file. <br />  
   Example: uint8_t dummy[RSI_HAL_MAX_WR_BUFF_LEN];
- For safe firmware upgrade via the bootloader, <br />  
   it will take approx. 65 sec duration for upgrading the firmware of 1.5 MB file.
- For fast firmware upgrade via the bootloader, <br />  
   it will take approx. 35 sec duration for upgrading the firmware of 1.5 MB file.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [fwupeq_s::image_loc](fwupeq-s#image-loc), [fwupeq_s::image_size](fwupeq-s#image-size), [fwupeq_s::magic_no](fwupeq-s#magic-no), [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_init_timer](driver11#rsi-init-timer), [rsi_timer_expired](driver11#rsi-timer-expired) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_get_ram_dump

`int32_t rsi_get_ram_dump(uint32_t addr, uint16_t length, uint8_t *buf)`

**Description:** Get RAM dump. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address of memory location in RS9116|
|uint16_t|[in]|length|- Length of the content to read|
|uint8_t *|[out]|buf|- Buffer to keep the read content|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [rsi_mem_rd](driver1#rsi-mem-rd) and [SL_PRINTF](bt-classic1#sl-printf)

#### Crypto APIs

This section describes the Crypto APIs 

##### Functions

###### rsi_sha_pen

`int32_t rsi_sha_pen(uint8_t sha_mode, uint8_t *msg, uint16_t msg_length, uint16_t chunk_len, uint8_t pending_flag, uint8_t *digest)`

**Description:** Compute the SHA digest. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|sha_mode|1 – For SHA1 <br /><br/> 2 – For SHA256 <br /><br/> 3 – For SHA384 <br /><br/> 4 – For SHA512 <br /><br/> 5 – For SHA224 <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length|
|uint16_t|[in]|chunk_len|- Current chunk length|
|uint8_t|[in]|pending_flag|- BIT(0) - 1st chunk <br /><br/> BIT(1) - Middle chunk <br /><br/> BIT(2) - Last chunk <br />|
|uint8_t *|[out]|digest|- Output parameter to hold computed digest from SHA|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_sha](crypto#rsi-sha)

###### rsi_sha

`int32_t rsi_sha(uint8_t sha_mode, uint8_t *msg, uint16_t msg_length, uint8_t *digest)`

**Description:** Decide whether the SHA message can be sent once or requires multiple calls to send. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|sha_mode|1 – For SHA1 <br /><br/> 2 – For SHA256 <br /><br/> 3 – For SHA384 <br /><br/> 4 – For SHA512 <br /><br/> 5– For SHA224 <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length|
|uint8_t *|[out]|digest|- Output parameter to hold computed digest from SHA|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_sha_pen](crypto#rsi-sha-pen), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_hmac_sha_pen

`int32_t rsi_hmac_sha_pen(uint8_t hmac_sha_mode, uint8_t *data, uint16_t total_length, uint16_t chunk_length, key_descriptor_t *key_info, uint8_t pending_flag, uint8_t *digest)`

**Description:** Hold computed digest from HMAC-SHA. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|hmac_sha_mode|- 1 – For HMAC-SHA1 <br /><br/> 2 – For HMAC-SHA256 <br /><br/> 3 – For HMAC-SHA384 <br /><br/> 4 – For HMAC-SHA512 <br />|
|uint8_t *|[in]|data|- Pointer to key along with message|
|uint16_t|[in]|total_length|- Total message length|
|uint16_t|[in]|chunk_length|- Current chunk length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t|[in]|pending_flag|- BIT(0) - 1st chunk <br /><br/> BIT(1) - Middle chunk <br /><br/> BIT(2) - Last chunk <br />|
|uint8_t *|[out]|digest|- Output parameter to hold computed digest from HMAC-SHA|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [crypto_key_s::key_slot](crypto-key-s#key-slot), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [key_descriptor_s::key_type](key-descriptor-s#key-type), [key_descriptor_s::reserved](key-descriptor-s#reserved), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [crypto_key_s::wrap_iv](crypto-key-s#wrap-iv) and [crypto_key_s::wrap_iv_mode](crypto-key-s#wrap-iv-mode)

**Referenced by:** [rsi_hmac_sha](crypto#rsi-hmac-sha)

###### rsi_hmac_sha

`int32_t rsi_hmac_sha(uint8_t hmac_sha_mode, uint8_t *msg, uint32_t msg_length, uint8_t *key, key_descriptor_t *key_info, uint8_t *digest, uint8_t *hmac_buffer)`

**Description:** Decide whether the HMAC-SHA message can be sent once or requires multiple calls to send the message. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|hmac_sha_mode|- 1 – For HMAC-SHA1 <br /><br/> 2 – For HMAC-SHA256 <br /><br/> 3 – For HMAC-SHA384 <br /><br/> 4 – For HMAC-SHA512 <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint32_t|[in]|msg_length|- Total message length|
|uint8_t *|[in]|key|- Pointer to HMAC key|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure Pointer to key_info|
|uint8_t *|[in]|digest|- HMAC key length in bytes|
|uint8_t *|[out]|hmac_buffer|- Output parameter to hold computed digest from HMAC-SHA|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [memcpy](bt-classic1#memcpy), [rsi_hmac_sha_pen](crypto#rsi-hmac-sha-pen), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_aes

`int32_t rsi_aes(uint16_t aes_mode, uint16_t enc_dec, uint8_t *msg, uint16_t msg_length, key_descriptor_t *key_info, uint8_t *iv, uint8_t *output)`

**Description:** Decide whether the AES message can be sent once or requires multiple calls to send the message. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|aes_mode|- 1 – For AES CBC mode <br /><br/> 2 – For AES ECB mode <br /><br/> 3 – For AES CTR mode <br />|
|uint16_t|[in]|enc_dec|- 1 – For AES Encryption <br /><br/> 2 – For AES Decryption <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length (must be divisible by 16)|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|iv|- Pointer to AES iv|
|uint8_t *|[out]|output|- Output parameter to hold encrypted/decrypted from AES|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_aes_pen](crypto#rsi-aes-pen), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_aes_pen

`int32_t rsi_aes_pen(uint16_t aes_mode, uint16_t enc_dec, uint8_t *msg, uint16_t msg_length, uint16_t chunk_length, key_descriptor_t *key_info, uint8_t *iv, uint8_t aes_flags, uint8_t *output)`

**Description:** Encrypt/decrypt the data using AES.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|aes_mode|- 1 – For AES CBC mode <br /><br/> 2 – For AES ECB mode <br /><br/> 3 – For AES CTR mode <br />|
|uint16_t|[in]|enc_dec|- 1 – For AES Encryption <br /><br/> 2 – For AES Decryption <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length (must be divisible by 16)|
|uint16_t|[in]|chunk_length|- Current chunk length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|iv|- Pointer to AES iv|
|uint8_t|[in]|aes_flags|- BIT(0) - 1st chunk <br /><br/> BIT(1) - Middle chunk <br /><br/> BIT(2) - Last chunk <br />|
|uint8_t *|[out]|output|- Output parameter to hold encrypted/decrypted from AES|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [crypto_key_s::key_slot](crypto-key-s#key-slot), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [key_descriptor_s::key_type](key-descriptor-s#key-type), [key_descriptor_s::reserved](key-descriptor-s#reserved), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [crypto_key_s::wrap_iv](crypto-key-s#wrap-iv) and [crypto_key_s::wrap_iv_mode](crypto-key-s#wrap-iv-mode)

**Referenced by:** [rsi_aes](crypto#rsi-aes)

###### rsi_exponentiation

`int32_t rsi_exponentiation(uint8_t *prime, uint32_t prime_length, uint8_t *base, uint32_t base_length, uint8_t *exponent, uint32_t exponent_length, uint8_t *exp_result)`

**Description:** Calculate the DH key. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|prime|- Pointer to the prime|
|uint32_t|[in]|prime_length|- Length of the prime|
|uint8_t *|[in]|base|- Pointer to base|
|uint32_t|[in]|base_length|- Length of the base|
|uint8_t *|[in]|exponent|- Pointer to exponent|
|uint32_t|[in]|exponent_length|- Length of the exponent|
|uint8_t *|[out]|exp_result|- Output exponentiation result|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ecdh_point_multiplication

`int32_t rsi_ecdh_point_multiplication(uint8_t ecdh_mode, uint8_t *d, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint32_t affinity, uint8_t *rx, uint8_t *ry, uint8_t *rz, uint8_t reverse)`

**Description:** Compute the ECDH point multiplication vector. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ecdh_mode|- 1 – For ECDH 192 <br /><br/> 2 – For ECDH 224 <br /><br/> 3 – For ECDH 256 <br />|
|uint8_t *|[in]|d|- Pointer to scalar value that needs to be multiplied|
|uint8_t *|[in]|sx|Pointer to x coordinate of the point to be multiplied with scalar ‘d’|
|uint8_t *|[in]|sy|Pointer to y coordinate of the point to be multiplied with scalar ‘d’|
|uint8_t *|[in]|sz|Pointer to z coordinate of the point to be multiplied with scalar ‘d’|
|uint32_t|[in]|affinity|- 0 – no affinity <br /><br/> 1 – affinity on input <br /><br/> 2 – affinity on output <br /><br/> 3 – affinity on both input and output <br />|
|uint8_t *|[out]|rx|Pointer to x coordinate of the result point|
|uint8_t *|[out]|ry|Pointer to y coordinate of the result point|
|uint8_t *|[out]|rz|Pointer to z coordinate of the result point|
|uint8_t|[in]|reverse|- setting this will perform reverse_8 on the inputs and outputs.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ecdh_point_addition

`int32_t rsi_ecdh_point_addition(uint8_t ecdh_mode, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint8_t *tx, uint8_t *ty, uint8_t *tz, uint8_t *rx, uint8_t *ry, uint8_t *rz)`

**Description:** Compute the ECDH point addition vector. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ecdh_mode|- 1 – For ECDH 192 <br /><br/> 2 – For ECDH 224 <br /><br/> 3 – For ECDH 256 <br />|
|uint8_t *|[in]|sx|- Pointer to x coordinate of the point1 that needs to be added|
|uint8_t *|[in]|sy|- Pointer to y coordinate of the point1 that needs to be added|
|uint8_t *|[in]|sz|- Pointer to z coordinate of the point1 that needs to be added|
|uint8_t *|[in]|tx|- Pointer to x coordinate of the point2 that needs to be added|
|uint8_t *|[in]|ty|- Pointer to y coordinate of the point2 that needs to be added|
|uint8_t *|[in]|tz|- Pointer to z coordinate of the point2 that needs to be added|
|uint8_t *|[out]|rx|- Pointer to x coordinate of the result point|
|uint8_t *|[out]|ry|- Pointer to y coordinate of the result point|
|uint8_t *|[out]|rz|- Pointer to z coordinate of the result point|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ecdh_point_subtraction

`int32_t rsi_ecdh_point_subtraction(uint8_t ecdh_mode, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint8_t *tx, uint8_t *ty, uint8_t *tz, uint8_t *rx, uint8_t *ry, uint8_t *rz)`

**Description:** Compute the ECDH point subtraction vector. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ecdh_mode|- 1 – For ECDH 192 <br /><br/> 2 – For ECDH 224 <br /><br/> 3 – For ECDH 256 <br />|
|uint8_t *|[in]|sx|- Pointers to x, y, z coordinates of the point1 that needs to be subtracted|
|uint8_t *|[in]|sy|- Pointers to x, y, z coordinates of the point2 that needs to be subtracted|
|uint8_t *|[out]|sz|- Pointers to x, y, z coordinates of the result point|
|uint8_t *|N/A|tx||
|uint8_t *|N/A|ty||
|uint8_t *|N/A|tz||
|uint8_t *|N/A|rx||
|uint8_t *|N/A|ry||
|uint8_t *|N/A|rz||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ecdh_point_double

`int32_t rsi_ecdh_point_double(uint8_t ecdh_mode, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint8_t *rx, uint8_t *ry, uint8_t *rz)`

**Description:** Compute the ECDH point double vector. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ecdh_mode|- 1 – For ECDH 192 <br /><br/> 2 – For ECDH 224 <br /><br/> 3 – For ECDH 256 <br />|
|uint8_t *|[in]|sx|- Pointers to x, y, z coordinates of the point1 that needs to be doubled|
|uint8_t *|[out]|sy|- Pointers to x, y, z coordinates of the result point|
|uint8_t *|N/A|sz||
|uint8_t *|N/A|rx||
|uint8_t *|N/A|ry||
|uint8_t *|N/A|rz||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ecdh_point_affine

`int32_t rsi_ecdh_point_affine(uint8_t ecdh_mode, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint8_t *rx, uint8_t *ry, uint8_t *rz)`

**Description:** Compute the ECDH point affinity vector. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ecdh_mode|- 1 – For ECDH 192 <br /><br/> 2 – For ECDH 224 <br /><br/> 3 – For ECDH 256 <br />|
|uint8_t *|[in]|sx|- Pointers to x, y, z coordinates of the point1 that needs to be affinified|
|uint8_t *|[out]|sy|- Pointers to x, y, z coordinates of the result point|
|uint8_t *|N/A|sz||
|uint8_t *|N/A|rx||
|uint8_t *|N/A|ry||
|uint8_t *|N/A|rz||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ccm

`int32_t rsi_ccm(uint8_t enc_dec, uint8_t *msg, uint16_t msg_length, key_descriptor_t *key_info, uint8_t *iv, uint16_t iv_sz, uint8_t *tag, uint16_t tag_len, uint8_t *ad, uint16_t ad_len, uint8_t *output)`

**Description:** Decides whether the CCM message can be sent once or requires multiple calls to send.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enc_dec|0 – For CCM Encryption 1 – For CCM Decryption|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|iv|Pointer to CCM iv|
|uint16_t|[in]|iv_sz|of IV|
|uint8_t *|[in]|tag|Pointer to CCM tag|
|uint16_t|[in]|tag_len|size of tag|
|uint8_t *|[in]|ad|to AD|
|uint16_t|[in]|ad_len|Total length of AD|
|uint8_t *|[out]|output|Output parameter to hold encrypted/decrypted from CCM<br/><br/>-|

**Returns**

- Non zero - If fails 0 - If success

##### description

This function decides whether the CCM message can be sent once or requires multiple calls to send the message 

**References:** [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [rsi_ccm_pen](crypto#rsi-ccm-pen) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_ccm_pen

`int32_t rsi_ccm_pen(uint8_t enc_dec, uint8_t *msg, uint16_t msg_length, uint16_t chunk_length, key_descriptor_t *key_info, uint8_t *iv, uint16_t iv_sz, uint8_t *tag, uint16_t tag_len, uint8_t *ad, uint16_t ad_len, uint8_t ccm_flags, uint8_t *output)`

**Description:** Encrypt/Decrypt the data using CCM.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enc_dec|0 – For CCM Encryption 1 – For CCM Decryption|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|uint16_t|[in]|chunk_length|current chunk length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|iv|Pointer to CCM iv|
|uint16_t|[in]|iv_sz|size of IV|
|uint8_t *|[in]|tag|Pointer to CCM tag|
|uint16_t|[in]|tag_len|size of tag|
|uint8_t *|[in]|ad|to AD|
|uint16_t|[in]|ad_len|Total length of AD|
|uint8_t|[in]|ccm_flags|BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk|
|uint8_t *|[out]|output|Output parameter to hold encrypted/decrypted from CCM<br/><br/>-|

**Returns**

- Non zero - If fails 0 - If success

##### description

This function encrypt/decrypt the data using CCM 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [crypto_key_s::key_slot](crypto-key-s#key-slot), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [key_descriptor_s::key_type](key-descriptor-s#key-type), [key_descriptor_s::reserved](key-descriptor-s#reserved), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [crypto_key_s::wrap_iv](crypto-key-s#wrap-iv) and [crypto_key_s::wrap_iv_mode](crypto-key-s#wrap-iv-mode)

**Referenced by:** [rsi_ccm](crypto#rsi-ccm)

###### trng_init

`int32_t trng_init(uint32_t *trng_key, uint32_t *trng_test_data, uint16_t input_length, uint32_t *output)`

**Description:** This API Initializes the TRNG hardware engine and Evaluate AES-CBC.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t *|[in]|trng_key|- Pointer to trng_key|
|uint32_t *|[in]|trng_test_data|- Pointer to test data for trng|
|uint16_t|[in]|input_length|- Length of test data in dwords|
|uint32_t *|[out]|output|- Pointer to output|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This API Initializes the TRNG hardware engine 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### trng_entropy

`int32_t trng_entropy(void)`

**Description:** This API check the health of Trng.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This API checks the Entropy of TRNG 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### trng_program_key

`int32_t trng_program_key(uint32_t *trng_key, uint16_t key_length)`

**Description:** This API Initializes key which needs to be programmed to TRNG hardware engine.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t *|[in]|trng_key|- Pointer to trng_key|
|uint16_t|[in]|key_length|- key_length - key length in Dwords|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This API Initializes key which needs to be programmed to TRNG hardware engine 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### trng_get_random_num

`int32_t trng_get_random_num(uint32_t *random_number, uint16_t length)`

**Description:** This API generated random number of desired length.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t *|[in]|random_number|- Address for Random number|
|uint16_t|[in]|length|- Random number which needs to be generated in Dwords|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This API generated random number of desired length 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### sl_attestation_get_token

`int32_t sl_attestation_get_token(uint8_t *token, uint16_t length, uint32_t *nonce)`

**Description:** This API gets token.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|token|- Address for token|
|uint16_t|[in]|length|-Length of token request|
|uint32_t *|[in]|nonce|- 32 byte nonce|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This API gets token 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_sha3_shake_pen

`int32_t rsi_sha3_shake_pen(uint8_t pad_char, uint8_t mode, uint8_t *msg, uint16_t msg_length, uint16_t chunk_len, uint8_t pending_flag, uint8_t *digest)`

**Description:** Computes the sha3/shake digest.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|pad_char|0x1F SHAKE, 0x06 SHA3|
|uint8_t|[in]|mode|21 - SHAKE_128 <br /><br/> 17 - SHAKE_256, SHA3_256 <br /><br/> 18 - SHA3_224 <br /><br/> 13 - SHA3_384 <br /><br/> 9 - SHA3_512|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|uint16_t|[in]|chunk_len|current chunk length|
|uint8_t|[in]|pending_flag|BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk|
|uint8_t *|[out]|digest|Output parameter to hold computed digest from SHA3/SHAKE|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This function computes the sha3/shake digest for the given input message 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_sha3](crypto#rsi-sha3) and [rsi_shake](crypto#rsi-shake)

###### rsi_shake

`int32_t rsi_shake(uint8_t mode, uint8_t *msg, uint16_t msg_length, uint8_t *digest)`

**Description:** Decides whether the sha message can be sent once or requires multiple calls to send.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|21 - SHAKE_128 17 - SHAKE_256|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|uint8_t *|[out]|digest|Output parameter to hold computed digest from SHAKE|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This function decides whether the shakeamessage can be sent once or requires multiple calls to send the message 

**References:** [rsi_sha3_shake_pen](crypto#rsi-sha3-shake-pen) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_sha3

`int32_t rsi_sha3(uint8_t mode, uint8_t *msg, uint16_t msg_length, uint8_t *digest)`

**Description:** Decides whether the sha message can be sent once or requires multiple calls to send.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|17 - SHA3_256 <br /><br/> 18 - SHA3_224 <br /><br/> 13 - SHA3_384 <br /><br/> 9 - SHA3_512 <br />|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|uint8_t *|[out]|digest|Output parameter to hold computed digest from SHA3|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This function decides whether the sha message can be sent once or requires multiple calls to send the message 

**References:** [rsi_sha3_shake_pen](crypto#rsi-sha3-shake-pen) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_chachapoly

`int32_t rsi_chachapoly(uint16_t chachapoly_mode, uint16_t enc_dec, uint16_t dma_use, uint8_t *msg, uint16_t msg_length, key_descriptor_t *key_info, uint8_t *nonce, uint8_t *header_input, uint16_t header_length, uint8_t *output)`

**Description:** Decides whether the CHACHAPOLY message can be sent once or requires multiple calls to send.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|chachapoly_mode|- 0 – For CHACHA20POLY1305 mode <br /><br/> 1 – For CHACHA20 mode <br /><br/> 3 – For POLY1305 mode <br />|
|uint16_t|[in]|enc_dec|- 0 – For CHACHAPOLY Encryption <br /><br/> 1 – For CHACHAPOLY Decryption <br />|
|uint16_t|[in]|dma_use|- 1 - DMA enable <br /><br/> 0- disable DMA <br />|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|nonce|- pointer to nonce (1st index is IV)|
|uint8_t *|[in]|header_input|Pointer to header|
|uint16_t|[in]|header_length|- header length in bytes|
|uint8_t *|[out]|output|Output parameter to hold encrypted/decrypted from chachapoly|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

**References:** [rsi_chachapoly_pen](crypto#rsi-chachapoly-pen) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_chachapoly_pen

`int32_t rsi_chachapoly_pen(uint16_t chachapoly_mode, uint16_t enc_dec, uint16_t dma_use, uint8_t *msg, uint16_t msg_length, uint16_t chunk_len, key_descriptor_t *key_info, uint8_t *nonce, uint8_t *header_input, uint16_t header_length, uint8_t chachapoly_flags, uint8_t *output)`

**Description:** Encrypt/Decrypt the data using CHACHA_POLY.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|chachapoly_mode|: 0 – For CHACHA20POLY1305 mode <br /><br/> 1 – For CHACHA20 mode <br /><br/> 3 – For POLY1305 mode <br />|
|uint16_t|[in]|enc_dec|0 – For CHACHAPOLY Encryption <br /><br/> 1 – For CHACHAPOLY Decryption <br />|
|uint16_t|[in]|dma_use|0 - DMA disable <br /><br/> 1- DMA enable <br />|
|uint8_t *|[in]|msg|Pointer to message|
|uint16_t|[in]|msg_length|Total message length|
|uint16_t|[in]|chunk_len|current chunk length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|Pointer to chacha key|
|uint8_t *|[in]|nonce|pointer to keyr_in|
|uint8_t *|[in]|header_input|pointer to keys_in|
|uint16_t|[in]|header_length|pointer to nonce (1st index is IV)|
|uint8_t|[in]|chachapoly_flags|Pointer to header|
|uint8_t *|[in]|output|header length in bytes|
||[in]|chachapoly_flags|BIT(0) - 1st chunk <br /><br/> BIT(1) - Middle chunk <br /><br/> BIT(2) - Last chunk <br />|
||[out]|output|Output parameter to hold encrypted/decrypted from chachapoly|

**Returns**

- 0 - Success
- Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [crypto_key_s::key_slot](crypto-key-s#key-slot), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [key_descriptor_s::key_type](key-descriptor-s#key-type), [key_descriptor_s::reserved](key-descriptor-s#reserved), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [crypto_key_s::wrap_iv](crypto-key-s#wrap-iv) and [crypto_key_s::wrap_iv_mode](crypto-key-s#wrap-iv-mode)

**Referenced by:** [rsi_chachapoly](crypto#rsi-chachapoly)

###### rsi_gcm

`int32_t rsi_gcm(uint32_t gcm_mode, uint8_t enc_dec, uint16_t dma_use, uint8_t *msg, uint16_t msg_length, key_descriptor_t *key_info, uint8_t *iv, uint16_t iv_sz, uint8_t *header, uint16_t header_length, uint8_t *output)`

**Description:** Decides whether the GCM/CMAC message can be sent once or requires multiple calls to send.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|gcm_mode|- 0 – For GCM, 1 – For CMAC. CMAC doesn't support decryption|
|uint8_t|[in]|enc_dec|- 0 – For GCM/CMAC Encryption 1 – For GCM Decryption|
|uint16_t|[in]|dma_use|- 0 - DMA disable 1: DMA Enable|
|uint8_t *|[in]|msg|- Pointer to message|
|uint16_t|[in]|msg_length|- Total message length|
|[key_descriptor_t](key-descriptor-s) *|[in]|key_info|- Structure pointer for key_info|
|uint8_t *|[in]|iv|- Pointer to GCM iv|
|uint16_t|[in]|iv_sz|- size of IV|
|uint8_t *|[in]|header|- pointer to header|
|uint16_t|[in]|header_length|- Total length of header|
|uint8_t *|[out]|output|- Output parameter to hold encrypted/decrypted from GCM|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes).

##### description

This function decides whether the GCM/CMAC message can be sent once or requires multiple calls to send the message 

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [crypto_key_s::key_buffer](crypto-key-s#key-buffer), [key_descriptor_s::key_detail](key-descriptor-s#key-detail), [sapi_key_info_s::key_size](sapi-key-info-s#key-size), [crypto_key_s::key_slot](crypto-key-s#key-slot), [sapi_key_info_s::key_spec](sapi-key-info-s#key-spec), [key_descriptor_s::key_type](key-descriptor-s#key-type), [key_descriptor_s::reserved](key-descriptor-s#reserved), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [crypto_key_s::wrap_iv](crypto-key-s#wrap-iv) and [crypto_key_s::wrap_iv_mode](crypto-key-s#wrap-iv-mode)

###### rsi_wrap

`int32_t rsi_wrap(key_descriptor_wrap_t *key_info, uint8_t *output)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[key_descriptor_wrap_t](key-descriptor-wrap-s) *|[in]|key_info|- size of keys in bytes, 32- M4_OTA_KEY, 96- M4_PUBLIC_KEY|
|uint8_t *|[in]|output|- 1- M4_OTA_KEY, 2- M4_PUBLIC_KEY|
||[out]|output|- Output parameter to hold built-in-key|

#### Firmware Update APIs

##### Functions

###### rsi_req_wireless_fwup

`int32_t rsi_req_wireless_fwup(void)`

**Description:** Request wireless firmware upgrade. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffc)<br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- For wireless firmware upgrade, it will take approximately 85 seconds for upgrading the firmware file of 1.5 MB <br />
- Need to call [rsi_bl_module_power_cycle()](driver6#rsi-bl-module-power-cycle) API, for the module to reboot after successful firmware upgradation and wait for 50 seconds for the upgraded firmware to be reflected. <br />
- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_fwup

`static int32_t rsi_fwup(uint8_t type, uint8_t *content, uint16_t length)`

**Description:** Helper function for actual APIs.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- Firmware upgrade chunk type|
|uint8_t *|[in]|content|- Firmware content|
|uint16_t|[in]|length|- Length of the content|

**Returns**

- 0 - Success <br />
- 3 - Firmware upgrade completed successfully <br />
- Negative Value - Failure

###### rsi_fwup_start

`int32_t rsi_fwup_start(uint8_t *rps_header)`

**Description:** Send the RPS header content of firmware file. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|rps_header|- Pointer to the RPS header content|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [fwupeq_s::image_loc](fwupeq-s#image-loc), [fwupeq_s::image_size](fwupeq-s#image-size), [fwupeq_s::magic_no](fwupeq-s#magic-no), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_fwup_load

`int32_t rsi_fwup_load(uint8_t *content, uint16_t length)`

**Description:** Send the firmware file content. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|content|- Pointer to the firmware file content|
|uint16_t|[in]|length|- Length of the content|

- [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API

**Returns**

- 0 - Success <br />
- 3 - Firmware upgradate is completed successfully <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffc) <br /><br />

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_http_fw_update

`int32_t rsi_http_fw_update(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, void(*http_otaf_response_handler)(uint16_t status, const uint8_t *buffer))`

**Description:** Initiate firmware update from an HTTP server. This is non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security <br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6 , by default it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_V_1_1|Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled|
|BIT(5)|HTTP_POST_DATA|Set this bit to enable Http_post large data feature|
|BIT(6)|HTTP_V_1_1|Set this bit to use HTTP version 1.1|
|BIT(9)|HTTPS_CERT_INDEX_1|Set this bit to indicate certificate at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate certificate at index 2 to be used for HTTPS|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>port</td>
      <td>- Port number, default : 80 - HTTP, 443 - HTTPS <br /></td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Host name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- Extender header if present</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server Authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server Authentication</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, const uint8_t *buffer)</td>
      <td>[in]</td>
      <td>http_otaf_response_handler</td>
      <td>- Callback is called when asynchronous response is received from module for HTTP firmware update request <br /></td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status</td>
      <td>- Status code</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>buffer</td>
      <td>- NULL</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure (**Possible Error Codes** - BBED,BB40,BB38,BBD2,FF74,FFF4) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />

**References:** [rsi_http_otaf_async](network9#rsi-http-otaf-async)

#### RTOS APIs

This section describes the RTOS APIs 

##### Functions

###### rsi_critical_section_entry

`rsi_reg_flags_t rsi_critical_section_entry()`

**Description:** Enter critical section.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Interrupt status before entering critical section

###### rsi_critical_section_exit

`void rsi_critical_section_exit(rsi_reg_flags_t xflags)`

**Description:** Exit critical section by restoring interrupts.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_reg_flags_t|[in]|xflags|- Interrupt status to restore interrupt on exit from critical section|

**Returns**

- Void

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_mutex_create

`rsi_error_t rsi_mutex_create(rsi_mutex_handle_t *mutex)`

**Description:** Create and initialize the mutex.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_mutex_lock

`rsi_error_t rsi_mutex_lock(volatile rsi_mutex_handle_t *mutex)`

**Description:** Lock the mutex.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|volatile rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure <br />

###### rsi_mutex_lock_from_isr

`void rsi_mutex_lock_from_isr(volatile rsi_mutex_handle_t *mutex)`

**Description:** Lock the mutex from ISR context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|volatile rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure <br />

###### rsi_mutex_unlock

`rsi_error_t rsi_mutex_unlock(volatile rsi_mutex_handle_t *mutex)`

**Description:** Unlock the mutex.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|volatile rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure <br />

###### rsi_mutex_unlock_from_isr

`void rsi_mutex_unlock_from_isr(volatile rsi_mutex_handle_t *mutex)`

**Description:** Unlock the mutex from ISR context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|volatile rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer <br />|

**Returns**

- None

###### rsi_mutex_destroy

`rsi_error_t rsi_mutex_destroy(rsi_mutex_handle_t *mutex)`

**Description:** Destroy the mutex.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_mutex_handle_t *|[in]|mutex|- Mutex handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_semaphore_create

`rsi_error_t rsi_semaphore_create(rsi_semaphore_handle_t *semaphore, uint32_t count)`

**Description:** Create and initialize the semaphore instance.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|
|uint32_t|[in]|count|- Resource count <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_semaphore_destroy

`rsi_error_t rsi_semaphore_destroy(rsi_semaphore_handle_t *semaphore)`

**Description:** Destroy the semaphore instance.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_semaphore_check_and_destroy

`rsi_error_t rsi_semaphore_check_and_destroy(rsi_semaphore_handle_t *semaphore)`

**Description:** Checks whether the semaphore is created and destroys the semaphore instance, if its created.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|

Check whether the semaphore is created and destroy, if created.

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Returns**

- 0 - Success <br />
- Negative Value - Failure <br />

###### rsi_semaphore_wait

`rsi_error_t rsi_semaphore_wait(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. If timeout_ms is 0 then wait till semaphore is acquired.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_semaphore_post

`rsi_error_t rsi_semaphore_post(rsi_semaphore_handle_t *semaphore)`

**Description:** Release semaphore, which is acquired.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_semaphore_post_from_isr

`rsi_error_t rsi_semaphore_post_from_isr(rsi_semaphore_handle_t *semaphore)`

**Description:** Release semaphore, which is acquired from ISR context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_semaphore_reset

`rsi_error_t rsi_semaphore_reset(rsi_semaphore_handle_t *semaphore)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|N/A|semaphore||

###### rsi_task_create

`rsi_error_t rsi_task_create(rsi_task_function_t task_function, uint8_t *task_name, uint32_t stack_size, void *parameters, uint32_t task_priority, rsi_task_handle_t *task_handle)`

**Description:** Create OS task/thread.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_function_t|[in]|task_function|- Pointer to function to be executed by created thread. <br />|
|uint8_t *|[in]|task_name|- Name of the created task <br />|
|uint32_t|[in]|stack_size|- Stack size given to the created task <br /><br />|
|void *|[in]|parameters|- Pointer to the parameters to be passed to task function <br />|
|uint32_t|[in]|task_priority|- Task priority <br />|
|rsi_task_handle_t *|[in]|task_handle|- Task handle/instance created <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

###### rsi_task_destroy

`void rsi_task_destroy(rsi_task_handle_t *task_handle)`

**Description:** Destroy the task created.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t *|[in]|task_handle|- Task handle/instance to be deleted|

**Returns**

- Void

**Referenced by:** [rsi_destroy_driver_task_and_driver_deinit](common#rsi-destroy-driver-task-and-driver-deinit) and [rsi_network_driver_task](network5#rsi-network-driver-task)

###### rsi_os_task_delay

`void rsi_os_task_delay(uint32_t timeout_ms)`

**Description:** Induce required delay in milli seconds.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|timeout_ms|- Expected delay in milli seconds|

**Returns**

- Void

###### rsi_start_os_scheduler

`void rsi_start_os_scheduler()`

**Description:** Schedule the tasks created.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void <br />

###### rsi_setup_timer_os_interrupt

`void rsi_setup_timer_os_interrupt()`

**Description:** Setup the systick timer to generate the tick interrupts at the required frequency.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|None||

**Returns**

- void

###### rsi_set_os_errno

`void rsi_set_os_errno(int32_t error)`

**Description:** Sets the OS error .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|error|- Error|

**Returns**

- Void

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_recvfrom](network5#rsi-recvfrom), [rsi_select](network5#rsi-select), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_create_async](network5#rsi-socket-create-async), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [rsi_tcp_window_update](network16#rsi-tcp-window-update) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_task_notify_wait

`rsi_base_type_t rsi_task_notify_wait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, uint32_t timeout)`

**Description:** Allow a task to wait with optional timeout.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|ulBitsToClearOnEntry|- Bits set here will be cleared in the task’s notification value on entry to the function.|
|uint32_t|[in]|ulBitsToClearOnExit|- Bits to clear on exit|
|uint32_t *|[in]|pulNotificationValue|- Used to pass out the task notification value. Optional parameter|
|uint32_t|[in]|timeout|- Maximum amount of time the calling task should remain in blocked state|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Referenced by:** [rsi_scheduler_non_rom](driver15#rsi-scheduler-non-rom)

###### rsi_task_notify

`rsi_base_type_t rsi_task_notify(rsi_task_handle_t xTaskToNotify, uint32_t ulValue)`

**Description:** Notify a task.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t|[in]|xTaskToNotify|- The handle of the task to which the notification is being sent|
|uint32_t|[in]|ulValue|- How ulValue is used is dependent on the eNotifyAction value|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Referenced by:** [rsi_set_event_non_rom](driver8#rsi-set-event-non-rom) and [rsi_unmask_event_non_rom](driver8#rsi-unmask-event-non-rom)

###### rsi_task_notify_from_isr

`rsi_base_type_t rsi_task_notify_from_isr(rsi_task_handle_t xTaskToNotify, uint32_t ulValue, rsi_base_type_t *pxHigherPriorityTaskWoken)`

**Description:** Notify a task from ISR context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t|[in]|xTaskToNotify|- The handle of the task to which the notification is being sent|
|uint32_t|[in]|ulValue|- How ulValue is used is dependent on the eNotifyAction value|
|rsi_base_type_t *|[in]|pxHigherPriorityTaskWoken|- Sets,if sending the notification caused a task to unblock, and the unblocked task has a priority higher than the currently running task.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Referenced by:** [rsi_set_event_from_isr_non_rom](driver8#rsi-set-event-from-isr-non-rom) and [rsi_unmask_event_from_isr_non_rom](driver8#rsi-unmask-event-from-isr-non-rom)

###### rsi_os_task_notify_take

`uint32_t rsi_os_task_notify_take(BaseType_t xClearCountOnExit, TickType_t xTicksToWait)`

**Description:** Allow a task in wait in blocked state for its notification value.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|BaseType_t|[in]|xClearCountOnExit|- Based on this value calling task notification value will be decremented/zero|
|TickType_t|[in]|xTicksToWait|- Maximum amount of time calling task should remain in blocked state|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

###### rsi_os_task_notify_give

`BaseType_t rsi_os_task_notify_give(rsi_task_handle_t xTaskToNotify)`

**Description:** Notify to a task.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t|[in]|xTaskToNotify|- Task handle to notify|

**Returns**

- Task notification value - Success<br />
- -1 - Failure

###### rsi_get_error

`int32_t rsi_get_error(int32_t sockID)`

**Description:** Get WLAN status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket ID|

**Returns**

- WLAN status

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_listen](network5#rsi-socket-listen) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_malloc

`void * rsi_malloc(uint32_t size)`

**Description:** Allocate memory from the buffer which is maintained by freeRTOS. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|size|- Required bytes in size|

**Returns**

- Void

###### rsi_free

`void rsi_free(void *ptr)`

**Description:** Free the memory pointed by 'ptr'.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ptr|- starting address of the memory to be freed|

**Returns**

- Void

###### rsi_vport_enter_critical

`void rsi_vport_enter_critical(void)`

**Description:** Enter into critical section.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void <br />

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit)

###### rsi_vport_exit_critical

`void rsi_vport_exit_critical(void)`

**Description:** Enter exit section.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit)

###### rsi_task_suspend

`void rsi_task_suspend(rsi_task_handle_t *task_handle)`

**Description:** Exit critical section.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_task_handle_t *|[in]|task_handle|- Task handle to be suspended|

**Returns**

- Void

#### Bluetooth APIs

This section describes the Bluetooth APIs 

##### Modules

[Common APIs](bt-ble)

[BT Classic APIs](bt-classic)

[BLE APIs](bt-low-energy)

##### Common APIs

###### Functions

###### rsi_bt_set_bd_addr (heading level 7)

`int32_t rsi_bt_set_bd_addr(uint8_t *dev_addr)`

**Description:** Set the device BD address. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- public address of the device to be set <br />|

- needs to be called immediately after [rsi_wireless_init()](common#rsi-wireless-init) OPERMODE command.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   -3 - Command is given in wrong state(i.e not immediate after opermode)

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_set_local_bd_addr_s::dev_addr](rsi-bt-set-local-bd-addr-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_ber_enable_or_disable (heading level 7)

`int32_t rsi_bt_ber_enable_or_disable(rsi_bt_ber_cmd_t *ber_cmd)`

**Description:** Enable and disable BER. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_ber_cmd_t](rsi-bt-ber-cmd-s) *|[in]|ber_cmd|- pointer address which contains the command structure. Please refer [rsi_bt_ber_cmd_s](rsi-bt-ber-cmd-s) structure for more info <br />|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_set_local_name (heading level 7)

`int32_t rsi_bt_set_local_name(uint8_t *local_name)`

**Description:** Set the given name to local device. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|local_name|- Name to be set to the local device.|

- [rsi_wireless_init()](common#rsi-wireless-init) API need to be called before this API.

**Note**

- For BLE alone Opermode : When the name of the local device is set to a value with length more than 16 bytes then error is returned with an error code 0x4E66.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_bt_req_set_local_name_s::name](rsi-bt-req-set-local-name-s#name), [rsi_bt_req_set_local_name_s::name_len](rsi-bt-req-set-local-name-s#name-len), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_cmd_update_gain_table_offset_or_max_pwr (heading level 7)

`int32_t rsi_bt_cmd_update_gain_table_offset_or_max_pwr(uint8_t node_id, uint8_t payload_len, uint8_t *payload, uint8_t req_type)`

**Description:** Update gain table offset/max power. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|node_id|- Node ID (0 - BLE, 1 - BT).|
|uint8_t|[in]|payload_len|- Length of the payload.|
|uint8_t *|[in]|payload|- Payload containing table data of gain table offset/max power|
|uint8_t|[in]|req_type|- update gain table request type (0 - max power update, 1 - offset update)|

- [rsi_wireless_init()](common#rsi-wireless-init) API need to be called before this API.

**Note**

- This API is applicable for High performance(HP) mode only.

**Returns**

- 0 - Success <br />  
   0x4F01 - Invalid gain table payload length <br />  
   0x4F02 - Invalid region. <br />  
   0x4F03 - Invalid gain table offset request type <br />  
   0x4F04 - Invalid node id. <br /><br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_bt_cmd_update_gain_table_offset_or_maxpower_s::node_id](rsi-bt-cmd-update-gain-table-offset-or-maxpower-s#node-id), [rsi_bt_cmd_update_gain_table_offset_or_maxpower_s::payload](rsi-bt-cmd-update-gain-table-offset-or-maxpower-s#payload), [rsi_bt_cmd_update_gain_table_offset_or_maxpower_s::payload_len](rsi-bt-cmd-update-gain-table-offset-or-maxpower-s#payload-len), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_cmd_update_gain_table_offset_or_maxpower_s::update_gain_table_type](rsi-bt-cmd-update-gain-table-offset-or-maxpower-s#update-gain-table-type)

###### rsi_bt_get_local_name (heading level 7)

`int32_t rsi_bt_get_local_name(rsi_bt_resp_get_local_name_t *bt_resp_get_local_name)`

**Description:** Get the local device name. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_resp_get_local_name_t](rsi-bt-resp-get-local-name-s) *|[out]|bt_resp_get_local_name|- This parameter is the response buffer to hold the response of this API. Please refer [rsi_bt_resp_get_local_name_s](rsi-bt-resp-get-local-name-s) structure for more info.|

- [rsi_wireless_init()](common#rsi-wireless-init) API need to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_get_rssi (heading level 7)

`int32_t rsi_bt_get_rssi(uint8_t *dev_addr, int8_t *resp)`

**Description:** Get the RSSI of the remote device. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- Remote device address.|
|int8_t *|[out]|resp|- Parameter to hold the response of this API, rssi is filled in this resp parameter.|

- [rsi_bt_connect()](bt-classic3#rsi-bt-connect) API need to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_get_rssi_s::dev_addr](rsi-bt-get-rssi-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_get_local_device_address (heading level 7)

`int32_t rsi_bt_get_local_device_address(uint8_t *resp)`

**Description:** Get the local device address. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- Parameter to hold the response of this API, local bd_addr is filled in this resp parameter.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_get_bt_stack_version (heading level 7)

`int32_t rsi_bt_get_bt_stack_version(rsi_bt_resp_get_bt_stack_version_t *bt_resp_get_bt_stack_version)`

**Description:** Get the BT stack version. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_resp_get_bt_stack_version_t](rsi-bt-resp-get-bt-stack-version-s) *|[out]|bt_resp_get_bt_stack_version|- Response buffer to hold the response of this API. Please refer [rsi_bt_resp_get_bt_stack_version_s](rsi-bt-resp-get-bt-stack-version-s) structure for more info|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_init (heading level 7)

`rsi_bt_init(void)`

**Description:** Initialize the BT device. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API. <br />  
   If the device is in powersave, get back the device to ACTIVE MODE by using [rsi_bt_power_save_profile()](bt-ble#rsi-bt-power-save-profile)

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_deinit (heading level 7)

`rsi_bt_deinit(void)`

**Description:** Deinitialize the BT device. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API. <br />  
   If the device is in powersave, get back the device to ACTIVE MODE by using [rsi_bt_power_save_profile()](bt-ble#rsi-bt-power-save-profile)

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_set_country_region (heading level 7)

`int32_t rsi_bt_set_country_region(uint8_t region, void *resp)`

**Description:** Set country region command for BT.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|region|- Parameter is used to set country region.|
|void *|[in]|resp|- Actual country region set by device.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_set_get_bt_country_region_s::country_region](rsi-bt-set-get-bt-country-region-s#country-region), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_get_country_region (heading level 7)

`int32_t rsi_bt_get_country_region(void *resp)`

**Description:** Set country region command for BT.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|resp|- Gets the current country region set.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_set_get_bt_country_region_s::country_region](rsi-bt-set-get-bt-country-region-s#country-region), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_set_antenna (heading level 7)

`int32_t rsi_bt_set_antenna(uint8_t antenna_value)`

**Description:** Select either internal / external antenna on the chip. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|antenna_value|- Parameter is used to select either internal or external antenna. Possible values: <br /><br/> 0x00 RSI_SEL_INTERNAL_ANTENNA <br /><br/> 0x01 RSI_SEL_EXTERNAL_ANTENNA|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_set_antenna_s::value](rsi-ble-set-antenna-s#value)

###### rsi_bt_set_antenna_tx_power_level (heading level 7)

`int32_t rsi_bt_set_antenna_tx_power_level(uint8_t protocol_mode, int8_t tx_power)`

**Description:** Enable/Disable the mentioned features. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|protocol_mode|- protocol mode <br /><br/> 1 - BT classic <br /><br/> 2 - BT Low Energy|
|int8_t|[in]|tx_power|- power value <br /><br/> Antenna transmit power level <br /><br/> Default Value for BLE Tx Power Index is 31, The range for the BLE Tx Power Index is 1 to 75 (0, 32 indexes are invalid) <br /><br/> Default tx power index for BT classic is 14 <br /><br/> 1 - 31 0DBM Mode. <br /><br/> 33 - 63 10DBM Mode. <br /><br/> 64 - 79 HP Mode. <br />|

- [rsi_wireless_init()](common#rsi-wireless-init) API need to be called before this API

**Note**

- The default value will vary based on country region and board <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_set_antenna_tx_power_level_s::protocol_mode](rsi-bt-set-antenna-tx-power-level-s#protocol-mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_set_antenna_tx_power_level_s::tx_power](rsi-bt-set-antenna-tx-power-level-s#tx-power)

###### rsi_bt_power_save_profile (heading level 7)

`int32_t rsi_bt_power_save_profile(uint8_t psp_mode, uint8_t psp_type)`

**Description:** Select the power save profile mode for BT / BLE. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|psp_mode|Following psp_mode is defined. <br /><br/> 0 - RSI_ACTIVE. In this mode module is active and power save is disabled. <br /><br/> 1 - RSI_SLEEP_MODE_1. On mode. In this sleep mode, SoC will never turn off, therefore no <br /><br/> handshake is required before sending data to the module. BT/BLE does not support this mode. <br /><br/> 2 - RSI_SLEEP_MODE_2. Connected sleep mode. In this sleep mode, SoC will go to sleep based <br /><br/> on GPIO or Message, therefore handshake is required before sending data to the module. <br /><br/> 8 - RSI_SLEEP_MODE_8 :Deep sleep mode with RAM RETENTION. <br /><br/> 10- RSI_SLEEP_MODE_10 : Deep sleep mode without RAM RETENTION. <br /><br/> In this sleep mode, module will turn off the <br /><br/> SoC. Since SoC is turn off, therefore handshake is required before sending data to the module. <br />|
|uint8_t|[in]|psp_type|Following psp_type is defined. <br /><br/> 0 - RSI_MAX_PSP. This psp_type will be used for max power saving <br /><br/> 1 - Fast PSP <br /><br/> 2 - UAPSD <br />|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- If the user wants to enable power save in CoEx mode (WLAN + BT LE) mode - It is mandatory to enable WLAN power save along with BT LE power save. <br />
- The device will enter into power save if and only if both protocol (WLAN, BLE) power save modes are enabled. <br />
- Refer Error Codes section for above error codes [Error Codes](error-codes) .
- psp_type is only valid in psp_mode 2. <br />  
   BT/BLE doesnot support in RSI_SLEEP_MODE_1. <br />  
   BT/BLE supports only RSI_MAX_PSP mode. Remaining modes are not supported.

**References:** [rsi_power_save_s::bt_psp_mode](rsi-power-save-s#bt-psp-mode), [rsi_power_save_s::bt_psp_type](rsi-power-save-s#bt-psp-type), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_sleep_mode_decision](driver5#rsi-sleep-mode-decision), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

##### BT Classic APIs

###### Modules

[A2DP](bt-classic1)

[AVRCP](bt-classic2)

[GAP](bt-classic3)

[SPP](bt-classic4)

[Test Mode](bt-classic5)

[Register callbacks](bt-classic6)

[Callback Declarations](bt-classic7)

###### A2DP

###### Variables (heading level 7)

###### pcm_mp3_data (heading level 8)

```
int32_t uint8_t* pcm_mp3_data
```

###### pcm_mp3_data_len (heading level 8)

```
bt_req_a2dp_pcm_mp3_pkt_part2 pcm_mp3_data_len
```

**Referenced by:** [rsi_bt_prepare_classic_pkt](driver14#rsi-bt-prepare-classic-pkt)

###### audio_type (heading level 8)

```
bt_req_a2dp_pcm_mp3_pkt_part2 audio_type
```

**Referenced by:** [rsi_bt_a2dp_send_sbc_aac_data](bt-classic1#rsi-bt-a2dp-send-sbc-aac-data)

###### bt_req_a2dp_pcm_mp3_pkt_part1 (heading level 8)

```
rsi_bt_req_a2dp_pcm_mp3_data_t bt_req_a2dp_pcm_mp3_pkt_part1
```

###### bt_req_a2dp_pcm_mp3_pkt_part2 (heading level 8)

```
rsi_bt_req_a2dp_pcm_mp3_data_t bt_req_a2dp_pcm_mp3_pkt_part2
```

###### RSI_SUCCESS (heading level 8)

```
return RSI_SUCCESS
```

**Referenced by:** [asciihex_2_num](driver12#asciihex-2-num), [ROM_WL_rsi_pkt_free](driver5#rom-wl-rsi-pkt-free), [ROM_WL_rsi_pkt_free_non_blocking](driver5#rom-wl-rsi-pkt-free-non-blocking), [rsi_aes](crypto#rsi-aes), [rsi_aes_pen](crypto#rsi-aes-pen), [rsi_ascii_hex2num](driver12#rsi-ascii-hex2num), [rsi_assert](common#rsi-assert), [rsi_bl_module_power_cycle](driver6#rsi-bl-module-power-cycle), [rsi_bl_waitfor_boardready](driver6#rsi-bl-waitfor-boardready), [rsi_ble_adv_ext_events_register_callbacks](bt-low-energy7#rsi-ble-adv-ext-events-register-callbacks), [rsi_ble_enhanced_gap_extended_register_callbacks](bt-low-energy7#rsi-ble-enhanced-gap-extended-register-callbacks), [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd), [rsi_bt_power_save_profile](bt-ble#rsi-bt-power-save-profile), [rsi_bt_smp_register_callbacks](bt-classic6#rsi-bt-smp-register-callbacks), [rsi_calib_read](wlan#rsi-calib-read), [rsi_calib_write](wlan#rsi-calib-write), [rsi_calibrate_dpd](wlan#rsi-calibrate-dpd), [rsi_ccm](crypto#rsi-ccm), [rsi_ccm_pen](crypto#rsi-ccm-pen), [rsi_chachapoly](crypto#rsi-chachapoly), [rsi_chachapoly_pen](crypto#rsi-chachapoly-pen), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_check_waiting_cmds](driver5#rsi-check-waiting-cmds), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_clear_interrupt](driver2#rsi-clear-interrupt), [rsi_cmd_m4_ta_secure_handshake](common#rsi-cmd-m4-ta-secure-handshake), [rsi_cmd_to_wr_comm_flash](common#rsi-cmd-to-wr-comm-flash), [rsi_cmd_uart_flow_ctrl](common#rsi-cmd-uart-flow-ctrl), [rsi_common_cb_init](driver5#rsi-common-cb-init), [rsi_common_debug_log](common#rsi-common-debug-log), [rsi_common_packet_transfer_done](driver5#rsi-common-packet-transfer-done), [rsi_config_ipaddress](wlan#rsi-config-ipaddress), [rsi_config_timeout](wlan#rsi-config-timeout), [rsi_destroy_driver_task_and_driver_deinit](common#rsi-destroy-driver-task-and-driver-deinit), [rsi_device_deinit](common#rsi-device-deinit), [rsi_device_init](common#rsi-device-init), [rsi_device_interrupt_status](driver4#rsi-device-interrupt-status), [rsi_dhcp_user_class](network1#rsi-dhcp-user-class), [rsi_dns_req](network6#rsi-dns-req), [rsi_dns_req_async](network6#rsi-dns-req-async), [rsi_dns_update](network6#rsi-dns-update), [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd), [rsi_driver_deinit](common#rsi-driver-deinit), [rsi_driver_init](common#rsi-driver-init), [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp), [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler), [rsi_driver_process_common_recv_cmd](driver5#rsi-driver-process-common-recv-cmd), [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_driver_send_data_non_rom](driver9#rsi-driver-send-data-non-rom), [rsi_driver_version](common#rsi-driver-version), [rsi_ecdh_point_addition](crypto#rsi-ecdh-point-addition), [rsi_ecdh_point_affine](crypto#rsi-ecdh-point-affine), [rsi_ecdh_point_double](crypto#rsi-ecdh-point-double), [rsi_ecdh_point_multiplication](crypto#rsi-ecdh-point-multiplication), [rsi_ecdh_point_subtraction](crypto#rsi-ecdh-point-subtraction), [rsi_ecdsa_256_verify_hash](common#rsi-ecdsa-256-verify-hash), [rsi_emb_mqtt_client_init](network2#rsi-emb-mqtt-client-init), [rsi_emb_mqtt_connect](network2#rsi-emb-mqtt-connect), [rsi_emb_mqtt_destroy](network2#rsi-emb-mqtt-destroy), [rsi_emb_mqtt_disconnect](network2#rsi-emb-mqtt-disconnect), [rsi_emb_mqtt_publish](network2#rsi-emb-mqtt-publish), [rsi_emb_mqtt_register_call_back](network2#rsi-emb-mqtt-register-call-back), [rsi_emb_mqtt_subscribe](network2#rsi-emb-mqtt-subscribe), [rsi_emb_mqtt_unsubscribe](network2#rsi-emb-mqtt-unsubscribe), [rsi_evm_write](wlan#rsi-evm-write), [rsi_exponentiation](crypto#rsi-exponentiation), [rsi_frame_read](driver1#rsi-frame-read), [rsi_frame_write](driver1#rsi-frame-write), [rsi_ftp_connect](network8#rsi-ftp-connect), [rsi_ftp_directory_create](network8#rsi-ftp-directory-create), [rsi_ftp_directory_delete](network8#rsi-ftp-directory-delete), [rsi_ftp_directory_list_async](network8#rsi-ftp-directory-list-async), [rsi_ftp_directory_set](network8#rsi-ftp-directory-set), [rsi_ftp_disconnect](network8#rsi-ftp-disconnect), [rsi_ftp_file_delete](network8#rsi-ftp-file-delete), [rsi_ftp_file_read_aysnc](network8#rsi-ftp-file-read-aysnc), [rsi_ftp_file_rename](network8#rsi-ftp-file-rename), [rsi_ftp_file_size_set](network8#rsi-ftp-file-size-set), [rsi_ftp_file_write](network8#rsi-ftp-file-write), [rsi_ftp_file_write_content](network8#rsi-ftp-file-write-content), [rsi_ftp_mode_set](network8#rsi-ftp-mode-set), [rsi_fwup_load](firmware#rsi-fwup-load), [rsi_fwup_start](firmware#rsi-fwup-start), [rsi_gcm](crypto#rsi-gcm), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_get_ram_log](common#rsi-get-ram-log), [rsi_get_random_bytes](wlan#rsi-get-random-bytes), [rsi_get_rtc_timer](common#rsi-get-rtc-timer), [rsi_gpio_pininit](common#rsi-gpio-pininit), [rsi_gpio_readpin](common#rsi-gpio-readpin), [rsi_gpio_writepin](common#rsi-gpio-writepin), [rsi_hmac_sha](crypto#rsi-hmac-sha), [rsi_hmac_sha_pen](crypto#rsi-hmac-sha-pen), [rsi_http_client_abort](network9#rsi-http-client-abort), [rsi_http_client_async](network9#rsi-http-client-async), [rsi_http_client_post_data](network9#rsi-http-client-post-data), [rsi_http_client_put_create](network9#rsi-http-client-put-create), [rsi_http_client_put_delete](network9#rsi-http-client-put-delete), [rsi_http_client_put_pkt](network9#rsi-http-client-put-pkt), [rsi_http_client_put_start](network9#rsi-http-client-put-start), [rsi_http_credentials](network9#rsi-http-credentials), [rsi_http_otaf_async](network9#rsi-http-otaf-async), [rsi_json_object_create](network14#rsi-json-object-create), [rsi_json_object_delete](network14#rsi-json-object-delete), [rsi_mdnsd_deinit](network15#rsi-mdnsd-deinit), [rsi_mdnsd_init](network15#rsi-mdnsd-init), [rsi_mdnsd_register_service](network15#rsi-mdnsd-register-service), [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr), [rsi_mqtt_connect](network13#rsi-mqtt-connect), [rsi_multicast_join](network3#rsi-multicast-join), [rsi_multicast_leave](network3#rsi-multicast-leave), [rsi_nwk_register_callbacks](wlan#rsi-nwk-register-callbacks), [rsi_ota_firmware_upgradation](network20#rsi-ota-firmware-upgradation), [rsi_pkt_rd](driver2#rsi-pkt-rd), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore), [rsi_pre_dsc_rd](driver2#rsi-pre-dsc-rd), [rsi_reg_rd](driver2#rsi-reg-rd), [rsi_reg_wr](driver2#rsi-reg-wr), [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore), [rsi_req_wakeup](driver5#rsi-req-wakeup), [rsi_req_wireless_fwup](firmware#rsi-req-wireless-fwup), [rsi_robust_drv_start_handshake](common#rsi-robust-drv-start-handshake), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_sdio_iface_init](driver1#rsi-sdio-iface-init), [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4), [rsi_send_evm_offset](wlan#rsi-send-evm-offset), [rsi_send_feature_frame](common#rsi-send-feature-frame), [rsi_send_feature_frame_dyn](common#rsi-send-feature-frame-dyn), [rsi_send_freq_offset](wlan#rsi-send-freq-offset), [rsi_send_ps_mode_to_module](driver5#rsi-send-ps-mode-to-module), [rsi_send_raw_data](network3#rsi-send-raw-data), [rsi_set_config](common#rsi-set-config), [rsi_set_intr_mask](driver2#rsi-set-intr-mask), [rsi_set_intr_type](driver2#rsi-set-intr-type), [rsi_set_region](common#rsi-set-region), [rsi_set_rtc_timer](common#rsi-set-rtc-timer), [rsi_sha](crypto#rsi-sha), [rsi_sha3](crypto#rsi-sha3), [rsi_sha3_shake_pen](crypto#rsi-sha3-shake-pen), [rsi_sha_pen](crypto#rsi-sha-pen), [rsi_shake](crypto#rsi-shake), [rsi_sleep_mode_decision](driver5#rsi-sleep-mode-decision), [rsi_sntp_client_create_async](network12#rsi-sntp-client-create-async), [rsi_sntp_client_delete_async](network12#rsi-sntp-client-delete-async), [rsi_sntp_client_gettime](network12#rsi-sntp-client-gettime), [rsi_sntp_client_gettime_date](network12#rsi-sntp-client-gettime-date), [rsi_sntp_client_server_info](network12#rsi-sntp-client-server-info), [rsi_socket_config](network5#rsi-socket-config), [rsi_spi_frame_data_wr](driver2#rsi-spi-frame-data-wr), [rsi_spi_frame_dsc_wr](driver2#rsi-spi-frame-dsc-wr), [rsi_spi_iface_init](driver2#rsi-spi-iface-init), [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token), [rsi_switch_proto](common#rsi-switch-proto), [rsi_transmit_test_start](wlan#rsi-transmit-test-start), [rsi_transmit_test_start_with_number_pkts](wlan#rsi-transmit-test-start-with-number-pkts), [rsi_transmit_test_stop](wlan#rsi-transmit-test-stop), [rsi_tx_event_handler](driver8#rsi-tx-event-handler), [rsi_uart_iface_int](driver3#rsi-uart-iface-int), [rsi_ulp_wakeup_init](driver2#rsi-ulp-wakeup-init), [rsi_wait4wakeup](driver5#rsi-wait4wakeup), [rsi_web_socket_close](network5#rsi-web-socket-close), [rsi_web_socket_create](network5#rsi-web-socket-create), [rsi_web_socket_send_async](network5#rsi-web-socket-send-async), [rsi_webpage_erase](network14#rsi-webpage-erase), [rsi_webpage_load](network14#rsi-webpage-load), [rsi_webpage_send](network14#rsi-webpage-send), [rsi_wireless_antenna](common#rsi-wireless-antenna), [rsi_wireless_deinit](common#rsi-wireless-deinit), [rsi_wireless_init](common#rsi-wireless-init), [rsi_wlan_add_profile](wlan#rsi-wlan-add-profile), [rsi_wlan_ap_start](wlan#rsi-wlan-ap-start), [rsi_wlan_ap_stop](wlan#rsi-wlan-ap-stop), [rsi_wlan_beacon_stop](wlan#rsi-wlan-beacon-stop), [rsi_wlan_bgscan_profile](wlan#rsi-wlan-bgscan-profile), [rsi_wlan_buffer_config](wlan#rsi-wlan-buffer-config), [rsi_wlan_check_waiting_wlan_cmd](driver13#rsi-wlan-check-waiting-wlan-cmd), [rsi_wlan_connect](wlan#rsi-wlan-connect), [rsi_wlan_connect_async](wlan#rsi-wlan-connect-async), [rsi_wlan_csi_config_async](wlan#rsi-wlan-csi-config-async), [rsi_wlan_delete_profile](wlan#rsi-wlan-delete-profile), [rsi_wlan_disconnect](wlan#rsi-wlan-disconnect), [rsi_wlan_disconnect_stations](wlan#rsi-wlan-disconnect-stations), [rsi_wlan_enable_auto_config](wlan#rsi-wlan-enable-auto-config), [rsi_wlan_execute_post_connect_cmds](wlan#rsi-wlan-execute-post-connect-cmds), [rsi_wlan_filter_broadcast](wlan#rsi-wlan-filter-broadcast), [rsi_wlan_get](wlan#rsi-wlan-get), [rsi_wlan_get_profile](wlan#rsi-wlan-get-profile), [rsi_wlan_nwk_register_json_event_cb](network14#rsi-wlan-nwk-register-json-event-cb), [rsi_wlan_nwk_register_json_update_cb](network14#rsi-wlan-nwk-register-json-update-cb), [rsi_wlan_nwk_register_send_large_data_event_cb](network14#rsi-wlan-nwk-register-send-large-data-event-cb), [rsi_wlan_nwk_register_webpage_req_cb](network14#rsi-wlan-nwk-register-webpage-req-cb), [rsi_wlan_nwk_register_wireless_fw_upgrade_cb](network14#rsi-wlan-nwk-register-wireless-fw-upgrade-cb), [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done), [rsi_wlan_ping_async](wlan#rsi-wlan-ping-async), [rsi_wlan_pmk_generate](wlan#rsi-wlan-pmk-generate), [rsi_wlan_power_save_disable_and_enable](wlan#rsi-wlan-power-save-disable-and-enable), [rsi_wlan_power_save_profile](wlan#rsi-wlan-power-save-profile), [rsi_wlan_power_save_with_listen_interval](wlan#rsi-wlan-power-save-with-listen-interval), [rsi_wlan_radio_deinit](network17#rsi-wlan-radio-deinit), [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init), [rsi_wlan_receive_stats_start](wlan#rsi-wlan-receive-stats-start), [rsi_wlan_receive_stats_stop](wlan#rsi-wlan-receive-stats-stop), [rsi_wlan_req_radio](network17#rsi-wlan-req-radio), [rsi_wlan_scan](wlan#rsi-wlan-scan), [rsi_wlan_scan_async](wlan#rsi-wlan-scan-async), [rsi_wlan_scan_async_with_bitmap_options](wlan#rsi-wlan-scan-async-with-bitmap-options), [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options), [rsi_wlan_send_data](wlan#rsi-wlan-send-data), [rsi_wlan_set](wlan#rsi-wlan-set), [rsi_wlan_set_certificate_index](wlan#rsi-wlan-set-certificate-index), [rsi_wlan_set_non_pref_chan](wlan#rsi-wlan-set-non-pref-chan), [rsi_wlan_set_sleep_timer](wlan#rsi-wlan-set-sleep-timer), [rsi_wlan_twt_auto_selection](wlan#rsi-wlan-twt-auto-selection), [rsi_wlan_twt_config](wlan#rsi-wlan-twt-config), [rsi_wlan_update_gain_table](wlan#rsi-wlan-update-gain-table), [rsi_wlan_wps_enter_pin](wlan#rsi-wlan-wps-enter-pin), [rsi_wlan_wps_generate_pin](wlan#rsi-wlan-wps-generate-pin), [rsi_wlan_wps_push_button_event](wlan#rsi-wlan-wps-push-button-event), [send_timeout](wlan#send-timeout), [sl_attestation_get_token](crypto#sl-attestation-get-token), [trng_entropy](crypto#trng-entropy), [trng_get_random_num](crypto#trng-get-random-num), [trng_init](crypto#trng-init) and [trng_program_key](crypto#trng-program-key)

###### Functions (heading level 7)

###### rsi_bt_a2dp_init (heading level 8)

`int32_t rsi_bt_a2dp_init(rsi_bt_a2dp_sbc_codec_cap_t *sbc_cap)`

**Description:** Initialize A2DP Profile with either user-defined audio codec params or default stack audio codec params. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_a2dp_sbc_codec_cap_t](rsi-bt-a2dp-sbc-codec-cap-s) *|[in]|sbc_cap|- audio codec params structure, please refer [rsi_bt_a2dp_sbc_codec_cap_s](rsi-bt-a2dp-sbc-codec-cap-s) structure for more info.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- if NULL is passed, A2DP profile initialize with default audio codec params. <br />

**References:** [rsi_bt_req_profile_mode_s::data](rsi-bt-req-profile-mode-s#data), [rsi_bt_req_profile_mode_s::data_len](rsi-bt-req-profile-mode-s#data-len), [memcpy](bt-classic1#memcpy), [rsi_bt_req_profile_mode_s::profile_mode](rsi-bt-req-profile-mode-s#profile-mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_connect (heading level 8)

`int32_t rsi_bt_a2dp_connect(uint8_t *remote_dev_addr)`

**Description:** Initiate the A2DP connection. This is a blocking API. A received event [rsi_bt_on_a2dp_connect_t](bt-classic7#rsi-bt-on-a2dp-connect-t) indicates that the a2dp connection response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4511 RSI_APP_ERR_A2DP_CONN_ALRDY_EXISTS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_connect_s::dev_addr](rsi-bt-req-a2dp-connect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_disconnect (heading level 8)

`int32_t rsi_bt_a2dp_disconnect(uint8_t *remote_dev_addr)`

**Description:** Use to disconnect A2DP. This is a blocking API. A received event [rsi_bt_on_a2dp_disconnect_t](bt-classic7#rsi-bt-on-a2dp-disconnect-t) indicates that the a2dp disconnection response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_disconnect_s::dev_addr](rsi-bt-req-a2dp-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_send_pcm_mp3_data (heading level 8)

`int32_t rsi_bt_a2dp_send_pcm_mp3_data(uint8_t *remote_dev_addr, uint8_t *pcm_mp3_data, uint16_t pcm_mp3_data_len, uint8_t audio_type, uint16_t *bytes_consumed) int32_t rsi_bt_a2dp_send_pcm_mp3_data(uint8_t *remote_dev_addr`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|N/A|remote_dev_addr||
|uint8_t *|N/A|pcm_mp3_data||
|uint16_t|N/A|pcm_mp3_data_len||
|uint8_t|N/A|audio_type||
|uint16_t *|N/A|bytes_consumed||

###### UNUSED_PARAMETER (heading level 8)

`UNUSED_PARAMETER(audio_type)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[audio_type](bt-classic1#audio-type)|N/A|undefined||

**Referenced by:** [intialize_bt_stack](driver14#intialize-bt-stack), [ROM_WL_calculate_buffers_required](network5#rom-wl-calculate-buffers-required), [ROM_WL_calculate_length_to_send](network5#rom-wl-calculate-length-to-send), [ROM_WL_rsi_block_queue](driver16#rom-wl-rsi-block-queue), [ROM_WL_rsi_check_queue_status](driver16#rom-wl-rsi-check-queue-status), [ROM_WL_rsi_dequeue_pkt](driver16#rom-wl-rsi-dequeue-pkt), [ROM_WL_rsi_enqueue_pkt](driver16#rom-wl-rsi-enqueue-pkt), [ROM_WL_rsi_enqueue_pkt_from_isr](driver16#rom-wl-rsi-enqueue-pkt-from-isr), [ROM_WL_rsi_get_event](driver15#rom-wl-rsi-get-event), [ROM_WL_rsi_is_pkt_available](driver5#rom-wl-rsi-is-pkt-available), [ROM_WL_rsi_pkt_alloc](driver5#rom-wl-rsi-pkt-alloc), [ROM_WL_rsi_pkt_alloc_non_blocking](driver5#rom-wl-rsi-pkt-alloc-non-blocking), [ROM_WL_rsi_pkt_free](driver5#rom-wl-rsi-pkt-free), [ROM_WL_rsi_pkt_free_non_blocking](driver5#rom-wl-rsi-pkt-free-non-blocking), [ROM_WL_rsi_pkt_pool_init](driver5#rom-wl-rsi-pkt-pool-init), [ROM_WL_rsi_queues_init](driver16#rom-wl-rsi-queues-init), [ROM_WL_rsi_unblock_queue](driver16#rom-wl-rsi-unblock-queue), [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler), [rsi_ble_connect_with_params](bt-low-energy1#rsi-ble-connect-with-params), [rsi_ble_gatt_read_response](bt-low-energy5#rsi-ble-gatt-read-response), [rsi_bt_avrcp_reg_notification](bt-classic2#rsi-bt-avrcp-reg-notification), [rsi_bt_callbacks_handler](driver14#rsi-bt-callbacks-handler), [rsi_bt_spp_transfer](bt-classic4#rsi-bt-spp-transfer), [rsi_check_common_buffer_full](driver13#rsi-check-common-buffer-full), [rsi_common_packet_transfer_done](driver5#rsi-common-packet-transfer-done), [rsi_critical_section_exit](rtos#rsi-critical-section-exit), [rsi_destroy_driver_task_and_driver_deinit](common#rsi-destroy-driver-task-and-driver-deinit), [rsi_emb_mqtt_connect](network2#rsi-emb-mqtt-connect), [rsi_frame_write](driver1#rsi-frame-write), [rsi_get_socket_id](network5#rsi-get-socket-id), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_json_object_create](network14#rsi-json-object-create), [rsi_mutex_destroy](rsi-os-h#rsi-mutex-destroy), [rsi_secure_ping_pong_wr](driver5#rsi-secure-ping-pong-wr), [rsi_semaphore_create](rtos#rsi-semaphore-create), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_webpage_send](network14#rsi-webpage-send) and [rsi_wlan_set](wlan#rsi-wlan-set)

###### USED_PARAMETER (heading level 8)

`USED_PARAMETER(remote_dev_addr)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|remote_dev_addr|N/A|undefined||

**Referenced by:** [rsi_bt_spp_disconnect](bt-classic4#rsi-bt-spp-disconnect) and [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### USED_PARAMETER (heading level 8)

`USED_PARAMETER(pcm_mp3_data)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[pcm_mp3_data](bt-classic1#pcm-mp3-data)|N/A|undefined||

###### USED_PARAMETER (heading level 8)

`USED_PARAMETER(pcm_mp3_data_len)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[pcm_mp3_data_len](bt-classic1#pcm-mp3-data-len)|N/A|undefined||

###### rsi_ascii_dev_address_to_6bytes_rev (heading level 8)

`rsi_ascii_dev_address_to_6bytes_rev(bt_req_a2dp_pcm_mp3_pkt_part1.dev_addr, remote_dev_addr)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part1.|N/A|dev_addr||
|remote_dev_addr|N/A|undefined||

**Referenced by:** [rsi_ble_addto_acceptlist](bt-low-energy1#rsi-ble-addto-acceptlist), [rsi_ble_att_error_response](bt-low-energy5#rsi-ble-att-error-response), [rsi_ble_conn_param_resp](bt-low-energy1#rsi-ble-conn-param-resp), [rsi_ble_conn_params_update](bt-low-energy1#rsi-ble-conn-params-update), [rsi_ble_connect](bt-low-energy1#rsi-ble-connect), [rsi_ble_connect_cancel](bt-low-energy1#rsi-ble-connect-cancel), [rsi_ble_connect_with_params](bt-low-energy1#rsi-ble-connect-with-params), [rsi_ble_deletefrom_acceptlist](bt-low-energy1#rsi-ble-deletefrom-acceptlist), [rsi_ble_disconnect](bt-low-energy1#rsi-ble-disconnect), [rsi_ble_execute_write](bt-low-energy3#rsi-ble-execute-write), [rsi_ble_execute_write_async](bt-low-energy4#rsi-ble-execute-write-async), [rsi_ble_gatt_prepare_write_response](bt-low-energy5#rsi-ble-gatt-prepare-write-response), [rsi_ble_gatt_read_response](bt-low-energy5#rsi-ble-gatt-read-response), [rsi_ble_gatt_write_response](bt-low-energy5#rsi-ble-gatt-write-response), [rsi_ble_get_att_descriptors](bt-low-energy3#rsi-ble-get-att-descriptors), [rsi_ble_get_att_descriptors_async](bt-low-energy4#rsi-ble-get-att-descriptors-async), [rsi_ble_get_att_value](bt-low-energy3#rsi-ble-get-att-value), [rsi_ble_get_att_value_async](bt-low-energy4#rsi-ble-get-att-value-async), [rsi_ble_get_char_services](bt-low-energy3#rsi-ble-get-char-services), [rsi_ble_get_char_services_async](bt-low-energy4#rsi-ble-get-char-services-async), [rsi_ble_get_char_value_by_uuid](bt-low-energy3#rsi-ble-get-char-value-by-uuid), [rsi_ble_get_char_value_by_uuid_async](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async), [rsi_ble_get_inc_services](bt-low-energy3#rsi-ble-get-inc-services), [rsi_ble_get_inc_services_async](bt-low-energy4#rsi-ble-get-inc-services-async), [rsi_ble_get_le_ping_timeout](bt-low-energy1#rsi-ble-get-le-ping-timeout), [rsi_ble_get_long_att_value](bt-low-energy3#rsi-ble-get-long-att-value), [rsi_ble_get_long_att_value_async](bt-low-energy4#rsi-ble-get-long-att-value-async), [rsi_ble_get_multiple_att_values](bt-low-energy3#rsi-ble-get-multiple-att-values), [rsi_ble_get_multiple_att_values_async](bt-low-energy4#rsi-ble-get-multiple-att-values-async), [rsi_ble_get_profile](bt-low-energy3#rsi-ble-get-profile), [rsi_ble_get_profile_async](bt-low-energy4#rsi-ble-get-profile-async), [rsi_ble_get_profiles](bt-low-energy3#rsi-ble-get-profiles), [rsi_ble_get_profiles_async](bt-low-energy4#rsi-ble-get-profiles-async), [rsi_ble_indicate_confirm](bt-low-energy4#rsi-ble-indicate-confirm), [rsi_ble_indicate_value](bt-low-energy5#rsi-ble-indicate-value), [rsi_ble_indicate_value_sync](bt-low-energy4#rsi-ble-indicate-value-sync), [rsi_ble_ltk_req_reply](bt-low-energy1#rsi-ble-ltk-req-reply), [rsi_ble_mtu_exchange_event](bt-low-energy3#rsi-ble-mtu-exchange-event), [rsi_ble_mtu_exchange_resp](bt-low-energy3#rsi-ble-mtu-exchange-resp), [rsi_ble_notify_value](bt-low-energy5#rsi-ble-notify-value), [rsi_ble_prepare_write](bt-low-energy3#rsi-ble-prepare-write), [rsi_ble_prepare_write_async](bt-low-energy4#rsi-ble-prepare-write-async), [rsi_ble_readphy](bt-low-energy1#rsi-ble-readphy), [rsi_ble_resolvlist](bt-low-energy1#rsi-ble-resolvlist), [rsi_ble_set_att_cmd](bt-low-energy3#rsi-ble-set-att-cmd), [rsi_ble_set_att_value](bt-low-energy3#rsi-ble-set-att-value), [rsi_ble_set_att_value_async](bt-low-energy4#rsi-ble-set-att-value-async), [rsi_ble_set_data_len](bt-low-energy1#rsi-ble-set-data-len), [rsi_ble_set_le_ping_timeout](bt-low-energy1#rsi-ble-set-le-ping-timeout), [rsi_ble_set_long_att_value](bt-low-energy3#rsi-ble-set-long-att-value), [rsi_ble_set_privacy_mode](bt-low-energy1#rsi-ble-set-privacy-mode), [rsi_ble_set_random_address_with_value](bt-low-energy1#rsi-ble-set-random-address-with-value), [rsi_ble_set_wo_resp_notify_buf_info](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info), [rsi_ble_setphy](bt-low-energy1#rsi-ble-setphy), [rsi_ble_smp_pair_failed](bt-low-energy1#rsi-ble-smp-pair-failed), [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request), [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response), [rsi_ble_smp_passkey](bt-low-energy1#rsi-ble-smp-passkey), [rsi_ble_start_advertising](bt-low-energy1#rsi-ble-start-advertising), [rsi_ble_start_encryption](bt-low-energy1#rsi-ble-start-encryption), [rsi_ble_update_directed_address](bt-low-energy1#rsi-ble-update-directed-address), [rsi_bt_a2dp_abort](bt-classic1#rsi-bt-a2dp-abort), [rsi_bt_a2dp_close](bt-classic1#rsi-bt-a2dp-close), [rsi_bt_a2dp_connect](bt-classic1#rsi-bt-a2dp-connect), [rsi_bt_a2dp_disconnect](bt-classic1#rsi-bt-a2dp-disconnect), [rsi_bt_a2dp_get_config](bt-classic1#rsi-bt-a2dp-get-config), [rsi_bt_a2dp_send_sbc_aac_data](bt-classic1#rsi-bt-a2dp-send-sbc-aac-data), [rsi_bt_a2dp_set_config](bt-classic1#rsi-bt-a2dp-set-config), [rsi_bt_a2dp_start](bt-classic1#rsi-bt-a2dp-start), [rsi_bt_a2dp_suspend](bt-classic1#rsi-bt-a2dp-suspend), [rsi_bt_accept_ssp_confirm](bt-classic3#rsi-bt-accept-ssp-confirm), [rsi_bt_avrcp_att_list_resp](bt-classic2#rsi-bt-avrcp-att-list-resp), [rsi_bt_avrcp_att_text_resp](bt-classic2#rsi-bt-avrcp-att-text-resp), [rsi_bt_avrcp_att_val_list_resp](bt-classic2#rsi-bt-avrcp-att-val-list-resp), [rsi_bt_avrcp_att_vals_text_resp](bt-classic2#rsi-bt-avrcp-att-vals-text-resp), [rsi_bt_avrcp_batt_status](bt-classic2#rsi-bt-avrcp-batt-status), [rsi_bt_avrcp_batt_status_resp](bt-classic2#rsi-bt-avrcp-batt-status-resp), [rsi_bt_avrcp_cap_resp](bt-classic2#rsi-bt-avrcp-cap-resp), [rsi_bt_avrcp_char_set_status_resp](bt-classic2#rsi-bt-avrcp-char-set-status-resp), [rsi_bt_avrcp_cmd_reject](bt-classic2#rsi-bt-avrcp-cmd-reject), [rsi_bt_avrcp_conn](bt-classic2#rsi-bt-avrcp-conn), [rsi_bt_avrcp_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-cur-att-val-resp), [rsi_bt_avrcp_disconn](bt-classic2#rsi-bt-avrcp-disconn), [rsi_bt_avrcp_ele_att_resp](bt-classic2#rsi-bt-avrcp-ele-att-resp), [rsi_bt_avrcp_get_att_list](bt-classic2#rsi-bt-avrcp-get-att-list), [rsi_bt_avrcp_get_att_text](bt-classic2#rsi-bt-avrcp-get-att-text), [rsi_bt_avrcp_get_att_val_text](bt-classic2#rsi-bt-avrcp-get-att-val-text), [rsi_bt_avrcp_get_att_vals_list](bt-classic2#rsi-bt-avrcp-get-att-vals-list), [rsi_bt_avrcp_get_capabilities](bt-classic2#rsi-bt-avrcp-get-capabilities), [rsi_bt_avrcp_get_cur_att_val](bt-classic2#rsi-bt-avrcp-get-cur-att-val), [rsi_bt_avrcp_get_element_att](bt-classic2#rsi-bt-avrcp-get-element-att), [rsi_bt_avrcp_get_folder_items_resp](bt-classic2#rsi-bt-avrcp-get-folder-items-resp), [rsi_bt_avrcp_get_play_status](bt-classic2#rsi-bt-avrcp-get-play-status), [rsi_bt_avrcp_get_remote_version](bt-classic2#rsi-bt-avrcp-get-remote-version), [rsi_bt_avrcp_get_tot_num_items_resp](bt-classic2#rsi-bt-avrcp-get-tot-num-items-resp), [rsi_bt_avrcp_next](bt-classic2#rsi-bt-avrcp-next), [rsi_bt_avrcp_notify](bt-classic2#rsi-bt-avrcp-notify), [rsi_bt_avrcp_pause](bt-classic2#rsi-bt-avrcp-pause), [rsi_bt_avrcp_play](bt-classic2#rsi-bt-avrcp-play), [rsi_bt_avrcp_play_status_resp](bt-classic2#rsi-bt-avrcp-play-status-resp), [rsi_bt_avrcp_previous](bt-classic2#rsi-bt-avrcp-previous), [rsi_bt_avrcp_reg_notification](bt-classic2#rsi-bt-avrcp-reg-notification), [rsi_bt_avrcp_reg_notify_resp](bt-classic2#rsi-bt-avrcp-reg-notify-resp), [rsi_bt_avrcp_set_abs_vol](bt-classic2#rsi-bt-avrcp-set-abs-vol), [rsi_bt_avrcp_set_abs_vol_resp](bt-classic2#rsi-bt-avrcp-set-abs-vol-resp), [rsi_bt_avrcp_set_addr_player_resp](bt-classic2#rsi-bt-avrcp-set-addr-player-resp), [rsi_bt_avrcp_set_cur_att_val](bt-classic2#rsi-bt-avrcp-set-cur-att-val), [rsi_bt_avrcp_set_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-set-cur-att-val-resp), [rsi_bt_avrcp_stop](bt-classic2#rsi-bt-avrcp-stop), [rsi_bt_avrcp_supp_char_sets](bt-classic2#rsi-bt-avrcp-supp-char-sets), [rsi_bt_avrcp_vol_down](bt-classic2#rsi-bt-avrcp-vol-down), [rsi_bt_avrcp_vol_up](bt-classic2#rsi-bt-avrcp-vol-up), [rsi_bt_cancel_connect](bt-classic3#rsi-bt-cancel-connect), [rsi_bt_change_pkt_type](bt-classic3#rsi-bt-change-pkt-type), [rsi_bt_connect](bt-classic3#rsi-bt-connect), [rsi_bt_disconnect](bt-classic3#rsi-bt-disconnect), [rsi_bt_encryption_enable_or_disable](bt-classic3#rsi-bt-encryption-enable-or-disable), [rsi_bt_get_local_device_role](bt-classic3#rsi-bt-get-local-device-role), [rsi_bt_get_rssi](bt-ble#rsi-bt-get-rssi), [rsi_bt_get_services_async](bt-classic3#rsi-bt-get-services-async), [rsi_bt_linkkey_request_reply](bt-classic3#rsi-bt-linkkey-request-reply), [rsi_bt_passkey](bt-classic3#rsi-bt-passkey), [rsi_bt_pincode_request_reply](bt-classic3#rsi-bt-pincode-request-reply), [rsi_bt_prepare_le_pkt](driver14#rsi-bt-prepare-le-pkt), [rsi_bt_reject_ssp_confirm](bt-classic3#rsi-bt-reject-ssp-confirm), [rsi_bt_remote_name_request_async](bt-classic3#rsi-bt-remote-name-request-async), [rsi_bt_remote_name_request_cancel](bt-classic3#rsi-bt-remote-name-request-cancel), [rsi_bt_request_authentication](bt-classic3#rsi-bt-request-authentication), [rsi_bt_search_service_async](bt-classic3#rsi-bt-search-service-async), [rsi_bt_set_bd_addr](bt-ble#rsi-bt-set-bd-addr), [rsi_bt_set_local_device_role](bt-classic3#rsi-bt-set-local-device-role), [rsi_bt_sniff_exit_mode](bt-classic3#rsi-bt-sniff-exit-mode), [rsi_bt_sniff_mode](bt-classic3#rsi-bt-sniff-mode), [rsi_bt_sniff_subrating_mode](bt-classic3#rsi-bt-sniff-subrating-mode), [rsi_bt_spp_connect](bt-classic4#rsi-bt-spp-connect) and [rsi_bt_spp_disconnect](bt-classic4#rsi-bt-spp-disconnect)

###### memcpy (heading level 8)

`memcpy(bt_req_a2dp_pcm_mp3_pkt_part1.dev_addr,(int8_t *) remote_dev_addr, 6)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part1.|N/A|dev_addr||
|(int8_t *)|N/A|remote_dev_addr||
|6|N/A|undefined||

**Referenced by:** [BT_LE_ADPacketExtract](bt-low-energy1#bt-le-ad-packet-extract), [rsi_add_remote_ble_dev_info](driver14#rsi-add-remote-ble-dev-info), [rsi_ble_accept_list_using_adv_data](bt-low-energy1#rsi-ble-accept-list-using-adv-data), [rsi_ble_add_service](bt-low-energy5#rsi-ble-add-service), [rsi_ble_addto_acceptlist](bt-low-energy1#rsi-ble-addto-acceptlist), [rsi_ble_ae_dev_to_periodic_list](bt-low-energy1#rsi-ble-ae-dev-to-periodic-list), [rsi_ble_ae_set_periodic_sync](bt-low-energy1#rsi-ble-ae-set-periodic-sync), [rsi_ble_ae_set_scan_enable](bt-low-energy1#rsi-ble-ae-set-scan-enable), [rsi_ble_ae_set_scan_params](bt-low-energy1#rsi-ble-ae-set-scan-params), [rsi_ble_app_set_periodic_ae_params](bt-low-energy1#rsi-ble-app-set-periodic-ae-params), [rsi_ble_att_error_response](bt-low-energy5#rsi-ble-att-error-response), [rsi_ble_conn_param_resp](bt-low-energy1#rsi-ble-conn-param-resp), [rsi_ble_conn_params_update](bt-low-energy1#rsi-ble-conn-params-update), [rsi_ble_connect](bt-low-energy1#rsi-ble-connect), [rsi_ble_connect_cancel](bt-low-energy1#rsi-ble-connect-cancel), [rsi_ble_connect_with_params](bt-low-energy1#rsi-ble-connect-with-params), [rsi_ble_deletefrom_acceptlist](bt-low-energy1#rsi-ble-deletefrom-acceptlist), [rsi_ble_disconnect](bt-low-energy1#rsi-ble-disconnect), [rsi_ble_encrypt](bt-low-energy1#rsi-ble-encrypt), [rsi_ble_enhance_connect_with_params](bt-low-energy1#rsi-ble-enhance-connect-with-params), [rsi_ble_execute_write](bt-low-energy3#rsi-ble-execute-write), [rsi_ble_execute_write_async](bt-low-energy4#rsi-ble-execute-write-async), [rsi_ble_extended_connect_with_params](bt-low-energy1#rsi-ble-extended-connect-with-params), [rsi_ble_gatt_prepare_write_response](bt-low-energy5#rsi-ble-gatt-prepare-write-response), [rsi_ble_gatt_read_response](bt-low-energy5#rsi-ble-gatt-read-response), [rsi_ble_gatt_write_response](bt-low-energy5#rsi-ble-gatt-write-response), [rsi_ble_get_att_descriptors](bt-low-energy3#rsi-ble-get-att-descriptors), [rsi_ble_get_att_descriptors_async](bt-low-energy4#rsi-ble-get-att-descriptors-async), [rsi_ble_get_att_value](bt-low-energy3#rsi-ble-get-att-value), [rsi_ble_get_att_value_async](bt-low-energy4#rsi-ble-get-att-value-async), [rsi_ble_get_char_services](bt-low-energy3#rsi-ble-get-char-services), [rsi_ble_get_char_services_async](bt-low-energy4#rsi-ble-get-char-services-async), [rsi_ble_get_char_value_by_uuid](bt-low-energy3#rsi-ble-get-char-value-by-uuid), [rsi_ble_get_char_value_by_uuid_async](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async), [rsi_ble_get_inc_services](bt-low-energy3#rsi-ble-get-inc-services), [rsi_ble_get_inc_services_async](bt-low-energy4#rsi-ble-get-inc-services-async), [rsi_ble_get_le_ping_timeout](bt-low-energy1#rsi-ble-get-le-ping-timeout), [rsi_ble_get_long_att_value](bt-low-energy3#rsi-ble-get-long-att-value), [rsi_ble_get_long_att_value_async](bt-low-energy4#rsi-ble-get-long-att-value-async), [rsi_ble_get_multiple_att_values](bt-low-energy3#rsi-ble-get-multiple-att-values), [rsi_ble_get_multiple_att_values_async](bt-low-energy4#rsi-ble-get-multiple-att-values-async), [rsi_ble_get_profile](bt-low-energy3#rsi-ble-get-profile), [rsi_ble_get_profile_async](bt-low-energy4#rsi-ble-get-profile-async), [rsi_ble_get_profiles](bt-low-energy3#rsi-ble-get-profiles), [rsi_ble_get_profiles_async](bt-low-energy4#rsi-ble-get-profiles-async), [rsi_ble_indicate_confirm](bt-low-energy4#rsi-ble-indicate-confirm), [rsi_ble_indicate_value](bt-low-energy5#rsi-ble-indicate-value), [rsi_ble_indicate_value_sync](bt-low-energy4#rsi-ble-indicate-value-sync), [rsi_ble_ltk_req_reply](bt-low-energy1#rsi-ble-ltk-req-reply), [rsi_ble_mtu_exchange_event](bt-low-energy3#rsi-ble-mtu-exchange-event), [rsi_ble_mtu_exchange_resp](bt-low-energy3#rsi-ble-mtu-exchange-resp), [rsi_ble_notify_value](bt-low-energy5#rsi-ble-notify-value), [rsi_ble_prepare_write](bt-low-energy3#rsi-ble-prepare-write), [rsi_ble_prepare_write_async](bt-low-energy4#rsi-ble-prepare-write-async), [rsi_ble_readphy](bt-low-energy1#rsi-ble-readphy), [rsi_ble_resolvlist](bt-low-energy1#rsi-ble-resolvlist), [rsi_ble_set_advertise_data](bt-low-energy1#rsi-ble-set-advertise-data), [rsi_ble_set_ae_data](bt-low-energy1#rsi-ble-set-ae-data), [rsi_ble_set_ae_params](bt-low-energy1#rsi-ble-set-ae-params), [rsi_ble_set_ae_set_random_address](bt-low-energy1#rsi-ble-set-ae-set-random-address), [rsi_ble_set_att_cmd](bt-low-energy3#rsi-ble-set-att-cmd), [rsi_ble_set_att_value](bt-low-energy3#rsi-ble-set-att-value), [rsi_ble_set_att_value_async](bt-low-energy4#rsi-ble-set-att-value-async), [rsi_ble_set_data_len](bt-low-energy1#rsi-ble-set-data-len), [rsi_ble_set_le_ping_timeout](bt-low-energy1#rsi-ble-set-le-ping-timeout), [rsi_ble_set_local_att_value](bt-low-energy5#rsi-ble-set-local-att-value), [rsi_ble_set_local_irk_value](bt-low-energy1#rsi-ble-set-local-irk-value), [rsi_ble_set_long_att_value](bt-low-energy3#rsi-ble-set-long-att-value), [rsi_ble_set_privacy_mode](bt-low-energy1#rsi-ble-set-privacy-mode), [rsi_ble_set_random_address_with_value](bt-low-energy1#rsi-ble-set-random-address-with-value), [rsi_ble_set_scan_response_data](bt-low-energy1#rsi-ble-set-scan-response-data), [rsi_ble_set_wo_resp_notify_buf_info](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info), [rsi_ble_setphy](bt-low-energy1#rsi-ble-setphy), [rsi_ble_smp_pair_failed](bt-low-energy1#rsi-ble-smp-pair-failed), [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request), [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response), [rsi_ble_smp_passkey](bt-low-energy1#rsi-ble-smp-passkey), [rsi_ble_start_advertising_with_values](bt-low-energy1#rsi-ble-start-advertising-with-values), [rsi_ble_start_ae_advertising](bt-low-energy1#rsi-ble-start-ae-advertising), [rsi_ble_start_encryption](bt-low-energy1#rsi-ble-start-encryption), [rsi_ble_start_scanning_with_values](bt-low-energy1#rsi-ble-start-scanning-with-values), [rsi_ble_update_directed_address](bt-low-energy1#rsi-ble-update-directed-address), [rsi_bt_a2dp_abort](bt-classic1#rsi-bt-a2dp-abort), [rsi_bt_a2dp_close](bt-classic1#rsi-bt-a2dp-close), [rsi_bt_a2dp_connect](bt-classic1#rsi-bt-a2dp-connect), [rsi_bt_a2dp_disconnect](bt-classic1#rsi-bt-a2dp-disconnect), [rsi_bt_a2dp_get_config](bt-classic1#rsi-bt-a2dp-get-config), [rsi_bt_a2dp_init](bt-classic1#rsi-bt-a2dp-init), [rsi_bt_a2dp_send_sbc_aac_data](bt-classic1#rsi-bt-a2dp-send-sbc-aac-data), [rsi_bt_a2dp_set_config](bt-classic1#rsi-bt-a2dp-set-config), [rsi_bt_a2dp_start](bt-classic1#rsi-bt-a2dp-start), [rsi_bt_a2dp_suspend](bt-classic1#rsi-bt-a2dp-suspend), [rsi_bt_accept_ssp_confirm](bt-classic3#rsi-bt-accept-ssp-confirm), [rsi_bt_avrcp_att_list_resp](bt-classic2#rsi-bt-avrcp-att-list-resp), [rsi_bt_avrcp_att_text_resp](bt-classic2#rsi-bt-avrcp-att-text-resp), [rsi_bt_avrcp_att_val_list_resp](bt-classic2#rsi-bt-avrcp-att-val-list-resp), [rsi_bt_avrcp_att_vals_text_resp](bt-classic2#rsi-bt-avrcp-att-vals-text-resp), [rsi_bt_avrcp_batt_status](bt-classic2#rsi-bt-avrcp-batt-status), [rsi_bt_avrcp_batt_status_resp](bt-classic2#rsi-bt-avrcp-batt-status-resp), [rsi_bt_avrcp_cap_resp](bt-classic2#rsi-bt-avrcp-cap-resp), [rsi_bt_avrcp_char_set_status_resp](bt-classic2#rsi-bt-avrcp-char-set-status-resp), [rsi_bt_avrcp_cmd_reject](bt-classic2#rsi-bt-avrcp-cmd-reject), [rsi_bt_avrcp_conn](bt-classic2#rsi-bt-avrcp-conn), [rsi_bt_avrcp_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-cur-att-val-resp), [rsi_bt_avrcp_disconn](bt-classic2#rsi-bt-avrcp-disconn), [rsi_bt_avrcp_ele_att_resp](bt-classic2#rsi-bt-avrcp-ele-att-resp), [rsi_bt_avrcp_get_att_list](bt-classic2#rsi-bt-avrcp-get-att-list), [rsi_bt_avrcp_get_att_text](bt-classic2#rsi-bt-avrcp-get-att-text), [rsi_bt_avrcp_get_att_val_text](bt-classic2#rsi-bt-avrcp-get-att-val-text), [rsi_bt_avrcp_get_att_vals_list](bt-classic2#rsi-bt-avrcp-get-att-vals-list), [rsi_bt_avrcp_get_capabilities](bt-classic2#rsi-bt-avrcp-get-capabilities), [rsi_bt_avrcp_get_cur_att_val](bt-classic2#rsi-bt-avrcp-get-cur-att-val), [rsi_bt_avrcp_get_element_att](bt-classic2#rsi-bt-avrcp-get-element-att), [rsi_bt_avrcp_get_folder_items_resp](bt-classic2#rsi-bt-avrcp-get-folder-items-resp), [rsi_bt_avrcp_get_play_status](bt-classic2#rsi-bt-avrcp-get-play-status), [rsi_bt_avrcp_get_remote_version](bt-classic2#rsi-bt-avrcp-get-remote-version), [rsi_bt_avrcp_get_tot_num_items_resp](bt-classic2#rsi-bt-avrcp-get-tot-num-items-resp), [rsi_bt_avrcp_next](bt-classic2#rsi-bt-avrcp-next), [rsi_bt_avrcp_notify](bt-classic2#rsi-bt-avrcp-notify), [rsi_bt_avrcp_pause](bt-classic2#rsi-bt-avrcp-pause), [rsi_bt_avrcp_play](bt-classic2#rsi-bt-avrcp-play), [rsi_bt_avrcp_play_status_resp](bt-classic2#rsi-bt-avrcp-play-status-resp), [rsi_bt_avrcp_previous](bt-classic2#rsi-bt-avrcp-previous), [rsi_bt_avrcp_reg_notification](bt-classic2#rsi-bt-avrcp-reg-notification), [rsi_bt_avrcp_reg_notify_resp](bt-classic2#rsi-bt-avrcp-reg-notify-resp), [rsi_bt_avrcp_set_abs_vol](bt-classic2#rsi-bt-avrcp-set-abs-vol), [rsi_bt_avrcp_set_abs_vol_resp](bt-classic2#rsi-bt-avrcp-set-abs-vol-resp), [rsi_bt_avrcp_set_addr_player_resp](bt-classic2#rsi-bt-avrcp-set-addr-player-resp), [rsi_bt_avrcp_set_cur_att_val](bt-classic2#rsi-bt-avrcp-set-cur-att-val), [rsi_bt_avrcp_set_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-set-cur-att-val-resp), [rsi_bt_avrcp_stop](bt-classic2#rsi-bt-avrcp-stop), [rsi_bt_avrcp_supp_char_sets](bt-classic2#rsi-bt-avrcp-supp-char-sets), [rsi_bt_avrcp_vol_down](bt-classic2#rsi-bt-avrcp-vol-down), [rsi_bt_avrcp_vol_up](bt-classic2#rsi-bt-avrcp-vol-up), [rsi_bt_cancel_connect](bt-classic3#rsi-bt-cancel-connect), [rsi_bt_change_pkt_type](bt-classic3#rsi-bt-change-pkt-type), [rsi_bt_cmd_update_gain_table_offset_or_max_pwr](bt-ble#rsi-bt-cmd-update-gain-table-offset-or-max-pwr), [rsi_bt_connect](bt-classic3#rsi-bt-connect), [rsi_bt_disconnect](bt-classic3#rsi-bt-disconnect), [rsi_bt_encryption_enable_or_disable](bt-classic3#rsi-bt-encryption-enable-or-disable), [rsi_bt_get_local_device_role](bt-classic3#rsi-bt-get-local-device-role), [rsi_bt_get_rssi](bt-ble#rsi-bt-get-rssi), [rsi_bt_get_services_async](bt-classic3#rsi-bt-get-services-async), [rsi_bt_linkkey_request_reply](bt-classic3#rsi-bt-linkkey-request-reply), [rsi_bt_passkey](bt-classic3#rsi-bt-passkey), [rsi_bt_pincode_request_reply](bt-classic3#rsi-bt-pincode-request-reply), [rsi_bt_prepare_classic_pkt](driver14#rsi-bt-prepare-classic-pkt), [rsi_bt_prepare_common_pkt](driver14#rsi-bt-prepare-common-pkt), [rsi_bt_prepare_le_pkt](driver14#rsi-bt-prepare-le-pkt), [rsi_bt_reject_ssp_confirm](bt-classic3#rsi-bt-reject-ssp-confirm), [rsi_bt_remote_name_request_async](bt-classic3#rsi-bt-remote-name-request-async), [rsi_bt_remote_name_request_cancel](bt-classic3#rsi-bt-remote-name-request-cancel), [rsi_bt_request_authentication](bt-classic3#rsi-bt-request-authentication), [rsi_bt_search_service_async](bt-classic3#rsi-bt-search-service-async), [rsi_bt_set_afh_host_channel_classification](bt-classic3#rsi-bt-set-afh-host-channel-classification), [rsi_bt_set_bd_addr](bt-ble#rsi-bt-set-bd-addr), [rsi_bt_set_eir_data](bt-classic3#rsi-bt-set-eir-data), [rsi_bt_set_local_device_role](bt-classic3#rsi-bt-set-local-device-role), [rsi_bt_set_local_name](bt-ble#rsi-bt-set-local-name), [rsi_bt_sniff_exit_mode](bt-classic3#rsi-bt-sniff-exit-mode), [rsi_bt_sniff_mode](bt-classic3#rsi-bt-sniff-mode), [rsi_bt_sniff_subrating_mode](bt-classic3#rsi-bt-sniff-subrating-mode), [rsi_bt_spp_connect](bt-classic4#rsi-bt-spp-connect), [rsi_bt_spp_disconnect](bt-classic4#rsi-bt-spp-disconnect), [rsi_bt_spp_transfer](bt-classic4#rsi-bt-spp-transfer), [rsi_bt_vendor_dynamic_pwr](bt-classic5#rsi-bt-vendor-dynamic-pwr), [rsi_bt_write_current_iac_lap](bt-classic3#rsi-bt-write-current-iac-lap), [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp), [rsi_driver_process_common_recv_cmd](driver5#rsi-driver-process-common-recv-cmd), [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_driver_version](common#rsi-driver-version), [rsi_fill_config_profile](wlan#rsi-fill-config-profile), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_frame_read](driver3#rsi-frame-read), [rsi_hmac_sha](crypto#rsi-hmac-sha), [rsi_mqtt_client_init](network13#rsi-mqtt-client-init), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_sort_scan_results_array_based_on_rssi](wlan#rsi-sort-scan-results-array-based-on-rssi), [rsi_web_socket_create](network5#rsi-web-socket-create), [rsi_wlan_set](wlan#rsi-wlan-set) and [USART0_RX_IRQHandler](driver3#usart0-rx-irq-handler)

###### memcpy (heading level 8)

`memcpy(bt_req_a2dp_pcm_mp3_pkt_part1.pcm_mp3_data, pcm_mp3_data, bt_req_a2dp_pcm_mp3_pkt_part1.pcm_mp3_data_len)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part1.|N/A|pcm_mp3_data||
|[pcm_mp3_data](bt-classic1#pcm-mp3-data)|N/A|undefined||
|bt_req_a2dp_pcm_mp3_pkt_part1.|N/A|pcm_mp3_data_len||

###### rsi_bt_driver_send_cmd (heading level 8)

`rsi_bt_driver_send_cmd(RSI_BT_REQ_A2DP_PCM_MP3_DATA_PREFILL_1, &bt_req_a2dp_pcm_mp3_pkt_part1, NULL)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|RSI_BT_REQ_A2DP_PCM_MP3_DATA_PREFILL_1|N/A|undefined||
|&|N/A|bt_req_a2dp_pcm_mp3_pkt_part1||
|NULL|N/A|undefined||

**Referenced by:** [rsi_ble_accept_list_using_adv_data](bt-low-energy1#rsi-ble-accept-list-using-adv-data), [rsi_ble_add_attribute](bt-low-energy5#rsi-ble-add-attribute), [rsi_ble_add_service](bt-low-energy5#rsi-ble-add-service), [rsi_ble_addto_acceptlist](bt-low-energy1#rsi-ble-addto-acceptlist), [rsi_ble_ae_dev_to_periodic_list](bt-low-energy1#rsi-ble-ae-dev-to-periodic-list), [rsi_ble_ae_read_periodic_adv_list_size](bt-low-energy1#rsi-ble-ae-read-periodic-adv-list-size), [rsi_ble_ae_set_periodic_sync](bt-low-energy1#rsi-ble-ae-set-periodic-sync), [rsi_ble_ae_set_scan_enable](bt-low-energy1#rsi-ble-ae-set-scan-enable), [rsi_ble_ae_set_scan_params](bt-low-energy1#rsi-ble-ae-set-scan-params), [rsi_ble_app_adv_set_clear_or_remove](bt-low-energy1#rsi-ble-app-adv-set-clear-or-remove), [rsi_ble_app_set_periodic_ae_enable](bt-low-energy1#rsi-ble-app-set-periodic-ae-enable), [rsi_ble_app_set_periodic_ae_params](bt-low-energy1#rsi-ble-app-set-periodic-ae-params), [rsi_ble_att_error_response](bt-low-energy5#rsi-ble-att-error-response), [rsi_ble_clear_acceptlist](bt-low-energy1#rsi-ble-clear-acceptlist), [rsi_ble_conn_param_resp](bt-low-energy1#rsi-ble-conn-param-resp), [rsi_ble_conn_params_update](bt-low-energy1#rsi-ble-conn-params-update), [rsi_ble_connect](bt-low-energy1#rsi-ble-connect), [rsi_ble_connect_cancel](bt-low-energy1#rsi-ble-connect-cancel), [rsi_ble_connect_with_params](bt-low-energy1#rsi-ble-connect-with-params), [rsi_ble_deletefrom_acceptlist](bt-low-energy1#rsi-ble-deletefrom-acceptlist), [rsi_ble_disconnect](bt-low-energy1#rsi-ble-disconnect), [rsi_ble_encrypt](bt-low-energy1#rsi-ble-encrypt), [rsi_ble_end_test_mode](bt-low-energy6#rsi-ble-end-test-mode), [rsi_ble_enhance_connect_with_params](bt-low-energy1#rsi-ble-enhance-connect-with-params), [rsi_ble_execute_write](bt-low-energy3#rsi-ble-execute-write), [rsi_ble_execute_write_async](bt-low-energy4#rsi-ble-execute-write-async), [rsi_ble_extended_connect_with_params](bt-low-energy1#rsi-ble-extended-connect-with-params), [rsi_ble_gatt_prepare_write_response](bt-low-energy5#rsi-ble-gatt-prepare-write-response), [rsi_ble_gatt_read_response](bt-low-energy5#rsi-ble-gatt-read-response), [rsi_ble_gatt_write_response](bt-low-energy5#rsi-ble-gatt-write-response), [rsi_ble_get_att_descriptors](bt-low-energy3#rsi-ble-get-att-descriptors), [rsi_ble_get_att_descriptors_async](bt-low-energy4#rsi-ble-get-att-descriptors-async), [rsi_ble_get_att_value](bt-low-energy3#rsi-ble-get-att-value), [rsi_ble_get_att_value_async](bt-low-energy4#rsi-ble-get-att-value-async), [rsi_ble_get_char_services](bt-low-energy3#rsi-ble-get-char-services), [rsi_ble_get_char_services_async](bt-low-energy4#rsi-ble-get-char-services-async), [rsi_ble_get_char_value_by_uuid](bt-low-energy3#rsi-ble-get-char-value-by-uuid), [rsi_ble_get_char_value_by_uuid_async](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async), [rsi_ble_get_device_state](bt-low-energy1#rsi-ble-get-device-state), [rsi_ble_get_inc_services](bt-low-energy3#rsi-ble-get-inc-services), [rsi_ble_get_inc_services_async](bt-low-energy4#rsi-ble-get-inc-services-async), [rsi_ble_get_le_ping_timeout](bt-low-energy1#rsi-ble-get-le-ping-timeout), [rsi_ble_get_local_att_value](bt-low-energy5#rsi-ble-get-local-att-value), [rsi_ble_get_long_att_value](bt-low-energy3#rsi-ble-get-long-att-value), [rsi_ble_get_long_att_value_async](bt-low-energy4#rsi-ble-get-long-att-value-async), [rsi_ble_get_max_adv_data_len](bt-low-energy1#rsi-ble-get-max-adv-data-len), [rsi_ble_get_max_no_of_supp_adv_sets](bt-low-energy1#rsi-ble-get-max-no-of-supp-adv-sets), [rsi_ble_get_multiple_att_values](bt-low-energy3#rsi-ble-get-multiple-att-values), [rsi_ble_get_multiple_att_values_async](bt-low-energy4#rsi-ble-get-multiple-att-values-async), [rsi_ble_get_profile](bt-low-energy3#rsi-ble-get-profile), [rsi_ble_get_profile_async](bt-low-energy4#rsi-ble-get-profile-async), [rsi_ble_get_profiles](bt-low-energy3#rsi-ble-get-profiles), [rsi_ble_get_profiles_async](bt-low-energy4#rsi-ble-get-profiles-async), [rsi_ble_get_resolving_list_size](bt-low-energy1#rsi-ble-get-resolving-list-size), [rsi_ble_indicate_confirm](bt-low-energy4#rsi-ble-indicate-confirm), [rsi_ble_indicate_value](bt-low-energy5#rsi-ble-indicate-value), [rsi_ble_indicate_value_sync](bt-low-energy4#rsi-ble-indicate-value-sync), [rsi_ble_ltk_req_reply](bt-low-energy1#rsi-ble-ltk-req-reply), [rsi_ble_mtu_exchange_event](bt-low-energy3#rsi-ble-mtu-exchange-event), [rsi_ble_mtu_exchange_resp](bt-low-energy3#rsi-ble-mtu-exchange-resp), [rsi_ble_notify_value](bt-low-energy5#rsi-ble-notify-value), [rsi_ble_per_receive](bt-low-energy6#rsi-ble-per-receive), [rsi_ble_per_transmit](bt-low-energy6#rsi-ble-per-transmit), [rsi_ble_prepare_write](bt-low-energy3#rsi-ble-prepare-write), [rsi_ble_prepare_write_async](bt-low-energy4#rsi-ble-prepare-write-async), [rsi_ble_read_max_data_len](bt-low-energy1#rsi-ble-read-max-data-len), [rsi_ble_read_rf_path_compensation](bt-low-energy1#rsi-ble-read-rf-path-compensation), [rsi_ble_read_transmit_power](bt-low-energy1#rsi-ble-read-transmit-power), [rsi_ble_readphy](bt-low-energy1#rsi-ble-readphy), [rsi_ble_remove_gatt_attibute](bt-low-energy5#rsi-ble-remove-gatt-attibute), [rsi_ble_remove_gatt_service](bt-low-energy5#rsi-ble-remove-gatt-service), [rsi_ble_resolvlist](bt-low-energy1#rsi-ble-resolvlist), [rsi_ble_rx_test_mode](bt-low-energy6#rsi-ble-rx-test-mode), [rsi_ble_set_addr_resolution_enable](bt-low-energy1#rsi-ble-set-addr-resolution-enable), [rsi_ble_set_advertise_data](bt-low-energy1#rsi-ble-set-advertise-data), [rsi_ble_set_ae_data](bt-low-energy1#rsi-ble-set-ae-data), [rsi_ble_set_ae_params](bt-low-energy1#rsi-ble-set-ae-params), [rsi_ble_set_ae_set_random_address](bt-low-energy1#rsi-ble-set-ae-set-random-address), [rsi_ble_set_att_cmd](bt-low-energy3#rsi-ble-set-att-cmd), [rsi_ble_set_att_value](bt-low-energy3#rsi-ble-set-att-value), [rsi_ble_set_att_value_async](bt-low-energy4#rsi-ble-set-att-value-async), [rsi_ble_set_data_len](bt-low-energy1#rsi-ble-set-data-len), [rsi_ble_set_le_ping_timeout](bt-low-energy1#rsi-ble-set-le-ping-timeout), [rsi_ble_set_local_att_value](bt-low-energy5#rsi-ble-set-local-att-value), [rsi_ble_set_local_irk_value](bt-low-energy1#rsi-ble-set-local-irk-value), [rsi_ble_set_long_att_value](bt-low-energy3#rsi-ble-set-long-att-value), [rsi_ble_set_privacy_mode](bt-low-energy1#rsi-ble-set-privacy-mode), [rsi_ble_set_random_address](bt-low-energy1#rsi-ble-set-random-address), [rsi_ble_set_random_address_with_value](bt-low-energy1#rsi-ble-set-random-address-with-value), [rsi_ble_set_scan_response_data](bt-low-energy1#rsi-ble-set-scan-response-data), [rsi_ble_set_smp_pairing_cap_data](bt-low-energy1#rsi-ble-set-smp-pairing-cap-data), [rsi_ble_set_wo_resp_notify_buf_info](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info), [rsi_ble_setphy](bt-low-energy1#rsi-ble-setphy), [rsi_ble_smp_pair_failed](bt-low-energy1#rsi-ble-smp-pair-failed), [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request), [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response), [rsi_ble_smp_passkey](bt-low-energy1#rsi-ble-smp-passkey), [rsi_ble_start_advertising](bt-low-energy1#rsi-ble-start-advertising), [rsi_ble_start_advertising_with_values](bt-low-energy1#rsi-ble-start-advertising-with-values), [rsi_ble_start_ae_advertising](bt-low-energy1#rsi-ble-start-ae-advertising), [rsi_ble_start_encryption](bt-low-energy1#rsi-ble-start-encryption), [rsi_ble_start_scanning](bt-low-energy1#rsi-ble-start-scanning), [rsi_ble_start_scanning_with_values](bt-low-energy1#rsi-ble-start-scanning-with-values), [rsi_ble_stop_advertising](bt-low-energy1#rsi-ble-stop-advertising), [rsi_ble_stop_scanning](bt-low-energy1#rsi-ble-stop-scanning), [rsi_ble_tx_test_mode](bt-low-energy6#rsi-ble-tx-test-mode), [rsi_ble_vendor_feature_bitmap](bt-low-energy1#rsi-ble-vendor-feature-bitmap), [rsi_ble_vendor_rf_type](bt-low-energy1#rsi-ble-vendor-rf-type), [rsi_ble_vendor_set_SMP_min_enc_keysize](bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize), [rsi_ble_write_rf_path_compensation](bt-low-energy1#rsi-ble-write-rf-path-compensation), [rsi_bt_a2dp_abort](bt-classic1#rsi-bt-a2dp-abort), [rsi_bt_a2dp_close](bt-classic1#rsi-bt-a2dp-close), [rsi_bt_a2dp_connect](bt-classic1#rsi-bt-a2dp-connect), [rsi_bt_a2dp_disconnect](bt-classic1#rsi-bt-a2dp-disconnect), [rsi_bt_a2dp_get_config](bt-classic1#rsi-bt-a2dp-get-config), [rsi_bt_a2dp_init](bt-classic1#rsi-bt-a2dp-init), [rsi_bt_a2dp_send_sbc_aac_data](bt-classic1#rsi-bt-a2dp-send-sbc-aac-data), [rsi_bt_a2dp_set_config](bt-classic1#rsi-bt-a2dp-set-config), [rsi_bt_a2dp_start](bt-classic1#rsi-bt-a2dp-start), [rsi_bt_a2dp_suspend](bt-classic1#rsi-bt-a2dp-suspend), [rsi_bt_accept_ssp_confirm](bt-classic3#rsi-bt-accept-ssp-confirm), [rsi_bt_add_device_id](bt-classic3#rsi-bt-add-device-id), [rsi_bt_avrcp_att_list_resp](bt-classic2#rsi-bt-avrcp-att-list-resp), [rsi_bt_avrcp_att_text_resp](bt-classic2#rsi-bt-avrcp-att-text-resp), [rsi_bt_avrcp_att_val_list_resp](bt-classic2#rsi-bt-avrcp-att-val-list-resp), [rsi_bt_avrcp_att_vals_text_resp](bt-classic2#rsi-bt-avrcp-att-vals-text-resp), [rsi_bt_avrcp_batt_status](bt-classic2#rsi-bt-avrcp-batt-status), [rsi_bt_avrcp_batt_status_resp](bt-classic2#rsi-bt-avrcp-batt-status-resp), [rsi_bt_avrcp_cap_resp](bt-classic2#rsi-bt-avrcp-cap-resp), [rsi_bt_avrcp_char_set_status_resp](bt-classic2#rsi-bt-avrcp-char-set-status-resp), [rsi_bt_avrcp_cmd_reject](bt-classic2#rsi-bt-avrcp-cmd-reject), [rsi_bt_avrcp_conn](bt-classic2#rsi-bt-avrcp-conn), [rsi_bt_avrcp_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-cur-att-val-resp), [rsi_bt_avrcp_disconn](bt-classic2#rsi-bt-avrcp-disconn), [rsi_bt_avrcp_ele_att_resp](bt-classic2#rsi-bt-avrcp-ele-att-resp), [rsi_bt_avrcp_get_att_list](bt-classic2#rsi-bt-avrcp-get-att-list), [rsi_bt_avrcp_get_att_text](bt-classic2#rsi-bt-avrcp-get-att-text), [rsi_bt_avrcp_get_att_val_text](bt-classic2#rsi-bt-avrcp-get-att-val-text), [rsi_bt_avrcp_get_att_vals_list](bt-classic2#rsi-bt-avrcp-get-att-vals-list), [rsi_bt_avrcp_get_capabilities](bt-classic2#rsi-bt-avrcp-get-capabilities), [rsi_bt_avrcp_get_cur_att_val](bt-classic2#rsi-bt-avrcp-get-cur-att-val), [rsi_bt_avrcp_get_element_att](bt-classic2#rsi-bt-avrcp-get-element-att), [rsi_bt_avrcp_get_folder_items_resp](bt-classic2#rsi-bt-avrcp-get-folder-items-resp), [rsi_bt_avrcp_get_play_status](bt-classic2#rsi-bt-avrcp-get-play-status), [rsi_bt_avrcp_get_remote_version](bt-classic2#rsi-bt-avrcp-get-remote-version), [rsi_bt_avrcp_get_tot_num_items_resp](bt-classic2#rsi-bt-avrcp-get-tot-num-items-resp), [rsi_bt_avrcp_init](bt-classic2#rsi-bt-avrcp-init), [rsi_bt_avrcp_next](bt-classic2#rsi-bt-avrcp-next), [rsi_bt_avrcp_notify](bt-classic2#rsi-bt-avrcp-notify), [rsi_bt_avrcp_pause](bt-classic2#rsi-bt-avrcp-pause), [rsi_bt_avrcp_play](bt-classic2#rsi-bt-avrcp-play), [rsi_bt_avrcp_play_status_resp](bt-classic2#rsi-bt-avrcp-play-status-resp), [rsi_bt_avrcp_previous](bt-classic2#rsi-bt-avrcp-previous), [rsi_bt_avrcp_reg_notification](bt-classic2#rsi-bt-avrcp-reg-notification), [rsi_bt_avrcp_reg_notify_resp](bt-classic2#rsi-bt-avrcp-reg-notify-resp), [rsi_bt_avrcp_set_abs_vol](bt-classic2#rsi-bt-avrcp-set-abs-vol), [rsi_bt_avrcp_set_abs_vol_resp](bt-classic2#rsi-bt-avrcp-set-abs-vol-resp), [rsi_bt_avrcp_set_addr_player_resp](bt-classic2#rsi-bt-avrcp-set-addr-player-resp), [rsi_bt_avrcp_set_cur_att_val](bt-classic2#rsi-bt-avrcp-set-cur-att-val), [rsi_bt_avrcp_set_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-set-cur-att-val-resp), [rsi_bt_avrcp_stop](bt-classic2#rsi-bt-avrcp-stop), [rsi_bt_avrcp_supp_char_sets](bt-classic2#rsi-bt-avrcp-supp-char-sets), [rsi_bt_avrcp_vol_down](bt-classic2#rsi-bt-avrcp-vol-down), [rsi_bt_avrcp_vol_up](bt-classic2#rsi-bt-avrcp-vol-up), [rsi_bt_ber_enable_or_disable](bt-ble#rsi-bt-ber-enable-or-disable), [rsi_bt_cancel_connect](bt-classic3#rsi-bt-cancel-connect), [rsi_bt_cancel_inquiry](bt-classic3#rsi-bt-cancel-inquiry), [rsi_bt_change_pkt_type](bt-classic3#rsi-bt-change-pkt-type), [rsi_bt_cmd_update_gain_table_offset_or_max_pwr](bt-ble#rsi-bt-cmd-update-gain-table-offset-or-max-pwr), [rsi_bt_connect](bt-classic3#rsi-bt-connect), [rsi_bt_deinit](bt-ble#rsi-bt-deinit), [rsi_bt_disable_authentication](bt-classic3#rsi-bt-disable-authentication), [rsi_bt_disconnect](bt-classic3#rsi-bt-disconnect), [rsi_bt_enable_authentication](bt-classic3#rsi-bt-enable-authentication), [rsi_bt_enable_device_under_testmode](bt-classic5#rsi-bt-enable-device-under-testmode), [rsi_bt_encryption_enable_or_disable](bt-classic3#rsi-bt-encryption-enable-or-disable), [rsi_bt_get_afh_host_channel_classification](bt-classic3#rsi-bt-get-afh-host-channel-classification), [rsi_bt_get_authentication](bt-classic3#rsi-bt-get-authentication), [rsi_bt_get_bt_stack_version](bt-ble#rsi-bt-get-bt-stack-version), [rsi_bt_get_connectable_status](bt-classic3#rsi-bt-get-connectable-status), [rsi_bt_get_country_region](bt-ble#rsi-bt-get-country-region), [rsi_bt_get_discoverable_status](bt-classic3#rsi-bt-get-discoverable-status), [rsi_bt_get_local_class_of_device](bt-classic3#rsi-bt-get-local-class-of-device), [rsi_bt_get_local_device_address](bt-ble#rsi-bt-get-local-device-address), [rsi_bt_get_local_device_role](bt-classic3#rsi-bt-get-local-device-role), [rsi_bt_get_local_name](bt-ble#rsi-bt-get-local-name), [rsi_bt_get_rssi](bt-ble#rsi-bt-get-rssi), [rsi_bt_get_services_async](bt-classic3#rsi-bt-get-services-async), [rsi_bt_init](bt-ble#rsi-bt-init), [rsi_bt_inquiry](bt-classic3#rsi-bt-inquiry), [rsi_bt_linkkey_request_reply](bt-classic3#rsi-bt-linkkey-request-reply), [rsi_bt_passkey](bt-classic3#rsi-bt-passkey), [rsi_bt_per_cw_mode](bt-classic5#rsi-bt-per-cw-mode), [rsi_bt_per_rx](bt-classic5#rsi-bt-per-rx), [rsi_bt_per_stats](bt-classic5#rsi-bt-per-stats), [rsi_bt_per_tx](bt-classic5#rsi-bt-per-tx), [rsi_bt_pincode_request_reply](bt-classic3#rsi-bt-pincode-request-reply), [rsi_bt_ptt_req](bt-classic3#rsi-bt-ptt-req), [rsi_bt_reject_ssp_confirm](bt-classic3#rsi-bt-reject-ssp-confirm), [rsi_bt_remote_name_request_async](bt-classic3#rsi-bt-remote-name-request-async), [rsi_bt_remote_name_request_cancel](bt-classic3#rsi-bt-remote-name-request-cancel), [rsi_bt_request_authentication](bt-classic3#rsi-bt-request-authentication), [rsi_bt_search_service_async](bt-classic3#rsi-bt-search-service-async), [rsi_bt_set_afh_host_channel_classification](bt-classic3#rsi-bt-set-afh-host-channel-classification), [rsi_bt_set_antenna](bt-ble#rsi-bt-set-antenna), [rsi_bt_set_antenna_tx_power_level](bt-ble#rsi-bt-set-antenna-tx-power-level), [rsi_bt_set_bd_addr](bt-ble#rsi-bt-set-bd-addr), [rsi_bt_set_connectable](bt-classic3#rsi-bt-set-connectable), [rsi_bt_set_country_region](bt-ble#rsi-bt-set-country-region), [rsi_bt_set_eir_data](bt-classic3#rsi-bt-set-eir-data), [rsi_bt_set_local_class_of_device](bt-classic3#rsi-bt-set-local-class-of-device), [rsi_bt_set_local_device_role](bt-classic3#rsi-bt-set-local-device-role), [rsi_bt_set_local_name](bt-ble#rsi-bt-set-local-name), [rsi_bt_set_non_connectable](bt-classic3#rsi-bt-set-non-connectable), [rsi_bt_set_ssp_mode](bt-classic3#rsi-bt-set-ssp-mode), [rsi_bt_sniff_exit_mode](bt-classic3#rsi-bt-sniff-exit-mode), [rsi_bt_sniff_mode](bt-classic3#rsi-bt-sniff-mode), [rsi_bt_sniff_subrating_mode](bt-classic3#rsi-bt-sniff-subrating-mode), [rsi_bt_spp_connect](bt-classic4#rsi-bt-spp-connect), [rsi_bt_spp_disconnect](bt-classic4#rsi-bt-spp-disconnect), [rsi_bt_spp_init](bt-classic4#rsi-bt-spp-init), [rsi_bt_spp_transfer](bt-classic4#rsi-bt-spp-transfer), [rsi_bt_start_discoverable](bt-classic3#rsi-bt-start-discoverable), [rsi_bt_start_limited_discoverable](bt-classic3#rsi-bt-start-limited-discoverable), [rsi_bt_stop_discoverable](bt-classic3#rsi-bt-stop-discoverable), [rsi_bt_vendor_ar_enable](bt-classic5#rsi-bt-vendor-ar-enable), [rsi_bt_vendor_avdtp_stats_enable](bt-classic5#rsi-bt-vendor-avdtp-stats-enable), [rsi_bt_vendor_dynamic_pwr](bt-classic5#rsi-bt-vendor-dynamic-pwr), [rsi_bt_vendor_set_afh_classification_intervals](bt-classic5#rsi-bt-vendor-set-afh-classification-intervals), [rsi_bt_vendor_set_hapi_rect_val](bt-classic5#rsi-bt-vendor-set-hapi-rect-val) and [rsi_bt_write_current_iac_lap](bt-classic3#rsi-bt-write-current-iac-lap)

###### rsi_ascii_dev_address_to_6bytes_rev (heading level 8)

`rsi_ascii_dev_address_to_6bytes_rev(bt_req_a2dp_pcm_mp3_pkt_part2.dev_addr, remote_dev_addr)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part2.|N/A|dev_addr||
|remote_dev_addr|N/A|undefined||

###### memcpy (heading level 8)

`memcpy(bt_req_a2dp_pcm_mp3_pkt_part2.dev_addr,(int8_t *) remote_dev_addr, 6)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part2.|N/A|dev_addr||
|(int8_t *)|N/A|remote_dev_addr||
|6|N/A|undefined||

###### memcpy (heading level 8)

`memcpy(bt_req_a2dp_pcm_mp3_pkt_part2.pcm_mp3_data,(pcm_mp3_data+sizeof(bt_req_a2dp_pcm_mp3_pkt_part1.pcm_mp3_data)), bt_req_a2dp_pcm_mp3_pkt_part2.pcm_mp3_data_len)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|bt_req_a2dp_pcm_mp3_pkt_part2.|N/A|pcm_mp3_data||
|([pcm_mp3_data](bt-classic1#pcm-mp3-data)+sizeof([bt_req_a2dp_pcm_mp3_pkt_part1.pcm_mp3_data](bt-classic1#pcm-mp3-data)))|N/A|undefined||
|bt_req_a2dp_pcm_mp3_pkt_part2.|N/A|pcm_mp3_data_len||

###### SL_PRINTF (heading level 8)

`SL_PRINTF(SL_RSI_BT_A2DP_SEND_PCM_MP3_DATA_TRIGGER, BLUETOOTH, LOG_INFO)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|SL_RSI_BT_A2DP_SEND_PCM_MP3_DATA_TRIGGER|N/A|undefined||
|BLUETOOTH|N/A|undefined||
|LOG_INFO|N/A|undefined||

**Referenced by:** [BT_LE_ADPacketExtract](bt-low-energy1#bt-le-ad-packet-extract), [intialize_bt_stack](driver14#intialize-bt-stack), [rsi_add_remote_ble_dev_info](driver14#rsi-add-remote-ble-dev-info), [rsi_aes](crypto#rsi-aes), [rsi_aes_pen](crypto#rsi-aes-pen), [rsi_assert](common#rsi-assert), [rsi_bl_module_power_cycle](driver6#rsi-bl-module-power-cycle), [rsi_bl_upgrade_firmware](common#rsi-bl-upgrade-firmware), [rsi_bl_waitfor_boardready](driver6#rsi-bl-waitfor-boardready), [rsi_ble_accept_list_using_adv_data](bt-low-energy1#rsi-ble-accept-list-using-adv-data), [rsi_ble_add_attribute](bt-low-energy5#rsi-ble-add-attribute), [rsi_ble_add_service](bt-low-energy5#rsi-ble-add-service), [rsi_ble_addto_acceptlist](bt-low-energy1#rsi-ble-addto-acceptlist), [rsi_ble_att_error_response](bt-low-energy5#rsi-ble-att-error-response), [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler), [rsi_ble_clear_acceptlist](bt-low-energy1#rsi-ble-clear-acceptlist), [rsi_ble_conn_param_resp](bt-low-energy1#rsi-ble-conn-param-resp), [rsi_ble_conn_params_update](bt-low-energy1#rsi-ble-conn-params-update), [rsi_ble_connect](bt-low-energy1#rsi-ble-connect), [rsi_ble_connect_cancel](bt-low-energy1#rsi-ble-connect-cancel), [rsi_ble_connect_with_params](bt-low-energy1#rsi-ble-connect-with-params), [rsi_ble_deletefrom_acceptlist](bt-low-energy1#rsi-ble-deletefrom-acceptlist), [rsi_ble_disconnect](bt-low-energy1#rsi-ble-disconnect), [rsi_ble_encrypt](bt-low-energy1#rsi-ble-encrypt), [rsi_ble_end_test_mode](bt-low-energy6#rsi-ble-end-test-mode), [rsi_ble_execute_write](bt-low-energy3#rsi-ble-execute-write), [rsi_ble_execute_write_async](bt-low-energy4#rsi-ble-execute-write-async), [rsi_ble_gap_extended_register_callbacks](bt-low-energy7#rsi-ble-gap-extended-register-callbacks), [rsi_ble_gap_register_callbacks](bt-low-energy7#rsi-ble-gap-register-callbacks), [rsi_ble_gatt_prepare_write_response](bt-low-energy5#rsi-ble-gatt-prepare-write-response), [rsi_ble_gatt_read_response](bt-low-energy5#rsi-ble-gatt-read-response), [rsi_ble_gatt_register_callbacks](bt-low-energy7#rsi-ble-gatt-register-callbacks), [rsi_ble_gatt_write_response](bt-low-energy5#rsi-ble-gatt-write-response), [rsi_ble_get_att_descriptors](bt-low-energy3#rsi-ble-get-att-descriptors), [rsi_ble_get_att_descriptors_async](bt-low-energy4#rsi-ble-get-att-descriptors-async), [rsi_ble_get_att_value](bt-low-energy3#rsi-ble-get-att-value), [rsi_ble_get_att_value_async](bt-low-energy4#rsi-ble-get-att-value-async), [rsi_ble_get_char_services](bt-low-energy3#rsi-ble-get-char-services), [rsi_ble_get_char_services_async](bt-low-energy4#rsi-ble-get-char-services-async), [rsi_ble_get_char_value_by_uuid](bt-low-energy3#rsi-ble-get-char-value-by-uuid), [rsi_ble_get_char_value_by_uuid_async](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async), [rsi_ble_get_device_state](bt-low-energy1#rsi-ble-get-device-state), [rsi_ble_get_inc_services](bt-low-energy3#rsi-ble-get-inc-services), [rsi_ble_get_inc_services_async](bt-low-energy4#rsi-ble-get-inc-services-async), [rsi_ble_get_le_ping_timeout](bt-low-energy1#rsi-ble-get-le-ping-timeout), [rsi_ble_get_local_att_value](bt-low-energy5#rsi-ble-get-local-att-value), [rsi_ble_get_long_att_value](bt-low-energy3#rsi-ble-get-long-att-value), [rsi_ble_get_long_att_value_async](bt-low-energy4#rsi-ble-get-long-att-value-async), [rsi_ble_get_multiple_att_values](bt-low-energy3#rsi-ble-get-multiple-att-values), [rsi_ble_get_multiple_att_values_async](bt-low-energy4#rsi-ble-get-multiple-att-values-async), [rsi_ble_get_profile](bt-low-energy3#rsi-ble-get-profile), [rsi_ble_get_profile_async](bt-low-energy4#rsi-ble-get-profile-async), [rsi_ble_get_profiles](bt-low-energy3#rsi-ble-get-profiles), [rsi_ble_get_profiles_async](bt-low-energy4#rsi-ble-get-profiles-async), [rsi_ble_get_resolving_list_size](bt-low-energy1#rsi-ble-get-resolving-list-size), [rsi_ble_indicate_confirm](bt-low-energy4#rsi-ble-indicate-confirm), [rsi_ble_indicate_value](bt-low-energy5#rsi-ble-indicate-value), [rsi_ble_indicate_value_sync](bt-low-energy4#rsi-ble-indicate-value-sync), [rsi_ble_ltk_req_reply](bt-low-energy1#rsi-ble-ltk-req-reply), [rsi_ble_mtu_exchange_event](bt-low-energy3#rsi-ble-mtu-exchange-event), [rsi_ble_notify_value](bt-low-energy5#rsi-ble-notify-value), [rsi_ble_on_chip_memory_status_callbacks_register](driver14#rsi-ble-on-chip-memory-status-callbacks-register), [rsi_ble_per_receive](bt-low-energy6#rsi-ble-per-receive), [rsi_ble_per_transmit](bt-low-energy6#rsi-ble-per-transmit), [rsi_ble_prepare_write](bt-low-energy3#rsi-ble-prepare-write), [rsi_ble_prepare_write_async](bt-low-energy4#rsi-ble-prepare-write-async), [rsi_ble_read_max_data_len](bt-low-energy1#rsi-ble-read-max-data-len), [rsi_ble_readphy](bt-low-energy1#rsi-ble-readphy), [rsi_ble_remove_gatt_attibute](bt-low-energy5#rsi-ble-remove-gatt-attibute), [rsi_ble_remove_gatt_service](bt-low-energy5#rsi-ble-remove-gatt-service), [rsi_ble_resolvlist](bt-low-energy1#rsi-ble-resolvlist), [rsi_ble_rx_test_mode](bt-low-energy6#rsi-ble-rx-test-mode), [rsi_ble_set_addr_resolution_enable](bt-low-energy1#rsi-ble-set-addr-resolution-enable), [rsi_ble_set_advertise_data](bt-low-energy1#rsi-ble-set-advertise-data), [rsi_ble_set_att_cmd](bt-low-energy3#rsi-ble-set-att-cmd), [rsi_ble_set_att_value](bt-low-energy3#rsi-ble-set-att-value), [rsi_ble_set_att_value_async](bt-low-energy4#rsi-ble-set-att-value-async), [rsi_ble_set_data_len](bt-low-energy1#rsi-ble-set-data-len), [rsi_ble_set_le_ping_timeout](bt-low-energy1#rsi-ble-set-le-ping-timeout), [rsi_ble_set_local_att_value](bt-low-energy5#rsi-ble-set-local-att-value), [rsi_ble_set_local_irk_value](bt-low-energy1#rsi-ble-set-local-irk-value), [rsi_ble_set_long_att_value](bt-low-energy3#rsi-ble-set-long-att-value), [rsi_ble_set_privacy_mode](bt-low-energy1#rsi-ble-set-privacy-mode), [rsi_ble_set_random_address](bt-low-energy1#rsi-ble-set-random-address), [rsi_ble_set_random_address_with_value](bt-low-energy1#rsi-ble-set-random-address-with-value), [rsi_ble_set_scan_response_data](bt-low-energy1#rsi-ble-set-scan-response-data), [rsi_ble_set_smp_pairing_cap_data](bt-low-energy1#rsi-ble-set-smp-pairing-cap-data), [rsi_ble_set_wo_resp_notify_buf_info](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info), [rsi_ble_setphy](bt-low-energy1#rsi-ble-setphy), [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request), [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response), [rsi_ble_smp_passkey](bt-low-energy1#rsi-ble-smp-passkey), [rsi_ble_smp_register_callbacks](bt-low-energy7#rsi-ble-smp-register-callbacks), [rsi_ble_start_advertising](bt-low-energy1#rsi-ble-start-advertising), [rsi_ble_start_advertising_with_values](bt-low-energy1#rsi-ble-start-advertising-with-values), [rsi_ble_start_encryption](bt-low-energy1#rsi-ble-start-encryption), [rsi_ble_start_scanning](bt-low-energy1#rsi-ble-start-scanning), [rsi_ble_start_scanning_with_values](bt-low-energy1#rsi-ble-start-scanning-with-values), [rsi_ble_stop_advertising](bt-low-energy1#rsi-ble-stop-advertising), [rsi_ble_stop_scanning](bt-low-energy1#rsi-ble-stop-scanning), [rsi_ble_tx_test_mode](bt-low-energy6#rsi-ble-tx-test-mode), [rsi_ble_update_directed_address](bt-low-energy1#rsi-ble-update-directed-address), [rsi_ble_update_le_dev_buf](driver14#rsi-ble-update-le-dev-buf), [rsi_ble_vendor_rf_type](bt-low-energy1#rsi-ble-vendor-rf-type), [rsi_bt_a2dp_abort](bt-classic1#rsi-bt-a2dp-abort), [rsi_bt_a2dp_close](bt-classic1#rsi-bt-a2dp-close), [rsi_bt_a2dp_connect](bt-classic1#rsi-bt-a2dp-connect), [rsi_bt_a2dp_disconnect](bt-classic1#rsi-bt-a2dp-disconnect), [rsi_bt_a2dp_get_config](bt-classic1#rsi-bt-a2dp-get-config), [rsi_bt_a2dp_init](bt-classic1#rsi-bt-a2dp-init), [rsi_bt_a2dp_register_callbacks](bt-classic6#rsi-bt-a2dp-register-callbacks), [rsi_bt_a2dp_send_sbc_aac_data](bt-classic1#rsi-bt-a2dp-send-sbc-aac-data), [rsi_bt_a2dp_set_config](bt-classic1#rsi-bt-a2dp-set-config), [rsi_bt_a2dp_start](bt-classic1#rsi-bt-a2dp-start), [rsi_bt_a2dp_suspend](bt-classic1#rsi-bt-a2dp-suspend), [rsi_bt_ar_events_register_callbacks](bt-classic6#rsi-bt-ar-events-register-callbacks), [rsi_bt_avdtp_events_register_callbacks](bt-classic6#rsi-bt-avdtp-events-register-callbacks), [rsi_bt_avrcp_att_list_resp](bt-classic2#rsi-bt-avrcp-att-list-resp), [rsi_bt_avrcp_att_text_resp](bt-classic2#rsi-bt-avrcp-att-text-resp), [rsi_bt_avrcp_att_val_list_resp](bt-classic2#rsi-bt-avrcp-att-val-list-resp), [rsi_bt_avrcp_att_vals_text_resp](bt-classic2#rsi-bt-avrcp-att-vals-text-resp), [rsi_bt_avrcp_batt_status](bt-classic2#rsi-bt-avrcp-batt-status), [rsi_bt_avrcp_batt_status_resp](bt-classic2#rsi-bt-avrcp-batt-status-resp), [rsi_bt_avrcp_cap_resp](bt-classic2#rsi-bt-avrcp-cap-resp), [rsi_bt_avrcp_char_set_status_resp](bt-classic2#rsi-bt-avrcp-char-set-status-resp), [rsi_bt_avrcp_cmd_reject](bt-classic2#rsi-bt-avrcp-cmd-reject), [rsi_bt_avrcp_conn](bt-classic2#rsi-bt-avrcp-conn), [rsi_bt_avrcp_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-cur-att-val-resp), [rsi_bt_avrcp_disconn](bt-classic2#rsi-bt-avrcp-disconn), [rsi_bt_avrcp_ele_att_resp](bt-classic2#rsi-bt-avrcp-ele-att-resp), [rsi_bt_avrcp_get_att_list](bt-classic2#rsi-bt-avrcp-get-att-list), [rsi_bt_avrcp_get_att_text](bt-classic2#rsi-bt-avrcp-get-att-text), [rsi_bt_avrcp_get_att_val_text](bt-classic2#rsi-bt-avrcp-get-att-val-text), [rsi_bt_avrcp_get_att_vals_list](bt-classic2#rsi-bt-avrcp-get-att-vals-list), [rsi_bt_avrcp_get_capabilities](bt-classic2#rsi-bt-avrcp-get-capabilities), [rsi_bt_avrcp_get_cur_att_val](bt-classic2#rsi-bt-avrcp-get-cur-att-val), [rsi_bt_avrcp_get_element_att](bt-classic2#rsi-bt-avrcp-get-element-att), [rsi_bt_avrcp_get_folder_items_resp](bt-classic2#rsi-bt-avrcp-get-folder-items-resp), [rsi_bt_avrcp_get_play_status](bt-classic2#rsi-bt-avrcp-get-play-status), [rsi_bt_avrcp_get_remote_version](bt-classic2#rsi-bt-avrcp-get-remote-version), [rsi_bt_avrcp_get_tot_num_items_resp](bt-classic2#rsi-bt-avrcp-get-tot-num-items-resp), [rsi_bt_avrcp_init](bt-classic2#rsi-bt-avrcp-init), [rsi_bt_avrcp_next](bt-classic2#rsi-bt-avrcp-next), [rsi_bt_avrcp_notify](bt-classic2#rsi-bt-avrcp-notify), [rsi_bt_avrcp_pause](bt-classic2#rsi-bt-avrcp-pause), [rsi_bt_avrcp_play](bt-classic2#rsi-bt-avrcp-play), [rsi_bt_avrcp_play_status_resp](bt-classic2#rsi-bt-avrcp-play-status-resp), [rsi_bt_avrcp_previous](bt-classic2#rsi-bt-avrcp-previous), [rsi_bt_avrcp_reg_notification](bt-classic2#rsi-bt-avrcp-reg-notification), [rsi_bt_avrcp_reg_notify_resp](bt-classic2#rsi-bt-avrcp-reg-notify-resp), [rsi_bt_avrcp_register_callbacks](bt-classic6#rsi-bt-avrcp-register-callbacks), [rsi_bt_avrcp_set_abs_vol](bt-classic2#rsi-bt-avrcp-set-abs-vol), [rsi_bt_avrcp_set_abs_vol_resp](bt-classic2#rsi-bt-avrcp-set-abs-vol-resp), [rsi_bt_avrcp_set_addr_player_resp](bt-classic2#rsi-bt-avrcp-set-addr-player-resp), [rsi_bt_avrcp_set_cur_att_val](bt-classic2#rsi-bt-avrcp-set-cur-att-val), [rsi_bt_avrcp_set_cur_att_val_resp](bt-classic2#rsi-bt-avrcp-set-cur-att-val-resp), [rsi_bt_avrcp_stop](bt-classic2#rsi-bt-avrcp-stop), [rsi_bt_avrcp_supp_char_sets](bt-classic2#rsi-bt-avrcp-supp-char-sets), [rsi_bt_avrcp_target_register_callbacks](bt-classic6#rsi-bt-avrcp-target-register-callbacks), [rsi_bt_avrcp_vol_down](bt-classic2#rsi-bt-avrcp-vol-down), [rsi_bt_avrcp_vol_up](bt-classic2#rsi-bt-avrcp-vol-up), [rsi_bt_ber_enable_or_disable](bt-ble#rsi-bt-ber-enable-or-disable), [rsi_bt_callbacks_handler](driver14#rsi-bt-callbacks-handler), [rsi_bt_cb_init](driver14#rsi-bt-cb-init), [rsi_bt_clear_wait_bitmap](driver14#rsi-bt-clear-wait-bitmap), [rsi_bt_cmd_update_gain_table_offset_or_max_pwr](bt-ble#rsi-bt-cmd-update-gain-table-offset-or-max-pwr), [rsi_bt_common_init](driver14#rsi-bt-common-init), [rsi_bt_common_tx_done](driver14#rsi-bt-common-tx-done), [rsi_bt_deinit](bt-ble#rsi-bt-deinit), [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd), [rsi_bt_gap_register_callbacks](bt-classic6#rsi-bt-gap-register-callbacks), [rsi_bt_gatt_extended_register_callbacks](driver14#rsi-bt-gatt-extended-register-callbacks), [rsi_bt_get_ACL_type](driver14#rsi-bt-get-acl-type), [rsi_bt_get_bt_stack_version](bt-ble#rsi-bt-get-bt-stack-version), [rsi_bt_get_country_region](bt-ble#rsi-bt-get-country-region), [rsi_bt_get_local_class_of_device](bt-classic3#rsi-bt-get-local-class-of-device), [rsi_bt_get_local_device_address](bt-ble#rsi-bt-get-local-device-address), [rsi_bt_get_local_name](bt-ble#rsi-bt-get-local-name), [rsi_bt_get_proto_type](driver14#rsi-bt-get-proto-type), [rsi_bt_get_rssi](bt-ble#rsi-bt-get-rssi), [rsi_bt_get_timeout](driver14#rsi-bt-get-timeout), [rsi_bt_global_cb_init](driver14#rsi-bt-global-cb-init), [rsi_bt_init](bt-ble#rsi-bt-init), [rsi_bt_per_cw_mode](bt-classic5#rsi-bt-per-cw-mode), [rsi_bt_per_stats](bt-classic5#rsi-bt-per-stats), [rsi_bt_pkt_change_events_register_callbacks](bt-classic6#rsi-bt-pkt-change-events-register-callbacks), [rsi_bt_power_save_profile](bt-ble#rsi-bt-power-save-profile), [rsi_bt_prepare_classic_pkt](driver14#rsi-bt-prepare-classic-pkt), [rsi_bt_prepare_common_pkt](driver14#rsi-bt-prepare-common-pkt), [rsi_bt_prepare_le_pkt](driver14#rsi-bt-prepare-le-pkt), [rsi_bt_set_antenna](bt-ble#rsi-bt-set-antenna), [rsi_bt_set_antenna_tx_power_level](bt-ble#rsi-bt-set-antenna-tx-power-level), [rsi_bt_set_bd_addr](bt-ble#rsi-bt-set-bd-addr), [rsi_bt_set_country_region](bt-ble#rsi-bt-set-country-region), [rsi_bt_set_local_class_of_device](bt-classic3#rsi-bt-set-local-class-of-device), [rsi_bt_set_local_name](bt-ble#rsi-bt-set-local-name), [rsi_bt_set_status](driver14#rsi-bt-set-status), [rsi_bt_set_wait_bitmap](driver14#rsi-bt-set-wait-bitmap), [rsi_bt_spp_connect](bt-classic4#rsi-bt-spp-connect), [rsi_bt_spp_disconnect](bt-classic4#rsi-bt-spp-disconnect), [rsi_bt_spp_init](bt-classic4#rsi-bt-spp-init), [rsi_bt_spp_register_callbacks](bt-classic6#rsi-bt-spp-register-callbacks), [rsi_bt_spp_transfer](bt-classic4#rsi-bt-spp-transfer), [rsi_bt_start_discoverable](bt-classic3#rsi-bt-start-discoverable), [rsi_bt_start_limited_discoverable](bt-classic3#rsi-bt-start-limited-discoverable), [rsi_bt_vendor_ar_enable](bt-classic5#rsi-bt-vendor-ar-enable), [rsi_bt_vendor_avdtp_stats_enable](bt-classic5#rsi-bt-vendor-avdtp-stats-enable), [rsi_bt_vendor_dynamic_pwr](bt-classic5#rsi-bt-vendor-dynamic-pwr), [rsi_bt_vendor_set_hapi_rect_val](bt-classic5#rsi-bt-vendor-set-hapi-rect-val), [rsi_cal_mqtt_packet_len](network2#rsi-cal-mqtt-packet-len), [rsi_calib_read](wlan#rsi-calib-read), [rsi_calib_write](wlan#rsi-calib-write), [rsi_calibrate_dpd](wlan#rsi-calibrate-dpd), [rsi_cmd_m4_ta_secure_handshake](common#rsi-cmd-m4-ta-secure-handshake), [rsi_cmd_to_wr_comm_flash](common#rsi-cmd-to-wr-comm-flash), [rsi_cmd_uart_flow_ctrl](common#rsi-cmd-uart-flow-ctrl), [rsi_common_debug_log](common#rsi-common-debug-log), [rsi_config_ipaddress](wlan#rsi-config-ipaddress), [rsi_destroy_driver_task_and_driver_deinit](common#rsi-destroy-driver-task-and-driver-deinit), [rsi_device_deinit](common#rsi-device-deinit), [rsi_device_init](common#rsi-device-init), [rsi_dhcp_user_class](network1#rsi-dhcp-user-class), [rsi_dns_req](network6#rsi-dns-req), [rsi_dns_req_async](network6#rsi-dns-req-async), [rsi_dns_update](network6#rsi-dns-update), [rsi_driver_deinit](common#rsi-driver-deinit), [rsi_driver_init](common#rsi-driver-init), [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp), [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler), [rsi_driver_version](common#rsi-driver-version), [rsi_ecdh_point_addition](crypto#rsi-ecdh-point-addition), [rsi_ecdh_point_affine](crypto#rsi-ecdh-point-affine), [rsi_ecdh_point_double](crypto#rsi-ecdh-point-double), [rsi_ecdh_point_multiplication](crypto#rsi-ecdh-point-multiplication), [rsi_ecdh_point_subtraction](crypto#rsi-ecdh-point-subtraction), [rsi_ecdsa_256_verify_hash](common#rsi-ecdsa-256-verify-hash), [rsi_emb_mqtt_client_init](network2#rsi-emb-mqtt-client-init), [rsi_emb_mqtt_connect](network2#rsi-emb-mqtt-connect), [rsi_emb_mqtt_destroy](network2#rsi-emb-mqtt-destroy), [rsi_emb_mqtt_disconnect](network2#rsi-emb-mqtt-disconnect), [rsi_emb_mqtt_publish](network2#rsi-emb-mqtt-publish), [rsi_emb_mqtt_register_call_back](network2#rsi-emb-mqtt-register-call-back), [rsi_emb_mqtt_subscribe](network2#rsi-emb-mqtt-subscribe), [rsi_emb_mqtt_unsubscribe](network2#rsi-emb-mqtt-unsubscribe), [rsi_evm_write](wlan#rsi-evm-write), [rsi_exponentiation](crypto#rsi-exponentiation), [rsi_fill_config_profile](wlan#rsi-fill-config-profile), [rsi_ftp_connect](network8#rsi-ftp-connect), [rsi_ftp_directory_create](network8#rsi-ftp-directory-create), [rsi_ftp_directory_delete](network8#rsi-ftp-directory-delete), [rsi_ftp_directory_list_async](network8#rsi-ftp-directory-list-async), [rsi_ftp_directory_set](network8#rsi-ftp-directory-set), [rsi_ftp_disconnect](network8#rsi-ftp-disconnect), [rsi_ftp_file_delete](network8#rsi-ftp-file-delete), [rsi_ftp_file_read_aysnc](network8#rsi-ftp-file-read-aysnc), [rsi_ftp_file_rename](network8#rsi-ftp-file-rename), [rsi_ftp_file_size_set](network8#rsi-ftp-file-size-set), [rsi_ftp_file_write](network8#rsi-ftp-file-write), [rsi_ftp_file_write_content](network8#rsi-ftp-file-write-content), [rsi_ftp_mode_set](network8#rsi-ftp-mode-set), [rsi_fwup_load](firmware#rsi-fwup-load), [rsi_fwup_start](firmware#rsi-fwup-start), [rsi_get_bt_state](driver14#rsi-get-bt-state), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_get_ram_dump](common#rsi-get-ram-dump), [rsi_get_ram_log](common#rsi-get-ram-log), [rsi_get_random_bytes](wlan#rsi-get-random-bytes), [rsi_get_rom_version](driver6#rsi-get-rom-version), [rsi_get_rtc_timer](common#rsi-get-rtc-timer), [rsi_gpio_pininit](common#rsi-gpio-pininit), [rsi_gpio_readpin](common#rsi-gpio-readpin), [rsi_gpio_writepin](common#rsi-gpio-writepin), [rsi_hmac_sha](crypto#rsi-hmac-sha), [rsi_hmac_sha_pen](crypto#rsi-hmac-sha-pen), [rsi_http_client_abort](network9#rsi-http-client-abort), [rsi_http_client_async](network9#rsi-http-client-async), [rsi_http_client_post_data](network9#rsi-http-client-post-data), [rsi_http_client_put_create](network9#rsi-http-client-put-create), [rsi_http_client_put_delete](network9#rsi-http-client-put-delete), [rsi_http_client_put_pkt](network9#rsi-http-client-put-pkt), [rsi_http_client_put_start](network9#rsi-http-client-put-start), [rsi_http_credentials](network9#rsi-http-credentials), [rsi_http_otaf_async](network9#rsi-http-otaf-async), [rsi_json_object_delete](network14#rsi-json-object-delete), [rsi_mdnsd_deinit](network15#rsi-mdnsd-deinit), [rsi_mdnsd_init](network15#rsi-mdnsd-init), [rsi_mdnsd_register_service](network15#rsi-mdnsd-register-service), [rsi_mqtt_client_init](network13#rsi-mqtt-client-init), [rsi_mqtt_connect](network13#rsi-mqtt-connect), [rsi_mqtt_disconnect](network13#rsi-mqtt-disconnect), [rsi_mqtt_poll_for_recv_data](network13#rsi-mqtt-poll-for-recv-data), [rsi_mqtt_publish](network13#rsi-mqtt-publish), [rsi_mqtt_subscribe](network13#rsi-mqtt-subscribe), [rsi_mqtt_unsubscribe](network13#rsi-mqtt-unsubscribe), [rsi_multicast_join](network3#rsi-multicast-join), [rsi_multicast_leave](network3#rsi-multicast-leave), [rsi_nwk_register_callbacks](wlan#rsi-nwk-register-callbacks), [rsi_powersave_gpio_init](driver5#rsi-powersave-gpio-init), [rsi_register_auto_config_rsp_handler](wlan#rsi-register-auto-config-rsp-handler), [rsi_register_wait_timeout_error_callbacks](common#rsi-register-wait-timeout-error-callbacks), [rsi_remove_remote_ble_dev_info](driver14#rsi-remove-remote-ble-dev-info), [rsi_req_wireless_fwup](firmware#rsi-req-wireless-fwup), [rsi_robust_drv_start_handshake](common#rsi-robust-drv-start-handshake), [rsi_sdio_iface_init](driver1#rsi-sdio-iface-init), [rsi_send_evm_offset](wlan#rsi-send-evm-offset), [rsi_send_feature_frame](common#rsi-send-feature-frame), [rsi_send_feature_frame_dyn](common#rsi-send-feature-frame-dyn), [rsi_send_freq_offset](wlan#rsi-send-freq-offset), [rsi_send_raw_data](network3#rsi-send-raw-data), [rsi_set_fast_fw_up](driver5#rsi-set-fast-fw-up), [rsi_set_rtc_timer](common#rsi-set-rtc-timer), [rsi_sha](crypto#rsi-sha), [rsi_sha_pen](crypto#rsi-sha-pen), [rsi_sntp_client_create_async](network12#rsi-sntp-client-create-async), [rsi_sntp_client_delete_async](network12#rsi-sntp-client-delete-async), [rsi_sntp_client_gettime](network12#rsi-sntp-client-gettime), [rsi_sntp_client_gettime_date](network12#rsi-sntp-client-gettime-date), [rsi_sntp_client_server_info](network12#rsi-sntp-client-server-info), [rsi_sort_scan_results_array_based_on_rssi](wlan#rsi-sort-scan-results-array-based-on-rssi), [rsi_spi_iface_init](driver2#rsi-spi-iface-init), [rsi_switch_proto](common#rsi-switch-proto), [rsi_transmit_test_start](wlan#rsi-transmit-test-start), [rsi_transmit_test_start_with_number_pkts](wlan#rsi-transmit-test-start-with-number-pkts), [rsi_transmit_test_stop](wlan#rsi-transmit-test-stop), [rsi_tx_event_handler](driver8#rsi-tx-event-handler), [rsi_uart_init](driver3#rsi-uart-init), [rsi_uregister_events_callbacks](common#rsi-uregister-events-callbacks), [rsi_web_socket_close](network5#rsi-web-socket-close), [rsi_web_socket_create](network5#rsi-web-socket-create), [rsi_web_socket_send_async](network5#rsi-web-socket-send-async), [rsi_webpage_erase](network14#rsi-webpage-erase), [rsi_webpage_load](network14#rsi-webpage-load), [rsi_webpage_send](network14#rsi-webpage-send), [rsi_wireless_antenna](common#rsi-wireless-antenna), [rsi_wireless_deinit](common#rsi-wireless-deinit), [rsi_wireless_driver_task](common#rsi-wireless-driver-task), [rsi_wireless_init](common#rsi-wireless-init), [rsi_wlan_add_profile](wlan#rsi-wlan-add-profile), [rsi_wlan_ap_start](wlan#rsi-wlan-ap-start), [rsi_wlan_ap_stop](wlan#rsi-wlan-ap-stop), [rsi_wlan_beacon_stop](wlan#rsi-wlan-beacon-stop), [rsi_wlan_bgscan_profile](wlan#rsi-wlan-bgscan-profile), [rsi_wlan_buffer_config](wlan#rsi-wlan-buffer-config), [rsi_wlan_connect](wlan#rsi-wlan-connect), [rsi_wlan_connect_async](wlan#rsi-wlan-connect-async), [rsi_wlan_csi_config_async](wlan#rsi-wlan-csi-config-async), [rsi_wlan_delete_profile](wlan#rsi-wlan-delete-profile), [rsi_wlan_disconnect](wlan#rsi-wlan-disconnect), [rsi_wlan_disconnect_stations](wlan#rsi-wlan-disconnect-stations), [rsi_wlan_enable_auto_config](wlan#rsi-wlan-enable-auto-config), [rsi_wlan_execute_post_connect_cmds](wlan#rsi-wlan-execute-post-connect-cmds), [rsi_wlan_filter_broadcast](wlan#rsi-wlan-filter-broadcast), [rsi_wlan_get](wlan#rsi-wlan-get), [rsi_wlan_get_profile](wlan#rsi-wlan-get-profile), [rsi_wlan_get_state](wlan#rsi-wlan-get-state), [rsi_wlan_get_status](wlan#rsi-wlan-get-status), [rsi_wlan_ping_async](wlan#rsi-wlan-ping-async), [rsi_wlan_pmk_generate](wlan#rsi-wlan-pmk-generate), [rsi_wlan_power_save_disable_and_enable](wlan#rsi-wlan-power-save-disable-and-enable), [rsi_wlan_power_save_profile](wlan#rsi-wlan-power-save-profile), [rsi_wlan_power_save_with_listen_interval](wlan#rsi-wlan-power-save-with-listen-interval), [rsi_wlan_radio_deinit](network17#rsi-wlan-radio-deinit), [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init), [rsi_wlan_receive_stats_start](wlan#rsi-wlan-receive-stats-start), [rsi_wlan_receive_stats_stop](wlan#rsi-wlan-receive-stats-stop), [rsi_wlan_register_callbacks](wlan#rsi-wlan-register-callbacks), [rsi_wlan_req_radio](network17#rsi-wlan-req-radio), [rsi_wlan_scan](wlan#rsi-wlan-scan), [rsi_wlan_scan_async](wlan#rsi-wlan-scan-async), [rsi_wlan_scan_async_with_bitmap_options](wlan#rsi-wlan-scan-async-with-bitmap-options), [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options), [rsi_wlan_send_data](wlan#rsi-wlan-send-data), [rsi_wlan_set](wlan#rsi-wlan-set), [rsi_wlan_set_certificate](wlan#rsi-wlan-set-certificate), [rsi_wlan_set_certificate_index](wlan#rsi-wlan-set-certificate-index), [rsi_wlan_set_sleep_timer](wlan#rsi-wlan-set-sleep-timer), [rsi_wlan_update_gain_table](wlan#rsi-wlan-update-gain-table), [rsi_wlan_wps_enter_pin](wlan#rsi-wlan-wps-enter-pin), [rsi_wlan_wps_generate_pin](wlan#rsi-wlan-wps-generate-pin) and [rsi_wlan_wps_push_button_event](wlan#rsi-wlan-wps-push-button-event)

###### rsi_bt_driver_send_cmd (heading level 8)

`return rsi_bt_driver_send_cmd(RSI_BT_REQ_A2DP_PCM_MP3_DATA, &bt_req_a2dp_pcm_mp3_pkt_part2, NULL)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|RSI_BT_REQ_A2DP_PCM_MP3_DATA|N/A|undefined||
|&|N/A|bt_req_a2dp_pcm_mp3_pkt_part2||
|NULL|N/A|undefined||

###### rsi_bt_a2dp_send_sbc_aac_data (heading level 8)

`int32_t rsi_bt_a2dp_send_sbc_aac_data(uint8_t *remote_dev_addr, uint8_t *sbc_aac_data, uint16_t sbc_aac_data_len, uint8_t audio_type)`

**Description:** Send the SBC/AAC data to the BT stack. This is a blocking API. if returns RSI_APP_ERR_HW_BUFFER_OVERFLOW err means that the firmware buffers are full and eventually host will receive a event [rsi_bt_on_a2dp_data_req_t](bt-classic7#rsi-bt-on-a2dp-data-req-t) which requests more data from application.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint8_t *|[in]|sbc_aac_data|- SBC/AAC data buffer.|
|uint16_t|[in]|sbc_aac_data_len|- SBC/AAC data length.|
|uint8_t|[in]|audio_type|- audio type. <br /><br/> 0 - Reserved <br /><br/> 1 - PCM Audio <br /><br/> 2 - SBC Audio <br /><br/> 3 - MP3 Audio|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP start is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4512 RSI_APP_ERR_A2DP_NOT_STREAMING <br />  
   0x4049 RSI_APP_ERR_A2DP_INVALID_SOCKET <br />  
   0x4057 RSI_APP_ERR_HW_BUFFER_OVERFLOW <br />  
   0x405D RSI_APP_ERR_HW_BUFFER_OVERFLOW_TIMEOUT

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [audio_type](bt-classic1#audio-type), [rsi_bt_req_a2dp_sbc_aac_data_s::audio_type](rsi-bt-req-a2dp-sbc-aac-data-s#audio-type), [rsi_bt_req_a2dp_sbc_aac_data_s::dev_addr](rsi-bt-req-a2dp-sbc-aac-data-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_bt_req_a2dp_sbc_aac_data_s::sbc_aac_data](rsi-bt-req-a2dp-sbc-aac-data-s#sbc-aac-data), [rsi_bt_req_a2dp_sbc_aac_data_s::sbc_aac_data_len](rsi-bt-req-a2dp-sbc-aac-data-s#sbc-aac-data-len) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_start (heading level 8)

`int32_t rsi_bt_a2dp_start(uint8_t *remote_dev_addr)`

**Description:** Send the A2DP start to the BT stack to start the stream procedure. This is a blocking API. A received event [rsi_bt_on_a2dp_start_t](bt-classic7#rsi-bt-on-a2dp-start-t) indicates that the a2dp start response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP Open is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_start_s::dev_addr](rsi-bt-req-a2dp-start-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_suspend (heading level 8)

`int32_t rsi_bt_a2dp_suspend(uint8_t *remote_dev_addr)`

**Description:** Send the A2DP suspend to the BT stack. This is a blocking API. A received event [rsi_bt_on_a2dp_suspend_t](bt-classic7#rsi-bt-on-a2dp-suspend-t) indicates that the a2dp suspend response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP start is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_suspend_s::dev_addr](rsi-bt-req-a2dp-suspend-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_close (heading level 8)

`int32_t rsi_bt_a2dp_close(uint8_t *remote_dev_addr)`

**Description:** Send the A2DP close to the BT stack for removing the a2dp stream. This is a blocking API. A received event [rsi_bt_on_a2dp_close_t](bt-classic7#rsi-bt-on-a2dp-close-t) indicates that the a2dp close response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP start is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_close_s::dev_addr](rsi-bt-req-a2dp-close-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_abort (heading level 8)

`int32_t rsi_bt_a2dp_abort(uint8_t *remote_dev_addr)`

**Description:** Send the A2DP abort to the BT stack for aborting the exsting a2dp link. This is a blocking API. A received event [rsi_bt_on_a2dp_abort_t](bt-classic7#rsi-bt-on-a2dp-abort-t) indicates that the a2dp abort response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP start is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_abort_s::dev_addr](rsi-bt-req-a2dp-abort-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_get_config (heading level 8)

`int32_t rsi_bt_a2dp_get_config(uint8_t *remote_dev_addr, rsi_bt_resp_a2dp_get_config_t *sbc_resp_cap)`

**Description:** To get remote device CODEC configuration. This is a blocking API.<br />
.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[rsi_bt_resp_a2dp_get_config_t](rsi-bt-resp-a2dp-get-config-s) *|[out]|sbc_resp_cap|- get audio codec params response from stack, please refer [rsi_bt_resp_a2dp_get_config_s](rsi-bt-resp-a2dp-get-config-s) structure for more info.|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_get_config_s::dev_addr](rsi-bt-req-a2dp-get-config-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_set_config (heading level 8)

`int32_t rsi_bt_a2dp_set_config(uint8_t *remote_dev_addr, rsi_bt_a2dp_sbc_codec_cap_t *set_sbc_cap, int32_t *status)`

**Description:** Set A2DP CODEC configuration. Used for A2DP Reconfig purposes. This is a blocking API. A received event [rsi_bt_on_a2dp_reconfig_t](bt-classic7#rsi-bt-on-a2dp-reconfig-t) indicates that the a2dp reconfig response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[rsi_bt_a2dp_sbc_codec_cap_t](rsi-bt-a2dp-sbc-codec-cap-s) *|[in]|set_sbc_cap|- new SBC codec params used for reconfig, please refer [rsi_bt_a2dp_sbc_codec_cap_s](rsi-bt-a2dp-sbc-codec-cap-s) structure for more info.|
|int32_t *|[in]|status|- This is the response status.|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP Open is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4513 RSI_APP_ERR_A2DP_SBC_SAME_CODEC_PARAMS <br />  
   0x4514 RSI_APP_ERR_A2DP_RECONFIG_CMD_TIMEOUT

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_a2dp_set_config_s::dev_addr](rsi-bt-req-a2dp-set-config-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_bt_req_a2dp_set_config_s::sbc_cap](rsi-bt-req-a2dp-set-config-s#sbc-cap) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_send_pcm_mp3_data (heading level 8)

`int32_t rsi_bt_a2dp_send_pcm_mp3_data(uint8_t *remote_dev_addr, uint8_t *pcm_mp3_data, uint16_t pcm_mp3_data_len, uint8_t audio_type)`

**Description:** Send the PCM data to the BT stack. This is a blocking API. if returns RSI_APP_ERR_HW_BUFFER_OVERFLOW err means that the firmware buffers are full and eventually host will receive a event [rsi_bt_on_a2dp_data_req_t](bt-classic7#rsi-bt-on-a2dp-data-req-t) which requests more data from application.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint8_t *|[in]|pcm_mp3_data|- PCM data buffer.|
|uint16_t|[in]|pcm_mp3_data_len|- PCM data length.|
|uint8_t|[in]|audio_type|- audio type. <br /><br/> 0 - Reserved <br /><br/> 1 - PCM Audio <br /><br/> 2 - SBC Audio <br /><br/> 3 - MP3 Audio|

- Call [rsi_bt_a2dp_init()](bt-classic1#rsi-bt-a2dp-init) and [rsi_bt_a2dp_connect()](bt-classic1#rsi-bt-a2dp-connect) before calling this API. <br />  
   Call this API only after A2DP start is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4512 RSI_APP_ERR_A2DP_NOT_STREAMING <br />  
   0x4049 RSI_APP_ERR_A2DP_INVALID_SOCKET <br />  
   0x4057 RSI_APP_ERR_HW_BUFFER_OVERFLOW

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

###### AVRCP

###### Functions (heading level 7)

###### rsi_bt_avrcp_init (heading level 8)

`int32_t rsi_bt_avrcp_init(uint8_t *avrcp_feature)`

**Description:** Set the AVRCP profile mode and also enables the Media Player Selection Feature, if required. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|avrcp_feature|- used for enabling avrcp features <br /><br/> NULL - Default features used <br /><br/> 1 - MediaPlayerSelection Feature Enable|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- if NULL is passed, AVRCP profile initialize with default stack features. <br />

**References:** [rsi_bt_req_profile_mode_s::data](rsi-bt-req-profile-mode-s#data), [rsi_bt_req_profile_mode_s::data_len](rsi-bt-req-profile-mode-s#data-len), [rsi_bt_req_profile_mode_s::profile_mode](rsi-bt-req-profile-mode-s#profile-mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_conn (heading level 8)

`int32_t rsi_bt_avrcp_conn(uint8_t *remote_dev_addr)`

**Description:** Initiate avrcp connection This is a blocking API. A received event [rsi_bt_on_avrcp_connect_t](bt-classic7#rsi-bt-on-avrcp-connect-t) indicates that the avrcp connection response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) before calling this API. Call this API after BT PHY level conn is completed.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4540 ERR_BT_AVRCP_NOT_INITIALISED

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- If A2DP Profile is Initialized, then before calling this API the a2dp connection should be established using this rsi_bt_a2dp_conn() API and once <br />[rsi_bt_on_a2dp_open_t](bt-classic7#rsi-bt-on-a2dp-open-t) callback is received start the streaming using rsi_bt_stream_start() API. <br />  
   This is applicable for all AVRCP related API's.

**References:** [rsi_bt_req_avrcp_conn_s::dev_addr](rsi-bt-req-avrcp-conn-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_disconn (heading level 8)

`int32_t rsi_bt_avrcp_disconn(uint8_t *remote_dev_addr)`

**Description:** Initiate avrcp disconnection. This is a blocking API. A received event [rsi_bt_on_avrcp_disconnect_t](bt-classic7#rsi-bt-on-avrcp-disconnect-t) indicates that the avrcp disconnection response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_disconnect_s::dev_addr](rsi-bt-req-avrcp-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_play (heading level 8)

`int32_t rsi_bt_avrcp_play(uint8_t *remote_dev_addr)`

**Description:** To play a track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_play_t](bt-classic7#rsi-bt-on-avrcp-play-t) indicates that the avrcp play(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_play_s::dev_addr](rsi-bt-req-avrcp-play-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_pause (heading level 8)

`int32_t rsi_bt_avrcp_pause(uint8_t *remote_dev_addr)`

**Description:** To Pause a track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_pause_t](bt-classic7#rsi-bt-on-avrcp-pause-t) indicates that the avrcp pause(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_pause_s::dev_addr](rsi-bt-req-avrcp-pause-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_stop (heading level 8)

`int32_t rsi_bt_avrcp_stop(uint8_t *remote_dev_addr)`

**Description:** To Stop a track, call this API. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_stop_s::dev_addr](rsi-bt-req-avrcp-stop-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_next (heading level 8)

`int32_t rsi_bt_avrcp_next(uint8_t *remote_dev_addr)`

**Description:** To Play the next track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_next_t](bt-classic7#rsi-bt-on-avrcp-next-t) indicates that the avrcp next(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_next_s::dev_addr](rsi-bt-req-avrcp-next-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_previous (heading level 8)

`int32_t rsi_bt_avrcp_previous(uint8_t *remote_dev_addr)`

**Description:** To move to previous track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_previous_t](bt-classic7#rsi-bt-on-avrcp-previous-t) indicates that the avrcp previous(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_previous_s::dev_addr](rsi-bt-req-avrcp-previous-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_vol_up (heading level 8)

`int32_t rsi_bt_avrcp_vol_up(uint8_t *remote_dev_addr)`

**Description:** To Increase the volume of a track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_vol_up_t](bt-classic7#rsi-bt-on-avrcp-vol-up-t) indicates that the avrcp volume(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_vol_up_s::dev_addr](rsi-bt-req-avrcp-vol-up-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_vol_down (heading level 8)

`int32_t rsi_bt_avrcp_vol_down(uint8_t *remote_dev_addr)`

**Description:** To Decrease the volume a track, call this API. This is a blocking API. A received event [rsi_bt_on_avrcp_vol_down_t](bt-classic7#rsi-bt-on-avrcp-vol-down-t) indicates that the avrcp volume(Button Pressed/Button Released) response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_vol_down_s::dev_addr](rsi-bt-req-avrcp-vol-down-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_capabilities (heading level 8)

`int32_t rsi_bt_avrcp_get_capabilities(uint8_t *remote_dev_addr, uint8_t capability_type, rsi_bt_rsp_avrcp_get_capabilities_t *cap_list)`

**Description:** Gets the capabilities supported by remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint8_t|[in]|capability_type|- capability type (either 2 or 3) <br /><br/> 2 - Company ID <br /><br/> 3 - Events Supported|
|[rsi_bt_rsp_avrcp_get_capabilities_t](rsi-bt-rsp-avrcp-get-capabilities-s) *|[out]|cap_list|- get remote capability list. Please refer [rsi_bt_rsp_avrcp_get_capabilities_s](rsi-bt-rsp-avrcp-get-capabilities-s)<br /><br/> structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_get_capabilities_s::dev_addr](rsi-bt-req-avrcp-get-capabilities-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_req_avrcp_get_capabilities_s::type](rsi-bt-req-avrcp-get-capabilities-s#type)

###### rsi_bt_avrcp_get_att_list (heading level 8)

`int32_t rsi_bt_avrcp_get_att_list(uint8_t *remote_dev_addr, rsi_bt_rsp_avrcp_get_atts_list_t *att_list)`

**Description:** Requests the TG to provide target supported player application setting attributes. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[rsi_bt_rsp_avrcp_get_atts_list_t](rsi-bt-rsp-avrcp-get-atts-list-s) *|[out]|att_list|- attribute list, Please refer [rsi_bt_rsp_avrcp_get_atts_list_s](rsi-bt-rsp-avrcp-get-atts-list-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_att_list_s::dev_addr](rsi-bt-req-avrcp-get-att-list-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_att_vals_list (heading level 8)

`int32_t rsi_bt_avrcp_get_att_vals_list(uint8_t *remote_dev_addr, uint8_t att_id, rsi_bt_rsp_avrcp_get_att_vals_list_t *att_vals_list)`

**Description:** Requests the TG to list the set of possible values for the requested player application setting attribute. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint8_t|[in]|att_id|- attribute ID|
|[rsi_bt_rsp_avrcp_get_att_vals_list_t](rsi-bt-rsp-avrcp-get-att-vals-list-s) *|[out]|att_vals_list|- attribute value list, Please refer [rsi_bt_rsp_avrcp_get_att_vals_list_s](rsi-bt-rsp-avrcp-get-att-vals-list-s) structure for more info. <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_att_vals_list_s::att_id](rsi-bt-req-avrcp-get-att-vals-list-s#att-id), [rsi_bt_req_avrcp_get_att_vals_list_s::dev_addr](rsi-bt-req-avrcp-get-att-vals-list-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_cur_att_val (heading level 8)

`int32_t rsi_bt_avrcp_get_cur_att_val(uint8_t *remote_dev_addr, uint8_t *att_list, uint8_t nbr_atts, rsi_bt_rsp_avrcp_get_cur_att_val_t *att_vals_list)`

**Description:** Requests the TG to provide the current set values on the target for the provided player application setting attributes list. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint8_t *|[in]|att_list|- attribute ID|
|uint8_t|[in]|nbr_atts|- number of attributes|
|[rsi_bt_rsp_avrcp_get_cur_att_val_t](rsi-bt-rsp-avrcp-get-cur-att-val-s) *|[out]|att_vals_list|- attribute value list, Please refer [rsi_bt_rsp_avrcp_get_cur_att_val_s](rsi-bt-rsp-avrcp-get-cur-att-val-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_cur_att_val_s::att_list](rsi-bt-req-avrcp-get-cur-att-val-s#att-list), [rsi_bt_req_avrcp_get_cur_att_val_s::dev_addr](rsi-bt-req-avrcp-get-cur-att-val-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_avrcp_get_cur_att_val_s::nbr_atts](rsi-bt-req-avrcp-get-cur-att-val-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_set_cur_att_val (heading level 8)

`int32_t rsi_bt_avrcp_set_cur_att_val(uint8_t *remote_dev_addr, att_val_t *val_list, uint8_t nbr_atts)`

**Description:** requests to set the player application setting list of player application setting values on the TG for the corresponding defined list of PlayerApplicationSettingAttributes. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[att_val_t](att-val-s) *|[in]|val_list|- value list|
|uint8_t|[in]|nbr_atts|- number of attributes <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [att_val_s::att_id](att-val-s#att-id), [att_val_s::att_val](att-val-s#att-val), [rsi_bt_req_avrcp_set_cur_att_val_s::att_val_list](rsi-bt-req-avrcp-set-cur-att-val-s#att-val-list), [rsi_bt_req_avrcp_set_cur_att_val_s::dev_addr](rsi-bt-req-avrcp-set-cur-att-val-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_avrcp_set_cur_att_val_s::nbr_atts](rsi-bt-req-avrcp-set-cur-att-val-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_element_att (heading level 8)

`int32_t rsi_bt_avrcp_get_element_att(uint8_t *remote_dev_addr, uint8_t *att_ids, uint8_t nbr_atts, rsi_bt_rsp_avrcp_elem_attr_t *att_vals)`

**Description:** Requests the TG to provide the attributes of the element specified in the parameter. This shall only be used to retrieve Metadata for the currently playing track from the Addressed Player on the Control channel when GetItemAttributes is not supported. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Address of remote device <br />|
|uint8_t *|[in]|att_ids|- attributes ids|
|uint8_t|[in]|nbr_atts|- number of attributes|
|[rsi_bt_rsp_avrcp_elem_attr_t](rsi-bt-rsp-avrcp-elem-attr-s) *|[out]|att_vals|- attribute values in the list. Please refer [rsi_bt_rsp_avrcp_elem_attr_s](rsi-bt-rsp-avrcp-elem-attr-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_ele_att_s::att_list](rsi-bt-req-avrcp-get-ele-att-s#att-list), [rsi_bt_req_avrcp_get_ele_att_s::dev_addr](rsi-bt-req-avrcp-get-ele-att-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_avrcp_get_ele_att_s::nbr_atts](rsi-bt-req-avrcp-get-ele-att-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_play_status (heading level 8)

`int32_t rsi_bt_avrcp_get_play_status(uint8_t *remote_dev_addr, rsi_bt_rsp_avrcp_get_player_status_t *play_status)`

**Description:** CT to get the status of the currently playing media at the TG. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[rsi_bt_rsp_avrcp_get_player_status_t](rsi-bt-rsp-avrcp-get-player-status-s) *|[out]|play_status|- to capture the player status <br /><br/> Please refer [rsi_bt_rsp_avrcp_get_player_status_s](rsi-bt-rsp-avrcp-get-player-status-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_player_status_s::dev_addr](rsi-bt-req-avrcp-get-player-status-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_reg_notification (heading level 8)

`int32_t rsi_bt_avrcp_reg_notification(uint8_t *remote_dev_addr, uint8_t event_id, uint8_t *p_resp_val)`

**Description:** Registers with the TG to receive notifications asynchronously based on specific events occurring. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|event_id|- event ID.|
|uint8_t *|[out]|p_resp_val|- used to capture response for the event which is registered.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_reg_notification_s::dev_addr](rsi-bt-req-avrcp-reg-notification-s#dev-addr), [rsi_bt_req_avrcp_reg_notification_s::event_id](rsi-bt-req-avrcp-reg-notification-s#event-id), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_bt_avrcp_get_remote_version (heading level 8)

`int32_t rsi_bt_avrcp_get_remote_version(uint8_t *remote_dev_addr, rsi_bt_rsp_avrcp_remote_version_t *version)`

**Description:** Get the AVRCP profile version from remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|[rsi_bt_rsp_avrcp_remote_version_t](rsi-bt-rsp-avrcp-remote-version-s) *|[out]|version|- version info. Please refer [rsi_bt_rsp_avrcp_remote_version_s](rsi-bt-rsp-avrcp-remote-version-s) structure for more info|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_remote_version_s::dev_addr](rsi-bt-req-avrcp-remote-version-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_att_text (heading level 8)

`int32_t rsi_bt_avrcp_get_att_text(uint8_t *remote_dev_addr, uint8_t nbr_atts, uint8_t *p_atts, player_att_text_t *p_att_text_resp)`

**Description:** Requests the TG to provide supported player application setting attribute displayable text for the provided PlayerApplicationSettingAttributeID. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_atts|- number of attributes.|
|uint8_t *|[in]|p_atts|- pointer to attributes.|
|[player_att_text_t](player-att-text-s) *|[out]|p_att_text_resp|- to capture response from this API. <br /><br/> Please refer [player_att_text_s](player-att-text-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_get_cur_att_val_s::att_list](rsi-bt-req-avrcp-get-cur-att-val-s#att-list), [rsi_bt_req_avrcp_get_cur_att_val_s::dev_addr](rsi-bt-req-avrcp-get-cur-att-val-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_avrcp_get_cur_att_val_s::nbr_atts](rsi-bt-req-avrcp-get-cur-att-val-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_get_att_val_text (heading level 8)

`int32_t rsi_bt_avrcp_get_att_val_text(uint8_t *remote_dev_addr, uint8_t att_id, uint8_t nbr_vals, uint8_t *p_vals, player_att_text_t *p_att_text_resp)`

**Description:** Get the AVRCP profile player attribute values text from remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|att_id|- attribute ID.|
|uint8_t|[in]|nbr_vals|- number of attribute values.|
|uint8_t *|[in]|p_vals|- pointer to attribute values.|
|[player_att_text_t](player-att-text-s) *|[out]|p_att_text_resp|- to capture response from this API. <br /><br/> Please refer [player_att_text_s](player-att-text-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_get_att_val_text_s::att_id](rsi-bt-req-avrcp-get-att-val-text-s#att-id), [rsi_bt_req_avrcp_get_att_val_text_s::dev_addr](rsi-bt-req-avrcp-get-att-val-text-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_avrcp_get_att_val_text_s::nbr_vals](rsi-bt-req-avrcp-get-att-val-text-s#nbr-vals), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_req_avrcp_get_att_val_text_s::vals](rsi-bt-req-avrcp-get-att-val-text-s#vals)

###### rsi_bt_avrcp_batt_status (heading level 8)

`int32_t rsi_bt_avrcp_batt_status(uint8_t *remote_dev_addr, uint8_t batt_level)`

**Description:** Send the device battery status to remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|batt_level|- to update battery level.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_avrcp_batt_status_s::batt_status](rsi-bt-req-avrcp-batt-status-s#batt-status), [rsi_bt_req_avrcp_batt_status_s::dev_addr](rsi-bt-req-avrcp-batt-status-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_supp_char_sets (heading level 8)

`int32_t rsi_bt_avrcp_supp_char_sets(uint8_t *remote_dev_addr, uint8_t nbr_sets, uint16_t *p_sets)`

**Description:** Provides the list of character sets supported by CT to the TG. This shall allow the TG to send responses with strings in any of the character sets supported by CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_sets|- Number of displayable character sets provided|
|uint16_t *|[in]|p_sets|- Supported Character Set <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_req_avrcp_char_sets_s::char_sets](rsi-bt-req-avrcp-char-sets-s#char-sets), [rsi_bt_req_avrcp_char_sets_s::dev_addr](rsi-bt-req-avrcp-char-sets-s#dev-addr), [memcpy](bt-classic1#memcpy), [char_sets_s::nbr_sets](char-sets-s#nbr-sets), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [char_sets_s::supp_vals](char-sets-s#supp-vals)

###### rsi_bt_avrcp_set_abs_vol (heading level 8)

`int32_t rsi_bt_avrcp_set_abs_vol(uint8_t *remote_dev_addr, uint8_t abs_vol, uint8_t *p_resp_abs_vol)`

**Description:** Send absolute volume information to remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|abs_vol|- absolute volume.|
|uint8_t *|[out]|p_resp_abs_vol|- to capture the response from this API.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_avrcp_set_abs_vol_s::abs_vol](rsi-bt-avrcp-set-abs-vol-s#abs-vol), [rsi_bt_avrcp_set_abs_vol_s::dev_addr](rsi-bt-avrcp-set-abs-vol-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_cap_resp (heading level 8)

`int32_t rsi_bt_avrcp_cap_resp(uint8_t *remote_dev_addr, uint8_t cap_type, uint8_t nbr_caps, uint32_t *p_caps)`

**Description:** Sends the device capabilites Supported by TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|cap_type|- capability type.|
|uint8_t|[in]|nbr_caps|- number of capabilities <br />|
|uint32_t *|[in]|p_caps|- capability ID's list. <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_cap_resp_s::cap_type](rsi-bt-avrcp-cap-resp-s#cap-type), [rsi_bt_avrcp_cap_resp_s::caps](rsi-bt-avrcp-cap-resp-s#caps), [rsi_bt_avrcp_cap_resp_s::dev_addr](rsi-bt-avrcp-cap-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_cap_resp_s::nbr_caps](rsi-bt-avrcp-cap-resp-s#nbr-caps), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_att_list_resp (heading level 8)

`int32_t rsi_bt_avrcp_att_list_resp(uint8_t *remote_dev_addr, uint8_t nbr_atts, uint8_t *p_atts)`

**Description:** Sends the supported attribute lists from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|nbr_atts|- number of attributes.|
|uint8_t *|[in]|p_atts|- pointer to attributes list.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_att_list_resp_s::atts](rsi-bt-avrcp-att-list-resp-s#atts), [rsi_bt_avrcp_att_list_resp_s::dev_addr](rsi-bt-avrcp-att-list-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_att_list_resp_s::nbr_atts](rsi-bt-avrcp-att-list-resp-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_att_val_list_resp (heading level 8)

`int32_t rsi_bt_avrcp_att_val_list_resp(uint8_t *remote_dev_addr, uint8_t nbr_vals, uint8_t *p_vals)`

**Description:** Sends the attributes value list response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_vals|- number of values.|
|uint8_t *|[in]|p_vals|- pointer to values list. <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_att_vals_list_resp_s::dev_addr](rsi-bt-avrcp-att-vals-list-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_att_vals_list_resp_s::nbr_vals](rsi-bt-avrcp-att-vals-list-resp-s#nbr-vals), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_att_vals_list_resp_s::vals](rsi-bt-avrcp-att-vals-list-resp-s#vals)

###### rsi_bt_avrcp_cur_att_val_resp (heading level 8)

`int32_t rsi_bt_avrcp_cur_att_val_resp(uint8_t *remote_dev_addr, uint8_t nbr_atts, att_val_t *p_att_vals)`

**Description:** Sends the current attributes values from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_atts|- number of attributes.|
|[att_val_t](att-val-s) *|[in]|p_att_vals|- pointer to attributes values list. Please refer [attr_list_s](attr-list-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [att_val_s::att_id](att-val-s#att-id), [rsi_bt_avrcp_cur_att_vals_resp_s::att_list](rsi-bt-avrcp-cur-att-vals-resp-s#att-list), [att_val_s::att_val](att-val-s#att-val), [att_val_list_s::att_vals](att-val-list-s#att-vals), [rsi_bt_avrcp_cur_att_vals_resp_s::dev_addr](rsi-bt-avrcp-cur-att-vals-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [att_val_list_s::nbr_atts](att-val-list-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_set_cur_att_val_resp (heading level 8)

`int32_t rsi_bt_avrcp_set_cur_att_val_resp(uint8_t *remote_dev_addr, uint8_t status)`

**Description:** Sends the current attributes value status response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|status|- status to be sent.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_set_att_vals_resp_s::dev_addr](rsi-bt-avrcp-set-att-vals-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_set_att_vals_resp_s::status](rsi-bt-avrcp-set-att-vals-resp-s#status)

###### rsi_bt_avrcp_ele_att_resp (heading level 8)

`int32_t rsi_bt_avrcp_ele_att_resp(uint8_t *remote_dev_addr, uint8_t num_attrs, attr_list_t *p_attr_list)`

**Description:** Sends the Current Playing Track attributes from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|num_attrs|- number of attributes.|
|[attr_list_t](attr-list-s) *|[in]|p_attr_list|- pointer to attributes list. Please refer [attr_list_s](attr-list-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [attr_list_s::attr_len](attr-list-s#attr-len), [elem_attr_list_s::attr_list](elem-attr-list-s#attr-list), [attr_list_s::attr_val](attr-list-s#attr-val), [attr_list_s::char_set_id](attr-list-s#char-set-id), [rsi_bt_avrcp_elem_attr_resp_s::dev_addr](rsi-bt-avrcp-elem-attr-resp-s#dev-addr), [rsi_bt_avrcp_elem_attr_resp_s::elem_attr_list](rsi-bt-avrcp-elem-attr-resp-s#elem-attr-list), [attr_list_s::id](attr-list-s#id), [memcpy](bt-classic1#memcpy), [elem_attr_list_s::num_attrs](elem-attr-list-s#num-attrs), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_play_status_resp (heading level 8)

`int32_t rsi_bt_avrcp_play_status_resp(uint8_t *remote_dev_addr, uint8_t play_status, uint32_t song_len, uint32_t song_pos)`

**Description:** Sends the Current Playing Track status from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|play_status|- player status.|
|uint32_t|[in]|song_len|- song length.|
|uint32_t|[in]|song_pos|- song position.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_play_status_resp_s::dev_addr](rsi-bt-avrcp-play-status-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_play_status_resp_s::play_status](rsi-bt-avrcp-play-status-resp-s#play-status), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_avrcp_play_status_resp_s::song_len](rsi-bt-avrcp-play-status-resp-s#song-len) and [rsi_bt_avrcp_play_status_resp_s::song_pos](rsi-bt-avrcp-play-status-resp-s#song-pos)

###### rsi_bt_avrcp_reg_notify_resp (heading level 8)

`int32_t rsi_bt_avrcp_reg_notify_resp(uint8_t *remote_dev_addr, uint8_t event_id, uint8_t event_data_len, uint8_t *event_data)`

**Description:** Register notify Interim response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|event_id|- event ID.|
|uint8_t|[in]|event_data_len|- length of event_data buffer.|
|uint8_t *|[in]|event_data|- event data.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [reg_notify_val_u::abs_vol](reg-notify-val-u#abs-vol), [reg_notify_val_u::curr_track_idx](reg-notify-val-u#curr-track-idx), [rsi_bt_avrcp_reg_notify_interim_resp_s::dev_addr](rsi-bt-avrcp-reg-notify-interim-resp-s#dev-addr), [rsi_bt_avrcp_reg_notify_interim_resp_s::event_id](rsi-bt-avrcp-reg-notify-interim-resp-s#event-id), [memcpy](bt-classic1#memcpy), [reg_notify_val_u::play_status](reg-notify-val-u#play-status), [reg_notify_val_u::playerid](reg-notify-val-u#playerid), [rsi_bt_avrcp_reg_notify_interim_resp_s::reg_notify_val](rsi-bt-avrcp-reg-notify-interim-resp-s#reg-notify-val), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [reg_notify_val_u::uidcounter](reg-notify-val-u#uidcounter)

###### rsi_bt_avrcp_att_text_resp (heading level 8)

`int32_t rsi_bt_avrcp_att_text_resp(uint8_t *remote_dev_addr, uint8_t nbr_atts, att_text_t *p_att_text)`

**Description:** Send supporting attribute text response to remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_atts|- number of attributes.|
|[att_text_t](att-text-s) *|[in]|p_att_text|- pointer to attribute text. <br /><br/> Please refer [att_text_s](att-text-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [att_text_s::att_text](att-text-s#att-text), [rsi_bt_avrcp_att_text_resp_s::atts_text](rsi-bt-avrcp-att-text-resp-s#atts-text), [rsi_bt_avrcp_att_text_resp_s::dev_addr](rsi-bt-avrcp-att-text-resp-s#dev-addr), [att_text_s::id](att-text-s#id), [player_att_text_s::list](player-att-text-s#list), [memcpy](bt-classic1#memcpy), [player_att_text_s::nbr_atts](player-att-text-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_att_vals_text_resp (heading level 8)

`int32_t rsi_bt_avrcp_att_vals_text_resp(uint8_t *remote_dev_addr, uint8_t nbr_vals, att_text_t *p_vals_text)`

**Description:** Send supporting attribute values text response to remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|nbr_vals|- number of values.|
|[att_text_t](att-text-s) *|[in]|p_vals_text|- pointer to values list. <br /><br/> Please refer [att_text_s](att-text-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [att_text_s::att_text](att-text-s#att-text), [rsi_bt_avrcp_att_text_resp_s::atts_text](rsi-bt-avrcp-att-text-resp-s#atts-text), [rsi_bt_avrcp_att_text_resp_s::dev_addr](rsi-bt-avrcp-att-text-resp-s#dev-addr), [att_text_s::id](att-text-s#id), [player_att_text_s::list](player-att-text-s#list), [memcpy](bt-classic1#memcpy), [player_att_text_s::nbr_atts](player-att-text-s#nbr-atts), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_batt_status_resp (heading level 8)

`int32_t rsi_bt_avrcp_batt_status_resp(uint8_t *remote_dev_addr, uint8_t status)`

**Description:** Sends battery status response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|status|- status to be sent.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_reg_notifiy_resp_s::dev_addr](rsi-bt-avrcp-reg-notifiy-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_reg_notifiy_resp_s::status](rsi-bt-avrcp-reg-notifiy-resp-s#status)

###### rsi_bt_avrcp_char_set_status_resp (heading level 8)

`int32_t rsi_bt_avrcp_char_set_status_resp(uint8_t *remote_dev_addr, uint8_t status)`

**Description:** Sends character set repsonse from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|status|- status to be sent.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_reg_notifiy_resp_s::dev_addr](rsi-bt-avrcp-reg-notifiy-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_reg_notifiy_resp_s::status](rsi-bt-avrcp-reg-notifiy-resp-s#status)

###### rsi_bt_avrcp_notify (heading level 8)

`int32_t rsi_bt_avrcp_notify(uint8_t *remote_dev_addr, uint8_t event_id, notify_val_t *p_notify_val)`

**Description:** Register notify CHANGED response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|event_id|- event ID.|
|[notify_val_t](notify-val-s) *|[in]|p_notify_val|- pointer to notofication values. please refer [notify_val_s](notify-val-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_notify_s::dev_addr](rsi-bt-avrcp-notify-s#dev-addr), [rsi_bt_avrcp_notify_s::event_id](rsi-bt-avrcp-notify-s#event-id), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_notify_s::notify_val](rsi-bt-avrcp-notify-s#notify-val), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_cmd_reject (heading level 8)

`int32_t rsi_bt_avrcp_cmd_reject(uint8_t *remote_dev_addr, uint8_t pdu_id, uint8_t status)`

**Description:** Rejects the received request from CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address. <br />|
|uint8_t|[in]|pdu_id|- PDU ID.|
|uint8_t|[in]|status|- status to be sent. <br />|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_cmd_reject_s::dev_addr](rsi-bt-avrcp-cmd-reject-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_cmd_reject_s::pdu_id](rsi-bt-avrcp-cmd-reject-s#pdu-id), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_cmd_reject_s::status](rsi-bt-avrcp-cmd-reject-s#status)

###### rsi_bt_avrcp_set_abs_vol_resp (heading level 8)

`int32_t rsi_bt_avrcp_set_abs_vol_resp(uint8_t *remote_dev_addr, uint8_t abs_vol)`

**Description:** Sends absolute volume response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address.|
|uint8_t|[in]|abs_vol|- absolute volume.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_set_abs_vol_resp_s::abs_vol](rsi-bt-avrcp-set-abs-vol-resp-s#abs-vol), [rsi_bt_avrcp_set_abs_vol_resp_s::dev_addr](rsi-bt-avrcp-set-abs-vol-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_set_addr_player_resp (heading level 8)

`int32_t rsi_bt_avrcp_set_addr_player_resp(uint8_t *remote_dev_addr, uint8_t status)`

**Description:** Sends Addressed player response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device Address|
|uint8_t|[in]|status|- Status|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- This funtion can be accessed only if Media Player Selection Feature is enabled via bt_avrcp_init().
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_set_addr_player_resp_s::dev_addr](rsi-bt-avrcp-set-addr-player-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_set_addr_player_resp_s::status](rsi-bt-avrcp-set-addr-player-resp-s#status)

###### rsi_bt_avrcp_get_folder_items_resp (heading level 8)

`int32_t rsi_bt_avrcp_get_folder_items_resp(uint8_t *remote_dev_addr, uint8_t status, folder_items_resp_t folder_items_resp)`

**Description:** Sends folder items response from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device Address|
|uint8_t|[in]|status|- Status|
|[folder_items_resp_t](folder-items-resp-s)|[in]|folder_items_resp|- Folder items, Please refer [folder_items_resp_s](folder-items-resp-s) structure for more info.|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- The folder_items_resp flag holds the details of Media Player Items. <br />  
   This funtion can be accessed only if Media Player Selection Feature is enabled via bt_avrcp_init().
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_get_folder_items_resp_s::dev_addr](rsi-bt-avrcp-get-folder-items-resp-s#dev-addr), [rsi_bt_avrcp_get_folder_items_resp_s::fldr_items](rsi-bt-avrcp-get-folder-items-resp-s#fldr-items), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_avrcp_get_folder_items_resp_s::status](rsi-bt-avrcp-get-folder-items-resp-s#status)

###### rsi_bt_avrcp_get_tot_num_items_resp (heading level 8)

`int32_t rsi_bt_avrcp_get_tot_num_items_resp(uint8_t *remote_dev_addr, uint8_t status, uint16_t uidcntr, uint32_t numofitems)`

**Description:** Sends the response for the total number of items from TG to CT. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device Address|
|uint8_t|[in]|status|- Status|
|uint16_t|[in]|uidcntr|- uid counter|
|uint32_t|[in]|numofitems|- Number of items|

- Call [rsi_bt_avrcp_init()](bt-classic2#rsi-bt-avrcp-init) and [rsi_bt_avrcp_conn()](bt-classic2#rsi-bt-avrcp-conn) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- This funtion can be accessed only if Media Player Selection Feature is enabled via bt_avrcp_init().
- CT and TG specifies Controller and Target respectively as per BT AVRCP Specification.

**References:** [rsi_bt_avrcp_get_tot_num_items_resp_s::dev_addr](rsi-bt-avrcp-get-tot-num-items-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_avrcp_get_tot_num_items_resp_s::numofitems](rsi-bt-avrcp-get-tot-num-items-resp-s#numofitems), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_avrcp_get_tot_num_items_resp_s::status](rsi-bt-avrcp-get-tot-num-items-resp-s#status) and [rsi_bt_avrcp_get_tot_num_items_resp_s::uidcntr](rsi-bt-avrcp-get-tot-num-items-resp-s#uidcntr)

###### GAP

###### Functions (heading level 7)

###### rsi_bt_set_local_class_of_device (heading level 8)

`int32_t rsi_bt_set_local_class_of_device(uint32_t class_of_device)`

**Description:** Sets the local device COD (The Class_Of_Device parameter is used to <br />
 indicate the capabilities of the local device to other device). This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|class_of_device|- name to be set to the local device COD <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_local_cod_s::class_of_device](rsi-bt-req-set-local-cod-s#class-of-device), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_get_local_class_of_device (heading level 8)

`int32_t rsi_bt_get_local_class_of_device(uint8_t *resp)`

**Description:** Gets the local device COD (The Class_Of_Device parameter is used to <br />
 indicate the capabilities of the local device to other device). This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_start_discoverable (heading level 8)

`rsi_bt_start_discoverable(void)`

**Description:** Sets the BT Module discovery mode status to INQUIRY_SCAN. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init](common#rsi-wireless-init) API needs to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_discv_mode_s::mode](rsi-bt-req-set-discv-mode-s#mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_req_set_discv_mode_s::time_out](rsi-bt-req-set-discv-mode-s#time-out)

###### rsi_bt_start_limited_discoverable (heading level 8)

`int32_t rsi_bt_start_limited_discoverable(int32_t time_out_ms)`

**Description:** Request the local device to enter limited discovery mode. <br />
 The device comes out of discovery mode after the time out. <br />
 If the 'time_out_ms' is set to '0', the device will be in continuous discoverable mode. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|time_out_ms|- Limited discovery mode time_out in ms. <br />|

- [rsi_wireless_init](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_discv_mode_s::mode](rsi-bt-req-set-discv-mode-s#mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_req_set_discv_mode_s::time_out](rsi-bt-req-set-discv-mode-s#time-out)

###### rsi_bt_write_current_iac_lap (heading level 8)

`int32_t rsi_bt_write_current_iac_lap(uint8_t no_of_iaps, uint8_t *iap_lap_list)`

**Description:** Write the current iac lap to the controller. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|no_of_iaps|- number of iap lap count <br />|
|uint8_t *|[in]|iap_lap_list|- pointer to the iap laps list <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_current_iap_lap_s::cnt](rsi-bt-req-set-current-iap-lap-s#cnt), [rsi_bt_req_set_current_iap_lap_s::list](rsi-bt-req-set-current-iap-lap-s#list), [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_stop_discoverable (heading level 8)

`rsi_bt_stop_discoverable(void)`

**Description:** Clears INQUIRY_SCAN BIT from BT Module discovery mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_discv_mode_s::mode](rsi-bt-req-set-discv-mode-s#mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [rsi_bt_req_set_discv_mode_s::time_out](rsi-bt-req-set-discv-mode-s#time-out)

###### rsi_bt_get_discoverable_status (heading level 8)

`int32_t rsi_bt_get_discoverable_status(uint8_t *resp)`

**Description:** Gets the BT Module discovery mode status, <br />
 whether INQUIRY_SCAN enabled/not. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API <br />|

- [rsi_bt_start_discoverable()](bt-classic3#rsi-bt-start-discoverable) API need to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_connectable (heading level 8)

`rsi_bt_set_connectable(void)`

**Description:** Sets the BT Module connectablity status to PAGE_SCAN. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_connectability_mode::connectability_mode](rsi-bt-req-set-connectability-mode#connectability-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_afh_host_channel_classification (heading level 8)

`int32_t rsi_bt_set_afh_host_channel_classification(uint8_t enable, uint8_t *channel_map)`

**Description:** Sets the No.of channels to be used to Transmit or Receive the <br />
 data/control packets between Local and Remote Devices. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enable|- This parameter is used to enable or disable afh host channel classification. <br /><br/> This parameter supports the following values. <br /><br/> 0 - Disable <br /><br/> 1 - Enable <br />|
|uint8_t *|[in]|channel_map|- Array of channel mapping values. <br /><br/> Channel map range: This parameter contains 80 1-bit fields. <br /><br/> The nth such field (in the range 0 to 78 bits) contains the value for channel n: <br /><br/> 0: channel n is bad <br /><br/> 1: channel n is unknown <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND <br />  
   0x4E12 - INVALID_HCI_COMMAND_PARAMETERS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_afh_host_channel_classification_s::channel_assessment_mode](rsi-bt-req-set-afh-host-channel-classification-s#channel-assessment-mode), [rsi_bt_req_set_afh_host_channel_classification_s::channel_classification](rsi-bt-req-set-afh-host-channel-classification-s#channel-classification), [rsi_bt_req_set_afh_host_channel_classification_s::enable](rsi-bt-req-set-afh-host-channel-classification-s#enable), [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_get_afh_host_channel_classification (heading level 8)

`int32_t rsi_bt_get_afh_host_channel_classification(uint8_t *status)`

**Description:** Reads the afh mode, whether it is enable/disable. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|status|- This parameter is to hold the response of this API. <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_afh_host_channel_classification_s::channel_assessment_mode](rsi-bt-req-set-afh-host-channel-classification-s#channel-assessment-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_non_connectable (heading level 8)

`rsi_bt_set_non_connectable(void)`

**Description:** Clears the PAGE_SCAN BIT in BT Module connectablity status. This is a blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- [rsi_wireless_init](common#rsi-wireless-init) API need to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_connectability_mode::connectability_mode](rsi-bt-req-set-connectability-mode#connectability-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_get_connectable_status (heading level 8)

`int32_t rsi_bt_get_connectable_status(uint8_t *resp)`

**Description:** Gets the BT Module connectablity status, <br />
 whether PAGE_SCAN enabled/not. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API <br />|

- [rsi_bt_set_connectable()](bt-classic3#rsi-bt-set-connectable) API needs to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_enable_authentication (heading level 8)

`rsi_bt_enable_authentication(void)`

**Description:** If the local device requires to authenticate the remote device at <br />
 connection setup (between the HCI_Create_Connection command or <br />
 acceptance of an incoming ACL connection and the corresponding <br />
 Connection Complete event).At connection setup, only the device(s) <br /><br />
 with the Authentication_Enable parameter enabled will try to authenticate <br />
 the other device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- Changing this parameter does not affect existing connection.

**References:** [rsi_bt_pair_mode_s::pair_mode](rsi-bt-pair-mode-s#pair-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_disable_authentication (heading level 8)

`rsi_bt_disable_authentication(void)`

**Description:** If the local device doesn't requires to authenticate the remote device at <br />
 connection setup (between the HCI_Create_Connection command or acceptance <br />
 of an incoming ACL connection and the corresponding Connection Complete event). <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- Changing this parameter does not affect existing connection.

**References:** [rsi_bt_pair_mode_s::pair_mode](rsi-bt-pair-mode-s#pair-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_get_authentication (heading level 8)

`int32_t rsi_bt_get_authentication(uint8_t *resp)`

**Description:** Reads the value from the Authentication_Enable configuration parameter, <br />
 whether Authentication is Enabled/Disabled. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_remote_name_request_async (heading level 8)

`int32_t rsi_bt_remote_name_request_async(uint8_t *remote_dev_addr, rsi_bt_event_remote_device_name_t *bt_event_remote_device_name)`

**Description:** Know the remote device name, if empty name present in the Inquired list during Inquiry. And also can call this API after bt connection. <br />
 This is a blocking API. A received event [rsi_bt_on_remote_name_resp_t](bt-classic7#rsi-bt-on-remote-name-resp-t) has the name of the remote_dev_addr which is requested. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|[rsi_bt_event_remote_device_name_t](rsi-bt-event-remote-device-name-s) *|[out]|bt_event_remote_device_name|- response buffer to hold the name of remote device <br /><br/> Please refer [rsi_bt_event_remote_device_name_s](rsi-bt-event-remote-device-name-s) structure for more info.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_inquiry()](bt-classic3#rsi-bt-inquiry) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_remote_name_s::dev_addr](rsi-bt-req-remote-name-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_remote_name_request_cancel (heading level 8)

`int32_t rsi_bt_remote_name_request_cancel(uint8_t *remote_dev_addr)`

**Description:** The Remote Device name request which is initiated by [rsi_bt_remote_name_request_async()](bt-classic3#rsi-bt-remote-name-request-async)<br />
 api will be cancelled by using this API. This is a blocking API. <br />
 A received event [rsi_bt_on_remote_name_request_cancel_t](bt-classic7#rsi-bt-on-remote-name-request-cancel-t) indicates that remote name request has been cancelled.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|

- [rsi_bt_remote_name_request_async()](bt-classic3#rsi-bt-remote-name-request-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E12 - INVALID_HCI_COMMAND_PARAMETERS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_remote_name_cancel_s::dev_addr](rsi-bt-req-remote-name-cancel-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_inquiry (heading level 8)

`int32_t rsi_bt_inquiry(uint8_t inquiry_type, uint32_t inquiry_duration, uint8_t max_devices)`

**Description:** Starts the Inquiry procedure till duration specified in the <br />
 inquiry_duration parameter and allowed maximum number of devices to <br />
 be inquired is mentioned in max_devices parameter. This is a blocking API. <br /><br />
 A received event [rsi_bt_on_scan_resp_t](bt-classic7#rsi-bt-on-scan-resp-t) provides the Inquired devices information. <br />
 A received event [rsi_bt_on_inquiry_complete_t](bt-classic7#rsi-bt-on-inquiry-complete-t) indicates that Inquiry has been completed <br />
.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|inquiry_type|- This is the Inquiry type. <br /><br/> 0 - Standard Inquiry <br /><br/> 1 - Inquiry with RSSI <br /><br/> 2 - Extended Inquiry <br />|
|uint32_t|[in]|inquiry_duration|- duration of inquiry. <br />|
|uint8_t|[in]|max_devices|- This is the maximum number of devices allowed to inquiry from 1 to 10 <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_inquiry_s::duration](rsi-bt-req-inquiry-s#duration), [rsi_bt_req_inquiry_s::inquiry_type](rsi-bt-req-inquiry-s#inquiry-type), [rsi_bt_req_inquiry_s::lap](rsi-bt-req-inquiry-s#lap), [rsi_bt_req_inquiry_s::maximum_devices_to_find](rsi-bt-req-inquiry-s#maximum-devices-to-find) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_cancel_inquiry (heading level 8)

`rsi_bt_cancel_inquiry(void)`

**Description:** The Inquiry request which is initiated with [rsi_bt_inquiry()](bt-classic3#rsi-bt-inquiry) api <br />
 will be cancelled by using this API. This is a blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) and then [rsi_bt_inquiry()](bt-classic3#rsi-bt-inquiry) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4FF9 - ERROR_STATE_INVALID

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_connect (heading level 8)

`int32_t rsi_bt_connect(uint8_t *remote_dev_addr)`

**Description:** To Initiate Connection Request to the Remote Device, need to <br />
 call this API. This is a blocking API. <br />
 A received event [rsi_bt_on_connect_t](bt-classic7#rsi-bt-on-connect-t) indicates that the connection opened successfully.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4300 - ERR_BT_HCI_CONN_ALREADY_EXISTS <br />  
   0x4059 - ERR_BT_HCI_CONNECTION_FAIL <br />  
   0x4E0B - ERR_ACL_CONN_ALREADY_EXISTS <br />  
   0x4E0D - ERR_LIMITED_RESOURCE <br />  
   0x4E04 - ERR_PAGE_TIMEOUT

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_connect_s::dev_addr](rsi-bt-req-connect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_cancel_connect (heading level 8)

`int32_t rsi_bt_cancel_connect(uint8_t *remote_dev_address)`

**Description:** The Connection request which is initiated with [rsi_bt_connect()](bt-classic3#rsi-bt-connect) api <br />
 will be cancelled by using this API. This is a blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and then [rsi_bt_connect()](bt-classic3#rsi-bt-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4E0B - ERR_ACL_CONN_ALREADY_EXISTS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_connect_cancel_s::dev_addr](rsi-bt-req-connect-cancel-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_disconnect (heading level 8)

`int32_t rsi_bt_disconnect(uint8_t *remote_dev_address)`

**Description:** To disconnect the established PHY Level COnnection, need to <br />
 call this API. This is a blocking API. <br />
 A received event [rsi_bt_on_unbond_t](bt-classic7#rsi-bt-on-unbond-t)/ [rsi_bt_on_disconnect_t](bt-classic7#rsi-bt-on-disconnect-t) indicates that the BT PHY Level connection is disconnected successfully.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4061 - ERR_BT_NO_HCI_CONNECTION <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4E12 - INVALID_HCI_COMMAND_PARAMETERS <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_disconnect_s::dev_addr](rsi-bt-req-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_accept_ssp_confirm (heading level 8)

`int32_t rsi_bt_accept_ssp_confirm(uint8_t *remote_dev_address)`

**Description:** After LinkLevel Connection established between Local and Remote Device, <br />
 the first level of authentication will occur by sharing the PASSKEY to the <br />
 host to compare with the Remote Device. If the Local and Remote Devices has <br />
 same PASSKEY, then need to call this API for confirmation. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address <br />|

- [rsi_bt_set_ssp_mode()](bt-classic3#rsi-bt-set-ssp-mode) API need to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - COMMAND_DISALLOWED <br />  
   0x4046 - ERR_BT_INVALID_ARGS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_user_confirmation_s::confirmation](rsi-bt-req-user-confirmation-s#confirmation), [rsi_bt_req_user_confirmation_s::dev_addr](rsi-bt-req-user-confirmation-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_reject_ssp_confirm (heading level 8)

`int32_t rsi_bt_reject_ssp_confirm(uint8_t *remote_dev_address)`

**Description:** After LinkLevel Connection established between Local and Remote Device, <br />
 the first level of authentication will occur by sharing the PASSKEY to the <br />
 host to compare with the Remote Device. If the Local and Remote Devices has <br />
 different PASSKEY, then need to call this API for Rejection. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address <br />|

- [rsi_bt_set_ssp_mode()](bt-classic3#rsi-bt-set-ssp-mode) API need to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E06 - COMMAND_DISALLOWED <br />  
   0x4046 - ERR_BT_INVALID_ARGS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_user_confirmation_s::confirmation](rsi-bt-req-user-confirmation-s#confirmation), [rsi_bt_req_user_confirmation_s::dev_addr](rsi-bt-req-user-confirmation-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_passkey (heading level 8)

`int32_t rsi_bt_passkey(uint8_t *remote_dev_addr, uint32_t passkey, uint8_t reply_type)`

**Description:** Send the passkey with Positive Reply or rejects the incoming pass key request with Negative Reply. <br /><br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint32_t|[in]|passkey|- This is the passkey input|
|uint8_t|[in]|reply_type|-This is the positive or negative reply <br /><br/> 0 - negative reply <br /><br/> 1 - positive reply|

- [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) APIs need to be called <br />  
   before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E06 - COMMAND_DISALLOWED <br />  
   0x4046 - ERR_BT_INVALID_ARGS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_passkey_reply_s::dev_addr](rsi-bt-req-passkey-reply-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_passkey_reply_s::pass_key](rsi-bt-req-passkey-reply-s#pass-key), [rsi_bt_req_passkey_reply_s::reply_type](rsi-bt-req-passkey-reply-s#reply-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_pincode_request_reply (heading level 8)

`int32_t rsi_bt_pincode_request_reply(uint8_t *remote_dev_addr, uint8_t *pin_code, uint8_t reply_type)`

**Description:** Sends the pincode with the positive reply or rejects with <br />
 negative reply to the incoming pincode request. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint8_t *|[in]|pin_code|- pin code input <br />|
|uint8_t|[in]|reply_type|- This is the positive or negative reply <br /><br/> 0 - negative reply <br /><br/> 1 - positive reply|

- [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) APIs need to be called <br />  
   before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4039 - ERR_BT_PINCODE_REPLY_FOR_WRONG_BD_ADDRESS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- This API need to issue during the legacy connection process.

**References:** [rsi_bt_req_pincode_reply_s::dev_addr](rsi-bt-req-pincode-reply-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_pincode_reply_s::pincode](rsi-bt-req-pincode-reply-s#pincode), [rsi_bt_req_pincode_reply_s::reply_type](rsi-bt-req-pincode-reply-s#reply-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_linkkey_request_reply (heading level 8)

`int32_t rsi_bt_linkkey_request_reply(uint8_t *remote_dev_addr, uint8_t *linkkey, uint8_t reply_type)`

**Description:** If linkkey exists, sends positive (along with the link key), else <br /><br />
 negative reply to the incoming link key request. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint8_t *|[in]|linkkey|- Linkkey input|
|uint8_t|[in]|reply_type|- Positive or negative reply <br /><br/> 0 - negative reply <br /><br/> 1 - positive reply|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) api's before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4039 - ERR_BT_PINCODE_REPLY_FOR_WRONG_BD_ADDRESS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_linkkey_reply_s::dev_addr](rsi-bt-req-linkkey-reply-s#dev-addr), [rsi_bt_req_linkkey_reply_s::linkkey](rsi-bt-req-linkkey-reply-s#linkkey), [memcpy](bt-classic1#memcpy), [rsi_bt_req_linkkey_reply_s::reply_type](rsi-bt-req-linkkey-reply-s#reply-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_get_local_device_role (heading level 8)

`int32_t rsi_bt_get_local_device_role(uint8_t *remote_dev_addr, uint8_t *resp)`

**Description:** Gets the role of local device, whether it is MASTER/SLAVE. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) api's before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_query_role_s::dev_addr](rsi-bt-req-query-role-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_local_device_role (heading level 8)

`int32_t rsi_bt_set_local_device_role(uint8_t *remote_dev_addr, uint8_t set_role, uint8_t *resp)`

**Description:** Sets the role of local device, whether it is MASTER/SLAVE. This is a blocking API. <br />
 A received event [rsi_bt_on_role_change_t](bt-classic7#rsi-bt-on-role-change-t) indicates that the device role changed successfully.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint8_t|[in]|set_role|- This paramets sets either Master/Slave Role <br /><br/> 0 Master Role <br /><br/> 1 Slave Role|
|uint8_t *|[out]|resp|- response buffer to hold the response of this API|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) api's before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E06 - COMMAND_DISALLOWED <br />  
   0x4046 - ERR_BT_INVALID_ARGS

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_role_s::dev_addr](rsi-bt-req-set-role-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_req_set_role_s::role](rsi-bt-req-set-role-s#role), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_get_services_async (heading level 8)

`int32_t rsi_bt_get_services_async(uint8_t *remote_dev_addr, rsi_bt_resp_query_services_t *bt_resp_query_services)`

**Description:** Queries the services supported by remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device address|
|[rsi_bt_resp_query_services_t](rsi-bt-resp-query-services-s) *|[out]|bt_resp_query_services|- Response struct to hold the response of this API, <br /><br/> please refer [rsi_bt_resp_query_services_s](rsi-bt-resp-query-services-s) structure for more info.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4100 - ERR_BT_INVALID_PDU <br />  
   0x4102 - ERR_BT_SDP_SERVICE_NOT_FOUND <br />  
   0x4101 - ERR_BT_INVALID_PDU_DATA_ELEMENT <br />  
   0x4049 - ERR_BT_SOCK_STATE_INVALID

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_query_services_s::dev_addr](rsi-bt-req-query-services-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_search_service_async (heading level 8)

`int32_t rsi_bt_search_service_async(uint8_t *remote_dev_addr, uint32_t service_uuid)`

**Description:** Search service of the given uuid from remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint32_t|[in]|service_uuid|- uuid of the service for search <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4100 - ERR_BT_INVALID_PDU <br />  
   0x4102 - ERR_BT_SDP_SERVICE_NOT_FOUND <br />  
   0x4101 - ERR_BT_INVALID_PDU_DATA_ELEMENT <br />  
   0x4049 - ERR_BT_SOCK_STATE_INVALID

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_search_service_s::dev_addr](rsi-bt-req-search-service-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [rsi_bt_req_search_service_s::service_uuid](rsi-bt-req-search-service-s#service-uuid)

###### rsi_bt_sniff_mode (heading level 8)

`int32_t rsi_bt_sniff_mode(uint8_t *remote_dev_addr, uint16_t sniff_max_intv, uint16_t sniff_min_intv, uint16_t sniff_attempt, uint16_t sniff_tout)`

**Description:** Request the local device to enter into sniff mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|
|uint16_t|[in]|sniff_max_intv|- Sniff maximum Interval <br />|
|uint16_t|[in]|sniff_min_intv|- Sniff Minimum Interval <br />|
|uint16_t|[in]|sniff_attempt|- Sniff Attempt|
|uint16_t|[in]|sniff_tout|- Sniff timeout|

- [rsi_bt_spp_connect()](bt-classic4#rsi-bt-spp-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4061 - ERR_BT_NO_HCI_CONNECTION <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4E06 - COMMAND_DISALLOWED

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_sniff_mode_s::dev_addr](rsi-bt-req-sniff-mode-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_bt_req_sniff_mode_s::sniff_attempt](rsi-bt-req-sniff-mode-s#sniff-attempt), [rsi_bt_req_sniff_mode_s::sniff_max_intv](rsi-bt-req-sniff-mode-s#sniff-max-intv), [rsi_bt_req_sniff_mode_s::sniff_min_intv](rsi-bt-req-sniff-mode-s#sniff-min-intv) and [rsi_bt_req_sniff_mode_s::sniff_tout](rsi-bt-req-sniff-mode-s#sniff-tout)

###### rsi_bt_sniff_exit_mode (heading level 8)

`int32_t rsi_bt_sniff_exit_mode(uint8_t *remote_dev_addr)`

**Description:** Request the local device to exit from sniff/sniff subrating mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address <br />|

- [rsi_bt_sniff_mode()](bt-classic3#rsi-bt-sniff-mode) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - ERR_BT_INVALID_ARGS <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4E06 - COMMAND_DISALLOWED

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_sniff_exit_mode_s::dev_addr](rsi-bt-req-sniff-exit-mode-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_sniff_subrating_mode (heading level 8)

`int32_t rsi_bt_sniff_subrating_mode(uint8_t *remote_dev_addr, uint16_t max_latency, uint16_t min_remote_tout, uint16_t min_local_tout)`

**Description:** Requests the device entered into the sniff subrating mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- remote device address|
|uint16_t|[in]|max_latency|- Maximum Latency|
|uint16_t|[in]|min_remote_tout|- Minimum remote timeout|
|uint16_t|[in]|min_local_tout|- Minimum local timeout|

- [rsi_bt_sniff_mode()](bt-classic3#rsi-bt-sniff-mode) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - ERR_BT_INVALID_ARGS <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_sniff_subrating_mode_s::dev_addr](rsi-bt-req-sniff-subrating-mode-s#dev-addr), [rsi_bt_req_sniff_subrating_mode_s::max_latency](rsi-bt-req-sniff-subrating-mode-s#max-latency), [memcpy](bt-classic1#memcpy), [rsi_bt_req_sniff_subrating_mode_s::min_local_tout](rsi-bt-req-sniff-subrating-mode-s#min-local-tout), [rsi_bt_req_sniff_subrating_mode_s::min_remote_tout](rsi-bt-req-sniff-subrating-mode-s#min-remote-tout), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_ssp_mode (heading level 8)

`int32_t rsi_bt_set_ssp_mode(uint8_t pair_mode, uint8_t IOcapability)`

**Description:** Enables or disables Simple Secure Profile (SSP) mode and also <br />
 updates the IOcapability, which is used for Authentication process. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|pair_mode|- This parameter is used to enable or disable SSP mode. <br /><br/> This parameters supports the following values. <br /><br/> 0 - Disable <br /><br/> 1 - Enable|
|uint8_t|[in]|IOcapability|- This is the IO capability request for SSP mode. <br /><br/> This parameter supports the following values. <br /><br/> 0 - DisplayOnly <br /><br/> 1 - DisplayYesNo <br /><br/> 2 - KeyboardOnly <br /><br/> 3 - NoInputNoOutput|

- [rsi_bt_set_connectable()](bt-classic3#rsi-bt-set-connectable) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - ERR_BT_INVALID_ARGS <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_set_ssp_mode_s::IO_capability](rsi-bt-req-set-ssp-mode-s#io-capability), [rsi_bt_req_set_ssp_mode_s::pair_mode](rsi-bt-req-set-ssp-mode-s#pair-mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_set_eir_data (heading level 8)

`int32_t rsi_bt_set_eir_data(uint8_t *data, uint16_t data_len)`

**Description:** Sets the extended Inquiry Response data. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|data|- Pointer to the EIR data buffer which is an array that can store data upto 200 Bytes|
|uint16_t|[in]|data_len|- length of the eir data <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .
- Currently EIR data supports upto 200 bytes. <br />

**References:** [rsi_bt_set_eir_data_s::data_len](rsi-bt-set-eir-data-s#data-len), [rsi_bt_set_eir_data_s::eir_data](rsi-bt-set-eir-data-s#eir-data), [rsi_bt_set_eir_data_s::fec_required](rsi-bt-set-eir-data-s#fec-required), [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_add_device_id (heading level 8)

`int32_t rsi_bt_add_device_id(uint16_t spec_id, uint16_t vendor_id, uint16_t product_id, uint16_t version, int primary_rec, uint16_t vendor_id_source)`

**Description:** Add device Identification in SDP protocol. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|spec_id|- Version number of the Bluetooth Device ID Profile specification supported by the device. <br />|
|uint16_t|[in]|vendor_id|- Uniquely identify the vendor of the device.|
|uint16_t|[in]|product_id|- To distinguish between different products made by the vendor <br />|
|uint16_t|[in]|version|- A numeric expression identifying the device release number in Binary-Coded Decimal|
|int|[in]|primary_rec|- Set to TRUE in the case single Device ID Service <br /><br/> Record exists in the device. If multiple Device ID Service Records exist, <br /><br/> and no primary record has been defined, set to FALSE. <br />|
|uint16_t|[in]|vendor_id_source|- This attribute designates which organization assigned the <br /><br/> VendorID attribute, 0x201.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4105 - ERR_BT_SDP_PNP_SERVICE_ALREADY_EXISTS <br />  
   0x4046 - ERR_BT_INVALID_ARGS <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_add_device_id_s::primary_rec](rsi-bt-req-add-device-id-s#primary-rec), [rsi_bt_req_add_device_id_s::product_id](rsi-bt-req-add-device-id-s#product-id), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_bt_req_add_device_id_s::spec_id](rsi-bt-req-add-device-id-s#spec-id), [rsi_bt_req_add_device_id_s::vendor_id](rsi-bt-req-add-device-id-s#vendor-id), [rsi_bt_req_add_device_id_s::vendor_id_source](rsi-bt-req-add-device-id-s#vendor-id-source) and [rsi_bt_req_add_device_id_s::version](rsi-bt-req-add-device-id-s#version)

###### rsi_bt_change_pkt_type (heading level 8)

`int32_t rsi_bt_change_pkt_type(uint8_t *remote_dev_addr, uint16_t pkt_type)`

**Description:** Change the packet types in the controller after connection only, can switch between <br />
 2DH3,2DH5,3DH3,3DH5. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device address|
|uint16_t|[in]|pkt_type|- change the packet types in the controller <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4061 - ERR_BT_NO_HCI_CONNECTION <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_ptt_pkt_type_s::dev_addr](rsi-bt-ptt-pkt-type-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_bt_ptt_pkt_type_s::pkt_type](rsi-bt-ptt-pkt-type-s#pkt-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_ptt_req (heading level 8)

`int32_t rsi_bt_ptt_req(uint8_t mode)`

**Description:** Configure the LP HP transitions in the controller. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|- BR/EDR mode <br /><br/> 0 - BR Mode <br /><br/> 1 - EDR Mode <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E01 - UNKNOWN_HCI_COMMAND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_ptt_mode_s::mode](rsi-bt-ptt-mode-s#mode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_request_authentication (heading level 8)

`int32_t rsi_bt_request_authentication(int8_t *remote_dev_addr)`

**Description:** Usually Authentication procedure will starts from stack itself <br />
 once PHY Level Connection completes, but if already authentication is in <br />
 disable state and after PHY Level Connection if User needs Authetication, <br />
 then firstly need to enable Authentication and secondly call this API. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_addr|- Remote device address|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4061 - ERR_BT_NO_HCI_CONNECTION <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_cmd_conn_auth_s::dev_addr](rsi-bt-cmd-conn-auth-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_encryption_enable_or_disable (heading level 8)

`int32_t rsi_bt_encryption_enable_or_disable(int8_t *remote_dev_addr, uint8_t enable_or_disable)`

**Description:** Usually Encrytpion procedure will starts from stack itself once <br />
 PHY Level Connection and authentication completed, but user can decide <br />
 whether to enable/disable encryption from the host. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_addr|- Remote device address|
|uint8_t|[in]|enable_or_disable|- To enable/disable the encryption. <br /><br/> 1 - Enable <br /><br/> 0 - Disable <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4061 - ERR_BT_NO_HCI_CONNECTION <br />  
   0x4E02 - UNKNOWN_CONNECTION_IDENTIFIER <br />  
   0x4E11 - UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_cmd_conn_enc_s::dev_addr](rsi-bt-cmd-conn-enc-s#dev-addr), [rsi_bt_cmd_conn_enc_s::enable_or_disable](rsi-bt-cmd-conn-enc-s#enable-or-disable), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### SPP

###### Functions (heading level 7)

###### rsi_bt_spp_init (heading level 8)

`rsi_bt_spp_init(void)`

**Description:** Set the SPP profile mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_req_profile_mode_s::profile_mode](rsi-bt-req-profile-mode-s#profile-mode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_spp_connect (heading level 8)

`int32_t rsi_bt_spp_connect(uint8_t *remote_dev_addr)`

**Description:** Initiate the SPP profile level connection. This is a blocking API. A received event [rsi_bt_on_spp_connect_t](bt-classic7#rsi-bt-on-spp-connect-t) indicates that the connection opened successfully.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device address|

- [rsi_bt_spp_init()](bt-classic4#rsi-bt-spp-init) API and [rsi_bt_connect()](bt-classic3#rsi-bt-connect) API needs to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4501 - ERR_BT_SPP_NOT_INITIALISED <br />  
   0x4046 - ERR_BT_INVALID_ARGS <br />  
   0x4102 - ERR_SDP_SRV_NOT_FOUND

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_connect_s::dev_addr](rsi-bt-req-connect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_spp_disconnect (heading level 8)

`int32_t rsi_bt_spp_disconnect(uint8_t *remote_dev_addr)`

**Description:** Initiate the SPP Profile level disconnection. This is a blocking API. A received event [rsi_bt_on_spp_disconnect_t](bt-classic7#rsi-bt-on-spp-disconnect-t) indicates that the spp connection is disconnected successfully.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- This is the remote device address <br />|

- [rsi_bt_spp_connect()](bt-classic4#rsi-bt-spp-connect) API need to be called before this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4501 - ERR_BT_SPP_NOT_INITIALISED <br />  
   0x4500 - ERR_BT_SPP_NOT_CONNECTED

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_disconnect_s::dev_addr](rsi-bt-req-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [USED_PARAMETER](bt-classic1#used-parameter)

###### rsi_bt_spp_transfer (heading level 8)

`int32_t rsi_bt_spp_transfer(uint8_t *remote_dev_addr, uint8_t *data, uint16_t length)`

**Description:** Transfers the data through SPP profile. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- This is the remote device address <br />|
|uint8_t *|[in]|data|- This is the data for transmission|
|uint16_t|[in]|length|- This is the data length for transfer, Max length supported upto 1000 bytes <br />|

- [rsi_bt_spp_connect()](bt-classic4#rsi-bt-spp-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non Zero Value - Failure <br />  
   0x4501 - ERR_BT_SPP_NOT_INITIALISED <br />  
   0x4500 - ERR_BT_SPP_NOT_CONNECTED <br />  
   0x4201 - ERR_BT_RFCOMM_DISCONNECTED <br />  
   0x4049 - ERR_BT_SOCK_STATE_INVALID

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) . <br />

**References:** [rsi_bt_req_spp_transfer_s::data](rsi-bt-req-spp-transfer-s#data), [rsi_bt_req_spp_transfer_s::data_length](rsi-bt-req-spp-transfer-s#data-length), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### Test Mode

###### Functions (heading level 7)

###### rsi_bt_per_stats (heading level 8)

`int32_t rsi_bt_per_stats(uint8_t cmd_type, struct rsi_bt_per_stats_s *per_stats)`

**Description:** Request the local device for BT PER operation.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|cmd_type|- Parameter to define the command id type for PER operation. <br /><br/> BT_PER_STATS_CMD_ID (0x08) - Command id enables PER statistics <br /><br/> BT_TRANSMIT_CMD_ID (0x15) - Command id enables PER transmit <br /><br/> BT_RECEIVE_CMD_ID (0x16) - Command id enables PER receive <br />|
|struct [rsi_bt_per_stats_s](rsi-bt-per-stats-s) *|[in]|rsi_bt_per_stats|- reference to the response structure. Please refer to [rsi_bt_per_stats_s](rsi-bt-per-stats-s) structure for more info.|

- Call [rsi_bt_per_tx()](bt-classic5#rsi-bt-per-tx) or [rsi_bt_per_rx()](bt-classic5#rsi-bt-per-rx) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_per_cw_mode (heading level 8)

`int32_t rsi_bt_per_cw_mode(struct rsi_bt_per_cw_mode_s *bt_cw_mode)`

**Description:** Keep the device in continuous wave mode. <br />
 Not necessary to be called if transmit_mode is set to 2 - CONTINUOUS_WAVE_MODE in [rsi_bt_tx_per_params_s](rsi-bt-tx-per-params-s) structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|struct [rsi_bt_per_cw_mode_s](rsi-bt-per-cw-mode-s) *|[in]|bt_cw_mode|- continuous wave mode information needs to filled in this structure. Please refer [rsi_bt_per_cw_mode_s](rsi-bt-per-cw-mode-s) for more info.|

- Call [rsi_bt_per_tx()](bt-classic5#rsi-bt-per-tx) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_vendor_avdtp_stats_enable (heading level 8)

`int32_t rsi_bt_vendor_avdtp_stats_enable(uint16_t avdtp_stats_enable, uint32_t avdtp_stats_rate)`

**Description:** Issue vendor specific command for setting avdtp stats enable in controller, to receive the Stats. <br />
 This is a blocking API. A received event [rsi_bt_on_avdtp_stats_t](bt-classic7#rsi-bt-on-avdtp-stats-t) has AVDTP Stats.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|avdtp_stats_enable|- stats enable, Enables the AVDTP stats in Controller|
|uint32_t|[in]|avdtp_stats_rate|- stats rate, The rate for which the stats received to Host. <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Note**

- Presently stats rate is defined with 30000 milisec. This is the minimum time will be fine tunes by running all the possible modes.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_vendor_avdtp_stats_s::avdtp_stats_enable](rsi-bt-vendor-avdtp-stats-s#avdtp-stats-enable), [rsi_bt_vendor_avdtp_stats_s::avdtp_stats_rate](rsi-bt-vendor-avdtp-stats-s#avdtp-stats-rate), [rsi_bt_vendor_avdtp_stats_s::opcode](rsi-bt-vendor-avdtp-stats-s#opcode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_vendor_ar_enable (heading level 8)

`int32_t rsi_bt_vendor_ar_enable(uint16_t enable)`

**Description:** Issue vendor specific command for setting AutoRate in controller on given inputs. <br />
 This is a blocking API. A received event [rsi_bt_on_ar_stats_t](bt-classic7#rsi-bt-on-ar-stats-t) has AutoRate Stats.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|enable|- enables the AutoRate.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_vendor_ar_cmd_s::_2m_state_continuous_pass_threshold](rsi-bt-vendor-ar-cmd-s#2m-state-continuous-pass-threshold), [rsi_bt_vendor_ar_cmd_s::_2m_state_pass_threshold](rsi-bt-vendor-ar-cmd-s#2m-state-pass-threshold), [rsi_bt_vendor_ar_cmd_s::_3m_state_absolute_fail_threshold](rsi-bt-vendor-ar-cmd-s#3m-state-absolute-fail-threshold), [rsi_bt_vendor_ar_cmd_s::_3m_state_continuous_fail_threshold](rsi-bt-vendor-ar-cmd-s#3m-state-continuous-fail-threshold), [rsi_bt_vendor_ar_cmd_s::_3m_state_relative_fail_threshold](rsi-bt-vendor-ar-cmd-s#3m-state-relative-fail-threshold), [rsi_bt_vendor_ar_cmd_s::ar_enable](rsi-bt-vendor-ar-cmd-s#ar-enable), [rsi_bt_vendor_ar_cmd_s::opcode](rsi-bt-vendor-ar-cmd-s#opcode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_vendor_set_hapi_rect_val (heading level 8)

`rsi_bt_vendor_set_hapi_rect_val(uint8_t value)`

**Description:** Issue vendor specific command for setting respective RECT defines in HAPI/DOTC. <br />
 This is a blocking API. The division of rect_val is as follows - BITS[7:6] - RECT selection for LR (Default value -> 0b00), BITS[5:4] - RECT selection for LE 2 Mbps (Default value -> 0b00), BITS[3:2] - RECT selection for LE 1 Mbps (Default value -> 0b00), BITS[1:0] - reserved (Default -> 0b01)

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|value|- enables the respective RECT define in HAPI/DOTC.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_set_hapi_rect_val_s::opcode](rsi-bt-set-hapi-rect-val-s#opcode), [rsi_bt_set_hapi_rect_val_s::rect_val](rsi-bt-set-hapi-rect-val-s#rect-val), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_vendor_dynamic_pwr (heading level 8)

`int32_t rsi_bt_vendor_dynamic_pwr(uint16_t enable, uint8_t *remote_addr, uint8_t power_index_br, uint8_t power_index_2m, uint8_t power_index_3m)`

**Description:** Issue vendor specific command for setting dynamic_tx_power_index in controller on given inputs. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|enable|- Remote Device Address|
|uint8_t *|[in]|remote_addr|- Power value sets to BR Mode .|
|uint8_t|[in]|power_index_br|- Power value sets to 2m Mode data rate|
|uint8_t|[in]|power_index_2m|- Power value sets to 3m Mode data rate|
|uint8_t|N/A|power_index_3m||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [dynamic_pwr_index_s::dynamic_power_enable](dynamic-pwr-index-s#dynamic-power-enable), [set_dynamic_pwr_index_s::dynamic_pwr_index](set-dynamic-pwr-index-s#dynamic-pwr-index), [memcpy](bt-classic1#memcpy), [rsi_bt_vendor_dynamic_pwr_cmd_s::opcode](rsi-bt-vendor-dynamic-pwr-cmd-s#opcode), [dynamic_pwr_index_s::pwr_index_2m](dynamic-pwr-index-s#pwr-index-2m), [dynamic_pwr_index_s::pwr_index_3m](dynamic-pwr-index-s#pwr-index-3m), [dynamic_pwr_index_s::pwr_index_br](dynamic-pwr-index-s#pwr-index-br), [set_dynamic_pwr_index_s::remote_dev](set-dynamic-pwr-index-s#remote-dev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_bt_vendor_dynamic_pwr_cmd_s::set_dynamic_pwr_index](rsi-bt-vendor-dynamic-pwr-cmd-s#set-dynamic-pwr-index) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_vendor_set_afh_classification_intervals (heading level 8)

`int32_t rsi_bt_vendor_set_afh_classification_intervals(uint16_t afh_min, uint16_t afh_max)`

**Description:** Issue vendor specific command for setting afh min and max in controller on given inputs.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|afh_min|- afh minimum interval|
|uint16_t|[in]|afh_max|- afh maximum interval|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_bt_vendor_afh_classification_cmd_s::afh_max](rsi-bt-vendor-afh-classification-cmd-s#afh-max), [rsi_bt_vendor_afh_classification_cmd_s::afh_min](rsi-bt-vendor-afh-classification-cmd-s#afh-min), [rsi_bt_vendor_afh_classification_cmd_s::opcode](rsi-bt-vendor-afh-classification-cmd-s#opcode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_enable_device_under_testmode (heading level 8)

`int32_t rsi_bt_enable_device_under_testmode(void)`

**Description:** LMP has PDUs to support different test modes used for certification and compliance testing <br />
 of the Bluetooth radio and baseband. We can activate locally (via a HW or SW interface), <br />
 or using the air interface. For activation over the air interface, entering the test mode shall be <br />
 locally enabled for security and type approval reasons. So, to keep the device in test_mode locally, will call this API. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_per_rx (heading level 8)

`int32_t rsi_bt_per_rx(uint32_t *bt_perrx)`

**Description:** Configure the per receive parameters in the controller and start/stop the PER.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t *|[in]|bt_perrx|- Buffer to hold the structure values. Please Refer to [rsi_bt_rx_per_params_s](rsi-bt-rx-per-params-s) structure for more info.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_bt_per_tx (heading level 8)

`int32_t rsi_bt_per_tx(uint32_t *bt_pertx)`

**Description:** Configure the per transmit parameters in the controller and start/stop the PER.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t *|[in]|bt_pertx|- Buffer to hold the structure values. Please refer to [rsi_bt_tx_per_params_s](rsi-bt-tx-per-params-s) structure for more info.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for common error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### Register callbacks

###### Functions (heading level 7)

###### rsi_bt_gap_register_callbacks (heading level 8)

`void rsi_bt_gap_register_callbacks(rsi_bt_on_role_change_t bt_on_role_change_status_event, rsi_bt_on_connect_t bt_on_conn_status_event, rsi_bt_on_unbond_t bt_on_unbond_status, rsi_bt_on_disconnect_t bt_on_disconnect_event, rsi_bt_on_scan_resp_t bt_on_scan_resp_event, rsi_bt_on_remote_name_resp_t bt_on_remote_name_resp_event, rsi_bt_on_passkey_display_t bt_on_passkey_display_event, rsi_bt_on_remote_name_request_cancel_t bt_on_remote_name_request_cancel_event, rsi_bt_on_confirm_request_t bt_on_confirm_request_event, rsi_bt_on_pincode_request_t bt_on_pincode_request_event, rsi_bt_on_passkey_request_t bt_on_passkey_request_event, rsi_bt_on_inquiry_complete_t bt_on_inquiry_complete_event, rsi_bt_on_auth_complete_t bt_on_auth_complete_event, rsi_bt_on_linkkey_request_t bt_on_linkkey_request_event, rsi_bt_on_ssp_complete_t bt_on_ssp_complete_event, rsi_bt_on_linkkey_save_t bt_on_linkkey_save_event, rsi_bt_on_get_services_t bt_on_get_services_event, rsi_bt_on_search_service_t bt_on_search_service_event, rsi_bt_on_mode_chnage_t bt_on_mode_change_event, rsi_bt_on_sniff_subrating_t bt_on_sniff_subrating_event, rsi_bt_on_connection_initiated_t bt_on_connection_initiated)`

**Description:** Register the GAP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_role_change_t](bt-classic7#rsi-bt-on-role-change-t)|[in]|bt_on_role_change_status_event|- Connection status callback|
|[rsi_bt_on_connect_t](bt-classic7#rsi-bt-on-connect-t)|[in]|bt_on_conn_status_event|- Connection status callback|
|[rsi_bt_on_unbond_t](bt-classic7#rsi-bt-on-unbond-t)|[in]|bt_on_unbond_status|- Connection status callback|
|[rsi_bt_on_disconnect_t](bt-classic7#rsi-bt-on-disconnect-t)|[in]|bt_on_disconnect_event|- Disconnection status callback|
|[rsi_bt_on_scan_resp_t](bt-classic7#rsi-bt-on-scan-resp-t)|[in]|bt_on_scan_resp_event|- Scan report callback|
|[rsi_bt_on_remote_name_resp_t](bt-classic7#rsi-bt-on-remote-name-resp-t)|[in]|bt_on_remote_name_resp_event|- Remote name report callback|
|[rsi_bt_on_passkey_display_t](bt-classic7#rsi-bt-on-passkey-display-t)|[in]|bt_on_passkey_display_event|- Passkey display report callback|
|[rsi_bt_on_remote_name_request_cancel_t](bt-classic7#rsi-bt-on-remote-name-request-cancel-t)|[in]|bt_on_remote_name_request_cancel_event|- Remote name request cancel status callback|
|[rsi_bt_on_confirm_request_t](bt-classic7#rsi-bt-on-confirm-request-t)|[in]|bt_on_confirm_request_event|- Authentication status callback|
|[rsi_bt_on_pincode_request_t](bt-classic7#rsi-bt-on-pincode-request-t)|[in]|bt_on_pincode_request_event|- Pincode request status callback|
|[rsi_bt_on_passkey_request_t](bt-classic7#rsi-bt-on-passkey-request-t)|[in]|bt_on_passkey_request_event|- Passkey request status callback|
|[rsi_bt_on_inquiry_complete_t](bt-classic7#rsi-bt-on-inquiry-complete-t)|[in]|bt_on_inquiry_complete_event|- Inquiry report callback|
|[rsi_bt_on_auth_complete_t](bt-classic7#rsi-bt-on-auth-complete-t)|[in]|bt_on_auth_complete_event|- Authentication status callback|
|[rsi_bt_on_linkkey_request_t](bt-classic7#rsi-bt-on-linkkey-request-t)|[in]|bt_on_linkkey_request_event|- Linkkey request report callback|
|[rsi_bt_on_ssp_complete_t](bt-classic7#rsi-bt-on-ssp-complete-t)|[in]|bt_on_ssp_complete_event|- SSP status callback|
|[rsi_bt_on_linkkey_save_t](bt-classic7#rsi-bt-on-linkkey-save-t)|[in]|bt_on_linkkey_save_event|- Linkkey save status callback|
|[rsi_bt_on_get_services_t](bt-classic7#rsi-bt-on-get-services-t)|[in]|bt_on_get_services_event|- Get services report callback|
|[rsi_bt_on_search_service_t](bt-classic7#rsi-bt-on-search-service-t)|[in]|bt_on_search_service_event|- Search service status callback|
|[rsi_bt_on_mode_chnage_t](bt-classic7#rsi-bt-on-mode-chnage-t)|N/A|bt_on_mode_change_event||
|[rsi_bt_on_sniff_subrating_t](bt-classic7#rsi-bt-on-sniff-subrating-t)|N/A|bt_on_sniff_subrating_event||
|[rsi_bt_on_connection_initiated_t](bt-classic7#rsi-bt-on-connection-initiated-t)|N/A|bt_on_connection_initiated||

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_auth_complete_event](rsi-bt-classic-cb-s#bt-on-auth-complete-event), [rsi_bt_classic_cb_s::bt_on_confirm_request_event](rsi-bt-classic-cb-s#bt-on-confirm-request-event), [rsi_bt_classic_cb_s::bt_on_conn_status_event](rsi-bt-classic-cb-s#bt-on-conn-status-event), [rsi_bt_classic_cb_s::bt_on_connection_initiated](rsi-bt-classic-cb-s#bt-on-connection-initiated), [rsi_bt_classic_cb_s::bt_on_disconnect_event](rsi-bt-classic-cb-s#bt-on-disconnect-event), [rsi_bt_classic_cb_s::bt_on_get_services_event](rsi-bt-classic-cb-s#bt-on-get-services-event), [rsi_bt_classic_cb_s::bt_on_inquiry_complete_event](rsi-bt-classic-cb-s#bt-on-inquiry-complete-event), [rsi_bt_classic_cb_s::bt_on_linkkey_request_event](rsi-bt-classic-cb-s#bt-on-linkkey-request-event), [rsi_bt_classic_cb_s::bt_on_linkkey_save_event](rsi-bt-classic-cb-s#bt-on-linkkey-save-event), [rsi_bt_classic_cb_s::bt_on_mode_change_event](rsi-bt-classic-cb-s#bt-on-mode-change-event), [rsi_bt_classic_cb_s::bt_on_passkey_display_event](rsi-bt-classic-cb-s#bt-on-passkey-display-event), [rsi_bt_classic_cb_s::bt_on_passkey_request_event](rsi-bt-classic-cb-s#bt-on-passkey-request-event), [rsi_bt_classic_cb_s::bt_on_pincode_request_event](rsi-bt-classic-cb-s#bt-on-pincode-request-event), [rsi_bt_classic_cb_s::bt_on_remote_name_request_cancel_event](rsi-bt-classic-cb-s#bt-on-remote-name-request-cancel-event), [rsi_bt_classic_cb_s::bt_on_remote_name_resp_event](rsi-bt-classic-cb-s#bt-on-remote-name-resp-event), [rsi_bt_classic_cb_s::bt_on_role_change_status_event](rsi-bt-classic-cb-s#bt-on-role-change-status-event), [rsi_bt_classic_cb_s::bt_on_scan_resp_event](rsi-bt-classic-cb-s#bt-on-scan-resp-event), [rsi_bt_classic_cb_s::bt_on_search_service_event](rsi-bt-classic-cb-s#bt-on-search-service-event), [rsi_bt_classic_cb_s::bt_on_sniff_subrating_event](rsi-bt-classic-cb-s#bt-on-sniff-subrating-event), [rsi_bt_classic_cb_s::bt_on_ssp_complete_event](rsi-bt-classic-cb-s#bt-on-ssp-complete-event), [rsi_bt_classic_cb_s::bt_on_unbond_status](rsi-bt-classic-cb-s#bt-on-unbond-status), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_smp_register_callbacks (heading level 8)

`uint16_t rsi_bt_smp_register_callbacks(uint16_t callback_id, void(*callback_handler_ptr)(uint16_t status, uint8_t *buffer))`

**Description:** Register the BT SMP call back functions.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|callback_id|- This is the Id of the call back function Following ids are supported:|
|void(*)(uint16_t status, uint8_t *buffer)|[in]|callback_handler_ptr|(*callback_handler_ptr)(void - This is the Call back handler|
||[in]|status|- status of the asynchronous response|
||[in]|buffer|- payload of the asynchronous response|

**Returns**

- 0 - Success <br />  
   -50 - Failure <br />  
   If call_back_id is greater than the maximum callbacks to register, returns ref/ RSI_ERROR_BLE_INVALID_CALLBACK_CNT.

**Note**

- In callbacks, application should not initiate any TX operation to the module.

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_ctkd_event](rsi-bt-classic-cb-s#bt-on-ctkd-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_bt_avdtp_events_register_callbacks (heading level 8)

`void rsi_bt_avdtp_events_register_callbacks(rsi_bt_on_avdtp_stats_t bt_on_avdtp_stats_event)`

**Description:** Register the AVDTP Event callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_avdtp_stats_t](bt-classic7#rsi-bt-on-avdtp-stats-t)|[in]|bt_on_avdtp_stats_event|- AVDP stats callback|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_avdtp_stats_event](rsi-bt-classic-cb-s#bt-on-avdtp-stats-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_pkt_change_events_register_callbacks (heading level 8)

`void rsi_bt_pkt_change_events_register_callbacks(rsi_bt_pkt_change_stats_t bt_pkt_change_stats_event)`

**Description:** Register the HCI callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_pkt_change_stats_t](bt-classic7#rsi-bt-pkt-change-stats-t)|[in]|bt_pkt_change_stats_event|- This a callback function and will be called when ever packet change event received from the module.|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_pkt_change_stats_event](rsi-bt-classic-cb-s#bt-pkt-change-stats-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_ar_events_register_callbacks (heading level 8)

`void rsi_bt_ar_events_register_callbacks(rsi_bt_on_ar_stats_t bt_on_ar_stats_event)`

**Description:** Register events stats callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_ar_stats_t](bt-classic7#rsi-bt-on-ar-stats-t)|[in]|bt_on_ar_stats_event|- Status Event callback|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_ar_stats_event](rsi-bt-classic-cb-s#bt-on-ar-stats-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_spp_register_callbacks (heading level 8)

`void rsi_bt_spp_register_callbacks(rsi_bt_on_spp_connect_t bt_on_spp_connect_event, rsi_bt_on_spp_disconnect_t bt_on_spp_disconnect_event, rsi_bt_on_spp_rx_data_t bt_on_spp_rx_data_event)`

**Description:** Register the SPP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_spp_connect_t](bt-classic7#rsi-bt-on-spp-connect-t)|[in]|bt_on_spp_connect_event|- spp connection status callback|
|[rsi_bt_on_spp_disconnect_t](bt-classic7#rsi-bt-on-spp-disconnect-t)|[in]|bt_on_spp_disconnect_event|- spp disconnection status callback|
|[rsi_bt_on_spp_rx_data_t](bt-classic7#rsi-bt-on-spp-rx-data-t)|[in]|bt_on_spp_rx_data_event|- spp data transfer status callback|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_spp_connect_event](rsi-bt-classic-cb-s#bt-on-spp-connect-event), [rsi_bt_classic_cb_s::bt_on_spp_disconnect_event](rsi-bt-classic-cb-s#bt-on-spp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_spp_rx_data_event](rsi-bt-classic-cb-s#bt-on-spp-rx-data-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_a2dp_register_callbacks (heading level 8)

`void rsi_bt_a2dp_register_callbacks(rsi_bt_on_a2dp_connect_t bt_on_a2dp_connect_event, rsi_bt_on_a2dp_disconnect_t bt_on_a2dp_disconnect_event, rsi_bt_on_a2dp_configure_t bt_on_a2dp_configure_event, rsi_bt_on_a2dp_open_t bt_on_a2dp_open_event, rsi_bt_on_a2dp_start_t bt_on_a2dp_start_event, rsi_bt_on_a2dp_suspend_t bt_on_a2dp_suspend_event, rsi_bt_on_a2dp_abort_t bt_on_a2dp_abort_event, rsi_bt_on_a2dp_close_t bt_on_a2dp_close_event, rsi_bt_on_a2dp_encode_data_t bt_on_a2dp_encode_data_event, rsi_bt_on_a2dp_pcm_data_t bt_on_a2dp_pcm_data_event, rsi_bt_on_a2dp_data_req_t bt_on_a2dp_data_req_event, rsi_bt_on_a2dp_reconfig_t bt_on_a2dp_reconfig_event)`

**Description:** Register the A2DP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_a2dp_connect_t](bt-classic7#rsi-bt-on-a2dp-connect-t)|[in]|bt_on_a2dp_connect_event|- A2DP connection status callback|
|[rsi_bt_on_a2dp_disconnect_t](bt-classic7#rsi-bt-on-a2dp-disconnect-t)|[in]|bt_on_a2dp_disconnect_event|- A2DP disconnection status callback|
|[rsi_bt_on_a2dp_configure_t](bt-classic7#rsi-bt-on-a2dp-configure-t)|[in]|bt_on_a2dp_configure_event|- A2DP configure status callback|
|[rsi_bt_on_a2dp_open_t](bt-classic7#rsi-bt-on-a2dp-open-t)|[in]|bt_on_a2dp_open_event|- A2DP open callback|
|[rsi_bt_on_a2dp_start_t](bt-classic7#rsi-bt-on-a2dp-start-t)|[in]|bt_on_a2dp_start_event|- A2DP start status callback|
|[rsi_bt_on_a2dp_suspend_t](bt-classic7#rsi-bt-on-a2dp-suspend-t)|[in]|bt_on_a2dp_suspend_event|- A2DP suspend status callback|
|[rsi_bt_on_a2dp_abort_t](bt-classic7#rsi-bt-on-a2dp-abort-t)|[in]|bt_on_a2dp_abort_event|- A2DP abort status callback|
|[rsi_bt_on_a2dp_close_t](bt-classic7#rsi-bt-on-a2dp-close-t)|[in]|bt_on_a2dp_close_event|- A2DP close status callback|
|[rsi_bt_on_a2dp_encode_data_t](bt-classic7#rsi-bt-on-a2dp-encode-data-t)|[in]|bt_on_a2dp_encode_data_event|- A2DP encode data stauts callback|
|[rsi_bt_on_a2dp_pcm_data_t](bt-classic7#rsi-bt-on-a2dp-pcm-data-t)|[in]|bt_on_a2dp_pcm_data_event|- A2DP pcm data status callback|
|[rsi_bt_on_a2dp_data_req_t](bt-classic7#rsi-bt-on-a2dp-data-req-t)|[in]|bt_on_a2dp_data_req_event|- A2DP data request status callback|
|[rsi_bt_on_a2dp_reconfig_t](bt-classic7#rsi-bt-on-a2dp-reconfig-t)|[in]|bt_on_a2dp_reconfig_event|- A2DP reconfig status callback|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_a2dp_abort_event](rsi-bt-classic-cb-s#bt-on-a2dp-abort-event), [rsi_bt_classic_cb_s::bt_on_a2dp_close_event](rsi-bt-classic-cb-s#bt-on-a2dp-close-event), [rsi_bt_classic_cb_s::bt_on_a2dp_configure_event](rsi-bt-classic-cb-s#bt-on-a2dp-configure-event), [rsi_bt_classic_cb_s::bt_on_a2dp_connect_event](rsi-bt-classic-cb-s#bt-on-a2dp-connect-event), [rsi_bt_classic_cb_s::bt_on_a2dp_data_req_event](rsi-bt-classic-cb-s#bt-on-a2dp-data-req-event), [rsi_bt_classic_cb_s::bt_on_a2dp_disconnect_event](rsi-bt-classic-cb-s#bt-on-a2dp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_a2dp_encode_data_event](rsi-bt-classic-cb-s#bt-on-a2dp-encode-data-event), [rsi_bt_classic_cb_s::bt_on_a2dp_open_event](rsi-bt-classic-cb-s#bt-on-a2dp-open-event), [rsi_bt_classic_cb_s::bt_on_a2dp_pcm_data_event](rsi-bt-classic-cb-s#bt-on-a2dp-pcm-data-event), [rsi_bt_classic_cb_s::bt_on_a2dp_reconfig_event](rsi-bt-classic-cb-s#bt-on-a2dp-reconfig-event), [rsi_bt_classic_cb_s::bt_on_a2dp_start_event](rsi-bt-classic-cb-s#bt-on-a2dp-start-event), [rsi_bt_classic_cb_s::bt_on_a2dp_suspend_event](rsi-bt-classic-cb-s#bt-on-a2dp-suspend-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_register_callbacks (heading level 8)

`void rsi_bt_avrcp_register_callbacks(rsi_bt_on_avrcp_connect_t bt_on_avrcp_connect_event, rsi_bt_on_avrcp_disconnect_t bt_on_avrcp_disconnect_event, rsi_bt_on_avrcp_play_t bt_on_avrcp_play_event, rsi_bt_on_avrcp_pause_t bt_on_avrcp_pause_event, rsi_bt_on_avrcp_stop_t bt_on_avrcp_stop_event, rsi_bt_on_avrcp_next_t bt_on_avrcp_next_event, rsi_bt_on_avrcp_previous_t bt_on_avrcp_previous_event, rsi_bt_on_avrcp_vol_up_t bt_on_avrcp_vol_up_event, rsi_bt_on_avrcp_vol_down_t bt_on_avrcp_vol_down_event, rsi_bt_on_avrcp_get_elem_attr_resp_t bt_on_avrcp_get_elem_attr_resp_event, rsi_bt_on_avrcp_notify_event_t bt_on_avrcp_notify_event)`

**Description:** Register the AVRCP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_avrcp_connect_t](bt-classic7#rsi-bt-on-avrcp-connect-t)|[in]|bt_on_avrcp_connect_event|- AVRCP connection status callback|
|[rsi_bt_on_avrcp_disconnect_t](bt-classic7#rsi-bt-on-avrcp-disconnect-t)|[in]|bt_on_avrcp_disconnect_event|- AVRCP disconnection status callback|
|[rsi_bt_on_avrcp_play_t](bt-classic7#rsi-bt-on-avrcp-play-t)|[in]|bt_on_avrcp_play_event|- AVRCP play status callback|
|[rsi_bt_on_avrcp_pause_t](bt-classic7#rsi-bt-on-avrcp-pause-t)|[in]|bt_on_avrcp_pause_event|- AVRCP pause status callback|
|[rsi_bt_on_avrcp_stop_t](bt-classic7#rsi-bt-on-avrcp-stop-t)|[in]|bt_on_avrcp_stop_event|- AVRCP stop status callback|
|[rsi_bt_on_avrcp_next_t](bt-classic7#rsi-bt-on-avrcp-next-t)|[in]|bt_on_avrcp_next_event|- AVRCP next status callback|
|[rsi_bt_on_avrcp_previous_t](bt-classic7#rsi-bt-on-avrcp-previous-t)|[in]|bt_on_avrcp_previous_event|- AVRCP previous status callback|
|[rsi_bt_on_avrcp_vol_up_t](bt-classic7#rsi-bt-on-avrcp-vol-up-t)|[in]|bt_on_avrcp_vol_up_event|- AVRCP vol up status callback|
|[rsi_bt_on_avrcp_vol_down_t](bt-classic7#rsi-bt-on-avrcp-vol-down-t)|[in]|bt_on_avrcp_vol_down_event|- AVRCP vol down status callback|
|[rsi_bt_on_avrcp_get_elem_attr_resp_t](bt-classic7#rsi-bt-on-avrcp-get-elem-attr-resp-t)|[in]|bt_on_avrcp_get_elem_attr_resp_event|- AVRCP elem attr resp status callback|
|[rsi_bt_on_avrcp_notify_event_t](bt-classic7#rsi-bt-on-avrcp-notify-event-t)|N/A|bt_on_avrcp_notify_event||

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_avrcp_connect_event](rsi-bt-classic-cb-s#bt-on-avrcp-connect-event), [rsi_bt_classic_cb_s::bt_on_avrcp_disconnect_event](rsi-bt-classic-cb-s#bt-on-avrcp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_avrcp_get_elem_attr_resp_event](rsi-bt-classic-cb-s#bt-on-avrcp-get-elem-attr-resp-event), [rsi_bt_classic_cb_s::bt_on_avrcp_next_event](rsi-bt-classic-cb-s#bt-on-avrcp-next-event), [rsi_bt_classic_cb_s::bt_on_avrcp_notify_event](rsi-bt-classic-cb-s#bt-on-avrcp-notify-event), [rsi_bt_classic_cb_s::bt_on_avrcp_pause_event](rsi-bt-classic-cb-s#bt-on-avrcp-pause-event), [rsi_bt_classic_cb_s::bt_on_avrcp_play_event](rsi-bt-classic-cb-s#bt-on-avrcp-play-event), [rsi_bt_classic_cb_s::bt_on_avrcp_previous_event](rsi-bt-classic-cb-s#bt-on-avrcp-previous-event), [rsi_bt_classic_cb_s::bt_on_avrcp_stop_event](rsi-bt-classic-cb-s#bt-on-avrcp-stop-event), [rsi_bt_classic_cb_s::bt_on_avrcp_vol_down_event](rsi-bt-classic-cb-s#bt-on-avrcp-vol-down-event), [rsi_bt_classic_cb_s::bt_on_avrcp_vol_up_event](rsi-bt-classic-cb-s#bt-on-avrcp-vol-up-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_avrcp_target_register_callbacks (heading level 8)

`void rsi_bt_avrcp_target_register_callbacks(rsi_bt_on_avrcp_get_cap_event_t bt_on_avrcp_gat_cap, rsi_bt_on_avrcp_get_app_supp_atts_event_t bt_on_avrcp_get_app_att_list, rsi_bt_on_avrcp_get_app_suup_att_vals_event_t bt_on_avrcp_get_app_att_vals_list, rsi_bt_on_avrcp_get_app_cur_att_val_event_t bt_on_avrcp_get_app_cur_att_val, rsi_bt_on_avrcp_set_app_cur_att_val_event_t bt_on_avrcp_set_app_cur_att_val, rsi_bt_on_avrcp_get_app_att_text_event_t bt_on_avrcp_get_app_att_text, rsi_bt_on_avrcp_get_app_att_vals_text_event_t bt_on_avrcp_get_app_att_vals_text, rsi_bt_on_avrcp_supp_char_sets_event_t bt_on_avrcp_supp_char_sets, rsi_bt_on_avrcp_batt_status_event_t bt_on_avrcp_batt_status, rsi_bt_on_avrcp_get_song_atts_event_t bt_on_avrcp_get_song_atts, rsi_bt_on_avrcp_get_play_status_event_t bt_on_avrcp_get_player_status, rsi_bt_on_avrcp_reg_notify_event_t bt_on_avrcp_reg_notifivation, rsi_bt_on_avrcp_set_abs_vol_event_t bt_on_avrcp_set_abs_vol, rsi_bt_on_avrcp_set_addr_player_event_t bt_on_avrcp_set_addr_player, rsi_bt_on_avrcp_get_folder_items_event_t bt_on_avrcp_get_folder_items, rsi_bt_on_avrcp_get_tot_num_items_event_t bt_on_avrcp_get_tot_num_items)`

**Description:** Register the AVRCP target callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_on_avrcp_get_cap_event_t](bt-classic7#rsi-bt-on-avrcp-get-cap-event-t)|[in]|bt_on_avrcp_gat_cap|- AVRCP gat callback|
|[rsi_bt_on_avrcp_get_app_supp_atts_event_t](bt-classic7#rsi-bt-on-avrcp-get-app-supp-atts-event-t)|[in]|bt_on_avrcp_get_app_att_list|- AVRCP get application callbacks|
|[rsi_bt_on_avrcp_get_app_suup_att_vals_event_t](bt-classic7#rsi-bt-on-avrcp-get-app-suup-att-vals-event-t)|[in]|bt_on_avrcp_get_app_att_vals_list|- AVRCP get application list callback|
|[rsi_bt_on_avrcp_get_app_cur_att_val_event_t](bt-classic7#rsi-bt-on-avrcp-get-app-cur-att-val-event-t)|[in]|bt_on_avrcp_get_app_cur_att_val|- AVRCP get current value callback|
|[rsi_bt_on_avrcp_set_app_cur_att_val_event_t](bt-classic7#rsi-bt-on-avrcp-set-app-cur-att-val-event-t)|[in]|bt_on_avrcp_set_app_cur_att_val|-AVRCP set current value callback|
|[rsi_bt_on_avrcp_get_app_att_text_event_t](bt-classic7#rsi-bt-on-avrcp-get-app-att-text-event-t)|[in]|bt_on_avrcp_get_app_att_text|- AVRCP get text callback|
|[rsi_bt_on_avrcp_get_app_att_vals_text_event_t](bt-classic7#rsi-bt-on-avrcp-get-app-att-vals-text-event-t)|[in]|bt_on_avrcp_get_app_att_vals_text|- AVRCP get vals text callback|
|[rsi_bt_on_avrcp_supp_char_sets_event_t](bt-classic7#rsi-bt-on-avrcp-supp-char-sets-event-t)|[in]|bt_on_avrcp_supp_char_sets|- AVRCP support character set callback|
|[rsi_bt_on_avrcp_batt_status_event_t](bt-classic7#rsi-bt-on-avrcp-batt-status-event-t)|[in]|bt_on_avrcp_batt_status|- AVRCP status callback|
|[rsi_bt_on_avrcp_get_song_atts_event_t](bt-classic7#rsi-bt-on-avrcp-get-song-atts-event-t)|[in]|bt_on_avrcp_get_song_atts|- AVRCP get song|
|[rsi_bt_on_avrcp_get_play_status_event_t](bt-classic7#rsi-bt-on-avrcp-get-play-status-event-t)|[in]|bt_on_avrcp_get_player_status|- AVRCP get player status callback|
|[rsi_bt_on_avrcp_reg_notify_event_t](bt-classic7#rsi-bt-on-avrcp-reg-notify-event-t)|[in]|bt_on_avrcp_reg_notifivation|- AVRCP notification callback|
|[rsi_bt_on_avrcp_set_abs_vol_event_t](bt-classic7#rsi-bt-on-avrcp-set-abs-vol-event-t)|[in]|bt_on_avrcp_set_abs_vol|- AVRCP set abs volume callback|
|[rsi_bt_on_avrcp_set_addr_player_event_t](bt-classic7#rsi-bt-on-avrcp-set-addr-player-event-t)|N/A|bt_on_avrcp_set_addr_player||
|[rsi_bt_on_avrcp_get_folder_items_event_t](bt-classic7#rsi-bt-on-avrcp-get-folder-items-event-t)|N/A|bt_on_avrcp_get_folder_items||
|[rsi_bt_on_avrcp_get_tot_num_items_event_t](bt-classic7#rsi-bt-on-avrcp-get-tot-num-items-event-t)|N/A|bt_on_avrcp_get_tot_num_items||

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_avrcp_batt_status](rsi-bt-classic-cb-s#bt-on-avrcp-batt-status), [rsi_bt_classic_cb_s::bt_on_avrcp_gat_cap](rsi-bt-classic-cb-s#bt-on-avrcp-gat-cap), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_list](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-list), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_text](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-text), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_vals_list](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-vals-list), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_vals_text](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-vals-text), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_cur_att_val](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-cur-att-val), [rsi_bt_classic_cb_s::bt_on_avrcp_get_folder_items](rsi-bt-classic-cb-s#bt-on-avrcp-get-folder-items), [rsi_bt_classic_cb_s::bt_on_avrcp_get_player_status](rsi-bt-classic-cb-s#bt-on-avrcp-get-player-status), [rsi_bt_classic_cb_s::bt_on_avrcp_get_song_atts](rsi-bt-classic-cb-s#bt-on-avrcp-get-song-atts), [rsi_bt_classic_cb_s::bt_on_avrcp_get_tot_num_items](rsi-bt-classic-cb-s#bt-on-avrcp-get-tot-num-items), [rsi_bt_classic_cb_s::bt_on_avrcp_reg_notifivation](rsi-bt-classic-cb-s#bt-on-avrcp-reg-notifivation), [rsi_bt_classic_cb_s::bt_on_avrcp_set_abs_vol](rsi-bt-classic-cb-s#bt-on-avrcp-set-abs-vol), [rsi_bt_classic_cb_s::bt_on_avrcp_set_addr_player](rsi-bt-classic-cb-s#bt-on-avrcp-set-addr-player), [rsi_bt_classic_cb_s::bt_on_avrcp_set_app_cur_att_val](rsi-bt-classic-cb-s#bt-on-avrcp-set-app-cur-att-val), [rsi_bt_classic_cb_s::bt_on_avrcp_supp_char_sets](rsi-bt-classic-cb-s#bt-on-avrcp-supp-char-sets), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### Callback Declarations

###### Typedefs (heading level 7)

###### rsi_bt_on_role_change_t (heading level 8)

`void(* rsi_bt_on_role_change_t)(uint16_t resp_status, rsi_bt_event_role_change_t *role_change_status)`

**Description:**

When role change status event is received from the module this callback will be called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the role_change_status information , please refer [rsi_bt_event_role_change_s](rsi-bt-event-role-change-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes).

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_connect_t (heading level 8)

`void(* rsi_bt_on_connect_t)(uint16_t resp_status, rsi_bt_event_bond_t *bond_response)`

**Description:**

When Connect event is raised from the module, this callback will be called. <br />
 This event will be given by the module when BT PHY Level connection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the connect/bond response information , please refer [rsi_bt_event_bond_response_s](rsi-bt-event-bond-response-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_unbond_t (heading level 8)

`void(* rsi_bt_on_unbond_t)(uint16_t resp_status, rsi_bt_event_unbond_t *unbond_status)`

**Description:**

When unbond event is raised from the module this callback is called . <br />
 This event will be given by the module when either slave or master device issues unbond command to the other.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the disconnection information , please refer [rsi_bt_event_unbond_s](rsi-bt-event-unbond-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_disconnect_t (heading level 8)

`void(* rsi_bt_on_disconnect_t)(uint16_t resp_status, rsi_bt_event_disconnect_t *bt_disconnect)`

**Description:**

When disconnection event is raised from the module this callback will be called . <br />
 This event will be given by the module when either slave or master device issues disconnect command to the other.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the disconnection information , please refer [rsi_bt_event_disconnect_s](rsi-bt-event-disconnect-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_scan_resp_t (heading level 8)

`void(* rsi_bt_on_scan_resp_t)(uint16_t resp_status, rsi_bt_event_inquiry_response_t *single_scan_resp)`

**Description:**

When the single scan response is received from the module in response to inquiry command this callback is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the inquiry response information , please refer [rsi_bt_event_inquiry_response_s](rsi-bt-event-inquiry-response-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_remote_name_resp_t (heading level 8)

`void(* rsi_bt_on_remote_name_resp_t)(uint16_t resp_status, rsi_bt_event_remote_device_name_t *name_resp)`

**Description:**

When the remote name request command response is received from the module this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the remote device name information, please refer [rsi_bt_event_remote_device_name_s](rsi-bt-event-remote-device-name-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_passkey_display_t (heading level 8)

`typedef void(* rsi_bt_on_passkey_display_t)(uint16_t resp_status, rsi_bt_event_user_passkey_display_t *bt_event_user_passkey_display)`

**Description:**

When the passkey display request is received from the module this callback function is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the passkey information , please refer [rsi_bt_event_user_passkey_display_s](rsi-bt-event-user-passkey-display-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_remote_name_request_cancel_t (heading level 8)

`typedef void(* rsi_bt_on_remote_name_request_cancel_t)(uint16_t resp_status, rsi_bt_event_remote_name_request_cancel_t *remote_name_request_cancel)`

**Description:**

When the remote name request cancels the command response received from the module this callback function is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response to remote name request cancel cmd , please refer [rsi_bt_event_remote_name_request_cancel_s](rsi-bt-event-remote-name-request-cancel-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_confirm_request_t (heading level 8)

`void(* rsi_bt_on_confirm_request_t)(uint16_t resp_status, rsi_bt_event_user_confirmation_request_t *user_confirmation_request)`

**Description:**

When the user confirmation request is received from the module this callback is called. <br />
 The user has to give rsi_bt_accept_ssp_confirm or rsi_bt_reject_ssp_confirm command upon reception of this event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the confirmation request information ,please refer [rsi_bt_event_user_confirmation_request_s](rsi-bt-event-user-confirmation-request-s) structure for more information .|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_pincode_request_t (heading level 8)

`void(* rsi_bt_on_pincode_request_t)(uint16_t resp_status, rsi_bt_event_user_pincode_request_t *user_pincode_request)`

**Description:**

When pincode request is received from the module, this callback is called. <br />
 User has to give rsi_bt_accept_pincode_request command upon reception of this event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the pincode request information ,please refer [rsi_bt_event_user_pincode_request_s](rsi-bt-event-user-pincode-request-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_passkey_request_t (heading level 8)

`void(* rsi_bt_on_passkey_request_t)(uint16_t resp_status, rsi_bt_event_user_passkey_request_t *user_passkey_request)`

**Description:**

When the passkey request is received from the module this callback is called. <br />
 User has to give rsi_bt_passkey command upon reception of this event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the passkey request information ,please refer [rsi_bt_event_user_passkey_request_s](rsi-bt-event-user-passkey-request-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_inquiry_complete_t (heading level 8)

`void(* rsi_bt_on_inquiry_complete_t)(uint16_t resp_status)`

**Description:**

When inquiry complete status is received from the module this callback is called . <br />
 This event will be given by the module when inquiry command is completely executed.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response status (Success or Error code) <br /><br/> 0 - SUCCESS <br /><br/> Non-Zero Value - ErrorCodes|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_auth_complete_t (heading level 8)

`void(* rsi_bt_on_auth_complete_t)(uint16_t resp_status, rsi_bt_event_auth_complete_t *auth_complete)`

**Description:**

When authentication complete indication is received from the module this callback is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the authentication complete information , please refer [rsi_bt_event_auth_complete_s](rsi-bt-event-auth-complete-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_linkkey_request_t (heading level 8)

`void(* rsi_bt_on_linkkey_request_t)(uint16_t resp_status, rsi_bt_event_user_linkkey_request_t *user_linkkey_request)`

**Description:**

When linkkey request is received from the module this callback is called. <br />
 User has to give linkkey reply command upon reception of this event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the linkkey request information , please refer [rsi_bt_event_user_linkkey_request_s](rsi-bt-event-user-linkkey-request-s) structure for mre information .|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_ssp_complete_t (heading level 8)

`void(* rsi_bt_on_ssp_complete_t)(uint16_t resp_status, rsi_bt_event_ssp_complete_t *ssp_complete)`

**Description:**

When SSP complete status is received from the module this callback is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the ssp complete status, please refer [rsi_bt_event_ssp_complete_s](rsi-bt-event-ssp-complete-s) structure for more information .|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_linkkey_save_t (heading level 8)

`void(* rsi_bt_on_linkkey_save_t)(uint16_t resp_status, rsi_bt_event_user_linkkey_save_t *user_linkkey_save)`

**Description:**

When linkkey save is received from the module this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the linkkey save information , plesae refer [rsi_bt_event_user_linkkey_save_s](rsi-bt-event-user-linkkey-save-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_get_services_t (heading level 8)

`void(* rsi_bt_on_get_services_t)(uint16_t resp_status, rsi_bt_resp_query_services_t *service_list)`

**Description:**

When the get services command response is received from the module this callback is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response information to get services cmd ,please refer [rsi_bt_resp_query_services_s](rsi-bt-resp-query-services-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback is Reserved for Future.
- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_search_service_t (heading level 8)

`void(* rsi_bt_on_search_service_t)(uint16_t resp_status, uint8_t *status)`

**Description:**

When the search service command response is received from the module this calback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the status response to search service cmd.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback is Reserved for Future.
- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_mode_chnage_t (heading level 8)

`void(* rsi_bt_on_mode_chnage_t)(uint16_t resp_status, rsi_bt_event_mode_change_t *mode_change)`

**Description:**

When the local device enters / exits the Sniff mode this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response payload for the mode change response , please refer [rsi_bt_event_mode_change_s](rsi-bt-event-mode-change-s) structure for more information .|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_avdtp_stats_t (heading level 8)

`void(* rsi_bt_on_avdtp_stats_t)(uint16_t resp_status, rsi_bt_event_avdtp_stats_t *avdtp_event)`

**Description:**

When AVDTP stats event is receicved from module this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response status (Success or Error code) <br /><br/> 0 - SUCCESS <br /><br/> Non-Zero Value - ErrorCodes|
||[out]|avdtp_eventcontains|the avdtp stats parameters , please refer [rsi_bt_event_avdtp_stats_s](rsi-bt-event-avdtp-stats-s) structure for more information . <br />|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avdtp_events_register_callbacks API

###### rsi_bt_on_ar_stats_t (heading level 8)

`void(* rsi_bt_on_ar_stats_t)(uint16_t resp_status, rsi_bt_event_ar_stats_t *ar_event)`

**Description:**

When AR stats event is received from module this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response status (Success or Error code) <br /><br/> 0 - SUCCESS <br /><br/> Non-Zero Value - ErrorCodes|
||[out]|ar_eventcontains|the ar stats parameters , please refer [rsi_bt_event_ar_stats_s](rsi-bt-event-ar-stats-s) structure for more information.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_ar_events_register_callbacks API

###### rsi_bt_pkt_change_stats_t (heading level 8)

`void(* rsi_bt_pkt_change_stats_t)(uint16_t resp_status, rsi_bt_event_pkt_change_t *bt_pkt_change_stats)`

**Description:**

When HCI packet type change receicved from module this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response status (Success or Error code) <br /><br/> 0 - SUCCESS <br /><br/> Non-Zero Value - ErrorCodes|
||[out]|avdtp_eventcontains|the packet type , please refer [rsi_bt_event_pkt_change_s](rsi-bt-event-pkt-change-s) structure for more information. <br />|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_pkt_change_events_register_callbacks API

###### rsi_bt_on_sniff_subrating_t (heading level 8)

`void(* rsi_bt_on_sniff_subrating_t)(uint16_t resp_status, rsi_bt_event_sniff_subrating_t *mode_change)`

**Description:**

When Sniff subrating is enabled or the parameters are negotiated with the remote device this callback is called .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|parameters related to sniff subrating , please refer [rsi_bt_event_sniff_subrating_s](rsi-bt-event-sniff-subrating-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_connection_initiated_t (heading level 8)

`void(* rsi_bt_on_connection_initiated_t)(uint16_t resp_status, rsi_bt_event_connection_initiated_t *mode_change)`

**Description:**

When the headset initiates the connection this callback is called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the value is 1 implies connection initiated by remote device , please refer [rsi_bt_event_connection_initiated_s](rsi-bt-event-connection-initiated-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_register_gap_callbacks API

###### rsi_bt_on_spp_connect_t (heading level 8)

`void(* rsi_bt_on_spp_connect_t)(uint16_t resp_status, rsi_bt_event_spp_connect_t *spp_connect)`

**Description:**

When SPP connected event is raised from the module,this callback will be called .<br />
 This event will be given by the module when spp profile level connection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the spp connect information, please refer [rsi_bt_event_spp_connect_s](rsi-bt-event-spp-connect-s) for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_spp_register_callbacks API

###### rsi_bt_on_spp_disconnect_t (heading level 8)

`void(* rsi_bt_on_spp_disconnect_t)(uint16_t resp_status, rsi_bt_event_spp_disconnect_t *spp_disconnect)`

**Description:**

When SPP disconnected event is raised from the module,this callback will be called .<br />
 This event will be given by the module when spp profile level disconnection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the spp disconnect information, please refer [rsi_bt_event_spp_disconnect_s](rsi-bt-event-spp-disconnect-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_spp_register_callbacks API.

###### rsi_bt_on_spp_rx_data_t (heading level 8)

`void(* rsi_bt_on_spp_rx_data_t)(uint16_t resp_status, rsi_bt_event_spp_receive_t *bt_event_spp_receive)`

**Description:**

When SPP receive event is raised from the module,this callback will be called.<br />
 This event will be given by the local device when it receives data from the remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the spp rcvd data information, please refer [rsi_bt_event_spp_receive_s](rsi-bt-event-spp-receive-s) structure for more information.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes)

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_spp_register_callbacks API

###### rsi_bt_on_a2dp_connect_t (heading level 8)

`void(* rsi_bt_on_a2dp_connect_t)(uint16_t resp_status, rsi_bt_event_a2dp_connect_t *a2dp_connect)`

**Description:**

When A2DP connected event is raised from the module, this callback will be called. <br />
 This event will be given by the module when A2DP profile level connection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp connect information, please refer [rsi_bt_event_a2dp_connect_s](rsi-bt-event-a2dp-connect-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_disconnect_t (heading level 8)

`void(* rsi_bt_on_a2dp_disconnect_t)(uint16_t resp_status, rsi_bt_event_a2dp_disconnect_t *a2dp_disconnect)`

**Description:**

When A2DP disconnected event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp profile level disconnection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp disconnect information, please refer [rsi_bt_event_a2dp_disconnect_s](rsi-bt-event-a2dp-disconnect-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_configure_t (heading level 8)

`void(* rsi_bt_on_a2dp_configure_t)(uint16_t resp_status, rsi_bt_event_a2dp_configure_t *a2dp_configure)`

**Description:**

When A2DP configured event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp profile onfiguration happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp configure information, please refer [rsi_bt_event_a2dp_configure_s](rsi-bt-event-a2dp-configure-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_open_t (heading level 8)

`void(* rsi_bt_on_a2dp_open_t)(uint16_t resp_status, rsi_bt_event_a2dp_open_t *a2dp_open)`

**Description:**

When A2DP open event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp opens in either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp open information, please refer [rsi_bt_event_a2dp_open_s](rsi-bt-event-a2dp-open-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_start_t (heading level 8)

`void(* rsi_bt_on_a2dp_start_t)(uint16_t resp_status, rsi_bt_event_a2dp_start_t *a2dp_start)`

**Description:**

When A2DP start event is raised from the module, this callback is called. <br />
 This event will be given by the module when a2dp starts from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp start information, please refer [rsi_bt_event_a2dp_start_s](rsi-bt-event-a2dp-start-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_suspend_t (heading level 8)

`void(* rsi_bt_on_a2dp_suspend_t)(uint16_t resp_status, rsi_bt_event_a2dp_suspend_t *a2dp_suspend)`

**Description:**

When A2DP suspend event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp suspend happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|suspend, contains the a2dp suspend information, please refer [rsi_bt_event_a2dp_suspend_s](rsi-bt-event-a2dp-suspend-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_abort_t (heading level 8)

`void(* rsi_bt_on_a2dp_abort_t)(uint16_t resp_status, rsi_bt_event_a2dp_abort_t *a2dp_abort)`

**Description:**

When A2DP abort event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp abort happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp abort information, please refer [rsi_bt_event_a2dp_abort_s](rsi-bt-event-a2dp-abort-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_close_t (heading level 8)

`void(* rsi_bt_on_a2dp_close_t)(uint16_t resp_status, rsi_bt_event_a2dp_close_t *a2dp_close)`

**Description:**

When A2DP close event is raised from the module, this callback will be called. <br />
 This event will be given by the module when a2dp closed from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp close information, please refer [rsi_bt_event_a2dp_close_s](rsi-bt-event-a2dp-close-s) structure <br /><br/> for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_encode_data_t (heading level 8)

`void(* rsi_bt_on_a2dp_encode_data_t)(uint16_t resp_status, rsi_bt_event_a2dp_encode_data_t *a2dp_encode_data)`

**Description:**

Callback function to be called if SBC data received from TA.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the SBC encoded packet information, please refer [rsi_bt_event_a2dp_encode_data_s](rsi-bt-event-a2dp-encode-data-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_pcm_data_t (heading level 8)

`void(* rsi_bt_on_a2dp_pcm_data_t)(uint16_t resp_status, rsi_bt_event_a2dp_pcm_data_t *a2dp_pcm_data)`

**Description:**

Callback function to be called if PCM data is received from TA.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the PCM audio data information|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_data_req_t (heading level 8)

`void(* rsi_bt_on_a2dp_data_req_t)(uint16_t resp_status, rsi_bt_event_a2dp_more_data_req_t *a2dp_more_data_req)`

**Description:**

Callback function to be called if more data request evenis received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp_more_data_req information|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_a2dp_reconfig_t (heading level 8)

`void(* rsi_bt_on_a2dp_reconfig_t)(uint16_t resp_status, rsi_bt_event_a2dp_reconfig_t *a2dp_reconfig)`

**Description:**

When A2DP Reconfig event is raised from the module, this callback will be called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the a2dp reconfig information, please refer [rsi_bt_event_a2dp_reconfig_s](rsi-bt-event-a2dp-reconfig-s) structure for more info|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_a2dp_register_callbacks API

###### rsi_bt_on_avrcp_connect_t (heading level 8)

`void(* rsi_bt_on_avrcp_connect_t)(uint16_t resp_status, rsi_bt_event_avrcp_connect_t *bt_event_avrcp_connect)`

**Description:**

When Avrcp Connect event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp connection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp connected information, please refer [rsi_bt_event_avrcp_connect_s](rsi-bt-event-avrcp-connect-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_disconnect_t (heading level 8)

`void(* rsi_bt_on_avrcp_disconnect_t)(uint16_t resp_status, rsi_bt_event_avrcp_disconnect_t *bt_event_avrcp_disconnect)`

**Description:**

When Avrcp Disconnect event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp connection happens from either side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp disconnected information, please refer [rsi_bt_event_avrcp_disconnect_s](rsi-bt-event-avrcp-disconnect-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_play_t (heading level 8)

`void(* rsi_bt_on_avrcp_play_t)(uint16_t resp_status, rsi_bt_event_avrcp_play_t *bt_event_avrcp_play)`

**Description:**

When Avrcp Play event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp play button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp play information, please refer [rsi_bt_event_avrcp_play_s](rsi-bt-event-avrcp-play-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_pause_t (heading level 8)

`void(* rsi_bt_on_avrcp_pause_t)(uint16_t resp_status, rsi_bt_event_avrcp_pause_t *bt_event_avrcp_pause)`

**Description:**

When Avrcp Pause event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp pause button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp pause information, please refer [rsi_bt_event_avrcp_pause_s](rsi-bt-event-avrcp-pause-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- Refer Bluetooth Generic Error Codes section upto 0x4FF8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_stop_t (heading level 8)

`void(* rsi_bt_on_avrcp_stop_t)(uint16_t resp_status, rsi_bt_event_avrcp_stop_t *bt_event_avrcp_stop)`

**Description:**

When Avrcp Stop event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp stop button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp pause information, please refer [rsi_bt_event_avrcp_stop_s](rsi-bt-event-avrcp-stop-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_next_t (heading level 8)

`void(* rsi_bt_on_avrcp_next_t)(uint16_t resp_status, rsi_bt_event_avrcp_next_t *bt_event_avrcp_next)`

**Description:**

When Avrcp next event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp next button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp next information, please refer [rsi_bt_event_avrcp_next_s](rsi-bt-event-avrcp-next-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_previous_t (heading level 8)

`void(* rsi_bt_on_avrcp_previous_t)(uint16_t resp_status, rsi_bt_event_avrcp_previous_t *bt_event_avrcp_previous)`

**Description:**

When Avrcp Previous event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp Previous button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp previous information, please refer [rsi_bt_event_avrcp_previous_s](rsi-bt-event-avrcp-previous-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_vol_up_t (heading level 8)

`void(* rsi_bt_on_avrcp_vol_up_t)(uint16_t resp_status, rsi_bt_event_avrcp_vol_up_t *bt_event_avrcp_vol_up)`

**Description:**

When Avrcp volume up event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp volume up button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|avrcp vol up info, please refer [rsi_bt_event_avrcp_vol_up_s](rsi-bt-event-avrcp-vol-up-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_vol_down_t (heading level 8)

`void(* rsi_bt_on_avrcp_vol_down_t)(uint16_t resp_status, rsi_bt_event_avrcp_vol_down_t *bt_event_avrcp_vol_down)`

**Description:**

When Avrcp volume Down event is raised from the module, this callback will be called. <br />
 This event will be given by the module when avrcp volume Down button pressed/Released from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp vol down info, please refer [rsi_bt_event_avrcp_vol_down_s](rsi-bt-event-avrcp-vol-down-s)<br /><br/> structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_get_elem_attr_resp_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_elem_attr_resp_t)(uint16_t resp_status, rsi_bt_event_avrcp_get_elem_attr_resp_t *avrcp_get_elem_attr_resp)`

**Description:**

When Remote Devices Element Attributes is received this callback will be called.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp get elem attr resp info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_avrcp_notify_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_notify_event_t)(uint16_t resp_status, rsi_bt_event_avrcp_notify_t *bt_event_avrcp_notify)`

**Description:**

Callback function is invoke when avrcp notification received from Control Device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the avrcp registered notifications information, <br /><br/> please refer [rsi_bt_event_avrcp_notify_s](rsi-bt-event-avrcp-notify-s) structure for more info.|

**Details:**

**Note**

- refer bluetooth generic error codes section upto 0x4ff8 from [Error Codes](error-codes) .

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_register_callbacks API

###### rsi_bt_on_ctkd_t (heading level 8)

`void(* rsi_bt_on_ctkd_t)(uint16_t resp_status, rsi_bt_event_ctkd_t *ctkd)`

**Description:**

Callback function invoked if ctkd event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|ctkdcontains|the converted key|

**Details:**

**Returns**

- void

**Note**

- This callback function will be called if the ctkd is generated for the remote device This callback has to be registered using rsi_ble_smp_extended_register_callbacks API

###### rsi_bt_on_avrcp_get_cap_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_cap_event_t)(uint8_t *bd_addr, uint8_t cap_type)`

**Description:**

Callback function is invoke when we receive get capabilities request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|cap_typeavrcp|capabilities type.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_app_supp_atts_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_app_supp_atts_event_t)(uint8_t *bd_addr)`

**Description:**

Callback function is invoke when we receive get application support attribute list request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_app_suup_att_vals_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_app_suup_att_vals_event_t)(uint8_t *bd_addr, uint8_t att_id)`

**Description:**

Callback function is invoke when we receive get application support attribute values request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|att_idapplication|attribute id.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_app_cur_att_val_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_app_cur_att_val_event_t)(rsi_bt_event_avrcp_get_cur_att_val_t *p_att_list)`

**Description:**

Callback function is invoke when we receive get application current attributes value request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_att_listattribute|list, please refer [rsi_bt_event_avrcp_get_cur_att_val_s](rsi-bt-event-avrcp-get-cur-att-val-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_set_app_cur_att_val_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_set_app_cur_att_val_event_t)(rsi_bt_event_avrcp_set_att_val_t *p_att_list)`

**Description:**

Callback function is invoke when we receive set application curent attributes value request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_att_listattribute|list, please refer [rsi_bt_event_avrcp_set_att_val_s](rsi-bt-event-avrcp-set-att-val-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_app_att_text_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_app_att_text_event_t)(rsi_bt_event_avrcp_get_cur_att_val_t *p_att_list)`

**Description:**

Callback function is invoke when we receive get application attributes text request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_att_listattribute|list, please refer [rsi_bt_event_avrcp_get_cur_att_val_s](rsi-bt-event-avrcp-get-cur-att-val-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_app_att_vals_text_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_app_att_vals_text_event_t)(rsi_bt_event_avrcp_vals_text_req_t *p_vals_list)`

**Description:**

Callback function is invoke when we receive get application attribute values text request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_vals_listattribute|values list, please refer [rsi_bt_event_avrcp_vals_text_req_s](rsi-bt-event-avrcp-vals-text-req-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_supp_char_sets_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_supp_char_sets_event_t)(rsi_bt_event_avrcp_char_sets_t *p_char_sets)`

**Description:**

Callback function is invoke when we receive inform character sets request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_char_setssupport|character sets list, please refer [rsi_bt_event_avrcp_char_sets_s](rsi-bt-event-avrcp-char-sets-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_batt_status_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_batt_status_event_t)(uint8_t *bd_addr, uint8_t batt_status)`

**Description:**

Callback function is invoke when we receive battery status from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|batt_statusbattery|status.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_song_atts_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_song_atts_event_t)(rsi_bt_event_avrcp_ele_att_t *p_song_atts)`

**Description:**

Callback function is invoke when we receive element/song attribute request from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|p_song_attsrequested|song attribute list, please refer [rsi_bt_event_avrcp_ele_att_s](rsi-bt-event-avrcp-ele-att-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_play_status_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_get_play_status_event_t)(uint8_t *bd_addr)`

**Description:**

Callback function is invoke when we receive player status from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_reg_notify_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_reg_notify_event_t)(uint8_t *bd_addr, uint8_t event_id)`

**Description:**

Callback function is invoke when we receive register notify event from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|event_idEvent|for which the Control Device requires notifications|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_set_abs_vol_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_set_abs_vol_event_t)(rsi_bt_event_avrcp_set_abs_vol_t *p_abs_vol)`

**Description:**

Callback function is invoke when we receive set absolute volume event from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|p_abs_volavrcp|absolute vol, please refer [rsi_bt_event_avrcp_set_abs_vol_s](rsi-bt-event-avrcp-set-abs-vol-s) structure <br /><br/> for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_set_addr_player_event_t (heading level 8)

`void(* rsi_bt_on_avrcp_set_addr_player_event_t)(rsi_bt_event_avrcp_set_addr_player_t *p_set_addr_player)`

**Description:**

Callback function is invoke when we receive set address player event from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|p_set_addr_playerinform|the Target Device of which media player the Control Device wishes to control, <br /><br/> please refer [rsi_bt_event_avrcp_set_addr_player_s](rsi-bt-event-avrcp-set-addr-player-s) structure for more info.|

**Details:**

**Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_folder_items_event_t (heading level 8)

`typedef void(* rsi_bt_on_avrcp_get_folder_items_event_t) (rsi_bt_event_avrcp_get_folder_items_t *p_get_folder_items)`

**Description:**

Callback function is invoke when we receive get folder items event from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|p_get_folder_itemsto|get the media player items list in a folder, please refer [rsi_bt_event_avrcp_get_folder_items_s](rsi-bt-event-avrcp-get-folder-items-s)<br /><br/> structure for more info.|

**Details:**

@callback rsi_bt_on_avrcp_get_folder_items_event_t **Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

###### rsi_bt_on_avrcp_get_tot_num_items_event_t (heading level 8)

`typedef void(* rsi_bt_on_avrcp_get_tot_num_items_event_t) (rsi_bt_event_avrcp_get_tot_num_items_t *p_get_tot_num_items)`

**Description:**

Callback function is invoke when we receive get total number of items event from remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|bd_addrRemote|bd address.|
||[out]|p_get_tot_num_itemstotal|number of items present in a folder, please refer [rsi_bt_event_avrcp_get_tot_num_items_s](rsi-bt-event-avrcp-get-tot-num-items-s)<br /><br/> structure for more info.|

**Details:**

@callback rsi_bt_on_avrcp_get_tot_num_items_event_t **Returns**

- void

**Note**

- This callback has to be registered using rsi_bt_avrcp_target_register_callbacks API

##### BLE APIs

###### Modules

[GAP](bt-low-energy1)

[GATT](bt-low-energy2)

[Test Mode](bt-low-energy6)

[Register callbacks](bt-low-energy7)

[Callbacks Declarations](bt-low-energy8)

###### GAP

###### Functions (heading level 7)

###### rsi_ble_set_random_address (heading level 8)

`int32_t rsi_ble_set_random_address(void)`

**Description:** Request the local device to set a random address. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_random_address_with_value (heading level 8)

`int32_t rsi_ble_set_random_address_with_value(uint8_t *random_addr)`

**Description:** Request the local device to set a given random address. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|random_addr|- random address of the device to be set|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_ble_req_rand_s::rand_addr](rsi-ble-req-rand-s#rand-addr), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_start_advertising (heading level 8)

`rsi_ble_start_advertising(void)`

**Description:** Request the local device to start advertising. This is a Blocking API <br />
 A received event [rsi_ble_on_enhance_connect_t](bt-low-energy8#rsi-ble-on-enhance-connect-t)/ [rsi_ble_on_connect_t](bt-low-energy8#rsi-ble-on-connect-t) indicates remote device given ble connect command and got connected.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_adv_s::adv_channel_map](rsi-ble-req-adv-s#adv-channel-map), [rsi_ble_req_adv_s::adv_int_max](rsi-ble-req-adv-s#adv-int-max), [rsi_ble_req_adv_s::adv_int_min](rsi-ble-req-adv-s#adv-int-min), [rsi_ble_req_adv_s::adv_type](rsi-ble-req-adv-s#adv-type), [rsi_ble_req_adv_s::direct_addr](rsi-ble-req-adv-s#direct-addr), [rsi_ble_req_adv_s::direct_addr_type](rsi-ble-req-adv-s#direct-addr-type), [rsi_ble_req_adv_s::filter_type](rsi-ble-req-adv-s#filter-type), [rsi_ble_req_adv_s::own_addr_type](rsi-ble-req-adv-s#own-addr-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_adv_s::status](rsi-ble-req-adv-s#status)

###### rsi_ble_start_advertising_with_values (heading level 8)

`int32_t rsi_ble_start_advertising_with_values(void *rsi_ble_adv)`

**Description:** Request the local device to start advertising with specified values. This is a Blocking API <br />
 A received event [rsi_ble_on_enhance_connect_t](bt-low-energy8#rsi-ble-on-enhance-connect-t)/ [rsi_ble_on_connect_t](bt-low-energy8#rsi-ble-on-connect-t) indicates remote device given ble connect command and got connected.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|rsi_ble_adv|- This structure pointer holds the information of advertising values <br /><br/> This variable is the pointer of the [rsi_ble_req_adv_s](rsi-ble-req-adv-s) structure|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_adv_s::status](rsi-ble-req-adv-s#status)

###### rsi_ble_encrypt (heading level 8)

`int32_t rsi_ble_encrypt(uint8_t *key, uint8_t *data, uint8_t *resp)`

**Description:** Encrypt the plain text data fed by the user using the key provided.<br />
 It uses the AES-128 bit block cypher alogo to generate encrypted data. Refer to Bluetooth Spec 5.0 for further details.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|key|- 16 Bytes key for Encryption of data.|
|uint8_t *|[in]|data|- 16 Bytes of Data request to encrypt.|
|uint8_t *|[out]|resp|- Encrypted data|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API. This is a Blocking API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_encrypt_s::data](rsi-ble-encrypt-s#data), [rsi_ble_encrypt_s::key](rsi-ble-encrypt-s#key), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_stop_advertising (heading level 8)

`rsi_ble_stop_advertising(void)`

**Description:** Stop advertising. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- Call [rsi_ble_start_advertising()](bt-low-energy1#rsi-ble-start-advertising) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_adv_s::status](rsi-ble-req-adv-s#status)

###### rsi_ble_set_advertise_data (heading level 8)

`int32_t rsi_ble_set_advertise_data(uint8_t *data, uint16_t data_len)`

**Description:** Set the advertising data. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|data|- Advertising data.|
|uint16_t|[in]|data_len|- Total length of advertising data.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .
- 1. The maximum length of advertising data payload is 31 bytes. <br />  
  1. The basic format of advertising payload record contains length and data. <br />

**References:** [rsi_ble_req_adv_data_s::adv_data](rsi-ble-req-adv-data-s#adv-data), [rsi_ble_req_adv_data_s::data_len](rsi-ble-req-adv-data-s#data-len), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_scan_response_data (heading level 8)

`int32_t rsi_ble_set_scan_response_data(uint8_t *data, uint16_t data_len)`

**Description:** Request the local device to set the scan response data. This is a Blocking API <br />
.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|data|- Data about to be sent|
|uint16_t|[in]|data_len|- Length of data, which is about to be sent|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_scanrsp_data_s::data_len](rsi-ble-req-scanrsp-data-s#data-len), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_req_scanrsp_data_s::scanrsp_data](rsi-ble-req-scanrsp-data-s#scanrsp-data) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_start_scanning (heading level 8)

`rsi_ble_start_scanning(void)`

**Description:** Start scanning. This is a Blocking API A received event [rsi_ble_on_adv_report_event_t](bt-low-energy8#rsi-ble-on-adv-report-event-t) indicates advertise report of remote device received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_scan_s::filter_type](rsi-ble-req-scan-s#filter-type), [rsi_ble_req_scan_s::own_addr_type](rsi-ble-req-scan-s#own-addr-type), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_req_scan_s::scan_int](rsi-ble-req-scan-s#scan-int), [rsi_ble_req_scan_s::scan_type](rsi-ble-req-scan-s#scan-type), [rsi_ble_req_scan_s::scan_win](rsi-ble-req-scan-s#scan-win), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_scan_s::status](rsi-ble-req-scan-s#status)

###### rsi_ble_start_scanning_with_values (heading level 8)

`int32_t rsi_ble_start_scanning_with_values(void *rsi_ble_scan_params)`

**Description:** Start scanning with values. This is a Blocking API <br />
 A received event [rsi_ble_on_adv_report_event_t](bt-low-energy8#rsi-ble-on-adv-report-event-t) indicates advertise report of remote device received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|rsi_ble_scan_params|- BLE scan parameters structure please refer [rsi_ble_req_scan_s](rsi-ble-req-scan-s) structure for more info|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) . <br />

**References:** [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_scan_s::status](rsi-ble-req-scan-s#status)

###### rsi_ble_stop_scanning (heading level 8)

`rsi_ble_stop_scanning(void)`

**Description:** Stop scanning. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- [rsi_ble_start_scanning()](bt-low-energy1#rsi-ble-start-scanning) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command 0x4E0C - Command disallowed

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_scan_s::status](rsi-ble-req-scan-s#status)

###### rsi_ble_connect_with_params (heading level 8)

`int32_t rsi_ble_connect_with_params(uint8_t remote_dev_addr_type, int8_t *remote_dev_addr, uint16_t scan_interval, uint16_t scan_window, uint16_t conn_interval_max, uint16_t conn_interval_min, uint16_t conn_latency, uint16_t supervision_tout)`

**Description:** Connect to the remote BLE device with the user configured parameters. This is a blocking API. <br />
 A received event [rsi_ble_on_enhance_connect_t](bt-low-energy8#rsi-ble-on-enhance-connect-t) / [rsi_ble_on_connect_t](bt-low-energy8#rsi-ble-on-connect-t) indicates that the connection successful and <br />
 a received event [rsi_ble_on_disconnect_t](bt-low-energy8#rsi-ble-on-disconnect-t) indicates that connection failures have occurred. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|remote_dev_addr_type|- AddressType - Specifies the type of the address mentioned in BD Address <br /><br/> 0 - Public Address <br /><br/> 1 - Random Address|
|int8_t *|[in]|remote_dev_addr|- This parameter describes the device address of remote device|
|uint16_t|[in]|scan_interval|- LE Scan Interval : N=0xXXXX <br /><br/> It is defined as the time interval from when the Controller started its last LE scan until it <br /><br/> begins the subsequent LE scan. <br /><br/> Range: 0x0004 to 0x4000 <br /><br/> Time = N * 0.625 msec <br /><br/> Time Range: 2.5 msec to 10 . 24 seconds|
|uint16_t|[in]|scan_window|- LE Scan Window : N=0xXXXX <br /><br/> Amount of time for the duration of the LE scan. LE_Scan_Window must be less than or equal to LE_Scan_Interval <br /><br/> Range: 0x0004 to 0x4000 <br /><br/> Time = N * 0.625 msec <br /><br/> Time Range: 2.5 msec to 10 . 24 seconds|
|uint16_t|[in]|conn_interval_max|- Max Connection Interval : N=0xXXXX <br /><br/> Minimum value for the connection event interval, which must <br /><br/> be greater than or equal to Conn_Interval_Min. <br /><br/> Range: 0x0006 to 0x0C80 <br /><br/> Time = N * 1.25 msec <br /><br/> Time Range: 7.5 msec to 4 seconds. <br /><br/> 0x0000 - 0x0005 and 0x0C81 - 0xFFFF - Reserved for future use|
|uint16_t|[in]|conn_interval_min|- Min Connection Interval : N=0xXXXX <br /><br/> Minimum value for the connection event interval, which must be greater than or equal to Conn_Interval_Max. <br /><br/> Range: 0x0006 to 0x0C80 <br /><br/> Time = N * 1.25 msec <br /><br/> Time Range: 7.5 msec to 4 seconds. <br /><br/> 0x0000 - 0x0005 and 0x0C81 - 0xFFFF - Reserved for future use|
|uint16_t|[in]|conn_latency|- Connection Latency : N = 0xXXXX <br /><br/> Slave latency for the connection in number of connection events. <br /><br/> Range: 0x0000 to 0x01F4|
|uint16_t|[in]|supervision_tout|- Supervision Timeout : N = 0xXXXX <br /><br/> Supervision timeout for the LE Link. <br /><br/> Range: 0x000A to 0x0C80 <br /><br/> Time = N * 10 msec <br /><br/> Time Range: 100 msec to 32 seconds <br /><br/> 0x0000 - 0x0009 and 0x0C81 - 0xFFFF - Reserved for future use|

**Note**

- If a connection can't be established, for example, the remote device has gone out of range, has entered into deep sleep, or is not advertising, <br />  
   the stack will try to connect forever. In this case, the application will not get an event related to the connection request. <br />  
   To recover from this situation, the application can implement a timeout and call [rsi_ble_connect_cancel()](bt-low-energy1#rsi-ble-connect-cancel) to cancel the connection request. <br />  
   Subsequent calls of this command have to wait for the ongoing command to complete.

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) . <br />

**References:** [rsi_ble_req_conn_s::conn_interval_max](rsi-ble-req-conn-s#conn-interval-max), [rsi_ble_req_conn_s::conn_interval_min](rsi-ble-req-conn-s#conn-interval-min), [rsi_ble_req_conn_s::conn_latency](rsi-ble-req-conn-s#conn-latency), [rsi_ble_req_conn_s::dev_addr](rsi-ble-req-conn-s#dev-addr), [rsi_ble_req_conn_s::dev_addr_type](rsi-ble-req-conn-s#dev-addr-type), [rsi_ble_req_conn_s::le_scan_interval](rsi-ble-req-conn-s#le-scan-interval), [rsi_ble_req_conn_s::le_scan_window](rsi-ble-req-conn-s#le-scan-window), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_ble_req_conn_s::supervision_tout](rsi-ble-req-conn-s#supervision-tout) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_ble_connect (heading level 8)

`int32_t rsi_ble_connect(uint8_t remote_dev_addr_type, int8_t *remote_dev_addr)`

**Description:** Connect to the remote BLE device. This is a blocking API. <br />
 A received event [rsi_ble_on_enhance_connect_t](bt-low-energy8#rsi-ble-on-enhance-connect-t)/ [rsi_ble_on_connect_t](bt-low-energy8#rsi-ble-on-connect-t) indicates that the connection successful and <br />
 a received event [rsi_ble_on_disconnect_t](bt-low-energy8#rsi-ble-on-disconnect-t) indicates that connection failures have occurred.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|remote_dev_addr_type|- This parameter describes the address type of the remote device|
|int8_t *|[in]|remote_dev_addr|- This parameter describes the device address of the remote device|

**Note**

- If a connection can't be established, for example, the remote device has gone out of range, has entered into deep sleep, or is not advertising, <br />  
   the stack will try to connect forever. In this case, the application will not get an event related to the connection request. <br />  
   To recover from this situation, the application can implement a timeout and call [rsi_ble_connect_cancel()](bt-low-energy1#rsi-ble-connect-cancel) to cancel the connection request. <br />  
   Subsequent calls of this command have to wait for the ongoing command to complete.

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) . <br />

**References:** [rsi_ble_req_conn_s::conn_interval_max](rsi-ble-req-conn-s#conn-interval-max), [rsi_ble_req_conn_s::conn_interval_min](rsi-ble-req-conn-s#conn-interval-min), [rsi_ble_req_conn_s::conn_latency](rsi-ble-req-conn-s#conn-latency), [rsi_ble_req_conn_s::dev_addr](rsi-ble-req-conn-s#dev-addr), [rsi_ble_req_conn_s::dev_addr_type](rsi-ble-req-conn-s#dev-addr-type), [rsi_ble_req_conn_s::le_scan_interval](rsi-ble-req-conn-s#le-scan-interval), [rsi_ble_req_conn_s::le_scan_window](rsi-ble-req-conn-s#le-scan-window), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_conn_s::supervision_tout](rsi-ble-req-conn-s#supervision-tout)

###### rsi_ble_enhance_connect_with_params (heading level 8)

`int32_t rsi_ble_enhance_connect_with_params(void *ble_enhance_conn_params)`

**Description:** Connect to the remote BLE device with the user configured parameters.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ble_enhance_conn_params|- BLE enhance connection parameter structure: <br /><br/> dev_addr_type - Address type of the device to connect <br /><br/> 0 - Public Address <br /><br/> 1 - Random Address <br /><br /><br/> dev_addr - Address of the device to connect <br /><br /><br/> filter_policy - Initiater filter policy is used to determine whether the Filter Accept List is used. <br /><br/> 0 - Filter Accept List is not used to determine which advertiser to connect to. <br /><br/> 1 - Filter Accept List is used to determine which advertiser to connect to. <br /><br /><br/> own_addr_type - own address type <br /><br /><br/> le_scan_interval - LE Scan Interval : N=0xXXXX <br /><br/> It is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. <br /><br/> Range: 0x0004 to 0x4000 <br /><br/> Time = N * 0.625 msec <br /><br/> Time Range: 2.5 msec to 10 . 24 seconds <br /><br /><br/> le_scan_window - LE Scan Window : N=0xXXXX <br /><br/> Amount of time for the duration of the LE scan. LE_Scan_Window must be less than or equal to LE_Scan_Interval <br /><br/> Range: 0x0004 to 0x4000 <br /><br/> Time = N * 0.625 msec <br /><br/> Time Range: 2.5 msec to 10 . 24 seconds <br /><br /><br/> conn_interval_min - Min Connection Interval : N=0xXXXX <br /><br/> Minimum value for the connection event interval, which must be greater than or equal to Conn_Interval_Max. <br /><br/> Range: 0x0006 to 0x0C80 <br /><br/> Time = N * 1.25 msec <br /><br/> Time Range: 7.5 msec to 4 seconds. <br /><br/> 0x0000 - 0x0005 and 0x0C81 - 0xFFFF - Reserved for future use <br /><br /><br/> conn_interval_max - Max Connection Interval : N=0xXXXX <br /><br/> Maximum value for the connection event interval, which must be greater than or equal to Conn_Interval_Min. <br /><br/> Range: 0x0006 to 0x0C80 <br /><br/> Time = N * 1.25 msec <br /><br/> Time Range: 7.5 msec to 4 seconds. <br /><br/> 0x0000 - 0x0005 and 0x0C81 - 0xFFFF - Reserved for future use <br /><br /><br/> conn_latency - Connection Latency : N = 0xXXXX <br /><br/> Slave latency for the connection in number of connection events. <br /><br/> Range: 0x0000 to 0x01F4 <br /><br /><br/> supervision_tout - Supervision Timeout : N = 0xXXXX <br /><br/> Supervision timeout for the LE Link. <br /><br/> Range: 0x000A to 0x0C80 <br /><br/> Time = N * 10 msec <br /><br/> Time Range: 100 msec to 32 seconds <br /><br/> 0x0000 - 0x0009 and 0x0C81 - 0xFFFF - Reserved for future use <br /><br /><br/> min_ce_length - Min Connection Event Length : N=0xXXXX <br /><br/> The minimum length of connection event recommended for this LE connection. <br /><br/> Range: 0x0000 to 0xFFFF <br /><br/> Time = N * 0.625 msec <br /><br /><br/> max_ce_length - Max Connection Event Length : N=0xXXXX <br /><br/> The maximum length of connection event recommended for this LE connection. <br /><br/> Range: 0x0000 to 0xFFFF <br /><br/> Time = N * 0.625 msec <br /><br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_connect_cancel (heading level 8)

`int32_t rsi_ble_connect_cancel(int8_t *remote_dev_address)`

**Description:** Cancel the connection to the remote BLE device. This is a blocking API. <br />
 A received event [rsi_ble_on_disconnect_t](bt-low-energy8#rsi-ble-on-disconnect-t) indicates disconnect complete.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_address|- This parameter describes the device address of the remote device|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />  
   0x4E02 - Unknown Connection Identifier <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_disconnect_s::dev_addr](rsi-ble-req-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_disconnect_s::type](rsi-ble-req-disconnect-s#type)

###### rsi_ble_disconnect (heading level 8)

`int32_t rsi_ble_disconnect(int8_t *remote_dev_address)`

**Description:** Disconnect with the remote BLE device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_address|- This parameter describes the device address of the remote device|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E0C - Command disallowed <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) . <br />

**References:** [rsi_ble_req_disconnect_s::dev_addr](rsi-ble-req-disconnect-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_disconnect_s::type](rsi-ble-req-disconnect-s#type)

###### rsi_ble_get_device_state (heading level 8)

`int32_t rsi_ble_get_device_state(uint8_t *resp)`

**Description:** Get the local device state. This is a Blocking API. The state value is filled in "resp".

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- This is an output parameter which consists of local device state. <br /><br/> This is a 1-byte value. The possible states are described below <br /><br/> BIT(0) Advertising state <br /><br/> BIT(1) Scanning state <br /><br/> BIT(2) Initiating state <br /><br/> BIT(3) Connected state <br /><br/> BIT(4) Extended Advertising state <br /><br/> BIT(5) Extended Scanning state <br /><br/> BIT(6) Extended Initiating state <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_smp_pairing_cap_data (heading level 8)

`int32_t rsi_ble_set_smp_pairing_cap_data(rsi_ble_set_smp_pairing_capabilty_data_t *smp_pair_cap_data)`

**Description:** Set the SMP Pairing Capability of local device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_set_smp_pairing_capabilty_data_t](rsi-ble-set-smp-pairing-capabilty-data) *|[in]|smp_pair_cap_data|- This structure pointer holds the information of the SMP capability data values <br /><br/> please refer [rsi_ble_set_smp_pairing_capabilty_data](rsi-ble-set-smp-pairing-capabilty-data) structure for more info <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_local_irk_value (heading level 8)

`int32_t rsi_ble_set_local_irk_value(uint8_t *l_irk)`

**Description:** Set the IRK value to the local device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|l_irk|- l_irk Pointer to local_irk|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_local_irk_s::irk](rsi-ble-set-local-irk-s#irk), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_conn_param_resp (heading level 8)

`int32_t rsi_ble_conn_param_resp(uint8_t *remote_dev_address, uint8_t status)`

**Description:** Give the response for the remote device connection parameter request. This is a Blocking API <br />
 A received event [rsi_ble_on_conn_update_complete_t](bt-low-energy8#rsi-ble-on-conn-update-complete-t) indicates connection update procedure is successful.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address|
|uint8_t|[in]|status|- accept or reject the connection parameters update request <br /><br/> 0 - ACCEPT, <br /><br/> 1 - REJECT <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4E0C - Command disallowed <br />  
   0x4046 - Invalid Arguments <br />  
   0x4E02 - Unknown Connection Identifier

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_cmd_conn_param_resp::dev_addr](rsi-ble-cmd-conn-param-resp#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_cmd_conn_param_resp::status](rsi-ble-cmd-conn-param-resp#status)

###### rsi_ble_smp_pair_request (heading level 8)

`int32_t rsi_ble_smp_pair_request(uint8_t *remote_dev_address, uint8_t io_capability, uint8_t mitm_req)`

**Description:** Request the SMP pairing process with the remote device. This is a Blocking API <br />
 A received event [rsi_ble_on_smp_request_t](bt-low-energy8#rsi-ble-on-smp-request-t) indicated remote device is given Security Request and need to respond back with [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request)<br />
 A received event [rsi_ble_on_smp_response_t](bt-low-energy8#rsi-ble-on-smp-response-t) indicated remote device is given SMP Pair Request and need to respond back with [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response)<br />
 A received event [rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t) indicated SMP procedure have failed.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint8_t|[in]|io_capability|- This is the device input output capability <br /><br/> 0x00 - Display Only <br /><br/> 0x01 - Display Yes/No <br /><br/> 0x02 - Keyboard Only <br /><br/> 0x03 - No Input No Output|
|uint8_t|[in]|mitm_req|- MITM enable/disable <br /><br/> 0 - Disable <br /><br/> 1 - Enable|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_smp_pair_s::dev_addr](rsi-ble-req-smp-pair-s#dev-addr), [rsi_ble_req_smp_pair_s::io_capability](rsi-ble-req-smp-pair-s#io-capability), [memcpy](bt-classic1#memcpy), [rsi_ble_req_smp_pair_s::mitm_req](rsi-ble-req-smp-pair-s#mitm-req), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_smp_pair_failed (heading level 8)

`int32_t rsi_ble_smp_pair_failed(uint8_t *remote_dev_address, uint8_t reason)`

**Description:** Send SMP pairing failure reason to the remote device.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint8_t|[in]|reason|- This is the reason for SMP Pairing Failure <br /><br/> 0x05 - Pairing Not Supported <br /><br/> 0x08 - Unspecified Reason <br /><br/> 0x09 - Repeated Attempts <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**References:** [rsi_ble_req_smp_pair_failed_s::dev_addr](rsi-ble-req-smp-pair-failed-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_req_smp_pair_failed_s::reason](rsi-ble-req-smp-pair-failed-s#reason), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ltk_req_reply (heading level 8)

`int32_t rsi_ble_ltk_req_reply(uint8_t *remote_dev_address, uint8_t reply_type, uint8_t *ltk)`

**Description:** Send the local long term key of its associated local EDIV and local Rand. This is a Blocking API <br />
 A received event [rsi_ble_on_encrypt_started_t](bt-low-energy8#rsi-ble-on-encrypt-started-t) indicated encrypted event is received from module <br />
 A received event [rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t) indicated SMP procedure have failed.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address|
|uint8_t|[in]|reply_type|- 0 - Negative reply <br /><br/> BIT(0) - Positive Reply (Encryption Enabled)<br /><br/> BIT(1) - Un authenticated LTK or STK based Encyption Enabled <br /><br/> BIT(2) - Authenticated LTK or STK based Encyption Enabled <br /><br/> BIT(3) - Auntenticated LTK with LE Secure Connections based Encryption Enabled <br /><br/> BIT(4) to BIT(6) - Reserved for Future use <br /><br/> BIT(7) - LE Secure Connection Enabled <br />|
|uint8_t *|[in]|ltk|- Long Term Key 16 bytes|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_le_ltkreqreply_s::dev_addr](rsi-ble-set-le-ltkreqreply-s#dev-addr), [rsi_ble_set_le_ltkreqreply_s::localltk](rsi-ble-set-le-ltkreqreply-s#localltk), [memcpy](bt-classic1#memcpy), [rsi_ble_set_le_ltkreqreply_s::replytype](rsi-ble-set-le-ltkreqreply-s#replytype), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_smp_pair_response (heading level 8)

`int32_t rsi_ble_smp_pair_response(uint8_t *remote_dev_address, uint8_t io_capability, uint8_t mitm_req)`

**Description:** Send SMP pairing response during the process of pairing with the remote device. This is a Blocking API <br />
 A received event [rsi_ble_on_smp_passkey_t](bt-low-energy8#rsi-ble-on-smp-passkey-t) indicated Legacy SMP passkey is received and need to respond back with [rsi_ble_smp_passkey()](bt-low-energy1#rsi-ble-smp-passkey)<br />
 A received event [rsi_ble_on_sc_passkey_t](bt-low-energy8#rsi-ble-on-sc-passkey-t) indicated BLE SC passkey is received and need to respond back with [rsi_ble_smp_passkey()](bt-low-energy1#rsi-ble-smp-passkey)<br />
 A received event [rsi_ble_on_smp_passkey_display_t](bt-low-energy8#rsi-ble-on-smp-passkey-display-t) indicates SMP passkey display is received from the module <br />
 A received event [rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t) indicated SMP Failed event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint8_t|[in]|io_capability|- This is the device input output capability <br /><br/> 0x00 - Display Only <br /><br/> 0x01 - Display Yes/No <br /><br/> 0x02 - Keyboard Only <br /><br/> 0x03 - No Input No Output|
|uint8_t|[in]|mitm_req|- MITM Request info <br /><br/> 0 - Disable <br /><br/> 1 - Enable|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_smp_response_s::dev_addr](rsi-ble-smp-response-s#dev-addr), [rsi_ble_smp_response_s::io_capability](rsi-ble-smp-response-s#io-capability), [memcpy](bt-classic1#memcpy), [rsi_ble_smp_response_s::mitm_req](rsi-ble-smp-response-s#mitm-req), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_smp_passkey (heading level 8)

`int32_t rsi_ble_smp_passkey(uint8_t *remote_dev_address, uint32_t passkey)`

**Description:** Send SMP passkey during SMP pairing process with the remote device. This is a Blocking API <br />
 A received event [rsi_ble_on_encrypt_started_t](bt-low-energy8#rsi-ble-on-encrypt-started-t) indicated encrypted event is received from module <br />
 A received event [rsi_ble_on_le_security_keys_t](bt-low-energy8#rsi-ble-on-le-security-keys-t) indicates exchange of security keys completed after encryption <br />
 A received event [rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t) indicated SMP procedure have failed <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint32_t|[in]|passkey|- This is the key required in pairing process|

- Call [rsi_ble_smp_pair_request](bt-low-energy1#rsi-ble-smp-pair-request) and [rsi_ble_smp_pair_response](bt-low-energy1#rsi-ble-smp-pair-response) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_smp_passkey_s::dev_addr](rsi-ble-smp-passkey-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_smp_passkey_s::passkey](rsi-ble-smp-passkey-s#passkey), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_le_ping_timeout (heading level 8)

`int32_t rsi_ble_get_le_ping_timeout(uint8_t *remote_dev_address, uint16_t *time_out)`

**Description:** Get the timeout value of the LE ping. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint16_t *|[out]|time_out|- This a response parameter which holds timeout value for <br /><br/> authentication payload command.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .
- Currently Get ping is not supported.

**References:** [rsi_ble_get_le_ping_timeout_s::dev_addr](rsi-ble-get-le-ping-timeout-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_rsp_get_le_ping_timeout_s::time_out](rsi-ble-rsp-get-le-ping-timeout-s#time-out)

###### rsi_ble_set_le_ping_timeout (heading level 8)

`int32_t rsi_ble_set_le_ping_timeout(uint8_t *remote_dev_address, uint16_t time_out)`

**Description:** Set the timeout value of the LE ping. This is a Blocking API <br />
 A received event of [rsi_ble_on_le_ping_payload_timeout_t](bt-low-energy8#rsi-ble-on-le-ping-payload-timeout-t) indicates le ping payload timeout expired.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- This is the remote device address|
|uint16_t|[out]|time_out|- This input parameter sets timeout value for authentication <br /><br/> payload command.(in milliseconds)|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_le_ping_timeout_s::dev_addr](rsi-ble-set-le-ping-timeout-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_set_le_ping_timeout_s::time_out](rsi-ble-set-le-ping-timeout-s#time-out)

###### rsi_ble_clear_acceptlist (heading level 8)

`int32_t rsi_ble_clear_acceptlist(void)`

**Description:** Clear all the BD address present in accept list. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_accept_list_s::addordeltoacceptlist](rsi-ble-accept-list-s#addordeltoacceptlist), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_addto_acceptlist (heading level 8)

`int32_t rsi_ble_addto_acceptlist(int8_t *dev_address, uint8_t dev_addr_type)`

**Description:** Add BD address to accept list. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|dev_address|- Address of the device which is going to add in accept list|
|uint8_t|[in]|dev_addr_type|- address type of BD address|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Maximum number of device address that firmware can store is 10. <br />  
   Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_accept_list_s::addordeltoacceptlist](rsi-ble-accept-list-s#addordeltoacceptlist), [rsi_ble_accept_list_s::bdaddressType](rsi-ble-accept-list-s#bdaddress-type), [rsi_ble_accept_list_s::dev_addr](rsi-ble-accept-list-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_deletefrom_acceptlist (heading level 8)

`int32_t rsi_ble_deletefrom_acceptlist(int8_t *dev_address, uint8_t dev_addr_type)`

**Description:** Delete particular BD address from accept list. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|dev_address|- Address of the device which is going to delete from accept list|
|uint8_t|[in]|dev_addr_type|- address type of BD address|

- [rsi_ble_addto_acceptlist()](bt-low-energy1#rsi-ble-addto-acceptlist) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_accept_list_s::addordeltoacceptlist](rsi-ble-accept-list-s#addordeltoacceptlist), [rsi_ble_accept_list_s::bdaddressType](rsi-ble-accept-list-s#bdaddress-type), [rsi_ble_accept_list_s::dev_addr](rsi-ble-accept-list-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_resolvlist (heading level 8)

`int32_t rsi_ble_resolvlist(uint8_t process_type, uint8_t remote_dev_addr_type, uint8_t *remote_dev_address, uint8_t *peer_irk, uint8_t *local_irk)`

**Description:** resolvlist api used for multiple purpose based on the process type. It will be used to add/remove/clear a device to/from the list. This is a Blocking API

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|process_type|- Indicates which type of process this is, as follows: <br /><br/> 1 - add a device to the resolve list <br /><br/> 2 - remove a device from the resolve list <br /><br/> 3 - clear the entire resolve list|
|uint8_t|[in]|remote_dev_addr_type|- typr of the remote device address|
|uint8_t *|[in]|remote_dev_address|- remote device address <br /><br/> 0 - Public identity address <br /><br/> 1 - Random (static) identity address <br />|
|uint8_t *|[in]|peer_irk|- 16-byte IRK of the peer device|
|uint8_t *|[in]|local_irk|- 16-byte IRK of the local device|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_resolvlist_s::local_irk](rsi-ble-resolvlist-s#local-irk), [memcpy](bt-classic1#memcpy), [rsi_ble_resolvlist_s::peer_irk](rsi-ble-resolvlist-s#peer-irk), [rsi_ble_resolvlist_s::process_type](rsi-ble-resolvlist-s#process-type), [rsi_ble_resolvlist_s::remote_dev_addr](rsi-ble-resolvlist-s#remote-dev-addr), [rsi_ble_resolvlist_s::remote_dev_addr_type](rsi-ble-resolvlist-s#remote-dev-addr-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_resolving_list_size (heading level 8)

`int32_t rsi_ble_get_resolving_list_size(uint8_t *resp)`

**Description:** Request to get resolving list size. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|resp|- output parameter which consists of supported resolving the list size.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 : Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_addr_resolution_enable (heading level 8)

`int32_t rsi_ble_set_addr_resolution_enable(uint8_t enable, uint16_t tout)`

**Description:** Request to enable address resolution, and to set resolvable private address timeout. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enable|- value to enable/disable address resolution <br /><br/> 1 - enables address resolution <br /><br/> 0 - disables address resolution|
|uint16_t|[in]|tout|- the period for changing address of our local device in seconds <br /><br/> Value ranges from 0x0001 to 0xA1B8 (1s to approximately 11.5 hours)|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 : Buffer not available to serve the command

**References:** [rsi_ble_set_addr_resolution_enable_s::enable](rsi-ble-set-addr-resolution-enable-s#enable), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_set_addr_resolution_enable_s::tout](rsi-ble-set-addr-resolution-enable-s#tout)

###### rsi_ble_set_privacy_mode (heading level 8)

`int32_t rsi_ble_set_privacy_mode(uint8_t remote_dev_addr_type, uint8_t *remote_dev_address, uint8_t privacy_mode)`

**Description:** Request to set privacy mode for particular device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|remote_dev_addr_type|- type of the remote device address <br /><br/> 0 - Public Identity Address <br /><br/> 1 - Random (static) Identity Address|
|uint8_t *|[in]|remote_dev_address|- remote device address|
|uint8_t|[in]|privacy_mode|- type of the privacy mode <br /><br/> 0 - Network privacy mode <br /><br/> 1 - Device privacy mode|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 : Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_ble_set_privacy_mode_s::privacy_mode](rsi-ble-set-privacy-mode-s#privacy-mode), [rsi_ble_set_privacy_mode_s::remote_dev_addr](rsi-ble-set-privacy-mode-s#remote-dev-addr), [rsi_ble_set_privacy_mode_s::remote_dev_addr_type](rsi-ble-set-privacy-mode-s#remote-dev-addr-type), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_readphy (heading level 8)

`int32_t rsi_ble_readphy(int8_t *remote_dev_address, rsi_ble_resp_read_phy_t *resp)`

**Description:** Reads the TX and RX PHY rates of the Connection. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_address|- remote device address|
|[rsi_ble_resp_read_phy_t](rsi-ble-resp-read-phy-s) *|[out]|resp|- pointer to store the response please refer [rsi_ble_resp_read_phy_s](rsi-ble-resp-read-phy-s) structure for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_read_phy_s::dev_addr](rsi-ble-req-read-phy-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_setphy (heading level 8)

`int32_t rsi_ble_setphy(int8_t *remote_dev_address, uint8_t tx_phy, uint8_t rx_phy, uint16_t coded_phy)`

**Description:** Set TX and RX PHY. This is a Blocking API <br />
 A received event [rsi_ble_on_phy_update_complete_t](bt-low-energy8#rsi-ble-on-phy-update-complete-t) indicates phy rate update complete.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|remote_dev_address|- remote device address <br />|
|uint8_t|[in]|tx_phy|- transmit phy rate <br /><br/> BIT(0) - Host prefers to use the LE 1M transmitter PHY (possibly among others) <br /><br/> BIT(1) - Host prefers to use the LE 2M transmitter PHY (possibly among others) <br /><br/> BIT(2) - Host prefers to use the LE Coded transmitter PHY (possibly among others) <br /><br/> BIT(3) - BIT(7) Reserved for future use <br />|
|uint8_t|[in]|rx_phy|- receive phy rate <br /><br/> BIT(0) - Host prefers to use the LE 1M receiver PHY (possibly among others) <br /><br/> BIT(1) - Host prefers to use the LE 2M receiver PHY (possibly among others) <br /><br/> BIT(2) - Host prefers to use the LE Coded receiver PHY (possibly among others) <br /><br/> BIT(3) - BIT(7) Reserved for future use <br />|
|uint16_t|[in]|coded_phy|- TX/RX coded phy rate <br /><br/> 0 = Host has no preferred coding when transmitting on the LE Coded PHY <br /><br/> 1 = Host prefers that S=2 coding be used when transmitting on the LE Coded PHY <br /><br/> 2 = Host prefers that S=8 coding be used when transmitting on the LE Coded PHY <br /><br/> 3 = Reserved for future use <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_phy_s::all_phy](rsi-ble-set-phy-s#all-phy), [rsi_ble_set_phy_s::dev_addr](rsi-ble-set-phy-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_set_phy_s::phy_options](rsi-ble-set-phy-s#phy-options), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_set_phy_s::rx_phy](rsi-ble-set-phy-s#rx-phy), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_set_phy_s::tx_phy](rsi-ble-set-phy-s#tx-phy)

###### rsi_ble_conn_params_update (heading level 8)

`int32_t rsi_ble_conn_params_update(uint8_t *remote_dev_address, uint16_t min_int, uint16_t max_int, uint16_t latency, uint16_t timeout)`

**Description:** Requests the connection parameters change with the remote device.<br />
 When the Silabs device is acting as a master, this API is used to update the connection parameters. <br />
 When the Silabs device is acts as a slave, this API is used to request the master to intiate the connection update procedure. This is a Blocking API <br />
 A received event [rsi_ble_on_conn_update_complete_t](bt-low-energy8#rsi-ble-on-conn-update-complete-t) indicates connection parameters update complete.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device address|
|uint16_t|[in]|min_int|- minimum value for the connection interval. <br /><br/> this shall be less than or equal to max_int .|
|uint16_t|[in]|max_int|- maximum value for the connection interval. <br /><br/> this shall be greater than or equal to min_int.|
|uint16_t|[in]|latency|- slave latency for the connection in number of connection events.<br /><br/> Ranges from 0 to 499|
|uint16_t|[in]|timeout|- supervision timeout for the LE Link. <br /><br/> Ranges from 10 to 3200 (Time = N * 10 ms, Time Range: 100 ms to 32 s)|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .
- min_int and max_int values ranges from 6 to 3200 (Time = N * 1.25 ms, Time Range: 7.5 ms to 4 s)<br />  
   latency : If latency value is greater than 32 ,Limiting the slave latency value to 32<br />  
   Max supported slave latency is 32 when Device is in Slave Role.

**References:** [rsi_ble_cmd_conn_params_update_s::dev_addr](rsi-ble-cmd-conn-params-update-s#dev-addr), [rsi_ble_cmd_conn_params_update_s::latency](rsi-ble-cmd-conn-params-update-s#latency), [rsi_ble_cmd_conn_params_update_s::max_interval](rsi-ble-cmd-conn-params-update-s#max-interval), [memcpy](bt-classic1#memcpy), [rsi_ble_cmd_conn_params_update_s::min_interval](rsi-ble-cmd-conn-params-update-s#min-interval), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_cmd_conn_params_update_s::timeout](rsi-ble-cmd-conn-params-update-s#timeout)

###### rsi_ble_set_data_len (heading level 8)

`int32_t rsi_ble_set_data_len(uint8_t *remote_dev_address, uint16_t tx_octets, uint16_t tx_time)`

**Description:** Sets the TX octets and the TX time of specified link (remote device connection). This is a Blocking API. <br />
 A received event [rsi_ble_on_data_length_update_t](bt-low-energy8#rsi-ble-on-data-length-update-t) indicates data length update complete.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- remote device device <br />|
|uint16_t|[in]|tx_octets|- preferred maximum number of payload octets that the local Controller <br /><br/> should include in a single Link Layer packet on this connection.|
|uint16_t|[in]|tx_time|- preferred maximum number of microseconds that the local Controller <br /><br/> should use to transmit a single Link Layer packet on this connection.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - LE_Set_Data_Length command succeeded. <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_setdatalength_s::dev_addr](rsi-ble-setdatalength-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_ble_setdatalength_s::txoctets](rsi-ble-setdatalength-s#txoctets) and [rsi_ble_setdatalength_s::txtime](rsi-ble-setdatalength-s#txtime)

###### rsi_ble_read_max_data_len (heading level 8)

`int32_t rsi_ble_read_max_data_len(rsi_ble_read_max_data_length_t *blereaddatalen)`

**Description:** reads the max supported values of TX octets, TX time, RX octets and Rx time. This is a Blocking API

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_read_max_data_length_t](rsi-ble-resp-read-max-data-length-s) *|[out]|blereaddatalen|- pointer to structure variable, Please refer [rsi_ble_resp_read_max_data_length_s](rsi-ble-resp-read-max-data-length-s) structure for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - command success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_vendor_rf_type (heading level 8)

`int32_t rsi_ble_vendor_rf_type(uint8_t ble_power_index)`

**Description:** Issue a vendor-specific command to set the RF type in the controller on given inputs. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ble_power_index|- power index|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_vendor_rf_type_s::ble_power_index](rsi-ble-vendor-rf-type-s#ble-power-index), [rsi_ble_vendor_rf_type_s::opcode](rsi-ble-vendor-rf-type-s#opcode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_accept_list_using_adv_data (heading level 8)

`int32_t rsi_ble_accept_list_using_adv_data(uint8_t enable, uint8_t data_compare_index, uint8_t len_for_compare_data, uint8_t *payload)`

**Description:** Give vendor-specific command to set the acceptlist feature based on the advertisers advertising payload. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enable|- enable/disable|
|uint8_t|[in]|data_compare_index|- From which index onwards compare|
|uint8_t|[in]|len_for_compare_data|- total length of data to compare|
|uint8_t *|[in]|payload|- Payload|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command 0x4E62 Invalid Parameters <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_acceptlist_using_payload_s::adv_data_payload](rsi-ble-req-acceptlist-using-payload-s#adv-data-payload), [rsi_ble_req_acceptlist_using_payload_s::data_compare_index](rsi-ble-req-acceptlist-using-payload-s#data-compare-index), [rsi_ble_req_acceptlist_using_payload_s::enable](rsi-ble-req-acceptlist-using-payload-s#enable), [rsi_ble_req_acceptlist_using_payload_s::len_for_compare_data](rsi-ble-req-acceptlist-using-payload-s#len-for-compare-data), [memcpy](bt-classic1#memcpy), [rsi_ble_req_acceptlist_using_payload_s::opcode](rsi-ble-req-acceptlist-using-payload-s#opcode), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_acceptlist_using_payload_s::total_len](rsi-ble-req-acceptlist-using-payload-s#total-len)

###### BT_LE_ADPacketExtract (heading level 8)

`void BT_LE_ADPacketExtract(uint8_t *remote_name, uint8_t *pbuf, uint8_t buf_len)`

**Description:** Used to extract remote Bluetooth device name from the received advertising report.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_name|- device name|
|uint8_t *|[in]|pbuf|- advertise data packet buffer pointer|
|uint8_t|[in]|buf_len|- buffer length|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- void

**References:** [memcpy](bt-classic1#memcpy) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_update_directed_address (heading level 8)

`void rsi_ble_update_directed_address(uint8_t *remote_dev_addr)`

**Description:** Update the direct address with the remote device address. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_addr|- Remote device BD address|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_bt_cb_s::directed_addr](rsi-bt-cb-s#directed-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_start_encryption (heading level 8)

`int32_t rsi_ble_start_encryption(uint8_t *remote_dev_address, uint16_t ediv, uint8_t *rand, uint8_t *ltk)`

**Description:** Start the encryption process with the remote device. This is a Blocking API <br />
 A received event [rsi_ble_on_encrypt_started_t](bt-low-energy8#rsi-ble-on-encrypt-started-t) indicated encrypted event is received from module <br />
 A received event [rsi_ble_on_le_security_keys_t](bt-low-energy8#rsi-ble-on-le-security-keys-t) indicates exchange of security keys completed after encryption. <br />
 A received event [rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t) indicated SMP procedure have failed.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|remote_dev_address|- Remote BD address in string format|
|uint16_t|[in]|ediv|- remote device ediv value.|
|uint8_t *|[in]|rand|- remote device rand value.|
|uint8_t *|[in]|ltk|- remote device ltk value.|

- Encryption enabled event should come before calling this API for second time SMP connection.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />  
   -4 - Buffer not available to serve the command 0x4D05 BLE socket not available <br />  
   0x4E62 Invalid Parameters <br />  
   0x4D04 BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_start_encryption_s::dev_addr](rsi-ble-start-encryption-s#dev-addr), [rsi_ble_start_encryption_s::ediv](rsi-ble-start-encryption-s#ediv), [rsi_ble_start_encryption_s::ltk](rsi-ble-start-encryption-s#ltk), [memcpy](bt-classic1#memcpy), [rsi_ble_start_encryption_s::rand](rsi-ble-start-encryption-s#rand), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_max_no_of_supp_adv_sets (heading level 8)

`int32_t rsi_ble_get_max_no_of_supp_adv_sets(uint8_t *resp)`

**Description:** request to the controller to know the maximum no.of supporting advertising sets

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|resp||
||[out]|resp|- Number of Advertising sets supported ,filled by the controller. <br /><br/> Possible values of Number of Advertising sets supported : 0x01 to 0xF0|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the controller to know the maximum no.of supporting advertising sets **Note**

- : The number of advertising sets that can be supported is not fixed and it can be configured through the Opermodes

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_get_max_adv_data_len (heading level 8)

`int32_t rsi_ble_get_max_adv_data_len(uint8_t *resp)`

**Description:** request to the controller to know the maximum supporting advertising data length

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|resp||
||[out]|resp|- filled by the controller <br /><br/> Possible values of Maximum Advertising Data Length : 0x001F to 0x0672 <br />|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the controller to know the maximum supporting advertising data length 

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_set_ae_set_random_address (heading level 8)

`rsi_ble_set_ae_set_random_address(uint8_t handle, uint8_t *rand_addr)`

**Description:** sets the ae set random address

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|handle|- Advertising_Handle : Used to identify an advertising set|
|uint8_t *|[in]|rand_addr|- Random_Address : Random device address , may be either of static address or Private address|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function is used by the host to set the random device address specified by the Random_Address_parameter 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_set_ae_params (heading level 8)

`int32_t rsi_ble_set_ae_params(void *ble_ae_params, int8_t *sel_tx_pwr)`

**Description:** request the local device to set the extended advertising parameters

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ble_ae_params|- Extended Advertising Parameters command data to be sent is filled in this|
|int8_t *|[out]|sel_tx_pwr|- Selected_TX_Power, selected output tx power, Its units are in dBm and Range : -127 to +20 @|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the local device to set Extended Advertising Parameters 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_set_ae_data (heading level 8)

`int32_t rsi_ble_set_ae_data(void *ble_ae_data)`

**Description:** request the local device to set the AE advertiser data used in advertising PDUs

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ble_ae_data|- Extended Advertising data to be sent is filled in this|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the local device to set the AE advertiser data used in advertising PDUs **Note**

- Refer to Bluetooth spec 5.3 for possible combinations ae_adv/scanresp data can be set for .

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_start_ae_advertising (heading level 8)

`int32_t rsi_ble_start_ae_advertising(void *adv_enable)`

**Description:** request the local device to enable or disable an advertising set using the advertising sets identified by the Advertising_Handle[i] parameter.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|adv_enable|- data to be sent is filled in this|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the local device to enable or disable an advertising set using the advertising sets identified by the Advertising_Handle[i] parameter. 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_app_adv_set_clear_or_remove (heading level 8)

`int32_t rsi_ble_app_adv_set_clear_or_remove(uint8_t type, uint8_t handle)`

**Description:** request the local device to clear or remove the advertising sets based on the type specified

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- Specifies whether to remove or clear the advertising sets. {1} - clear {2} - remove|
|uint8_t|[in]|handle|- Advertising_Handle - Used to identify an Advertising set. Possible Values : 0x00 to 0xEF|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the local device to clear or remove an advertising set from the controller based on the type specified 

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_app_set_periodic_ae_params (heading level 8)

`int32_t rsi_ble_app_set_periodic_ae_params(void *periodic_adv_params)`

**Description:** request the local device to set periodic advertising params

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|periodic_adv_params|- Parameters for Periodic Advertising to be filled here.|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function is used by the host to set the parameters for periodic advertising 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_app_set_periodic_ae_enable (heading level 8)

`int32_t rsi_ble_app_set_periodic_ae_enable(uint8_t enable, uint8_t handle)`

**Description:** request the Controller to enable or disable the periodic advertising

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>enable</td>
      <td>- Enable, BIT map for Enable <br />

```c
           0      -  Enable Periodic Advertising  \n               
           1      -  Include the ADI field in AUX_SYNC_IND PDUs \n

        handle - Advertising_Handle - Used to Identify an Advertsing Set \n

```</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>N/A</td>
      <td>handle</td>
      <td></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the Controller to enable or disable the periodic advertising for the advertising set specified by the Advertising_Handle parameter 

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ae_set_scan_params (heading level 8)

`int32_t rsi_ble_ae_set_scan_params(void *ae_scan_params)`

**Description:** sets the extended scan parameters to be used on the advertising physical channels.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ae_scan_params|- Extended scan Parameters data would be filled here|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function sets the extended scan parameters to be used on the advertising physical channels. 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ae_set_scan_enable (heading level 8)

`int32_t rsi_ble_ae_set_scan_enable(void *ae_scan_enable)`

**Description:** request the local device to enable or disable scanning for both legacy and extended advertising PDUs

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ae_scan_enable|- Extended Scan Enable command Parameters would be filled here|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function requests the local device to enable or disable scanning for both legacy and extended advertising PDUs 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ae_set_periodic_sync (heading level 8)

`int32_t rsi_ble_ae_set_periodic_sync(uint8_t type, void *periodic_sync_data)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|N/A|type||
|void *|N/A|periodic_sync_data||

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ae_dev_to_periodic_list (heading level 8)

`int32_t rsi_ble_ae_dev_to_periodic_list(void *dev_to_list)`

**Description:** used to add,remove or clear the device to the periodic advertiser list

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|dev_to_list|- holds the data of the Device to be added to periodic Advertising list|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function used to add,remove or clear the device to the periodic advertiser list 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_ae_read_periodic_adv_list_size (heading level 8)

`int32_t rsi_ble_ae_read_periodic_adv_list_size(uint8_t *resp)`

**Description:** used to read the periodic advertiser list size

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|resp||
||[out]|resp|- stores the value of total number of Periodic Advertiser list entries/ advertinsing list size filled by the controller|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function used to read the periodic advertiser list size 

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_extended_connect_with_params (heading level 8)

`int32_t rsi_ble_extended_connect_with_params(void *ble_extended_conn_params)`

**Description:** This command is used to create an ACL connection, with the local device in the Central role, to a connectable advertiser.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|ble_extended_conn_params|holds the data of the Parameters required to connect with the peer device.|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function used to used to create an ACL connection, with the local device in the Central role, to a connectable advertiser. 

**References:** [memcpy](bt-classic1#memcpy) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_read_transmit_power (heading level 8)

`int32_t rsi_ble_read_transmit_power(void *resp)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|N/A|resp||

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_read_rf_path_compensation (heading level 8)

`int32_t rsi_ble_read_rf_path_compensation(void *resp)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|N/A|resp||

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_write_rf_path_compensation (heading level 8)

`int32_t rsi_ble_write_rf_path_compensation(uint16_t tx_path_value, uint16_t rx_path_value)`

**Description:** used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|tx_path_value|- RF_TX_Path_Compensation_Value, rx_path_value - RF_RX_Path_Compensation_Value <br /><br/> A positive value means a net RF path gain and a negative value means a net RF path loss <br /><br/> RF_TX_Path_compensation_Value : units in 0.1dB , Range : -128.0 dB (0xFB00) to 128.0 dB (0x0500) <br /><br/> RF_RX_Path_compensation_Value : units in 0.1dB , Range : -128.0 dB (0xFB00) to 128.0 dB (0x0500) <br />|
|uint16_t|N/A|rx_path_value||

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

This function used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components. 

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_vendor_feature_bitmap (heading level 8)

`int32_t rsi_ble_vendor_feature_bitmap(uint32_t bitmap)`

**Description:** Vendor specific BLE command to set bitmap.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|bitmap|BIT(0) - enable/disable BLE scan responses other - reserved for future use|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [ble_vendor_feature_bitmap_s::bitmap](ble-vendor-feature-bitmap-s#bitmap), [ble_vendor_feature_bitmap_s::opcode](ble-vendor-feature-bitmap-s#opcode) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### rsi_ble_vendor_set_SMP_min_enc_keysize (heading level 8)

`int32_t rsi_ble_vendor_set_SMP_min_enc_keysize(uint8_t min_keysize)`

**Description:** Set minimum encryption key size used when validating the peer pairing response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|min_keysize|- minimum key size (valid range 7–16 per BLE SMP).|

**Returns**

- 0 = success <br />  
   !0 = failure <br />

###### description (heading level 7)

Host command configures the controller minimum acceptable encryption key size for SMP pairing response handling. 

**References:** [rsi_ble_vendor_set_SMP_min_enc_keysize](bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

**Referenced by:** [rsi_ble_vendor_set_SMP_min_enc_keysize](bt-low-energy1#rsi-ble-vendor-set-smp-min-enc-keysize)

###### Test Mode

###### Functions (heading level 7)

###### rsi_ble_rx_test_mode (heading level 8)

`int32_t rsi_ble_rx_test_mode(uint8_t rx_channel, uint8_t phy, uint8_t modulation)`

**Description:** Start the BLE RX test mode in controller. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|rx_channel|- Channel in which packet have to be received (0 - 39)|
|uint8_t|[in]|phy|- 0x00 Reserved for future use <br /><br/> 0x01 Receiver set to use the LE 1M PHY <br /><br/> 0x02 Receiver set to use the LE 2M PHY <br /><br/> 0x03 Receiver set to use the LE Coded PHY <br /><br/> (0x04 - 0xFF) Reserved for future use.|
|uint8_t|[in]|modulation|- 0x00 Assume transmitter will have a standard standard modulation index <br /><br/> 0x01 Assume transmitter will have a stable modulation index <br /><br/> (0x02 - 0xFF) Reserved for future use|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_rx_test_mode_s::modulation](rsi-ble-rx-test-mode-s#modulation), [rsi_ble_rx_test_mode_s::phy](rsi-ble-rx-test-mode-s#phy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_rx_test_mode_s::rx_channel](rsi-ble-rx-test-mode-s#rx-channel) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_tx_test_mode (heading level 8)

`int32_t rsi_ble_tx_test_mode(uint8_t tx_channel, uint8_t phy, uint8_t tx_len, uint8_t mode)`

**Description:** Start the BLE TX test mode in controller. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|tx_channel|- RF Channel (0-39). <br />|
|uint8_t|[in]|phy|- 0x00 Reserved for future use <br /><br/> 0x01 Transmitter set to use the LE 1M PHY <br /><br/> 0x02 Transmitter set to use the LE 2M PHY <br /><br/> 0x03 Transmitter set to use the LE Coded PHY with S=8 data coding <br /><br/> 0x04 Transmitter set to use the LE Coded PHY with S=2 data coding <br /><br/> (0x05 - 0xFF) Reserved for future use.|
|uint8_t|[in]|tx_len|- Length in bytes of payload data in each packet ( 1 - 251 bytes).|
|uint8_t|[in]|mode|- 0x00 PRBS9 sequence '11111111100000111101...' <br /><br/> 0x01 Repeated '11110000' <br /><br/> 0x02 Repeated '10101010' <br /><br/> 0x03 PRBS15 <br /><br/> 0x04 Repeated '11111111' <br /><br/> 0x05 Repeated '00000000' <br /><br/> 0x06 Repeated '00001111' <br /><br/> 0x07 Repeated '01010101' <br /><br/> 0x08 - 0xFF Reserved for future use <br />|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_tx_test_mode_s::phy](rsi-ble-tx-test-mode-s#phy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_ble_tx_test_mode_s::tx_channel](rsi-ble-tx-test-mode-s#tx-channel), [rsi_ble_tx_test_mode_s::tx_data_mode](rsi-ble-tx-test-mode-s#tx-data-mode) and [rsi_ble_tx_test_mode_s::tx_len](rsi-ble-tx-test-mode-s#tx-len)

###### rsi_ble_end_test_mode (heading level 8)

`int32_t rsi_ble_end_test_mode(uint16_t *num_of_pkts)`

**Description:** Stop the BLE TX / RX test mode in controller. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t *|[out]|num_of_pkts|- Number of RX packets received are displayed when RX test is stopped <br />|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_per_transmit (heading level 8)

`int32_t rsi_ble_per_transmit(struct rsi_ble_per_transmit_s *rsi_ble_per_tx)`

**Description:** Initiate the BLE transmit PER mode in the controller. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|struct [rsi_ble_per_transmit_s](rsi-ble-per-transmit-s) *|[in]|rsi_ble_per_tx|- This parameter is the buffer to hold the structure values <br /><br/> This is a structure variable of struct [rsi_ble_per_transmit_s](rsi-ble-per-transmit-s)|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_per_receive (heading level 8)

`int32_t rsi_ble_per_receive(struct rsi_ble_per_receive_s *rsi_ble_per_rx)`

**Description:** Initiate the BLE receive PER mode in the controller. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|struct [rsi_ble_per_receive_s](rsi-ble-per-receive-s) *|[in]|rsi_ble_per_rx|- This parameter is the buffer to hold the structure values <br /><br/> This is a structure variable of struct [rsi_ble_per_receive_s](rsi-ble-per-receive-s)|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### Register callbacks

###### Functions (heading level 7)

###### rsi_ble_gap_register_callbacks (heading level 8)

`void rsi_ble_gap_register_callbacks(rsi_ble_on_adv_report_event_t ble_on_adv_report_event, rsi_ble_on_connect_t ble_on_conn_status_event, rsi_ble_on_disconnect_t ble_on_disconnect_event, rsi_ble_on_le_ping_payload_timeout_t ble_on_le_ping_time_expired_event, rsi_ble_on_phy_update_complete_t ble_on_phy_update_complete_event, rsi_ble_on_data_length_update_t rsi_ble_on_data_length_update_event, rsi_ble_on_enhance_connect_t ble_on_enhance_conn_status_event, rsi_ble_on_directed_adv_report_event_t ble_on_directed_adv_report_event, rsi_ble_on_conn_update_complete_t ble_on_conn_update_complete_event, rsi_ble_on_remote_conn_params_request_t ble_on_remote_conn_params_request_event)`

**Description:** Register GAP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_on_adv_report_event_t](bt-low-energy8#rsi-ble-on-adv-report-event-t)|[in]|ble_on_adv_report_event|- Callback function for Advertise events|
|[rsi_ble_on_connect_t](bt-low-energy8#rsi-ble-on-connect-t)|[in]|ble_on_conn_status_event|- Callback function for Connect events|
|[rsi_ble_on_disconnect_t](bt-low-energy8#rsi-ble-on-disconnect-t)|[in]|ble_on_disconnect_event|- Callback function for Disconnect events|
|[rsi_ble_on_le_ping_payload_timeout_t](bt-low-energy8#rsi-ble-on-le-ping-payload-timeout-t)|[in]|ble_on_le_ping_time_expired_event|- Callback function for le ping timeout events|
|[rsi_ble_on_phy_update_complete_t](bt-low-energy8#rsi-ble-on-phy-update-complete-t)|[in]|ble_on_phy_update_complete_event|- Callback function for phy update complete events|
|[rsi_ble_on_data_length_update_t](bt-low-energy8#rsi-ble-on-data-length-update-t)|[in]|rsi_ble_on_data_length_update_event|- Callback function for data length update events|
|[rsi_ble_on_enhance_connect_t](bt-low-energy8#rsi-ble-on-enhance-connect-t)|[in]|ble_on_enhance_conn_status_event|- Callback function for enhanced connection status events|
|[rsi_ble_on_directed_adv_report_event_t](bt-low-energy8#rsi-ble-on-directed-adv-report-event-t)|[in]|ble_on_directed_adv_report_event|- Callback function for directed advertiseing report events|
|[rsi_ble_on_conn_update_complete_t](bt-low-energy8#rsi-ble-on-conn-update-complete-t)|[in]|ble_on_conn_update_complete_event|- Callback function for conn update complete events|
|[rsi_ble_on_remote_conn_params_request_t](bt-low-energy8#rsi-ble-on-remote-conn-params-request-t)|[in]|ble_on_remote_conn_params_request_event|- Callback function to remote conn params request events|

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_adv_report_event](rsi-ble-cb-s#ble-on-adv-report-event), [rsi_ble_cb_s::ble_on_conn_status_event](rsi-ble-cb-s#ble-on-conn-status-event), [rsi_ble_cb_s::ble_on_conn_update_complete_event](rsi-ble-cb-s#ble-on-conn-update-complete-event), [rsi_ble_cb_s::ble_on_directed_adv_report_event](rsi-ble-cb-s#ble-on-directed-adv-report-event), [rsi_ble_cb_s::ble_on_disconnect_event](rsi-ble-cb-s#ble-on-disconnect-event), [rsi_ble_cb_s::ble_on_enhance_conn_status_event](rsi-ble-cb-s#ble-on-enhance-conn-status-event), [rsi_ble_cb_s::ble_on_le_ping_time_expired_event](rsi-ble-cb-s#ble-on-le-ping-time-expired-event), [rsi_ble_cb_s::ble_on_phy_update_complete_event](rsi-ble-cb-s#ble-on-phy-update-complete-event), [rsi_ble_cb_s::ble_on_remote_conn_params_request_event](rsi-ble-cb-s#ble-on-remote-conn-params-request-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_ble_cb_s::rsi_ble_on_data_length_update_event](rsi-ble-cb-s#rsi-ble-on-data-length-update-event) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_gap_extended_register_callbacks (heading level 8)

`void rsi_ble_gap_extended_register_callbacks(rsi_ble_on_remote_features_t ble_on_remote_features_event, rsi_ble_on_le_more_data_req_t ble_on_le_more_data_req_event)`

**Description:** Register GAP Extended responses/events callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_on_remote_features_t](bt-low-energy8#rsi-ble-on-remote-features-t)|[in]|ble_on_remote_features_event|- Call back function for Remote feature request|
|[rsi_ble_on_le_more_data_req_t](bt-low-energy8#rsi-ble-on-le-more-data-req-t)|[in]|ble_on_le_more_data_req_event|- Call back function for LE More data request|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Note**

- For more information about each callback, please refer to GAP Extended callbacks description section.

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_le_more_data_req_event](rsi-ble-cb-s#ble-on-le-more-data-req-event), [rsi_ble_cb_s::ble_on_remote_features_event](rsi-ble-cb-s#ble-on-remote-features-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_smp_register_callbacks (heading level 8)

`void rsi_ble_smp_register_callbacks(rsi_ble_on_smp_request_t ble_on_smp_request_event, rsi_ble_on_smp_response_t ble_on_smp_response_event, rsi_ble_on_smp_passkey_t ble_on_smp_passkey_event, rsi_ble_on_smp_failed_t ble_on_smp_failed_event, rsi_ble_on_encrypt_started_t ble_on_smp_encryptrd, rsi_ble_on_smp_passkey_display_t ble_on_smp_passkey_display_event, rsi_ble_on_sc_passkey_t ble_sc_passkey_event, rsi_ble_on_le_ltk_req_event_t ble_on_le_ltk_req_event, rsi_ble_on_le_security_keys_t ble_on_le_security_keys_event, rsi_ble_on_smp_response_t ble_on_cli_smp_response_event, rsi_ble_on_sc_method_t ble_on_sc_method_event)`

**Description:** Register the SMP callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_on_smp_request_t](bt-low-energy8#rsi-ble-on-smp-request-t)|[in]|ble_on_smp_request_event|- smp request callback|
|[rsi_ble_on_smp_response_t](bt-low-energy8#rsi-ble-on-smp-response-t)|[in]|ble_on_smp_response_event|- smp response callback|
|[rsi_ble_on_smp_passkey_t](bt-low-energy8#rsi-ble-on-smp-passkey-t)|[in]|ble_on_smp_passkey_event|- smp passkey callback|
|[rsi_ble_on_smp_failed_t](bt-low-energy8#rsi-ble-on-smp-failed-t)|[in]|ble_on_smp_failed_event|- smp failed callback|
|[rsi_ble_on_encrypt_started_t](bt-low-energy8#rsi-ble-on-encrypt-started-t)|[in]|ble_on_smp_encryptrd|- encription enabled callback|
|[rsi_ble_on_smp_passkey_display_t](bt-low-energy8#rsi-ble-on-smp-passkey-display-t)|[in]|ble_on_smp_passkey_display_event|- smp passkey display callback|
|[rsi_ble_on_sc_passkey_t](bt-low-energy8#rsi-ble-on-sc-passkey-t)|[in]|ble_sc_passkey_event|- sc passkey display callback|
|[rsi_ble_on_le_ltk_req_event_t](bt-low-energy8#rsi-ble-on-le-ltk-req-event-t)|[in]|ble_on_le_ltk_req_event|- This is the SMP ltk request callback|
|[rsi_ble_on_le_security_keys_t](bt-low-energy8#rsi-ble-on-le-security-keys-t)|[in]|ble_on_le_security_keys_event|- This is the SMP security keys callback|
|[rsi_ble_on_smp_response_t](bt-low-energy8#rsi-ble-on-smp-response-t)|[in]|ble_on_cli_smp_response_event|- sc method display callback|
|[rsi_ble_on_sc_method_t](bt-low-energy8#rsi-ble-on-sc-method-t)|N/A|ble_on_sc_method_event||

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_cli_smp_response_event](rsi-ble-cb-s#ble-on-cli-smp-response-event), [rsi_ble_cb_s::ble_on_le_ltk_req_event](rsi-ble-cb-s#ble-on-le-ltk-req-event), [rsi_ble_cb_s::ble_on_le_security_keys_event](rsi-ble-cb-s#ble-on-le-security-keys-event), [rsi_ble_cb_s::ble_on_sc_method_event](rsi-ble-cb-s#ble-on-sc-method-event), [rsi_ble_cb_s::ble_on_sc_passkey](rsi-ble-cb-s#ble-on-sc-passkey), [rsi_ble_cb_s::ble_on_smp_encrypt_started](rsi-ble-cb-s#ble-on-smp-encrypt-started), [rsi_ble_cb_s::ble_on_smp_fail_event](rsi-ble-cb-s#ble-on-smp-fail-event), [rsi_ble_cb_s::ble_on_smp_passkey_display](rsi-ble-cb-s#ble-on-smp-passkey-display), [rsi_ble_cb_s::ble_on_smp_passkey_event](rsi-ble-cb-s#ble-on-smp-passkey-event), [rsi_ble_cb_s::ble_on_smp_request_event](rsi-ble-cb-s#ble-on-smp-request-event), [rsi_ble_cb_s::ble_on_smp_response_event](rsi-ble-cb-s#ble-on-smp-response-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_gatt_register_callbacks (heading level 8)

`void rsi_ble_gatt_register_callbacks(rsi_ble_on_profiles_list_resp_t ble_on_profiles_list_resp, rsi_ble_on_profile_resp_t ble_on_profile_resp, rsi_ble_on_char_services_resp_t ble_on_char_services_resp, rsi_ble_on_inc_services_resp_t ble_on_inc_services_resp, rsi_ble_on_att_desc_resp_t ble_on_att_desc_resp, rsi_ble_on_read_resp_t ble_on_read_resp, rsi_ble_on_write_resp_t ble_on_write_resp, rsi_ble_on_gatt_write_event_t ble_on_gatt_event, rsi_ble_on_gatt_prepare_write_event_t ble_on_gatt_prepare_write_event, rsi_ble_on_execute_write_event_t ble_on_execute_write_event, rsi_ble_on_read_req_event_t ble_on_read_req_event, rsi_ble_on_mtu_event_t ble_on_mtu_event, rsi_ble_on_gatt_error_resp_t ble_on_gatt_error_resp_event, rsi_ble_on_gatt_desc_val_event_t ble_on_gatt_desc_val_resp_event, rsi_ble_on_event_profiles_list_t ble_on_profiles_list_event, rsi_ble_on_event_profile_by_uuid_t ble_on_profile_by_uuid_event, rsi_ble_on_event_read_by_char_services_t ble_on_read_by_char_services_event, rsi_ble_on_event_read_by_inc_services_t ble_on_read_by_inc_services_event, rsi_ble_on_event_read_att_value_t ble_on_read_att_value_event, rsi_ble_on_event_read_resp_t ble_on_read_resp_event, rsi_ble_on_event_write_resp_t ble_on_write_resp_event, rsi_ble_on_event_indicate_confirmation_t ble_on_indicate_confirmation_event, rsi_ble_on_event_prepare_write_resp_t ble_on_prepare_write_resp_event)`

**Description:** Register the GATT callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_on_profiles_list_resp_t](bt-low-energy8#rsi-ble-on-profiles-list-resp-t)|[in]|ble_on_profiles_list_resp|ble_on_profiles_list_resp - Callback for rsi_ble_get_profiles command|
|[rsi_ble_on_profile_resp_t](bt-low-energy8#rsi-ble-on-profile-resp-t)|[in]|ble_on_profile_resp|ble_on_profile_resp - Callback for rsi_ble_get_profile command|
|[rsi_ble_on_char_services_resp_t](bt-low-energy8#rsi-ble-on-char-services-resp-t)|[in]|ble_on_char_services_resp|ble_on_char_services_resp - Callback for rsi_ble_get_char_services command|
|[rsi_ble_on_inc_services_resp_t](bt-low-energy8#rsi-ble-on-inc-services-resp-t)|[in]|ble_on_inc_services_resp|ble_on_inc_services_resp - Callback for rsi_ble_get_inc_services command|
|[rsi_ble_on_att_desc_resp_t](bt-low-energy8#rsi-ble-on-att-desc-resp-t)|[in]|ble_on_att_desc_resp|ble_on_att_desc_resp - Callback for rsi_ble_get_att_descriptors command|
|[rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t)|[in]|ble_on_read_resp|ble_on_read_resp - Callback for all read requests command|
|[rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t)|[in]|ble_on_write_resp|ble_on_write_resp - Callback for all write commands|
|[rsi_ble_on_gatt_write_event_t](bt-low-energy8#rsi-ble-on-gatt-write-event-t)|[in]|ble_on_gatt_event|blw_on_gatt_event - Callback for all GATT events|
|[rsi_ble_on_gatt_prepare_write_event_t](bt-low-energy8#rsi-ble-on-gatt-prepare-write-event-t)|[in]|ble_on_gatt_prepare_write_event|ble_on_gatt_error_resp_event - Callback for GATT error events|
|[rsi_ble_on_execute_write_event_t](bt-low-energy8#rsi-ble-on-execute-write-event-t)|[in]|ble_on_execute_write_event|ble_on_gatt_desc_val_resp_event - Callback for GATT descriptor value event|
|[rsi_ble_on_read_req_event_t](bt-low-energy8#rsi-ble-on-read-req-event-t)|[in]|ble_on_read_req_event|ble_on_profiles_list_event - Callback function for profiles list event|
|[rsi_ble_on_mtu_event_t](bt-low-energy8#rsi-ble-on-mtu-event-t)|[in]|ble_on_mtu_event|ble_on_profile_by_uuid_event - Callback function for profile event|
|[rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t)|[in]|ble_on_gatt_error_resp_event|ble_on_read_by_char_services_event- Callback function for char services event|
|[rsi_ble_on_gatt_desc_val_event_t](bt-low-energy8#rsi-ble-on-gatt-desc-val-event-t)|[in]|ble_on_gatt_desc_val_resp_event|ble_on_read_by_inc_services_event - Callback function for inc services event|
|[rsi_ble_on_event_profiles_list_t](bt-low-energy8#rsi-ble-on-event-profiles-list-t)|[in]|ble_on_profiles_list_event|ble_on_read_att_value_event - Callback function for read att value event|
|[rsi_ble_on_event_profile_by_uuid_t](bt-low-energy8#rsi-ble-on-event-profile-by-uuid-t)|[in]|ble_on_profile_by_uuid_event|ble_on_read_resp_event - Callback function for read att event|
|[rsi_ble_on_event_read_by_char_services_t](bt-low-energy8#rsi-ble-on-event-read-by-char-services-t)|[in]|ble_on_read_by_char_services_event|ble_on_write_resp_event - Callback function for write event|
|[rsi_ble_on_event_read_by_inc_services_t](bt-low-energy8#rsi-ble-on-event-read-by-inc-services-t)|[in]|ble_on_read_by_inc_services_event|ble_on_indicate_confirmation_event- Callback function for indicate confirmation event|
|[rsi_ble_on_event_read_att_value_t](bt-low-energy8#rsi-ble-on-event-read-att-value-t)|[in]|ble_on_read_att_value_event|ble_on_prepare_write_resp_event - Callback function for prepare write event|
|[rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t)|N/A|ble_on_read_resp_event||
|[rsi_ble_on_event_write_resp_t](bt-low-energy8#rsi-ble-on-event-write-resp-t)|N/A|ble_on_write_resp_event||
|[rsi_ble_on_event_indicate_confirmation_t](bt-low-energy8#rsi-ble-on-event-indicate-confirmation-t)|N/A|ble_on_indicate_confirmation_event||
|[rsi_ble_on_event_prepare_write_resp_t](bt-low-energy8#rsi-ble-on-event-prepare-write-resp-t)|N/A|ble_on_prepare_write_resp_event||

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_att_desc_resp](rsi-ble-cb-s#ble-on-att-desc-resp), [rsi_ble_cb_s::ble_on_char_services_resp](rsi-ble-cb-s#ble-on-char-services-resp), [rsi_ble_cb_s::ble_on_execute_write_event](rsi-ble-cb-s#ble-on-execute-write-event), [rsi_ble_cb_s::ble_on_gatt_desc_val_resp_event](rsi-ble-cb-s#ble-on-gatt-desc-val-resp-event), [rsi_ble_cb_s::ble_on_gatt_error_resp_event](rsi-ble-cb-s#ble-on-gatt-error-resp-event), [rsi_ble_cb_s::ble_on_gatt_events](rsi-ble-cb-s#ble-on-gatt-events), [rsi_ble_cb_s::ble_on_inc_services_resp](rsi-ble-cb-s#ble-on-inc-services-resp), [rsi_ble_cb_s::ble_on_indicate_confirmation_event](rsi-ble-cb-s#ble-on-indicate-confirmation-event), [rsi_ble_cb_s::ble_on_mtu_event](rsi-ble-cb-s#ble-on-mtu-event), [rsi_ble_cb_s::ble_on_prepare_write_event](rsi-ble-cb-s#ble-on-prepare-write-event), [rsi_ble_cb_s::ble_on_prepare_write_resp_event](rsi-ble-cb-s#ble-on-prepare-write-resp-event), [rsi_ble_cb_s::ble_on_profile_by_uuid_event](rsi-ble-cb-s#ble-on-profile-by-uuid-event), [rsi_ble_cb_s::ble_on_profile_resp](rsi-ble-cb-s#ble-on-profile-resp), [rsi_ble_cb_s::ble_on_profiles_list_event](rsi-ble-cb-s#ble-on-profiles-list-event), [rsi_ble_cb_s::ble_on_profiles_list_resp](rsi-ble-cb-s#ble-on-profiles-list-resp), [rsi_ble_cb_s::ble_on_read_att_value_event](rsi-ble-cb-s#ble-on-read-att-value-event), [rsi_ble_cb_s::ble_on_read_by_char_services_event](rsi-ble-cb-s#ble-on-read-by-char-services-event), [rsi_ble_cb_s::ble_on_read_by_inc_services_event](rsi-ble-cb-s#ble-on-read-by-inc-services-event), [rsi_ble_cb_s::ble_on_read_req_event](rsi-ble-cb-s#ble-on-read-req-event), [rsi_ble_cb_s::ble_on_read_resp](rsi-ble-cb-s#ble-on-read-resp), [rsi_ble_cb_s::ble_on_read_resp_event](rsi-ble-cb-s#ble-on-read-resp-event), [rsi_ble_cb_s::ble_on_write_resp](rsi-ble-cb-s#ble-on-write-resp), [rsi_ble_cb_s::ble_on_write_resp_event](rsi-ble-cb-s#ble-on-write-resp-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_gatt_extended_register_callbacks (heading level 8)

`void rsi_ble_gatt_extended_register_callbacks(rsi_ble_on_mtu_exchange_info_t ble_on_mtu_exchange_info_event)`

**Description:** Register the GATT Extended responses/events callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_on_mtu_exchange_info_t](bt-low-energy8#rsi-ble-on-mtu-exchange-info-t)|[in]|ble_on_mtu_exchange_info_event|ble_on_mtu_exchange_info_event - Call back function for MTU Exchange information Event|

**Returns**

- void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_mtu_exchange_info_event](rsi-ble-cb-s#ble-on-mtu-exchange-info-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb) and [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb)

###### rsi_ble_enhanced_gap_extended_register_callbacks (heading level 8)

`uint16_t rsi_ble_enhanced_gap_extended_register_callbacks(uint16_t callback_id, void(*callback_handler_ptr)(uint16_t status, uint8_t *buffer))`

**Description:** Register the BLE GAP extended callback functions.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|callback_id|- This is the Id of the call back function, following ids are supported: <br /><br/> RSI_BLE_ON_REMOTE_DEVICE_INFORMATION <br /><br/> RSI_BLE_ON_RCP_EVENT <br />|
|void(*)(uint16_t status, uint8_t *buffer)|[in]|callback_handler_ptr|- This is the Callback handler <br />|
||[out]|status|- status of the asynchronous response <br />|
||[out]|buffer|- payload of the asynchronous response <br /><br />|

**Returns**

- 0 - Success <br />  
   -53 - Failure <br />  
   If call_back_id is greater than the maximum callbacks to register, returns RSI_ERROR_BLE_INVALID_CALLBACK_CNT.

**Note**

- In callbacks, application should not initiate any TX operation to the module.

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_rcp_resp_rcvd_event](rsi-ble-cb-s#ble-on-rcp-resp-rcvd-event), [rsi_ble_cb_s::ble_on_remote_device_info_event](rsi-ble-cb-s#ble-on-remote-device-info-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_ble_adv_ext_events_register_callbacks (heading level 8)

`uint16_t rsi_ble_adv_ext_events_register_callbacks(uint16_t callback_id, void(*callback_handler_ptr)(uint16_t status, uint8_t *buffer))`

**Description:** Register the BLE call back functions.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|callback_id|- This is the Id of the call back function following ids are supported:|
|void(*)(uint16_t status, uint8_t *buffer)|[in]|callback_handler_ptr|(*callback_handler_ptr)(void - This is the Call back handler|
||[in]|status|- status of the asynchronous response|
||[in]|buffer|- payload of the asynchronous response|

**Returns**

- 0 - Success <br />  
   -53 - Failure <br />  
   If call_back_id is greater than the maximum callbacks to register, returns ref/ RSI_ERROR_BLE_INVALID_CALLBACK_CNT.

**Note**

- In callbacks, application should not initiate any TX operation to the module.

**References:** [rsi_ble_cb_s::ble_ae_adv_set_terminated_event](rsi-ble-cb-s#ble-ae-adv-set-terminated-event), [rsi_ble_cb_s::ble_ae_per_adv_report_event](rsi-ble-cb-s#ble-ae-per-adv-report-event), [rsi_ble_cb_s::ble_ae_per_adv_sync_estbl_event](rsi-ble-cb-s#ble-ae-per-adv-sync-estbl-event), [rsi_ble_cb_s::ble_ae_per_adv_sync_lost_event](rsi-ble-cb-s#ble-ae-per-adv-sync-lost-event), [rsi_ble_cb_s::ble_ae_report_complete_event](rsi-ble-cb-s#ble-ae-report-complete-event), [rsi_ble_cb_s::ble_ae_scan_req_recvd_event](rsi-ble-cb-s#ble-ae-scan-req-recvd-event), [rsi_ble_cb_s::ble_ae_scan_timeout_event](rsi-ble-cb-s#ble-ae-scan-timeout-event), [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### Callbacks Declarations

###### Typedefs (heading level 7)

###### rsi_ble_on_adv_report_event_t (heading level 8)

`void(* rsi_ble_on_adv_report_event_t)(rsi_ble_event_adv_report_t *rsi_ble_event_adv)`

**Description:**

The callback function will be called if advertise report event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_adv|contains the advertise report information. Please refer [rsi_ble_event_adv_report_s](rsi-ble-event-adv-report-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the advertise event report is received from the module <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_connect_t (heading level 8)

`void(* rsi_ble_on_connect_t)(rsi_ble_event_conn_status_t *rsi_ble_event_conn)`

**Description:**

The callback function will be called if BLE connection status is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_conn|contains the BLE connection status. Please refer [rsi_ble_event_conn_status_s](rsi-ble-event-conn-status-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the BLE connection status is received from the module. For BLE 4.1 and lower version this callback will be called <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_enhance_connect_t (heading level 8)

`void(* rsi_ble_on_enhance_connect_t)(rsi_ble_event_enhance_conn_status_t *rsi_ble_event_enhance_conn)`

**Description:**

The callback function will be called if BLE connection status is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_conn|contains the BLE connection status. Please refer rsi_ble_event_enhance_conn_status_s for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the BLE connection status is received from the module. For BLE 4.2 and above version this callback will be called <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_disconnect_t (heading level 8)

`void(* rsi_ble_on_disconnect_t)(rsi_ble_event_disconnect_t *rsi_ble_event_disconnect, uint16_t reason)`

**Description:**

The callback function will be called if disconnect event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_disconnect|contains the disconnect status. Please refer [rsi_ble_event_disconnect_s](rsi-ble-event-disconnect-s) for more info.|
||[out]|reason|contains reason for failure. <br />|

**Details:**

**Note**

- Few reason for failure are given below <br />  
   0x4E13 Remote user terminated connection <br />  
   0x4E14 Remote device terminated connection due to low resources <br />  
   0x4E15 Remote device terminated connection due to power off <br />  
   0x4E3D Connection terminated due to MIC failure <br />  
   0x4E3E Connection Failed to be Established <br />  
   0x4E60 Invalid Handle Range

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the disconnect status event is received from the module <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_le_ping_payload_timeout_t (heading level 8)

`void(* rsi_ble_on_le_ping_payload_timeout_t)(rsi_ble_event_le_ping_time_expired_t *rsi_ble_event_timeout_expired)`

**Description:**

The callback function will be called if le ping payload timeout expired event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_disconnect|contains the disconnect status. Please refer [rsi_ble_event_le_ping_time_expired_s](rsi-ble-event-le-ping-time-expired-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the le ping time expired event is received from the module <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_le_ltk_req_event_t (heading level 8)

`void(* rsi_ble_on_le_ltk_req_event_t)(rsi_bt_event_le_ltk_request_t *rsi_ble_event_le_ltk_request)`

**Description:**

The callback function will be called if le ltk request event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_le_ltk_request|contains the ltk request info. Please refer [rsi_bt_event_le_ltk_request_s](rsi-bt-event-le-ltk-request-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if le ltk request event is received from the module <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_le_security_keys_t (heading level 8)

`void(* rsi_ble_on_le_security_keys_t)(rsi_bt_event_le_security_keys_t *rsi_ble_event_le_security_keys)`

**Description:**

The callback function will be called if le security keys event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_bt_event_le_security_keys_t|contains security keys. Please refer [rsi_bt_event_le_security_keys_s](rsi-bt-event-le-security-keys-s) for more info <br />|

**Details:**

**Note**

- When the device is disconnected from the remote device, the pairing information such as LTK, EDIV, and RAND will be erased. Therefore, it is essential for the application developer to store and manage this information in the Host NVM. <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if le security keys event is received from the module <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_smp_request_t (heading level 8)

`void(* rsi_ble_on_smp_request_t)(rsi_bt_event_smp_req_t *remote_dev_address)`

**Description:**

The callback function will be called if smp request is received in Master mode.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response status (Success or Error code)|
||[out]|remote_dev_address|contains the smp requested device address. Please refer [rsi_bt_event_smp_req_s](rsi-bt-event-smp-req-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the smp request is received from the remote device <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_smp_response_t (heading level 8)

`void(* rsi_ble_on_smp_response_t)(rsi_bt_event_smp_resp_t *remote_dev_address)`

**Description:**

The callback function will be called if smp request is received in slave mode.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|remote_dev_address|contains the smp resp information. please refer [rsi_bt_event_smp_resp_s](rsi-bt-event-smp-resp-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the smp request is received from the remote device <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_smp_passkey_t (heading level 8)

`void(* rsi_ble_on_smp_passkey_t)(rsi_bt_event_smp_passkey_t *remote_dev_address)`

**Description:**

The callback function will be called if smp passkey event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_statuscontains|the response status (Success or Error code)|
||[out]|remote_dev_address|contains the remote device address. please refer [rsi_bt_event_smp_passkey_s](rsi-bt-event-smp-passkey-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the smp passkey is received from the module <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_smp_passkey_display_t (heading level 8)

`void(* rsi_ble_on_smp_passkey_display_t)(rsi_bt_event_smp_passkey_display_t *smp_passkey_display)`

**Description:**

The callback function will be called if smp passkey event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response status (Success or Error code)|
||[out]|smp_passkey_display|contains the smp passkey display information. Please refer [rsi_bt_event_smp_passkey_display_s](rsi-bt-event-smp-passkey-display-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the smp passkey display is received from the module <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_smp_failed_t (heading level 8)

`void(* rsi_ble_on_smp_failed_t)(uint16_t resp_status, rsi_bt_event_smp_failed_t *remote_dev_address)`

**Description:**

The callback function will be called if smp failed event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the remote device address. Please refer [rsi_bt_event_smp_failed_s](rsi-bt-event-smp-failed-s) for more info.|

**Details:**

**Note**

- Error codes for SMP FAILED are given below <br />  
   0x4B01 SMP Passkey entry failed <br />  
   0x4B02 SMP OOB not available <br />  
   0x4B03 SMP Authentication Requirements <br />  
   0x4B04 SMP confirm value failed <br />  
   0x4B05 SMP Pairing not supported <br />  
   0x4B06 SMP Encryption key size insufficient <br />  
   0x4B07 SMP command not supported <br />  
   0x4B08 SMP Unspecified Reason <br />  
   0x4B09 SMP repeated attempts <br />  
   0x4B0C SMP Numeric Comparison Failed <br />  
   0x4B0B DHKEY Check Failed

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the smp process is failed with remote device <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_sc_method_t (heading level 8)

`void(* rsi_ble_on_sc_method_t)(rsi_bt_event_sc_method_t *scmethod)`

**Description:**

The callback function will be called if security method event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|scmethod|contains Security Method 1 means Just works or 2 means Passkey. Please refer [rsi_bt_event_sc_method_s](rsi-bt-event-sc-method-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the SC method is done with remote device <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_encrypt_started_t (heading level 8)

`void(* rsi_ble_on_encrypt_started_t)(uint16_t resp_status, rsi_bt_event_encryption_enabled_t *enc_enabled)`

**Description:**

The callback function will be called if encrypted event is received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response status (Success or Error code)|
||[out]|enc_enabled|contains encryption information. Please refer [rsi_bt_event_encryption_enabled_s](rsi-bt-event-encryption-enabled-s) for more info. <br />|

**Details:**

**Note**

- When the device is disconnected from the remote device, the pairing information such as LTK, EDIV, and RAND will be erased. Therefore, it is essential for the application developer to store and manage this information in the Host NVM. <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the encryption process is started with remote device <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_sc_passkey_t (heading level 8)

`void(* rsi_ble_on_sc_passkey_t)(rsi_bt_event_sc_passkey_t *sc_passkey)`

**Description:**

The callback function will be called if BLE Secure connection passkey event received from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|sc_passkey|contains LE SC Passkey information. Please refer [rsi_bt_event_encryption_enabled_s](rsi-bt-event-encryption-enabled-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the BLE Secure connection passkey event received <br />
This callback has to be registered using rsi_ble_smp_register_callbacks API

###### rsi_ble_on_phy_update_complete_t (heading level 8)

`void(* rsi_ble_on_phy_update_complete_t)(rsi_ble_event_phy_update_t *rsi_ble_event_phy_update_complete)`

**Description:**

The callback function will be called when phy update complete event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_phy_update_complete|contains the controller support phy information. Please refer [rsi_ble_event_phy_update_s](rsi-ble-event-phy-update-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when phy update complete event is received <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_conn_update_complete_t (heading level 8)

`void(* rsi_ble_on_conn_update_complete_t)(rsi_ble_event_conn_update_t *rsi_ble_event_conn_update_complete, uint16_t resp_status)`

**Description:**

The callback function will be called when conn update complete event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_conn_update_complete|contains the controller support conn information. Please refer [rsi_ble_event_conn_update_s](rsi-ble-event-conn-update-s) for more info.|
||[out]|resp_status|contains the response status (Success or Error code)|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when conn update complete event is received <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_remote_conn_params_request_t (heading level 8)

`void(* rsi_ble_on_remote_conn_params_request_t)(rsi_ble_event_remote_conn_param_req_t *rsi_ble_event_remote_conn_param, uint16_t resp_status)`

**Description:**

The callback function will be called if remote conn params request is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response status (Success or Error code)|
||[out]|rsi_ble_event_remote_features|contains the remote device supported features. Please refer [rsi_ble_event_remote_features_s](rsi-ble-event-remote-features-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when remote conn params request is received <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_remote_features_t (heading level 8)

`void(* rsi_ble_on_remote_features_t)(rsi_ble_event_remote_features_t *rsi_ble_event_remote_features)`

**Description:**

Callback function to peer device supported features.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_remote_features|contains the remote device supported features. Please refer [rsi_ble_event_remote_features_s](rsi-ble-event-remote-features-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when conn update complete event is received <br />
This callback has to be registered using rsi_ble_gap_extended_register_callbacks API

###### rsi_ble_on_le_more_data_req_t (heading level 8)

`void(* rsi_ble_on_le_more_data_req_t)(rsi_ble_event_le_dev_buf_ind_t *rsi_ble_more_data_evt)`

**Description:**

Callback function to le more data request.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_more_data_evt|contains the LE Device Buffer Indication information. Please refer [rsi_ble_event_le_dev_buf_ind_s](rsi-ble-event-le-dev-buf-ind-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when le more data event is received <br />
This callback has to be registered using rsi_ble_gap_extended_register_callbacks API

###### rsi_ble_on_data_length_update_t (heading level 8)

`void(* rsi_ble_on_data_length_update_t)(rsi_ble_event_data_length_update_t *remote_dev_address)`

**Description:**

This event is raised when data length is update in controller.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|remote_dev_address|contains the controller support tx and rx length information. Please refer [rsi_ble_event_data_length_update_s](rsi-ble-event-data-length-update-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when data length update complete event is received <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_directed_adv_report_event_t (heading level 8)

`void(* rsi_ble_on_directed_adv_report_event_t)(rsi_ble_event_directedadv_report_t *rsi_ble_event_directed)`

**Description:**

The callback function will be called if directed advertise report event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|rsi_ble_event_directedcontains|the advertise report information|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the advertise event report is received from the module <br />
This callback has to be registered using rsi_ble_gap_register_callbacks API

###### rsi_ble_on_gatt_error_resp_t (heading level 8)

`void(* rsi_ble_on_gatt_error_resp_t)(uint16_t event_status, rsi_ble_event_error_resp_t *rsi_ble_gatt_error)`

**Description:**

The callback function will be called if gatt error event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the gatt error information. Please refer [rsi_ble_event_error_resp_s](rsi-ble-event-error-resp-s) for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A06 - Request not supported <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A02 - Read not permitted <br />  
   0x4A03 - Write not permitted <br />  
   0x4A07 - Invalid offset <br />  
   0x4A0B - Attribute not Long <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the gatt error event is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_gatt_desc_val_event_t (heading level 8)

`void(* rsi_ble_on_gatt_desc_val_event_t)(uint16_t event_status, rsi_ble_event_gatt_desc_t *rsi_ble_gatt_desc_val)`

**Description:**

The callback function will be called if attribute descriptors event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_gatt_desc_val|contains the profiles list event information. Please refer [rsi_ble_event_gatt_desc_s](rsi-ble-event-gatt-desc-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the attribute descriptors event is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_profiles_list_t (heading level 8)

`void(* rsi_ble_on_event_profiles_list_t)(uint16_t event_status, rsi_ble_event_profiles_list_t *rsi_ble_event_profiles)`

**Description:**

The callback function will be called if profiles list event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_profiles|contains the profiles list event information. Please refer [rsi_ble_event_profiles_list_s](rsi-ble-event-profiles-list-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the profiles list response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_profile_by_uuid_t (heading level 8)

`void(* rsi_ble_on_event_profile_by_uuid_t)(uint16_t event_status, rsi_ble_event_profile_by_uuid_t *rsi_ble_event_profile)`

**Description:**

The callback function will be called if profile event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_profile|contains the profile response information. Please refer [rsi_ble_event_profile_by_uuid_s](rsi-ble-event-profile-by-uuid-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the profile response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_read_by_char_services_t (heading level 8)

`void(* rsi_ble_on_event_read_by_char_services_t)(uint16_t event_status, rsi_ble_event_read_by_type1_t *rsi_ble_event_read_type1)`

**Description:**

The callback function will be called if characteristic services list event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_read_type1|contains the char services event information. Please refer [rsi_ble_event_read_by_type1_s](rsi-ble-event-read-by-type1-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the characteristic services list response is received from the module <br />
 This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_read_by_inc_services_t (heading level 8)

`void(* rsi_ble_on_event_read_by_inc_services_t)(uint16_t event_status, rsi_ble_event_read_by_type2_t *rsi_ble_event_read_type2)`

**Description:**

The callback function will be called if include services list event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_read_type2|contains the inc services information. Please refer [rsi_ble_event_read_by_type2_s](rsi-ble-event-read-by-type2-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the include services list response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_read_att_value_t (heading level 8)

`void(* rsi_ble_on_event_read_att_value_t)(uint16_t event_status, rsi_ble_event_read_by_type3_t *rsi_ble_event_read_type3)`

**Description:**

The callback function will be called if attribute value event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_read_type3|contains the char services event information. Please refer [rsi_ble_event_read_by_type3_s](rsi-ble-event-read-by-type3-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the attribute value response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_read_resp_t (heading level 8)

`void(* rsi_ble_on_event_read_resp_t)(uint16_t event_status, rsi_ble_event_att_value_t *rsi_ble_event_att_val)`

**Description:**

The callback function will be called if attribute value event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_att_val|contains the profile response information. Please refer [rsi_ble_event_att_value_s](rsi-ble-event-att-value-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the attribute value is received from the module <br />
 This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_write_resp_t (heading level 8)

`void(* rsi_ble_on_event_write_resp_t)(uint16_t event_status, rsi_ble_set_att_resp_t *rsi_ble_event_set_att_rsp)`

**Description:**

The callback function will be called if gatt write event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_set_att_rsp|contains the profile response information. Please refer rsi_ble_set_att_resp_t for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the gatt write response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_indicate_confirmation_t (heading level 8)

`void(* rsi_ble_on_event_indicate_confirmation_t)(uint16_t event_status, rsi_ble_set_att_resp_t *rsi_ble_event_set_att_rsp)`

**Description:**

The callback function will be called if indication confirmation event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_set_att_rsp|contains the profile response information. Please refer [rsi_ble_set_att_resp_s](rsi-ble-set-att-resp-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the indication confirmation response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_event_prepare_write_resp_t (heading level 8)

`void(* rsi_ble_on_event_prepare_write_resp_t)(uint16_t event_status, rsi_ble_prepare_write_resp_t *rsi_ble_event_prepare_write)`

**Description:**

The callback function will be called if GATT prepare event is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_status|contains the response status <br /><br/> 0 - Success <br /><br/> Non-Zero Value - Failure <br />|
||[out]|rsi_ble_event_prepare_write|contains the char services event information. Please refer [rsi_ble_prepare_write_resp_s](rsi-ble-prepare-write-resp-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the GATT prepare response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_profiles_list_resp_t (heading level 8)

`void(* rsi_ble_on_profiles_list_resp_t)(uint16_t resp_status, rsi_ble_resp_profiles_list_t *rsi_ble_resp_profiles)`

**Description:**

The callback function will be called if profiles list response is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the profiles list response information. Please refer [rsi_ble_resp_profiles_list_s](rsi-ble-resp-profiles-list-s) for more info.|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A0A - Attribute not found <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the profiles list response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_profile_resp_t (heading level 8)

`void(* rsi_ble_on_profile_resp_t)(uint16_t resp_status, profile_descriptors_t *rsi_ble_resp_profile)`

**Description:**

The callback function will be called if profile response is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the profile response information. Please refer profile_descriptors_s for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A06 - Request not supported <br />  
   0x4A0A - Attribute not found <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the profile response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_char_services_resp_t (heading level 8)

`void(* rsi_ble_on_char_services_resp_t)(uint16_t resp_status, rsi_ble_resp_char_services_t *rsi_ble_resp_char_serv)`

**Description:**

The callback function will be called if service characteristics response is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the service characteristics response information. Please refer rsi_ble_resp_char_services_s for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A06 - Request not supported <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A02 - Read not permitted <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the service characteristics response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_inc_services_resp_t (heading level 8)

`void(* rsi_ble_on_inc_services_resp_t)(uint16_t resp_status, rsi_ble_resp_inc_services_t *rsi_ble_resp_inc_serv)`

**Description:**

The callback function will be called if include services response is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the include services response information. Please refer rsi_ble_resp_inc_services_s for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A06 - Request not supported <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A02 - Read not permitted <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the include service response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_att_desc_resp_t (heading level 8)

`void(* rsi_ble_on_att_desc_resp_t)(uint16_t resp_status, rsi_ble_resp_att_descs_t *rsi_ble_resp_att_desc)`

**Description:**

The callback function will be called if attribute descriptors response is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the attribute descriptors response information. Please refer [rsi_ble_resp_att_descs_s](rsi-ble-resp-att-descs-s) for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A02 - Read not permitted <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the attribute descriptors response is received from the module <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_read_resp_t (heading level 8)

`void(* rsi_ble_on_read_resp_t)(uint16_t resp_status, uint16_t resp_id, rsi_ble_resp_att_value_t *rsi_ble_resp_att_val)`

**Description:**

The callback function will be called upon receiving the attribute value.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response id because of which, this callback is called response ids: (RSI_BLE_RSP_READ_VAL, RSI_BLE_RSP_READ_BY_UUID, RSI_BLE_RSP_LONG_READ, RSI_BLE_RSP_MULTIPLE_READ)|
||[out]|rsi_ble_resp_att_val|contains the attribute value. Please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) for more info|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A02 - Read not permitted <br />  
   0x4A06 - Request not supported <br />  
   0x4A07 - Invalid offset <br />  
   0x4A0B - Attribute not Long <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called upon receiving the attribute value <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_write_resp_t (heading level 8)

`void(* rsi_ble_on_write_resp_t)(uint16_t resp_status, uint16_t resp_id)`

**Description:**

The callback function will be called if the attribute set/prepare/execute action is completed.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|resp_status|contains the response id because of which, this callback is called response ids: (RSI_BLE_RSP_WRITE, RSI_BLE_RSP_WRITE_NO_ACK, RSI_BLE_RSP_LONG_WRITE, RSI_BLE_RSP_EXECUTE_WRITE)|

**Details:**

**Note**

- Attribute protocol error codes <br />  
   0x4A01 - Invalid Handle <br />  
   0x4A0A - Attribute not found <br />  
   0x4A05 - Insufficient authentication <br />  
   0x4A08 - Insufficient authorization <br />  
   0x4A0C - Insufficient encryption key size <br />  
   0x4A0F - Insufficient encryption <br />  
   0x4A03 - Write not permitted <br />  
   0x4A07 - Invalid offset <br />  
   0x4A0D - Invalid attribute value length <br />

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the attribute set/prepare/execute action is completed <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_gatt_write_event_t (heading level 8)

`void(* rsi_ble_on_gatt_write_event_t)(uint16_t event_id, rsi_ble_event_write_t *rsi_ble_write)`

**Description:**

The callback function will be called if the GATT write/notify/indicate events are received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_id|contains the gatt_write event id (RSI_BLE_EVENT_GATT_WRITE) <br />|
||[out]|rsi_ble_write|contains the GATT event information. Please refer [rsi_ble_event_write_s](rsi-ble-event-write-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the GATT write/notify/indicate events are received <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_gatt_prepare_write_event_t (heading level 8)

`void(* rsi_ble_on_gatt_prepare_write_event_t)(uint16_t event_id, rsi_ble_event_prepare_write_t *rsi_ble_write)`

**Description:**

The callback function will be called if the GATT prepare events are received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_id|contains the gatt_prepare_write event id (RSI_BLE_EVENT_PREPARE_WRITE) <br />|
||[out]|rsi_ble_write|contains the GATT prepare event information. Please refer [rsi_ble_event_prepare_write_s](rsi-ble-event-prepare-write-s) for more info|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the GATT prepare event is received <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_execute_write_event_t (heading level 8)

`void(* rsi_ble_on_execute_write_event_t)(uint16_t event_id, rsi_ble_execute_write_t *rsi_ble_execute_write)`

**Description:**

The callback function will be called if the GATT execute events are received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_id|contains the gatt_execute_write event id (RSI_BLE_EVENT_EXECUTE_WRITE) <br />|
||[out]|rsi_ble_write|contains the GATT event information. Please refer [rsi_ble_execute_write_s](rsi-ble-execute-write-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the GATT execute event is received <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_read_req_event_t (heading level 8)

`void(* rsi_ble_on_read_req_event_t)(uint16_t event_id, rsi_ble_read_req_t *rsi_ble_read_req)`

**Description:**

The callback function will be called if the GATT read request events are received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|event_id|contains the gatt_read_req_event id (RSI_BLE_EVENT_READ_REQ) <br />|
||[out]|rsi_ble_write|contains the GATT event information. Please refer [rsi_ble_read_req_s](rsi-ble-read-req-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called if the GATT read request event is received <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_mtu_event_t (heading level 8)

`void(* rsi_ble_on_mtu_event_t)(rsi_ble_event_mtu_t *rsi_ble_event_mtu)`

**Description:**

The callback function will be called if MTU size request is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_mtu|contains the MTU size information. Please refer [rsi_ble_event_mtu_s](rsi-ble-event-mtu-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when connected to indicate MTU size <br />
This callback has to be registered using rsi_ble_gatt_register_callbacks API

###### rsi_ble_on_mtu_exchange_info_t (heading level 8)

`void(* rsi_ble_on_mtu_exchange_info_t)(rsi_ble_event_mtu_exchange_information_t *rsi_ble_event_mtu_exchange_info)`

**Description:**

Callback function to indicate MTU size and who initated MTU Exchange Request.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[out]|rsi_ble_event_mtu_exchange_info|contains the MTU exchange information. Please refer [rsi_ble_event_mtu_exchange_information_s](rsi-ble-event-mtu-exchange-information-s) for more info.|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when connected, this event will contain MTU Exchange Information <br />
This callback has to be registered using rsi_ble_gatt_extended_register_callbacks API

###### rsi_ble_on_remote_device_info_t (heading level 8)

`void(* rsi_ble_on_remote_device_info_t)(uint16_t status, rsi_ble_event_remote_device_info_t *resp_buffer)`

**Description:**

Callback function to get peer device information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|status|- status of the asynchronous response|
||[out]|resp_buffer|- remote device ble version information. Please refer [rsi_ble_event_remote_device_info_s](rsi-ble-event-remote-device-info-s) for more info. <br />|

**Details:**

**Returns**

- void

###### description (heading level 7)

This callback function will be called when conn update complete event is received <br />
This callback has to be registered using rsi_ble_enhanced_gap_extended_register_callbacks API <br />

###### rsi_ble_on_rcp_resp_rcvd_t (heading level 8)

`typedef void(* rsi_ble_on_rcp_resp_rcvd_t) (uint16_t status, rsi_ble_event_rcp_rcvd_info_t *resp_buffer)`

###### GATT

###### Modules (heading level 7)

[GATT Client](bt-low-energy3)

[GATT Client Asynchronous](bt-low-energy4)

[GATT Server](bt-low-energy5)

###### GATT Client (heading level 7)

###### Functions (heading level 8)

###### rsi_ble_get_profiles (heading level 9)

`nt32_t rsi_ble_get_profiles(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_profiles_list_t *p_prof_list)`

**Description:** Get the supported profiles / services of the connected remote device. [rsi_ble_on_profiles_list_resp_t](bt-low-energy8#rsi-ble-on-profiles-list-resp-t) callback function will be called after the profiles list response is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_profiles_list_resp_t](bt-low-energy8#rsi-ble-on-profiles-list-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_profiles_list_t](rsi-ble-resp-profiles-list-s) *|[out]|p_prof_list|- profiles/services information will be filled in this structure after retrieving from the remote device, please refer [rsi_ble_resp_profiles_list_s](rsi-ble-resp-profiles-list-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_profiles_list_s::dev_addr](rsi-ble-req-profiles-list-s#dev-addr), [rsi_ble_req_profiles_list_s::end_handle](rsi-ble-req-profiles-list-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_profiles_list_s::start_handle](rsi-ble-req-profiles-list-s#start-handle)

###### rsi_ble_get_profile (heading level 9)

`int32_t rsi_ble_get_profile(uint8_t *dev_addr, uuid_t profile_uuid, profile_descriptors_t *p_profile)`

**Description:** Get the specific profile / service of the connected remote device. [rsi_ble_on_profile_resp_t](bt-low-energy8#rsi-ble-on-profile-resp-t) callback function is called after the service characteristics response is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_profile_resp_t](bt-low-energy8#rsi-ble-on-profile-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|[uuid_t](uuid-s)|[in]|profile_uuid|- services/profiles which are searched using profile_uuid <br />|
|[profile_descriptors_t](profile-descriptor-s) *|[out]|p_profile|- profile / service information filled in this structure after retrieving from the remote device, please refer [profile_descriptor_s](profile-descriptor-s) structure for more info. <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_profile_s::dev_addr](rsi-ble-req-profile-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_req_profile_s::profile_uuid](rsi-ble-req-profile-s#profile-uuid), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_char_services (heading level 9)

`int32_t rsi_ble_get_char_services(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_char_services_t *p_char_serv_list)`

**Description:** Get the service characteristic services of the connected / remote device. [rsi_ble_on_char_services_resp_t](bt-low-energy8#rsi-ble-on-char-services-resp-t) callback function is called after the characteristic service response is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_char_services_resp_t](bt-low-energy8#rsi-ble-on-char-services-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_char_services_t](rsi-ble-resp-char-serv-s) *|[out]|p_char_serv_list|- service characteristics details are filled in this structure, please refer [rsi_ble_resp_char_serv_s](rsi-ble-resp-char-serv-s) structure for more info. <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_char_services_s::dev_addr](rsi-ble-req-char-services-s#dev-addr), [rsi_ble_req_char_services_s::end_handle](rsi-ble-req-char-services-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_char_services_s::start_handle](rsi-ble-req-char-services-s#start-handle)

###### rsi_ble_get_inc_services (heading level 9)

`int32_t rsi_ble_get_inc_services(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_inc_services_t *p_inc_serv_list)`

**Description:** Get the supported include services of the connected / remote device. [rsi_ble_on_inc_services_resp_t](bt-low-energy8#rsi-ble-on-inc-services-resp-t) callback function is called after the include service response is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_inc_services_resp_t](bt-low-energy8#rsi-ble-on-inc-services-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_inc_services_t](rsi-ble-resp-inc-serv) *|[out]|p_inc_serv_list|- include service characteristics details are filled in this structure, please refer [rsi_ble_resp_inc_serv](rsi-ble-resp-inc-serv) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_inc_services_s::dev_addr](rsi-ble-req-inc-services-s#dev-addr), [rsi_ble_req_inc_services_s::end_handle](rsi-ble-req-inc-services-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_inc_services_s::start_handle](rsi-ble-req-inc-services-s#start-handle)

###### rsi_ble_get_char_value_by_uuid (heading level 9)

`int32_t rsi_ble_get_char_value_by_uuid(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, uuid_t char_uuid, rsi_ble_resp_att_value_t *p_char_val)`

**Description:** Get the characteristic value by UUID (char_uuid). [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[uuid_t](uuid-s)|[in]|char_uuid|- UUID of the characteristic|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_char_val|- characteristic value is filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If the return value is less than 0 <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_char_val_by_uuid_s::char_uuid](rsi-ble-req-char-val-by-uuid-s#char-uuid), [rsi_ble_req_char_val_by_uuid_s::dev_addr](rsi-ble-req-char-val-by-uuid-s#dev-addr), [rsi_ble_req_char_val_by_uuid_s::end_handle](rsi-ble-req-char-val-by-uuid-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_char_val_by_uuid_s::start_handle](rsi-ble-req-char-val-by-uuid-s#start-handle)

###### rsi_ble_get_att_descriptors (heading level 9)

`int32_t rsi_ble_get_att_descriptors(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_att_descs_t *p_att_desc)`

**Description:** Get the characteristic descriptors list from the remote device. [rsi_ble_on_att_desc_resp_t](bt-low-energy8#rsi-ble-on-att-desc-resp-t) callback function is called after the attribute descriptors response is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_att_desc_resp_t](bt-low-energy8#rsi-ble-on-att-desc-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_att_descs_t](rsi-ble-resp-att-descs-s) *|[out]|p_att_desc|- pointer to characteristic descriptor structure, Please refer [rsi_ble_resp_att_descs_s](rsi-ble-resp-att-descs-s) strcuture for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_att_descs_s::dev_addr](rsi-ble-req-att-descs-s#dev-addr), [rsi_ble_req_att_descs_s::end_handle](rsi-ble-req-att-descs-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_att_descs_s::start_handle](rsi-ble-req-att-descs-s#start-handle)

###### rsi_ble_get_att_value (heading level 9)

`int32_t rsi_ble_get_att_value(uint8_t *dev_addr, uint16_t handle, rsi_ble_resp_att_value_t *p_att_val)`

**Description:** Get the attribute by handle. [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) callback function is called upon receiving the attribute value. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- handle value of the attribute|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_val|- attribute value is filled in this structure, Please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_att_value_s::dev_addr](rsi-ble-req-att-value-s#dev-addr), [rsi_ble_req_att_value_s::handle](rsi-ble-req-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_multiple_att_values (heading level 9)

`int32_t rsi_ble_get_multiple_att_values(uint8_t *dev_addr, uint8_t num_of_handlers, uint16_t *handles, rsi_ble_resp_att_value_t *p_att_vals)`

**Description:** Get the multiple attribute values by using multiple handles. [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|num_of_handlers|- number of handles in the list|
|uint16_t *|[in]|handles|- list of attribute handles|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_vals|- attribute values filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_multiple_att_val_s::dev_addr](rsi-ble-req-multiple-att-val-s#dev-addr), [rsi_ble_req_multiple_att_val_s::handles](rsi-ble-req-multiple-att-val-s#handles), [memcpy](bt-classic1#memcpy), [rsi_ble_req_multiple_att_val_s::num_of_handles](rsi-ble-req-multiple-att-val-s#num-of-handles), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_long_att_value (heading level 9)

`int32_t rsi_ble_get_long_att_value(uint8_t *dev_addr, uint16_t handle, uint16_t offset, rsi_ble_resp_att_value_t *p_att_vals)`

**Description:** Get the long attribute value by using handle and offset. [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_read_resp_t](bt-low-energy8#rsi-ble-on-read-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint16_t|[in]|offset|- offset within the attribute value|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_vals|- attribute value filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_long_att_value_s::dev_addr](rsi-ble-req-long-att-value-s#dev-addr), [rsi_ble_req_long_att_value_s::handle](rsi-ble-req-long-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ble_req_long_att_value_s::offset](rsi-ble-req-long-att-value-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_att_value (heading level 9)

`int32_t rsi_ble_set_att_value(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, uint8_t *p_data)`

**Description:** Set the attribute value of the remote device. [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) callback function is called if the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute value handle|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_att_val_s::att_value](rsi-ble-set-att-val-s#att-value), [rsi_ble_set_att_val_s::dev_addr](rsi-ble-set-att-val-s#dev-addr), [rsi_ble_set_att_val_s::handle](rsi-ble-set-att-val-s#handle), [rsi_ble_set_att_val_s::length](rsi-ble-set-att-val-s#length), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_att_cmd (heading level 9)

`int32_t rsi_ble_set_att_cmd(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, uint8_t *p_data)`

**Description:** Set the attribute value without waiting for an ACK from the remote device. This is a Blocking API. If the API returns RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait untill the [rsi_ble_on_le_more_data_req_t](bt-low-energy8#rsi-ble-on-le-more-data-req-t) event gets received from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute value handle|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />  
   0x4E65 - Invalid Attribute Length When Small Buffer Mode is Configured <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_att_cmd_s::att_value](rsi-ble-set-att-cmd-s#att-value), [rsi_ble_set_att_cmd_s::dev_addr](rsi-ble-set-att-cmd-s#dev-addr), [rsi_ble_set_att_cmd_s::handle](rsi-ble-set-att-cmd-s#handle), [rsi_ble_set_att_cmd_s::length](rsi-ble-set-att-cmd-s#length), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_long_att_value (heading level 9)

`int32_t rsi_ble_set_long_att_value(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, uint8_t *p_data)`

**Description:** Set the long attribute value of the remote device. [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) callback function is called after the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint16_t|[in]|offset|- attribute value offset|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_long_att_val_s::att_value](rsi-ble-set-long-att-val-s#att-value), [rsi_ble_set_long_att_val_s::dev_addr](rsi-ble-set-long-att-val-s#dev-addr), [rsi_ble_set_long_att_val_s::handle](rsi-ble-set-long-att-val-s#handle), [rsi_ble_set_long_att_val_s::length](rsi-ble-set-long-att-val-s#length), [memcpy](bt-classic1#memcpy), [rsi_ble_set_long_att_val_s::offset](rsi-ble-set-long-att-val-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_prepare_write (heading level 9)

`int32_t rsi_ble_prepare_write(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, uint8_t *p_data)`

**Description:** Prepare the attribute value. [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) callback function is called after the prepare attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint16_t|[in]|offset|- attribute value offset|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_prepare_write_s::att_value](rsi-ble-req-prepare-write-s#att-value), [rsi_ble_req_prepare_write_s::dev_addr](rsi-ble-req-prepare-write-s#dev-addr), [rsi_ble_req_prepare_write_s::handle](rsi-ble-req-prepare-write-s#handle), [rsi_ble_req_prepare_write_s::length](rsi-ble-req-prepare-write-s#length), [memcpy](bt-classic1#memcpy), [rsi_ble_req_prepare_write_s::offset](rsi-ble-req-prepare-write-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_execute_write (heading level 9)

`int32_t rsi_ble_execute_write(uint8_t *dev_addr, uint8_t exe_flag)`

**Description:** Execute the prepared attribute values. [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) callback function is called after the execute attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback [rsi_ble_on_write_resp_t](bt-low-energy8#rsi-ble-on-write-resp-t) is received from the device, to initiate further attribute related transactions on this remote device address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|exe_flag|- execute flag to write, possible values mentioned below<br /><br/> 0 - BLE_ATT_EXECUTE_WRITE_CANCEL <br /><br/> 1 - BLE_ATT_EXECUTE_PENDING_WRITES_IMMEDIATELY <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_execute_write_s::dev_addr](rsi-ble-req-execute-write-s#dev-addr), [rsi_ble_req_execute_write_s::flag](rsi-ble-req-execute-write-s#flag), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_mtu_exchange_event (heading level 9)

`int32_t rsi_ble_mtu_exchange_event(uint8_t *dev_addr, uint8_t mtu_size)`

**Description:** Initiates the MTU exchange request with the remote device. <br />
 This is a Blocking API and will recive a callback event [rsi_ble_on_mtu_event_t](bt-low-energy8#rsi-ble-on-mtu-event-t) as the response for this API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|mtu_size|- requested MTU value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4D04 - BLE not Connected <br />  
   0x4E62 - Invalid Parameters <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_mtu_exchange_s::dev_addr](rsi-ble-mtu-exchange-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_mtu_exchange_s::req_mtu_size](rsi-ble-mtu-exchange-s#req-mtu-size), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_mtu_exchange_resp (heading level 9)

`int32_t rsi_ble_mtu_exchange_resp(uint8_t *dev_addr, uint8_t mtu_size)`

**Description:** This function (Exchange MTU Response) is sent in reply to a received Exchange MTU Request.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- Remote Device Address|
|uint8_t|[in]|mtu_size|- requested MTU value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   0x4D0C - When RSI_BLE_MTU_EXCHANGE_FROM_HOST BIT is not SET. 0x4D05 - BLE Socket Not Available. Non-Zero Value - Failure Refer Error Codes section for above error codes [Error Codes](error-codes)

**References:** [rsi_ble_mtu_exchange_resp_s::dev_addr](rsi-ble-mtu-exchange-resp-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_mtu_exchange_resp_s::req_mtu_size](rsi-ble-mtu-exchange-resp-s#req-mtu-size), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev) and [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd)

###### GATT Client Asynchronous (heading level 7)

- 

###### Functions (heading level 8)

###### rsi_ble_get_profiles_async (heading level 9)

`int32_t rsi_ble_get_profiles_async(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_profiles_list_t *p_prof_list)`

**Description:** Get the supported profiles / services of the connected remote device asynchronously. [rsi_ble_on_event_profiles_list_t](bt-low-energy8#rsi-ble-on-event-profiles-list-t) callback function will be called after the profiles list event is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_profiles_list_t](bt-low-energy8#rsi-ble-on-event-profiles-list-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_profiles_list_t](rsi-ble-resp-profiles-list-s) *|[out]|p_prof_list|- profiles/services information will be filled in this structure after retrieving from the remote device, please refer [rsi_ble_resp_profiles_list_s](rsi-ble-resp-profiles-list-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_prof_list structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_profiles_list_s::dev_addr](rsi-ble-req-profiles-list-s#dev-addr), [rsi_ble_req_profiles_list_s::end_handle](rsi-ble-req-profiles-list-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_profiles_list_s::start_handle](rsi-ble-req-profiles-list-s#start-handle)

###### rsi_ble_get_profile_async (heading level 9)

`int32_t rsi_ble_get_profile_async(uint8_t *dev_addr, uuid_t profile_uuid, profile_descriptors_t *p_profile)`

**Description:** Get the specific profile / service of the connected remote device. rsi_ble_one_event_profile_by_uuid_t callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_one_event_profile_by_uuid_t or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|[uuid_t](uuid-s)|[in]|profile_uuid|- services/profiles which are searched using profile_uuid <br />|
|[profile_descriptors_t](profile-descriptor-s) *|[out]|p_profile|- profile / service information filled in this structure after retrieving from the remote device, please refer [profile_descriptor_s](profile-descriptor-s) structure for more info. <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_profile structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_profile_s::dev_addr](rsi-ble-req-profile-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ble_req_profile_s::profile_uuid](rsi-ble-req-profile-s#profile-uuid), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_char_services_async (heading level 9)

`rint32_t rsi_ble_get_char_services_async(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_char_services_t *p_char_serv_list)`

**Description:** Get the service characteristics of the connected / remote device. [rsi_ble_on_event_read_by_char_services_t](bt-low-energy8#rsi-ble-on-event-read-by-char-services-t) callback function is called after the included service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_by_char_services_t](bt-low-energy8#rsi-ble-on-event-read-by-char-services-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_char_services_t](rsi-ble-resp-char-serv-s) *|[out]|p_char_serv_list|- service characteristics details are filled in this structure, please refer [rsi_ble_resp_char_serv_s](rsi-ble-resp-char-serv-s) structure for more info. <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_char_services_list structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_char_services_s::dev_addr](rsi-ble-req-char-services-s#dev-addr), [rsi_ble_req_char_services_s::end_handle](rsi-ble-req-char-services-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_char_services_s::start_handle](rsi-ble-req-char-services-s#start-handle)

###### rsi_ble_get_inc_services_async (heading level 9)

`int32_t rsi_ble_get_inc_services_async(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_inc_services_t *p_inc_serv_list)`

**Description:** Get the supported include services of the connected / remote device. [rsi_ble_on_event_read_by_inc_services_t](bt-low-energy8#rsi-ble-on-event-read-by-inc-services-t) callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_by_inc_services_t](bt-low-energy8#rsi-ble-on-event-read-by-inc-services-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_inc_services_t](rsi-ble-resp-inc-serv) *|[out]|p_inc_serv_list|- include service characteristics details are filled in this structure, please refer [rsi_ble_resp_inc_serv](rsi-ble-resp-inc-serv) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_inc_serv_list structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_inc_services_s::dev_addr](rsi-ble-req-inc-services-s#dev-addr), [rsi_ble_req_inc_services_s::end_handle](rsi-ble-req-inc-services-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_inc_services_s::start_handle](rsi-ble-req-inc-services-s#start-handle)

###### rsi_ble_get_char_value_by_uuid_async (heading level 9)

`int32_t rsi_ble_get_char_value_by_uuid_async(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, uuid_t char_uuid, rsi_ble_resp_att_value_t *p_char_val)`

**Description:** Get the characteristic value by UUID (char_uuid). [rsi_ble_on_event_read_att_value_t](bt-low-energy8#rsi-ble-on-event-read-att-value-t) callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_att_value_t](bt-low-energy8#rsi-ble-on-event-read-att-value-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[uuid_t](uuid-s)|[in]|char_uuid|- UUID of the characteristic|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_char_val|- characteristic value is filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_char_value structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_char_val_by_uuid_s::char_uuid](rsi-ble-req-char-val-by-uuid-s#char-uuid), [rsi_ble_req_char_val_by_uuid_s::dev_addr](rsi-ble-req-char-val-by-uuid-s#dev-addr), [rsi_ble_req_char_val_by_uuid_s::end_handle](rsi-ble-req-char-val-by-uuid-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_char_val_by_uuid_s::start_handle](rsi-ble-req-char-val-by-uuid-s#start-handle)

###### rsi_ble_get_att_descriptors_async (heading level 9)

`int32_t rsi_ble_get_att_descriptors_async(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_att_descs_t *p_att_desc)`

**Description:** Get the characteristic descriptors list from the remote device. [rsi_ble_on_gatt_desc_val_event_t](bt-low-energy8#rsi-ble-on-gatt-desc-val-event-t) callback function is called after the attribute descriptors response is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_gatt_desc_val_event_t](bt-low-energy8#rsi-ble-on-gatt-desc-val-event-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|start_handle|- start handle (index) of the remote device's service records|
|uint16_t|[in]|end_handle|- end handle (index) of the remote device's service records|
|[rsi_ble_resp_att_descs_t](rsi-ble-resp-att-descs-s) *|[out]|p_att_desc|- pointer to characteristic descriptor structure, Please refer [rsi_ble_resp_att_descs_s](rsi-ble-resp-att-descs-s) strcuture for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_att_desc structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_att_descs_s::dev_addr](rsi-ble-req-att-descs-s#dev-addr), [rsi_ble_req_att_descs_s::end_handle](rsi-ble-req-att-descs-s#end-handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_req_att_descs_s::start_handle](rsi-ble-req-att-descs-s#start-handle)

###### rsi_ble_get_att_value_async (heading level 9)

`int32_t rsi_ble_get_att_value_async(uint8_t *dev_addr, uint16_t handle, rsi_ble_resp_att_value_t *p_att_val)`

**Description:** Get the attribute with a handle. [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) callback function is called upon receiving the attribute value. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- handle value of the attribute|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_val|- attribute value is filled in this structure, Please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_att_val structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_att_value_s::dev_addr](rsi-ble-req-att-value-s#dev-addr), [rsi_ble_req_att_value_s::handle](rsi-ble-req-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_multiple_att_values_async (heading level 9)

`int32_t rsi_ble_get_multiple_att_values_async(uint8_t *dev_addr, uint8_t num_of_handlers, uint16_t *handles, rsi_ble_resp_att_value_t *p_att_vals)`

**Description:** Get the multiple attribute values by using multiple handles. [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|num_of_handlers|- number of handles in the list|
|uint16_t *|[in]|handles|- list of attribute handles|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_vals|- attribute values filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_att_vals structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_multiple_att_val_s::dev_addr](rsi-ble-req-multiple-att-val-s#dev-addr), [rsi_ble_req_multiple_att_val_s::handles](rsi-ble-req-multiple-att-val-s#handles), [memcpy](bt-classic1#memcpy), [rsi_ble_req_multiple_att_val_s::num_of_handles](rsi-ble-req-multiple-att-val-s#num-of-handles), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_long_att_value_async (heading level 9)

`int32_t rsi_ble_get_long_att_value_async(uint8_t *dev_addr, uint16_t handle, uint16_t offset, rsi_ble_resp_att_value_t *p_att_vals)`

**Description:** Get the long attribute value by using handle and offset. [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_read_resp_t](bt-low-energy8#rsi-ble-on-event-read-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint16_t|[in]|offset|- offset within the attribute value|
|[rsi_ble_resp_att_value_t](rsi-ble-resp-att-value-s) *|[out]|p_att_vals|- attribute value filled in this structure, please refer [rsi_ble_resp_att_value_s](rsi-ble-resp-att-value-s) structure for more info.<br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Note**

- p_att_vals structure should be passed as NULL because nothing will be filled in this structure <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_long_att_value_s::dev_addr](rsi-ble-req-long-att-value-s#dev-addr), [rsi_ble_req_long_att_value_s::handle](rsi-ble-req-long-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ble_req_long_att_value_s::offset](rsi-ble-req-long-att-value-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_att_value_async (heading level 9)

`int32_t rsi_ble_set_att_value_async(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, uint8_t *p_data)`

**Description:** Set the attribute value of the remote device. [rsi_ble_on_event_write_resp_t](bt-low-energy8#rsi-ble-on-event-write-resp-t) callback function is called after the attribute set action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_write_resp_t](bt-low-energy8#rsi-ble-on-event-write-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute value handle|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_att_val_s::att_value](rsi-ble-set-att-val-s#att-value), [rsi_ble_set_att_val_s::dev_addr](rsi-ble-set-att-val-s#dev-addr), [rsi_ble_set_att_val_s::handle](rsi-ble-set-att-val-s#handle), [rsi_ble_set_att_val_s::length](rsi-ble-set-att-val-s#length), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_prepare_write_async (heading level 9)

`int32_t rsi_ble_prepare_write_async(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, uint8_t *p_data)`

**Description:** Prepare the attribute value. [rsi_ble_on_event_prepare_write_resp_t](bt-low-energy8#rsi-ble-on-event-prepare-write-resp-t) callback function is called after the prepare attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_prepare_write_resp_t](bt-low-energy8#rsi-ble-on-event-prepare-write-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint16_t|[in]|offset|- attribute value offset|
|uint8_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API

**Returns**

- 0 - Success <br />  
   0x4E60 - Invalid Handle range <br />  
   0x4E62 - Invalid Parameters <br />  
   0x4D04 - BLE not connected <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_prepare_write_s::att_value](rsi-ble-req-prepare-write-s#att-value), [rsi_ble_req_prepare_write_s::dev_addr](rsi-ble-req-prepare-write-s#dev-addr), [rsi_ble_req_prepare_write_s::handle](rsi-ble-req-prepare-write-s#handle), [rsi_ble_req_prepare_write_s::length](rsi-ble-req-prepare-write-s#length), [memcpy](bt-classic1#memcpy), [rsi_ble_req_prepare_write_s::offset](rsi-ble-req-prepare-write-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_execute_write_async (heading level 9)

`int32_t rsi_ble_execute_write_async(uint8_t *dev_addr, uint8_t exe_flag)`

**Description:** Execute the prepared attribute values. [rsi_ble_on_event_write_resp_t](bt-low-energy8#rsi-ble-on-event-write-resp-t) callback function is called after the execute attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_write_resp_t](bt-low-energy8#rsi-ble-on-event-write-resp-t) or [rsi_ble_on_gatt_error_resp_t](bt-low-energy8#rsi-ble-on-gatt-error-resp-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|exe_flag|- execute flag to write, possible values mentioned below<br /><br/> 0 - BLE_ATT_EXECUTE_WRITE_CANCEL <br /><br/> 1 - BLE_ATT_EXECUTE_PENDING_WRITES_IMMEDIATELY <br />|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 - BLE Socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_req_execute_write_s::dev_addr](rsi-ble-req-execute-write-s#dev-addr), [rsi_ble_req_execute_write_s::flag](rsi-ble-req-execute-write-s#flag), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_indicate_value_sync (heading level 9)

`int32_t rsi_ble_indicate_value_sync(uint8_t *dev_addr, uint16_t handle, uint16_t data_len, uint8_t *p_data)`

**Description:** Indicate the local value to the remote device. This is a blocking API. <br />
 This will not send any confirmation event to the application instead <br />
 send the status as success on receiving confirmation from remote side.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- local attribute handle|
|uint16_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 - BLE socket not available <br />  
   0x4E60 - Invalid Handle Range <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_notify_att_value_s::data](rsi-ble-notify-att-value-s#data), [rsi_ble_notify_att_value_s::data_len](rsi-ble-notify-att-value-s#data-len), [rsi_ble_notify_att_value_s::dev_addr](rsi-ble-notify-att-value-s#dev-addr), [rsi_ble_notify_att_value_s::handle](rsi-ble-notify-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_indicate_confirm (heading level 9)

`int32_t rsi_ble_indicate_confirm(uint8_t *dev_addr)`

**Description:** Send indicate confirmation to the remote device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4D05 - BLE socket not available <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_indicate_confirm_s::dev_addr](rsi-ble-indicate-confirm-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### GATT Server (heading level 7)

###### Functions (heading level 8)

###### rsi_ble_add_service (heading level 9)

`int32_t rsi_ble_add_service(uuid_t service_uuid, rsi_ble_resp_add_serv_t *p_resp_serv)`

**Description:** Add a new service to the local GATT Server. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[uuid_t](uuid-s)|[in]|service_uuid|- new service UUID value, please refer [uuid_s](uuid-s) structure for more info.|
|[rsi_ble_resp_add_serv_t](rsi-ble-resp-add-serv-s) *|[out]|p_resp_serv|- new service handler filled in this structure, please refer [rsi_ble_resp_add_serv_s](rsi-ble-resp-add-serv-s) structure for more info.|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - Invalid Arguments <br />  
   0x4D08 - Profile record full <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_req_add_serv_s::service_uuid](rsi-ble-req-add-serv-s#service-uuid) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_add_attribute (heading level 9)

`int32_t rsi_ble_add_attribute(rsi_ble_req_add_att_t *p_attribute)`

**Description:** Add a new attribute to a specific service. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_req_add_att_t](rsi-ble-req-add-att-s) *|[in]|p_attribute|- add a new attribute to the service, please refer [rsi_ble_req_add_att_s](rsi-ble-req-add-att-s) structure for more info. <br />|

- Call [rsi_wireless_init()](common#rsi-wireless-init) before calling this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - Invalid Arguments <br />  
   0x4D09 - Attribute record full <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_local_att_value (heading level 9)

`int32_t rsi_ble_set_local_att_value(uint16_t handle, uint16_t data_len, uint8_t *p_data)`

**Description:** Change the local attribute value. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|handle|- attribute value handle|
|uint16_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - Invalid Arguments <br />  
   0x4D06 - Attribute record not found <br />  
   0x4E60 - Invalid Handle Range <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .
- This API can only be used if the service is maintained inside the firmware. <br />  
   The services which are maintained by firmware must follow the below rules. <br />  
   Rule 1: The attribute_data_size is less than 20 bytes during the service_creation <br />  
   Rule 2: while creating the service, don't use the RSI_BLE_ATT_MAINTAIN_IN_HOST bit <br />  
   in the RSI_BLE_ATT_CONFIG_BITMAP macro. <br />  
   Rule 3: The data_len must be less than or equal to the dat_length mentioned while <br />  
   creating the service/attribute <br />  
   Rule 4: If the services are maintained in the Application/Host,<br />  
   then need to use [rsi_ble_notify_value()](bt-low-energy5#rsi-ble-notify-value) API to send the notifications to the remote devices.<br />

**References:** [rsi_ble_set_local_att_value_s::data](rsi-ble-set-local-att-value-s#data), [rsi_ble_set_local_att_value_s::data_len](rsi-ble-set-local-att-value-s#data-len), [rsi_ble_set_local_att_value_s::handle](rsi-ble-set-local-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_set_wo_resp_notify_buf_info (heading level 9)

`int32_t rsi_ble_set_wo_resp_notify_buf_info(uint8_t *dev_addr, uint8_t buf_mode, uint8_t buf_cnt)`

**Description:** Configure the buf mode for Notify and WO response commands for the remote device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|buf_mode|- buffer mode configuration<br /><br/> 0 - BLE_SMALL_BUFF_MODE <br /><br/> 1 - BLE_BIG_BUFF_MODE <br />|
|uint8_t|[in]|buf_cnt|- no of buffers to be configured <br /><br/> only value 1 and 2 are supporetd in BLE_SMALL_BUFF_MODE <br /><br/> in BLE_BIG_BUFF_MODE, buffers allocated based on the below notations. intial available_buf_cnt = RSI_BLE_NUM_CONN_EVENTS, a) When connection 1 is formed, the possible range of buffers is (available_buf_cnt - remaining possible no.connections) b) After allocating X buffers using [rsi_ble_set_wo_resp_notify_buf_info](bt-low-energy5#rsi-ble-set-wo-resp-notify-buf-info) to the 1st connection remaiining available_buf_cnt = (available_buf_cnt - X ) <br />|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4046 - Invalid Arguments <br />  
   0x4D05 - BLE socket not available <br />  
   0x4D06 - Attribute record not found <br />  
   0x4E60 - Invalid Handle Range <br />  
   0x4E63 - BLE Buffer Count Exceeded <br />  
   0x4E64 - BLE Buffer already in use <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes) .

**References:** [rsi_ble_set_wo_resp_notify_buf_info_s::buf_count](rsi-ble-set-wo-resp-notify-buf-info-s#buf-count), [rsi_ble_set_wo_resp_notify_buf_info_s::buf_mode](rsi-ble-set-wo-resp-notify-buf-info-s#buf-mode), [rsi_ble_set_wo_resp_notify_buf_info_s::dev_addr](rsi-ble-set-wo-resp-notify-buf-info-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_notify_value (heading level 9)

`int32_t rsi_ble_notify_value(uint8_t *dev_addr, uint16_t handle, uint16_t data_len, uint8_t *p_data)`

**Description:** Notify the local value to the remote device. This is a Blocking API. If the API returns RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait untill the [rsi_ble_on_le_more_data_req_t](bt-low-energy8#rsi-ble-on-le-more-data-req-t) event gets received from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- local attribute handle|
|uint16_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - Invalid Arguments <br />  
   0x4A0D - Invalid attribute value length <br />  
   0x4D05 - BLE socket not available <br />  
   0x4D06 - Attribute record not found <br />  
   0x4E60 - Invalid Handle Range <br />  
   0x4E65 - Invalid Attribute Length When Small Buffer Mode is Configured <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />
- If the services are maintained in the Application/Host,<br />  
   then need to use [rsi_ble_notify_value()](bt-low-energy5#rsi-ble-notify-value) API instead of using [rsi_ble_set_local_att_value()](bt-low-energy5#rsi-ble-set-local-att-value) API<br />  
   to send the notifications to the remote devices.

**References:** [rsi_ble_notify_att_value_s::data](rsi-ble-notify-att-value-s#data), [rsi_ble_notify_att_value_s::data_len](rsi-ble-notify-att-value-s#data-len), [rsi_ble_notify_att_value_s::dev_addr](rsi-ble-notify-att-value-s#dev-addr), [rsi_ble_notify_att_value_s::handle](rsi-ble-notify-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_indicate_value (heading level 9)

`int32_t rsi_ble_indicate_value(uint8_t *dev_addr, uint16_t handle, uint16_t data_len, uint8_t *p_data)`

**Description:** Indicate the local value to the remote device. This is a blocking API and can unblock the application on the reception of the callback functions either [rsi_ble_on_event_indicate_confirmation_t](bt-low-energy8#rsi-ble-on-event-indicate-confirmation-t).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- local attribute handle|
|uint16_t|[in]|data_len|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D05 - BLE socket not available <br />  
   0x4E60 - Invalid Handle Range <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_notify_att_value_s::data](rsi-ble-notify-att-value-s#data), [rsi_ble_notify_att_value_s::data_len](rsi-ble-notify-att-value-s#data-len), [rsi_ble_notify_att_value_s::dev_addr](rsi-ble-notify-att-value-s#dev-addr), [rsi_ble_notify_att_value_s::handle](rsi-ble-notify-att-value-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_get_local_att_value (heading level 9)

`int32_t rsi_ble_get_local_att_value(uint16_t handle, rsi_ble_resp_local_att_value_t *p_resp_local_att_val)`

**Description:** Get the local attribute value. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|handle|- local attribute handle|
|[rsi_ble_resp_local_att_value_t](rsi-ble-resp-local-att-value-s) *|[out]|p_resp_local_att_val|- local attribute value filled in this structure, plase refer [rsi_ble_resp_local_att_value_s](rsi-ble-resp-local-att-value-s) structure for more info.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4046 - Invalid Arguments <br />  
   0x4D06 - Attribute record not found <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />
- This API can only be used if the service is maintained inside the firmware. The services which are maintained by firmware must follow the below rules.<br />  
  Rule 1: The attribute_data_size is less than 20 bytes during the service_creation <br />  
  Rule 2: While creating the service, don't use the RSI_BLE_ATT_MAINTAIN_IN_HOST bit in the RSI_BLE_ATT_CONFIG_BITMAP macro.

**References:** [rsi_ble_get_local_att_value_s::handle](rsi-ble-get-local-att-value-s#handle), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_gatt_read_response (heading level 9)

`int32_t rsi_ble_gatt_read_response(uint8_t *dev_addr, uint8_t read_type, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *p_data)`

**Description:** Send the response for the read request received from the remote device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device Address|
|uint8_t|[in]|read_type|- read value type <br /><br/> 0 - Read response <br /><br/> 1 - Read blob response|
|uint16_t|[in]|handle|- attribute value handle|
|uint16_t|[in]|offset|- attribute value offset|
|uint16_t|[in]|length|- attribute value length|
|uint8_t *|[in]|p_data|- attribute value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D04 - BLE not connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_gatt_read_response_s::data](rsi-ble-gatt-read-response-s#data), [rsi_ble_gatt_read_response_s::data_len](rsi-ble-gatt-read-response-s#data-len), [rsi_ble_gatt_read_response_s::dev_addr](rsi-ble-gatt-read-response-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf), [rsi_ble_gatt_read_response_s::type](rsi-ble-gatt-read-response-s#type) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_ble_remove_gatt_service (heading level 9)

`int32_t rsi_ble_remove_gatt_service(uint32_t service_handler)`

**Description:** Remove the GATT service record. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|service_handler|- GATT service record handle|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D0A - BLE profile not found (profile handler invalid) <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_gatt_remove_serv_s::serv_hndler](rsi-ble-gatt-remove-serv-s#serv-hndler) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_remove_gatt_attibute (heading level 9)

`int32_t rsi_ble_remove_gatt_attibute(uint32_t service_handler, uint16_t att_hndl)`

**Description:** Remove the GATT attribute record. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|service_handler|- GATT service record handle|
|uint16_t|[in]|att_hndl|- attribute handle|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   0x4D06 - Attribute record not found <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_gatt_remove_att_s::att_hndl](rsi-ble-gatt-remove-att-s#att-hndl), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [rsi_ble_gatt_remove_att_s::serv_hndler](rsi-ble-gatt-remove-att-s#serv-hndler) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_att_error_response (heading level 9)

`int32_t rsi_ble_att_error_response(uint8_t *dev_addr, uint16_t handle, uint8_t opcode, uint8_t err)`

**Description:** Send attribute error response for any of the att request. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute handle|
|uint8_t|[in]|opcode|- error response opcode|
|uint8_t|[in]|err|- specific error related Gatt|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4D04 - BLE not Connected <br />  
   0x4E62 - Invalid Parameters <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_att_error_response_s::att_handle](rsi-ble-att-error-response-s#att-handle), [rsi_ble_att_error_response_s::dev_addr](rsi-ble-att-error-response-s#dev-addr), [rsi_ble_att_error_response_s::err_code](rsi-ble-att-error-response-s#err-code), [memcpy](bt-classic1#memcpy), [rsi_ble_att_error_response_s::req_opcode](rsi-ble-att-error-response-s#req-opcode), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_ble_gatt_write_response (heading level 9)

`int32_t rsi_ble_gatt_write_response(uint8_t *dev_addr, uint8_t type)`

**Description:** Send the response to the write request received from the remote device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint8_t|[in]|type|- response type <br /><br/> 0 - write response, <br /><br/> 1 - execute write response.|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4046 - Invalid Arguments <br />  
   0x4D04 - BLE not Connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_gatt_write_response_s::dev_addr](rsi-ble-gatt-write-response-s#dev-addr), [memcpy](bt-classic1#memcpy), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_ble_gatt_write_response_s::type](rsi-ble-gatt-write-response-s#type)

###### rsi_ble_gatt_prepare_write_response (heading level 9)

`int32_t rsi_ble_gatt_prepare_write_response(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *data)`

**Description:** Send the response for the prepare write requests received from the remote device. This is a Blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dev_addr|- remote device address|
|uint16_t|[in]|handle|- attribute value handle|
|uint16_t|[in]|offset|- attribute value offset|
|uint16_t|[in]|length|- attribute value length|
|uint8_t *|[in]|data|- attribite value|

- [rsi_ble_connect()](bt-low-energy1#rsi-ble-connect) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure 0x4046 - Invalid Arguments <br />  
   0x4D04 - BLE not Connected <br />

**Note**

- Refer Error Codes section for above error codes [Error Codes](error-codes)<br />

**References:** [rsi_ble_gatt_prepare_write_response_s::data](rsi-ble-gatt-prepare-write-response-s#data), [rsi_ble_gatt_prepare_write_response_s::data_len](rsi-ble-gatt-prepare-write-response-s#data-len), [rsi_ble_gatt_prepare_write_response_s::dev_addr](rsi-ble-gatt-prepare-write-response-s#dev-addr), [rsi_ble_gatt_prepare_write_response_s::handle](rsi-ble-gatt-prepare-write-response-s#handle), [memcpy](bt-classic1#memcpy), [rsi_ble_gatt_prepare_write_response_s::offset](rsi-ble-gatt-prepare-write-response-s#offset), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_bt_driver_send_cmd](bt-classic1#rsi-bt-driver-send-cmd) and [SL_PRINTF](bt-classic1#sl-printf)

#### Driver APIs

This section describes the Driver APIs 

##### Modules

[Device interface APIs](driver0)

[Driver](driver4)

[Events](driver7)

[Network](driver9)

[Wi-Fi](driver13)

[BT/BLE](driver14)

##### Network

###### Functions

###### rsi_wait_on_nwk_semaphore (heading level 7)

`rsi_error_t rsi_wait_on_nwk_semaphore(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for network semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. If timeout_ms is 0 then wait till semaphore is acquired.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb) and [rsi_wlan_set_nwk_status](driver9#rsi-wlan-set-nwk-status)

**Referenced by:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state)

###### rsi_wlan_get_nwk_status (heading level 7)

`int32_t rsi_wlan_get_nwk_status(void)`

**Description:** Return network status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- **Precondition** - This API should be called after [rsi_device_init()](common#rsi-device-init)

**References:** [rsi_driver_cb_non_rom::nwk_status](rsi-driver-cb-non-rom#nwk-status)

###### rsi_wlan_set_nwk_status (heading level 7)

`void rsi_wlan_set_nwk_status(int32_t status)`

**Description:** Set network status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- status value to be set|

**Returns**

- void

**References:** [rsi_driver_cb_non_rom::nwk_status](rsi-driver-cb-non-rom#nwk-status) and [rsi_wlan_set_status](driver13#rsi-wlan-set-status)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore) and [rsi_wait_on_nwk_semaphore](driver9#rsi-wait-on-nwk-semaphore)

###### rsi_driver_send_data_non_rom (heading level 7)

`int32_t rsi_driver_send_data_non_rom(uint32_t sockID, uint8_t *buffer, uint32_t length, struct rsi_sockaddr *destAddr)`

**Description:** Send data packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|sockID|- socket descriptor on which data needs to be send|
|uint8_t *|[in]|buffer|- pointer to data|
|uint32_t|[in]|length|- data length|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- pointer to destination socket details|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_driver_send_data](wlan#rsi-driver-send-data)

###### rsi_driver_process_recv_data_non_rom (heading level 7)

`int32_t rsi_driver_process_recv_data_non_rom(rsi_pkt_t *pkt)`

**Description:** Process received data packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer to data packet <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_rsp_socket_recv_s::dest_ip_addr](rsi-rsp-socket-recv-s#dest-ip-addr), [rsi_rsp_socket_recv_s::dest_port](rsi-rsp-socket-recv-s#dest-port), [rsi_socket_info_s::destination_ip_addr](rsi-socket-info-s#destination-ip-addr), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_rsp_socket_recv_s::end_of_the_data](rsi-rsp-socket-recv-s#end-of-the-data), [rsi_ip_addr_u::ipv4](rsi-ip-addr-u#ipv4), [rsi_rsp_socket_recv_s::ipv4_address](rsi-rsp-socket-recv-s#ipv4-address), [rsi_ip_addr_u::ipv6](rsi-ip-addr-u#ipv6), [rsi_rsp_socket_recv_s::ipv6_address](rsi-rsp-socket-recv-s#ipv6-address), [rsi_rsp_socket_recv_s::length](rsi-rsp-socket-recv-s#length), [memcpy](bt-classic1#memcpy), [rsi_rsp_socket_recv_s::more_data_pending](rsi-rsp-socket-recv-s#more-data-pending), [rsi_socket_info_non_rom_s::more_rx_data_pending](rsi-socket-info-non-rom-s#more-rx-data-pending), [rsi_rsp_socket_recv_s::offset](rsi-rsp-socket-recv-s#offset), [rsi_callback_cb_s::raw_data_receive_handler](rsi-callback-cb-s#raw-data-receive-handler), [rsi_socket_info_s::recv_buffer](rsi-socket-info-s#recv-buffer), [rsi_socket_info_s::recv_buffer_length](rsi-socket-info-s#recv-buffer-length), [rsi_socket_info_non_rom_s::recv_pending_bit](rsi-socket-info-non-rom-s#recv-pending-bit), [rsi_application_socket_descriptor](network5#rsi-application-socket-descriptor), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [global_cb_s::rx_buffer_mem_copy](global-cb-s#rx-buffer-mem-copy), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_receive_callback](rsi-socket-info-s#sock-receive-callback), [rsi_socket_info_s::sock_recv_available_length](rsi-socket-info-s#sock-recv-available-length), [rsi_socket_info_s::sock_recv_buffer](rsi-socket-info-s#sock-recv-buffer), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type), [rsi_rsp_socket_recv_s::socket_id](rsi-rsp-socket-recv-s#socket-id) and [rsi_socket_info_non_rom_s::socket_wait_bitmap](rsi-socket-info-non-rom-s#socket-wait-bitmap)

**Referenced by:** [rsi_driver_process_recv_data](wlan#rsi-driver-process-recv-data)

###### rsi_post_waiting_nwk_semaphore (heading level 7)

`void rsi_post_waiting_nwk_semaphore()`

**Description:** Post the network semaphore which is on wait.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|void|<br />|

**Returns**

- Void

**References:** [rsi_driver_cb_non_rom::nwk_cmd_send_sem](rsi-driver-cb-non-rom#nwk-cmd-send-sem), [rsi_driver_cb_non_rom::nwk_sem](rsi-driver-cb-non-rom#nwk-sem), [rsi_driver_cb_non_rom::nwk_wait_bitmap](rsi-driver-cb-non-rom#nwk-wait-bitmap) and [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post)

**Referenced by:** [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

##### Wi-Fi

###### Functions

###### rsi_wlan_cb_init (heading level 7)

`int8_t rsi_wlan_cb_init(rsi_wlan_cb_t *wlan_cb)`

**Description:** Initialize the WLAN control block structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_wlan_cb_t](rsi-wlan-cb-s) *|[in]|wlan_cb|- Pointer to WLAN cb structure|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_driver_cb_non_rom::nwk_cmd_send_sem](rsi-driver-cb-non-rom#nwk-cmd-send-sem), [rsi_driver_cb_non_rom::nwk_sem](rsi-driver-cb-non-rom#nwk-sem), [rsi_mutex_create](rsi-os-h#rsi-mutex-create), [rsi_semaphore_create](rsi-os-h#rsi-semaphore-create), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_wlan_cb_s::status](rsi-wlan-cb-s#status), [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem), [rsi_driver_cb_non_rom::wlan_cmd_send_sem](rsi-driver-cb-non-rom#wlan-cmd-send-sem), [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex) and [rsi_wlan_cb_s::wlan_sem](rsi-wlan-cb-s#wlan-sem)

###### rsi_driver_wlan_send_cmd (heading level 7)

`int32_t rsi_driver_wlan_send_cmd(rsi_wlan_cmd_request_t cmd, rsi_pkt_t *pkt)`

**Description:** Fill the command information and place it in the WLAN TX queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_wlan_cmd_request_t|[in]|cmd|- Type of the command to send|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer of the packet to send|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure <br />

###### rsi_extract_filename (heading level 7)

`uint8_t * rsi_extract_filename(uint8_t *json, uint8_t *buffer)`

**Description:** Extract file name from the received JSON data.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|json|- json object data string|
|uint8_t *|[in]|buffer|- contains file name|

**Returns**

- File name extracted

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_driver_process_wlan_recv_cmd (heading level 7)

`int32_t rsi_driver_process_wlan_recv_cmd(rsi_pkt_t *pkt)`

**Description:** Process received WLAN commands.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer to received RX packet <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Memory allocation for the pointer is from receive handler, after processing, it will be freed.

**References:** [rsi_socket_info_non_rom_s::accept_call_back_handler](rsi-socket-info-non-rom-s#accept-call-back-handler), [rsi_wlan_cb_s::ap_state](rsi-wlan-cb-s#ap-state), [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_callback_cb_s::auto_config_rsp_handler](rsi-callback-cb-s#auto-config-rsp-handler), [rsi_wlan_cb_s::auto_config_state](rsi-wlan-cb-s#auto-config-state), [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [calculate_buffers_required](network5#calculate-buffers-required), [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_callback_cb_s::certificate_response_handler](rsi-callback-cb-s#certificate-response-handler), [rsi_ftp_file_rsp_s::command_type](rsi-ftp-file-rsp-s#command-type), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_socket_info_s::current_available_buffer_count](rsi-socket-info-s#current-available-buffer-count), [rsi_power_save_s::current_ps_mode](rsi-power-save-s#current-ps-mode), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_ftp_file_rsp_s::data_content](rsi-ftp-file-rsp-s#data-content), [http_Put_Data_s::data_len](http-put-data-s#data-len), [rsi_ftp_file_rsp_s::data_length](rsi-ftp-file-rsp-s#data-length), [rsi_nwk_callback_s::data_transfer_complete_handler](rsi-nwk-callback-s#data-transfer-complete-handler), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_rsp_ltcp_est_s::dest_ip_addr](rsi-rsp-ltcp-est-s#dest-ip-addr), [rsi_rsp_socket_create_s::dest_ip_addr](rsi-rsp-socket-create-s#dest-ip-addr), [rsi_rsp_ltcp_est_s::dest_port](rsi-rsp-ltcp-est-s#dest-port), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_cert_recv_s::dst_port](rsi-cert-recv-s#dst-port), [rsi_rsp_socket_create_s::dst_port](rsi-rsp-socket-create-s#dst-port), [rsi_http_client_put_pkt_rsp_s::end_of_file](rsi-http-client-put-pkt-rsp-s#end-of-file), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array), [rsi_fd_set_s::fd_count](rsi-fd-set-s#fd-count), [rsi_nwk_callback_s::ftp_directory_list_call_back_handler](rsi-nwk-callback-s#ftp-directory-list-call-back-handler), [rsi_nwk_callback_s::ftp_file_read_call_back_handler](rsi-nwk-callback-s#ftp-file-read-call-back-handler), [rsi_nwk_callback_s::http_client_response_handler](rsi-nwk-callback-s#http-client-response-handler), [rsi_nwk_callback_s::http_otaf_response_handler](rsi-nwk-callback-s#http-otaf-response-handler), [rsi_cert_recv_s::ip_address](rsi-cert-recv-s#ip-address), [rsi_callback_cb_s::ip_change_notify_handler](rsi-callback-cb-s#ip-change-notify-handler), [rsi_callback_cb_s::ip_renewal_fail_handler](rsi-callback-cb-s#ip-renewal-fail-handler), [rsi_cert_recv_s::ip_version](rsi-cert-recv-s#ip-version), [rsi_rsp_ltcp_est_s::ip_version](rsi-rsp-ltcp-est-s#ip-version), [rsi_rsp_socket_create_s::ip_version](rsi-rsp-socket-create-s#ip-version), [rsi_rsp_socket_create_s::ipv4_addr](rsi-rsp-socket-create-s#ipv4-addr), [rsi_cert_recv_s::ipv4_address](rsi-cert-recv-s#ipv4-address), [rsi_rsp_ltcp_est_s::ipv4_address](rsi-rsp-ltcp-est-s#ipv4-address), [rsi_rsp_socket_create_s::ipv6_addr](rsi-rsp-socket-create-s#ipv6-addr), [rsi_cert_recv_s::ipv6_address](rsi-cert-recv-s#ipv6-address), [rsi_rsp_ltcp_est_s::ipv6_address](rsi-rsp-ltcp-est-s#ipv6-address), [rsi_callback_cb_s::join_fail_handler](rsi-callback-cb-s#join-fail-handler), [rsi_rsp_tcp_ack_s::length](rsi-rsp-tcp-ack-s#length), [rsi_socket_info_s::max_available_buffer_count](rsi-socket-info-s#max-available-buffer-count), [memcpy](bt-classic1#memcpy), [rsi_rsp_socket_create_s::module_port](rsi-rsp-socket-create-s#module-port), [rsi_power_save_s::module_state](rsi-power-save-s#module-state), [rsi_ftp_file_rsp_s::more](rsi-ftp-file-rsp-s#more), [rsi_rsp_ltcp_est_s::mss](rsi-rsp-ltcp-est-s#mss), [rsi_rsp_socket_create_s::mss](rsi-rsp-socket-create-s#mss), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [wpa_scan_results_arr::num](wpa-scan-results-arr#num), [rsi_driver_cb_non_rom::nwk_app_buffer](rsi-driver-cb-non-rom#nwk-app-buffer), [rsi_driver_cb_non_rom::nwk_app_buffer_length](rsi-driver-cb-non-rom#nwk-app-buffer-length), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_non_rom_s::nwk_cmd_rsp_pending](rsi-wlan-cb-non-rom-s#nwk-cmd-rsp-pending), [rsi_driver_cb_non_rom::nwk_sem](rsi-driver-cb-non-rom#nwk-sem), [rsi_driver_cb_non_rom::nwk_wait_bitmap](rsi-driver-cb-non-rom#nwk-wait-bitmap), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_rsp_socket_close_s::port_number](rsi-rsp-socket-close-s#port-number), [rsi_urlReqFrameRcv::post_content_length](rsi-url-req-frame-rcv#post-content-length), [rsi_urlReqFrameRcv::post_data](rsi-url-req-frame-rcv#post-data), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [process_scan_results](driver13#process-scan-results), [rsi_common_cb_s::ps_coex_mode](rsi-common-cb-s#ps-coex-mode), [rsi_wlan_cb_s::query_cmd](rsi-wlan-cb-s#query-cmd), [rsi_callback_cb_s::remote_socket_terminate_handler](rsi-callback-cb-s#remote-socket-terminate-handler), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_check_queue_status](driver16#rsi-check-queue-status), [rsi_clear_sockets](network5#rsi-clear-sockets), [rsi_nwk_callback_s::rsi_dhcp_usr_cls_rsp_handler](rsi-nwk-callback-s#rsi-dhcp-usr-cls-rsp-handler), [rsi_nwk_callback_s::rsi_dns_query_rsp_handler](rsi-nwk-callback-s#rsi-dns-query-rsp-handler), [rsi_nwk_callback_s::rsi_dns_update_rsp_handler](rsi-nwk-callback-s#rsi-dns-update-rsp-handler), [rsi_nwk_callback_s::rsi_emb_mqtt_keep_alive_timeout_callback](rsi-nwk-callback-s#rsi-emb-mqtt-keep-alive-timeout-callback), [rsi_nwk_callback_s::rsi_emb_mqtt_publish_message_callback](rsi-nwk-callback-s#rsi-emb-mqtt-publish-message-callback), [rsi_nwk_callback_s::rsi_emb_mqtt_remote_terminate_handler](rsi-nwk-callback-s#rsi-emb-mqtt-remote-terminate-handler), [rsi_extract_filename](driver13#rsi-extract-filename), [rsi_get_app_socket_descriptor](network5#rsi-get-app-socket-descriptor), [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_get_socket_descriptor](network5#rsi-get-socket-descriptor), [rsi_get_socket_id](network5#rsi-get-socket-id), [rsi_nwk_callback_s::rsi_http_client_post_data_response_handler](rsi-nwk-callback-s#rsi-http-client-post-data-response-handler), [rsi_nwk_callback_s::rsi_http_client_put_response_handler](rsi-nwk-callback-s#rsi-http-client-put-response-handler), [rsi_nwk_callback_s::rsi_json_object_event_handler](rsi-nwk-callback-s#rsi-json-object-event-handler), [rsi_nwk_callback_s::rsi_json_object_update_handler](rsi-nwk-callback-s#rsi-json-object-update-handler), [rsi_callback_cb_s::rsi_max_available_rx_window](rsi-callback-cb-s#rsi-max-available-rx-window), [rsi_nwk_callback_s::rsi_ota_fw_up_response_handler](rsi-nwk-callback-s#rsi-ota-fw-up-response-handler), [rsi_nwk_callback_s::rsi_pop3_client_mail_response_handler](rsi-nwk-callback-s#rsi-pop3-client-mail-response-handler), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore), [rsi_post_waiting_socket_semaphore](driver10#rsi-post-waiting-socket-semaphore), [rsi_rsp_socket_select_s::rsi_read_fds](rsi-rsp-socket-select-s#rsi-read-fds), [rsi_socket_select_info_s::rsi_sel_exception_fds_var](rsi-socket-select-info-s#rsi-sel-exception-fds-var), [rsi_socket_select_info_s::rsi_sel_read_fds_var](rsi-socket-select-info-s#rsi-sel-read-fds-var), [rsi_socket_select_info_s::rsi_sel_write_fds_var](rsi-socket-select-info-s#rsi-sel-write-fds-var), [rsi_select_set_status](network5#rsi-select-set-status), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_nwk_callback_s::rsi_sntp_client_create_response_handler](rsi-nwk-callback-s#rsi-sntp-client-create-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_non_rom_s::rsi_uart_data_ack_check](rsi-wlan-cb-non-rom-s#rsi-uart-data-ack-check), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_unmask_event](driver8#rsi-unmask-event), [rsi_nwk_callback_s::rsi_webpage_request_handler](rsi-nwk-callback-s#rsi-webpage-request-handler), [rsi_nwk_callback_s::rsi_wireless_fw_upgrade_handler](rsi-nwk-callback-s#rsi-wireless-fw-upgrade-handler), [rsi_wlan_check_waiting_wlan_cmd](driver13#rsi-wlan-check-waiting-wlan-cmd), [rsi_wlan_set_nwk_status](driver9#rsi-wlan-set-nwk-status), [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_rsp_socket_select_s::rsi_write_fds](rsi-rsp-socket-select-s#rsi-write-fds), [rsi_wlan_cb_non_rom_s::scan_results_to_host](rsi-wlan-cb-non-rom-s#scan-results-to-host), [rsi_rsp_socket_select_s::select_id](rsi-rsp-socket-select-s#select-id), [rsi_socket_select_info_s::select_state](rsi-socket-select-info-s#select-state), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [rsi_driver_cb_non_rom::send_wait_bitmap](rsi-driver-cb-non-rom#send-wait-bitmap), [rsi_nwk_callback_s::smtp_client_delete_response_handler](rsi-nwk-callback-s#smtp-client-delete-response-handler), [rsi_nwk_callback_s::smtp_client_mail_response_handler](rsi-nwk-callback-s#smtp-client-mail-response-handler), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_cert_recv_s::sock_desc](rsi-cert-recv-s#sock-desc), [rsi_socket_info_s::sock_id](rsi-socket-info-s#sock-id), [rsi_socket_select_info_s::sock_select_callback](rsi-socket-select-info-s#sock-select-callback), [rsi_socket_info_s::sock_state](rsi-socket-info-s#sock-state), [rsi_wlan_cb_non_rom_s::socket_cmd_rsp_pending](rsi-wlan-cb-non-rom-s#socket-cmd-rsp-pending), [rsi_callback_cb_s::socket_connect_response_handler](rsi-callback-cb-s#socket-connect-response-handler), [rsi_rsp_socket_close_s::socket_id](rsi-rsp-socket-close-s#socket-id), [rsi_rsp_ltcp_est_s::socket_id](rsi-rsp-ltcp-est-s#socket-id), [rsi_rsp_socket_create_s::socket_id](rsi-rsp-socket-create-s#socket-id), [rsi_rsp_tcp_ack_s::socket_id](rsi-rsp-tcp-ack-s#socket-id), [rsi_rsp_tcp_window_update_s::socket_id](rsi-rsp-tcp-window-update-s#socket-id), [rsi_rsp_socket_select_s::socket_terminate_bitmap](rsi-rsp-socket-select-s#socket-terminate-bitmap), [rsi_socket_info_non_rom_s::socket_terminate_indication](rsi-socket-info-non-rom-s#socket-terminate-indication), [rsi_rsp_socket_create_s::socket_type](rsi-rsp-socket-create-s#socket-type), [rsi_socket_info_non_rom_s::socket_wait_bitmap](rsi-socket-info-non-rom-s#socket-wait-bitmap), [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port), [rsi_cert_recv_s::src_port](rsi-cert-recv-s#src-port), [rsi_rsp_ltcp_est_s::src_port_num](rsi-rsp-ltcp-est-s#src-port-num), [rsi_wlan_cb_s::sta_state](rsi-wlan-cb-s#sta-state), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_callback_cb_s::stations_connect_notify_handler](rsi-callback-cb-s#stations-connect-notify-handler), [rsi_callback_cb_s::stations_disconnect_notify_handler](rsi-callback-cb-s#stations-disconnect-notify-handler), [rsi_cert_recv_s::total_len](rsi-cert-recv-s#total-len), [rsi_callback_cb_s::twt_response_handler](rsi-callback-cb-s#twt-response-handler), [rsi_urlReqFrameRcv::url_name](rsi-url-req-frame-rcv#url-name), [USED_PARAMETER](bt-classic1#used-parameter), [rsi_socket_info_non_rom_s::wait_to_connect](rsi-socket-info-non-rom-s#wait-to-connect), [rsi_socket_info_non_rom_s::window_size](rsi-socket-info-non-rom-s#window-size), [rsi_rsp_tcp_window_update_s::window_size](rsi-rsp-tcp-window-update-s#window-size), [rsi_callback_cb_s::wlan_async_module_state](rsi-callback-cb-s#wlan-async-module-state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem), [rsi_driver_cb_non_rom::wlan_cmd_send_sem](rsi-driver-cb-non-rom#wlan-cmd-send-sem), [rsi_callback_cb_s::wlan_join_response_handler](rsi-callback-cb-s#wlan-join-response-handler), [rsi_callback_cb_s::wlan_ping_response_handler](rsi-callback-cb-s#wlan-ping-response-handler), [rsi_wlan_cb_non_rom_s::wlan_radio](rsi-wlan-cb-non-rom-s#wlan-radio), [rsi_callback_cb_s::wlan_receive_csi_data_response_handler](rsi-callback-cb-s#wlan-receive-csi-data-response-handler), [rsi_callback_cb_s::wlan_receive_stats_response_handler](rsi-callback-cb-s#wlan-receive-stats-response-handler), [rsi_callback_cb_s::wlan_scan_response_handler](rsi-callback-cb-s#wlan-scan-response-handler), [rsi_wlan_cb_s::wlan_sem](rsi-wlan-cb-s#wlan-sem), [rsi_driver_cb_s::wlan_tx_q](rsi-driver-cb-s#wlan-tx-q), [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap), [rsi_callback_cb_s::wlan_wfd_connection_request_notify_handler](rsi-callback-cb-s#wlan-wfd-connection-request-notify-handler) and [rsi_callback_cb_s::wlan_wfd_discovery_notify_handler](rsi-callback-cb-s#wlan-wfd-discovery-notify-handler)

###### rsi_check_wlan_state (heading level 7)

`uint32_t rsi_check_wlan_state(void)`

**Description:** Get WLAN status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Wlan block status <br />
- 0 - RSI_WLAN_STATE_NONE <br />
- 1 - RSI_WLAN_STATE_OPERMODE_DONE <br />
- 2 - RSI_WLAN_STATE_BAND_DONE <br />
- 3 - RSI_WLAN_STATE_INIT_DONE <br />
- 4 - RSI_WLAN_STATE_SCAN_DONE <br />
- 5 - RSI_WLAN_STATE_CONNECTED <br />
- 6 - RSI_WLAN_STATE_IP_CONFIG_DONE <br />
- 7 - RSI_WLAN_STATE_IPV6_CONFIG_DONE <br />
- 8 - RSI_WLAN_STATE_AUTO_CONFIG_GOING_ON <br />
- 9 - RSI_WLAN_STATE_AUTO_CONFIG_DONE <br />
- 10- RSI_WLAN_STATE_AUTO_CONFIG_FAILED

**References:** [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_set_status (heading level 7)

`void rsi_wlan_set_status(int32_t status)`

**Description:** Set the WLAN status. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status value to be set|

**Returns**

- void

**References:** [rsi_wlan_cb_s::status](rsi-wlan-cb-s#status) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_check_common_buffer_full](driver13#rsi-check-common-buffer-full), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore), [rsi_select_set_status](network5#rsi-select-set-status), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done), [rsi_wlan_set_nwk_status](driver9#rsi-wlan-set-nwk-status) and [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status)

###### rsi_post_waiting_semaphore (heading level 7)

`int32_t rsi_post_waiting_semaphore(void)`

**Description:** Post on a waiting semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_socket_info_non_rom_s::accept_call_back_handler](rsi-socket-info-non-rom-s#accept-call-back-handler), [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_socket_info_non_rom_s::close_pending](rsi-socket-info-non-rom-s#close-pending), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_fd_set_s::fd_count](rsi-fd-set-s#fd-count), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_call_asynchronous_callback](driver13#rsi-call-asynchronous-callback), [rsi_clear_sockets](network5#rsi-clear-sockets), [rsi_post_waiting_nwk_semaphore](driver9#rsi-post-waiting-nwk-semaphore), [rsi_post_waiting_socket_semaphore](driver10#rsi-post-waiting-socket-semaphore), [rsi_socket_select_info_s::rsi_sel_exception_fds_var](rsi-socket-select-info-s#rsi-sel-exception-fds-var), [rsi_socket_select_info_s::rsi_sel_read_fds_var](rsi-socket-select-info-s#rsi-sel-read-fds-var), [rsi_socket_select_info_s::rsi_sel_write_fds_var](rsi-socket-select-info-s#rsi-sel-write-fds-var), [rsi_select_set_status](network5#rsi-select-set-status), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_wlan_set_nwk_status](driver9#rsi-wlan-set-nwk-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_socket_select_info_s::select_state](rsi-socket-select-info-s#select-state), [rsi_socket_select_info_s::sock_select_callback](rsi-socket-select-info-s#sock-select-callback), [rsi_wlan_cb_non_rom_s::socket_cmd_rsp_pending](rsi-wlan-cb-non-rom-s#socket-cmd-rsp-pending), [rsi_callback_cb_s::socket_connect_response_handler](rsi-callback-cb-s#socket-connect-response-handler), [rsi_rsp_socket_create_s::socket_id](rsi-rsp-socket-create-s#socket-id) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore)

###### rsi_wlan_check_waiting_socket_cmd (heading level 7)

`int32_t rsi_wlan_check_waiting_socket_cmd(void)`

**Description:** Check if any socket command is in waiting state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - No socket command is in waiting state <br />
- 1 - Socket command is in waiting state

**References:** [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_check_waiting_wlan_cmd (heading level 7)

`int32_t rsi_wlan_check_waiting_wlan_cmd(void)`

**Description:** Check if any WLAN command is in waiting state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_wlan_process_raw_data (heading level 7)

`void rsi_wlan_process_raw_data(rsi_pkt_t *pkt)`

**Description:** Receive raw data packet from module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer to RX pkt|

**Returns**

- Void

**Note**

- Memory allocation for the pointer is from receive handler ,after processing, it will be freed.

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16) and [rsi_callback_cb_s::wlan_data_receive_handler](rsi-callback-cb-s#wlan-data-receive-handler)

###### rsi_wlan_packet_transfer_done (heading level 7)

`void rsi_wlan_packet_transfer_done(rsi_pkt_t *pkt)`

**Description:** Handle packet transfer completion. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer to packet|

**Returns**

- void

**References:** [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [rsi_driver_cb_non_rom::send_wait_bitmap](rsi-driver-cb-non-rom#send-wait-bitmap), [rsi_req_socket_send_s::socket_id](rsi-req-socket-send-s#socket-id), [rsi_socket_info_non_rom_s::socket_wait_bitmap](rsi-socket-info-non-rom-s#socket-wait-bitmap) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_check_wlan_buffer_full (heading level 7)

`void rsi_check_wlan_buffer_full(rsi_pkt_t *pkt)`

**Description:** Clear TX packet, if TX buffer is full.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Buffer pointer|

**Note**

- BUFFER_FULL_HANDLING macro should be enabled.

**Returns**

- Void

**References:** [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [rsi_driver_cb_non_rom::send_wait_bitmap](rsi-driver-cb-non-rom#send-wait-bitmap), [rsi_req_socket_send_s::socket_id](rsi-req-socket-send-s#socket-id), [rsi_socket_info_non_rom_s::socket_wait_bitmap](rsi-socket-info-non-rom-s#socket-wait-bitmap) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_check_common_buffer_full (heading level 7)

`void rsi_check_common_buffer_full(rsi_pkt_t *pkt)`

**Description:** Check if the common buffer is full.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Buffer pointer <br />|

**Returns**

- void

**References:** [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [UNUSED_PARAMETER](bt-classic1#unused-parameter), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_wlan_cb_s::wlan_sem](rsi-wlan-cb-s#wlan-sem) and [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_wait_on_wlan_semaphore (heading level 7)

`rsi_error_t rsi_wait_on_wlan_semaphore(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for WLAN semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. <br /><br/> If timeout_ms is 0, then wait till semaphore is acquired|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb) and [rsi_wlan_set_status](driver13#rsi-wlan-set-status)

**Referenced by:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_wireless_init](common#rsi-wireless-init), [rsi_wlan_connect](wlan#rsi-wlan-connect), [rsi_wlan_scan](wlan#rsi-wlan-scan) and [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options)

###### rsi_update_wlan_cmd_state_to_free_state (heading level 7)

`void rsi_update_wlan_cmd_state_to_free_state(void)`

**Description:** Update the WLAN command state to free state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Void

**References:** [rsi_driver_cb_non_rom::wlan_cmd_state](rsi-driver-cb-non-rom#wlan-cmd-state)

###### rsi_update_wlan_cmd_state_to_progress_state (heading level 7)

`void rsi_update_wlan_cmd_state_to_progress_state(void)`

**Description:** Update the WLAN command state to progress state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Void

**References:** [rsi_driver_cb_non_rom::wlan_cmd_state](rsi-driver-cb-non-rom#wlan-cmd-state)

###### rsi_post_waiting_wlan_semaphore (heading level 7)

`int32_t rsi_post_waiting_wlan_semaphore(void)`

**Description:** Posts all waiting WLAN semaphores. This API is typically used to reset the semaphore states.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem), [rsi_driver_cb_non_rom::wlan_cmd_send_sem](rsi-driver-cb-non-rom#wlan-cmd-send-sem), [rsi_wlan_cb_s::wlan_sem](rsi-wlan-cb-s#wlan-sem) and [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap)

**Referenced by:** [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore)

###### rsi_call_asynchronous_callback (heading level 7)

`void rsi_call_asynchronous_callback()`

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_non_rom_s::nwk_cmd_rsp_pending](rsi-wlan-cb-non-rom-s#nwk-cmd-rsp-pending), [rsi_nwk_callback_s::rsi_dns_query_rsp_handler](rsi-nwk-callback-s#rsi-dns-query-rsp-handler), [rsi_nwk_callback_s::rsi_dns_update_rsp_handler](rsi-nwk-callback-s#rsi-dns-update-rsp-handler), [rsi_nwk_callback_s::rsi_sntp_client_create_response_handler](rsi-nwk-callback-s#rsi-sntp-client-create-response-handler) and [rsi_callback_cb_s::wlan_ping_response_handler](rsi-callback-cb-s#wlan-ping-response-handler)

**Referenced by:** [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### sort_index_based_on_rssi (heading level 7)

`void sort_index_based_on_rssi(struct wpa_scan_results_arr *scan_results_array)`

**Description:** Sort the scan list based on rssi value.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|struct [wpa_scan_results_arr](wpa-scan-results-arr) *|[in]|scan_results_array|- Pointer to scan results array <br />|

**Returns**

- void

###### get_akm_suites_info (heading level 7)

`static unsigned int get_akm_suites_info(const uint16_t akmcnt, const uint8_t *ie_data)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|const uint16_t|N/A|akmcnt||
|const uint8_t *|N/A|ie_data||

###### process_scan_results (heading level 7)

`int process_scan_results(uint8_t *buf, uint16_t len, int8_t rssi, uint8_t channel, uint16_t freq)`

**Description:** Process received beacons and probe responses.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|buf|- Received frame.|
|uint16_t|[in]|len|- Length of the buffer.|
|int8_t|[in]|rssi|- RSSI value|
|uint8_t|[in]|channel|- Channel in which the frame is received|
|uint16_t|[in]|freq|- Frequency of the channel <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - failure

**References:** [wpa_scan_res::bssid](wpa-scan-res#bssid), [wpa_scan_results_arr::num](wpa-scan-results-arr#num), [wpa_scan_results_arr::res](wpa-scan-results-arr#res), [wpa_scan_results_arr::sort_index](wpa-scan-results-arr#sort-index), [wpa_scan_res::ssid](wpa-scan-res#ssid) and [wpa_scan_res::ssid_len](wpa-scan-res#ssid-len)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

##### BT/BLE

###### Functions

###### rsi_bt_clear_wait_bitmap (heading level 7)

`void rsi_bt_clear_wait_bitmap(uint16_t protocol_type, uint8_t sem_type)`

**Description:** Clear the Bluetooth wait bitmap.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|protocol_type|- Protocol type|
|uint8_t|[in]|sem_type|- Type|

**Returns**

- void

**References:** [rsi_driver_cb_non_rom::bt_cmd_wait_bitmap](rsi-driver-cb-non-rom#bt-cmd-wait-bitmap), [rsi_driver_cb_non_rom::bt_wait_bitmap](rsi-driver-cb-non-rom#bt-wait-bitmap) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_bt_cb_init](driver14#rsi-bt-cb-init), [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd) and [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp)

###### rsi_bt_set_wait_bitmap (heading level 7)

`void rsi_bt_set_wait_bitmap(uint16_t protocol_type, uint8_t sem_type)`

**Description:** Set the bt wait bitmap.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|protocol_type|- Protocol|
|uint8_t|[in]|sem_type|- Type|

**Returns**

- void

**References:** [rsi_driver_cb_non_rom::bt_cmd_wait_bitmap](rsi-driver-cb-non-rom#bt-cmd-wait-bitmap), [rsi_driver_cb_non_rom::bt_wait_bitmap](rsi-driver-cb-non-rom#bt-wait-bitmap) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_bt_common_init](driver14#rsi-bt-common-init) and [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd)

###### rsi_bt_common_register_callbacks (heading level 7)

`void rsi_bt_common_register_callbacks(rsi_bt_get_ber_pkt_t rsi_bt_get_ber_pkt_from_app)`

**Description:** Register the bt-common callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_bt_get_ber_pkt_t|[in]|rsi_bt_get_ber_pkt_from_app|- BER Call back|

**Returns**

- void

**References:** [rsi_bt_global_cb_s::bt_common_specific_cb](rsi-bt-global-cb-s#bt-common-specific-cb), [rsi_driver_cb_s::bt_global_cb](rsi-driver-cb-s#bt-global-cb) and [rsi_bt_common_specific_cb_s::rsi_bt_get_ber_pkt](rsi-bt-common-specific-cb-s#rsi-bt-get-ber-pkt)

###### rsi_bt_get_ACL_type (heading level 7)

`uint8_t rsi_bt_get_ACL_type(uint16_t rsp_type)`

**Description:** Determine the ACL packet type (BT classic) using the frame type.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|rsp_type|- packet type|

**Returns**

- 1 - HCI Command Packet, 2 - HCI ACL packet ,3 - HCI PER Packet<br />  
   Non-Zero Value - Failure (Not a BT Classic Packet)

**References:** [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_bt_get_proto_type (heading level 7)

`uint16_t rsi_bt_get_proto_type(uint16_t rsp_type, rsi_bt_cb_t **bt_cb)`

**Description:** Determine the BT protocol (BT COMMON / BT classic / BLE ) using the packet type.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|rsp_type|- Packet type|
|[rsi_bt_cb_t](rsi-bt-cb-s) **|[in]|bt_cb|- BT control back|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_bt_cb_s::dev_type](rsi-bt-cb-s#dev-type), [rsi_driver_cb_s::prop_protocol_cb](rsi-driver-cb-s#prop-protocol-cb) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_bt_common_tx_done](driver14#rsi-bt-common-tx-done), [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd), [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_bt_get_timeout (heading level 7)

`uint32_t rsi_bt_get_timeout(uint16_t cmd_type, uint16_t protocol_type)`

**Description:** Calculate semaphore wait time for a protocol (BT COMMON / BT classic / BLE ) using the packet type.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|cmd_type|- Command Type|
|uint16_t|[in]|protocol_type|- Protocol type , whether it is BT Common/BT Classic/BLE|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_bt_driver_send_cmd](driver14#rsi-bt-driver-send-cmd)

###### rsi_bt_common_tx_done (heading level 7)

`void rsi_bt_common_tx_done(rsi_pkt_t *pkt)`

**Description:** Handle BT data transfer completion.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer to packet|

**Returns**

- void

**References:** [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_bt_get_proto_type](driver14#rsi-bt-get-proto-type), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_get_bt_state (heading level 7)

`uint32_t rsi_get_bt_state(rsi_bt_cb_t *bt_cb)`

**Description:** Return BT status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_cb|- BT control block|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_cb_s::state](rsi-bt-cb-s#state)

###### rsi_bt_set_status (heading level 7)

`void rsi_bt_set_status(rsi_bt_cb_t *bt_cb, int32_t status)`

**Description:** Set BT status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_cb|- BT control block|
|int32_t|[in]|status|- Status value to be set|
||[out]|None||

**Returns**

- void

**References:** [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_cb_s::status](rsi-bt-cb-s#status)

**Referenced by:** [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp)

###### rsi_bt_get_status (heading level 7)

`uint32_t rsi_bt_get_status(rsi_bt_cb_t *bt_cb)`

**Description:** Get bt status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_cb|- BT control block|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_bt_cb_s::status](rsi-bt-cb-s#status)

**Referenced by:** [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler) and [rsi_bt_callbacks_handler](driver14#rsi-bt-callbacks-handler)

###### rsi_ble_update_le_dev_buf (heading level 7)

`void rsi_ble_update_le_dev_buf(rsi_ble_event_le_dev_buf_ind_t *rsi_ble_event_le_dev_buf_ind)`

**Description:** Update local Device buffer availability per slave in global ble cb structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_event_le_dev_buf_ind_t](rsi-ble-event-le-dev-buf-ind-s) *|[in]|rsi_ble_event_le_dev_buf_ind||

**Returns**

- void

**References:** [rsi_ble_event_le_dev_buf_ind_s::avail_buf_cnt](rsi-ble-event-le-dev-buf-ind-s#avail-buf-cnt), [rsi_remote_ble_info_s::avail_buf_cnt](rsi-remote-ble-info-s#avail-buf-cnt), [rsi_remote_ble_info_s::ble_buff_mutex](rsi-remote-ble-info-s#ble-buff-mutex), [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_ble_event_le_dev_buf_ind_s::remote_dev_bd_addr](rsi-ble-event-le-dev-buf-ind-s#remote-dev-bd-addr), [rsi_remote_ble_info_s::remote_dev_bd_addr](rsi-remote-ble-info-s#remote-dev-bd-addr), [rsi_mutex_lock](rsi-os-h#rsi-mutex-lock), [rsi_mutex_unlock](rsi-os-h#rsi-mutex-unlock) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler)

###### rsi_add_remote_ble_dev_info (heading level 7)

`void rsi_add_remote_ble_dev_info(rsi_ble_event_enhance_conn_status_t *remote_dev_info)`

**Description:** Update Remote BLE Device info in global ble cb structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_event_enhance_conn_status_t](rsi-ble-event-enhnace-conn-status-s) *|[in]|remote_dev_info||

**Returns**

- void

**References:** [rsi_remote_ble_info_s::avail_buf_cnt](rsi-remote-ble-info-s#avail-buf-cnt), [rsi_remote_ble_info_s::ble_buff_mutex](rsi-remote-ble-info-s#ble-buff-mutex), [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_event_enhnace_conn_status_s::dev_addr](rsi-ble-event-enhnace-conn-status-s#dev-addr), [rsi_remote_ble_info_s::max_buf_cnt](rsi-remote-ble-info-s#max-buf-cnt), [memcpy](bt-classic1#memcpy), [rsi_remote_ble_info_s::mode](rsi-remote-ble-info-s#mode), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_remote_ble_info_s::remote_dev_bd_addr](rsi-remote-ble-info-s#remote-dev-bd-addr), [rsi_mutex_create](rsi-os-h#rsi-mutex-create), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_remote_ble_info_s::used](rsi-remote-ble-info-s#used)

**Referenced by:** [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler)

###### rsi_remove_remote_ble_dev_info (heading level 7)

`void rsi_remove_remote_ble_dev_info(rsi_ble_event_disconnect_t *remote_dev_info)`

**Description:** Remove Remote BLE Device info in global ble cb structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_ble_event_disconnect_t](rsi-ble-event-disconnect-s) *|[in]|remote_dev_info|- Remote device information|

**Returns**

- void

**References:** [rsi_remote_ble_info_s::avail_buf_cnt](rsi-remote-ble-info-s#avail-buf-cnt), [rsi_remote_ble_info_s::ble_buff_mutex](rsi-remote-ble-info-s#ble-buff-mutex), [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_remote_ble_info_s::cmd_in_use](rsi-remote-ble-info-s#cmd-in-use), [rsi_ble_event_disconnect_s::dev_addr](rsi-ble-event-disconnect-s#dev-addr), [rsi_remote_ble_info_s::expected_resp](rsi-remote-ble-info-s#expected-resp), [rsi_remote_ble_info_s::max_buf_cnt](rsi-remote-ble-info-s#max-buf-cnt), [rsi_remote_ble_info_s::max_buf_len](rsi-remote-ble-info-s#max-buf-len), [rsi_remote_ble_info_s::mode](rsi-remote-ble-info-s#mode), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_remote_ble_info_s::remote_dev_addr_type](rsi-remote-ble-info-s#remote-dev-addr-type), [rsi_remote_ble_info_s::remote_dev_bd_addr](rsi-remote-ble-info-s#remote-dev-bd-addr), [rsi_mutex_destroy](rsi-os-h#rsi-mutex-destroy), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_remote_ble_info_s::used](rsi-remote-ble-info-s#used)

**Referenced by:** [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler)

###### rsi_driver_process_bt_resp (heading level 7)

`int32_t rsi_driver_process_bt_resp(rsi_bt_cb_t *bt_cb, rsi_pkt_t *pkt, void(*rsi_bt_async_callback_handler)(rsi_bt_cb_t *cb, uint16_t type, uint8_t *data, uint16_t length), uint16_t protocol_type)`

**Description:** Process BT RX packets.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_cb|- BT control block|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer to received RX packet|
|void(*)([rsi_bt_cb_t](rsi-bt-cb-s) *cb, uint16_t type, uint8_t *data, uint16_t length)|[in]|rsi_bt_async_callback_handler||
|uint16_t|N/A|protocol_type||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_bt_cb_s::async_status](rsi-bt-cb-s#async-status), [rsi_remote_ble_info_s::avail_buf_cnt](rsi-remote-ble-info-s#avail-buf-cnt), [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_bt_cb_s::bt_sem](rsi-bt-cb-s#bt-sem), [rsi_ble_set_wo_resp_notify_buf_info_s::buf_count](rsi-ble-set-wo-resp-notify-buf-info-s#buf-count), [rsi_ble_set_wo_resp_notify_buf_info_s::buf_mode](rsi-ble-set-wo-resp-notify-buf-info-s#buf-mode), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_bt_cb_s::expected_response_buffer](rsi-bt-cb-s#expected-response-buffer), [rsi_bt_cb_s::expected_response_type](rsi-bt-cb-s#expected-response-type), [rsi_remote_ble_info_s::max_buf_cnt](rsi-remote-ble-info-s#max-buf-cnt), [memcpy](bt-classic1#memcpy), [rsi_remote_ble_info_s::mode](rsi-remote-ble-info-s#mode), [rsi_bt_cb_s::remote_ble_index](rsi-bt-cb-s#remote-ble-index), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_bt_clear_wait_bitmap](driver14#rsi-bt-clear-wait-bitmap), [rsi_bt_set_status](driver14#rsi-bt-set-status), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_cb_s::state](rsi-bt-cb-s#state) and [rsi_bt_cb_s::sync_rsp](rsi-bt-cb-s#sync-rsp)

**Referenced by:** [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler)

###### rsi_driver_process_bt_resp_handler (heading level 7)

`uint16_t rsi_driver_process_bt_resp_handler(rsi_pkt_t *pkt)`

**Description:** Process BT RX packets.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer to received RX packet|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_ble_event_disconnect_s::dev_type](rsi-ble-event-disconnect-s#dev-type), [rsi_bt_cb_s::dev_type](rsi-bt-cb-s#dev-type), [rsi_ble_callbacks_handler](driver14#rsi-ble-callbacks-handler), [rsi_bt_callbacks_handler](driver14#rsi-bt-callbacks-handler), [rsi_bt_get_proto_type](driver14#rsi-bt-get-proto-type), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_cb_init (heading level 7)

`int8_t rsi_bt_cb_init(rsi_bt_cb_t *bt_cb, uint16_t protocol_type)`

**Description:** Initialize bt control block structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_cb|- Pointer to bt_cb structure|
|uint16_t|[in]|protocol_type|- Protocol type|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_bt_cb_s::app_buffer](rsi-bt-cb-s#app-buffer), [rsi_bt_cb_s::bt_cmd_sem](rsi-bt-cb-s#bt-cmd-sem), [rsi_bt_cb_s::bt_sem](rsi-bt-cb-s#bt-sem), [rsi_bt_cb_s::expected_response_buffer](rsi-bt-cb-s#expected-response-buffer), [rsi_bt_cb_s::expected_response_type](rsi-bt-cb-s#expected-response-type), [rsi_bt_clear_wait_bitmap](driver14#rsi-bt-clear-wait-bitmap), [rsi_semaphore_create](rsi-os-h#rsi-semaphore-create), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_cb_s::state](rsi-bt-cb-s#state) and [rsi_bt_cb_s::status](rsi-bt-cb-s#status)

###### rsi_bt_global_cb_init (heading level 7)

`uint16_t rsi_bt_global_cb_init(rsi_driver_cb_t *driver_cb, uint8_t *buffer)`

**Description:** Initialize bt global control block.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_driver_cb_t](rsi-driver-cb-s) *|[in]|driver_cb|- Pointer to bt_cb structure|
|uint8_t *|[in]|buffer|- Buffer|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_driver_cb_s::bt_global_cb](rsi-driver-cb-s#bt-global-cb), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb), [rsi_driver_cb_s::prop_protocol_cb](rsi-driver-cb-s#prop-protocol-cb), [rsi_bt_global_cb_s::prop_protocol_specific_cb](rsi-bt-global-cb-s#prop-protocol-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_common_init (heading level 7)

`void rsi_bt_common_init(void)`

**Description:** Wait for BT card ready.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_bt_cb_s::bt_sem](rsi-bt-cb-s#bt-sem), [rsi_bt_set_wait_bitmap](driver14#rsi-bt-set-wait-bitmap), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_gatt_extended_register_callbacks (heading level 7)

`void rsi_bt_gatt_extended_register_callbacks(rsi_bt_on_gatt_connection_t bt_on_gatt_connection_event, rsi_bt_on_gatt_disconnection_t bt_on_gatt_disconnection_event)`

**Description:** Register the GAP extended callbacks.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_bt_on_gatt_connection_t|[in]|bt_on_gatt_connection_event|- GATT Connection status callback|
|rsi_bt_on_gatt_disconnection_t|[in]|bt_on_gatt_disconnection_event|- GATT Disconnection status callback|

**Returns**

- void

**References:** [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_gatt_connection_event](rsi-bt-classic-cb-s#bt-on-gatt-connection-event), [rsi_bt_classic_cb_s::bt_on_gatt_disconnection_event](rsi-bt-classic-cb-s#bt-on-gatt-disconnection-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_callbacks_handler (heading level 7)

`void rsi_bt_callbacks_handler(rsi_bt_cb_t *bt_classic_cb, uint16_t rsp_type, uint8_t *payload, uint16_t payload_length)`

**Description:** Initailize the BT callbacks register.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|bt_classic_cb|- BT BLE struct pointer|
|uint16_t|[in]|rsp_type|- BT Packet type|
|uint8_t *|[in]|payload|- Payload|
|uint16_t|[in]|payload_length|- payload length|

**Returns**

- void

**References:** [rsi_bt_cb_s::async_status](rsi-bt-cb-s#async-status), [rsi_bt_classic_cb_s::bt_app_iap2_auth_complete](rsi-bt-classic-cb-s#bt-app-iap2-auth-complete), [rsi_bt_classic_cb_s::bt_app_iap2_auth_fail](rsi-bt-classic-cb-s#bt-app-iap2-auth-fail), [rsi_bt_classic_cb_s::bt_app_iap2_auth_start](rsi-bt-classic-cb-s#bt-app-iap2-auth-start), [rsi_bt_classic_cb_s::bt_app_iap2_File_Transfer_rx_data](rsi-bt-classic-cb-s#bt-app-iap2-file-transfer-rx-data), [rsi_bt_classic_cb_s::bt_app_iap2_File_Tx_state](rsi-bt-classic-cb-s#bt-app-iap2-file-tx-state), [rsi_bt_classic_cb_s::bt_app_iap2_identification_complete](rsi-bt-classic-cb-s#bt-app-iap2-identification-complete), [rsi_bt_classic_cb_s::bt_app_iap2_identification_reject](rsi-bt-classic-cb-s#bt-app-iap2-identification-reject), [rsi_bt_classic_cb_s::bt_app_iap2_identification_start](rsi-bt-classic-cb-s#bt-app-iap2-identification-start), [rsi_bt_classic_cb_s::bt_app_iap_acc_auth_complete](rsi-bt-classic-cb-s#bt-app-iap-acc-auth-complete), [rsi_bt_classic_cb_s::bt_app_iap_acc_auth_fail](rsi-bt-classic-cb-s#bt-app-iap-acc-auth-fail), [rsi_bt_classic_cb_s::bt_app_iap_acc_auth_strt](rsi-bt-classic-cb-s#bt-app-iap-acc-auth-strt), [rsi_bt_classic_cb_s::bt_app_iap_conn](rsi-bt-classic-cb-s#bt-app-iap-conn), [rsi_bt_classic_cb_s::bt_app_iap_disconn](rsi-bt-classic-cb-s#bt-app-iap-disconn), [rsi_bt_classic_cb_s::bt_app_on_iap2_data_rx](rsi-bt-classic-cb-s#bt-app-on-iap2-data-rx), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_bt_classic_cb_s::bt_on_a2dp_abort_event](rsi-bt-classic-cb-s#bt-on-a2dp-abort-event), [rsi_bt_classic_cb_s::bt_on_a2dp_close_event](rsi-bt-classic-cb-s#bt-on-a2dp-close-event), [rsi_bt_classic_cb_s::bt_on_a2dp_configure_event](rsi-bt-classic-cb-s#bt-on-a2dp-configure-event), [rsi_bt_classic_cb_s::bt_on_a2dp_connect_event](rsi-bt-classic-cb-s#bt-on-a2dp-connect-event), [rsi_bt_classic_cb_s::bt_on_a2dp_data_req_event](rsi-bt-classic-cb-s#bt-on-a2dp-data-req-event), [rsi_bt_classic_cb_s::bt_on_a2dp_disconnect_event](rsi-bt-classic-cb-s#bt-on-a2dp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_a2dp_encode_data_event](rsi-bt-classic-cb-s#bt-on-a2dp-encode-data-event), [rsi_bt_classic_cb_s::bt_on_a2dp_open_event](rsi-bt-classic-cb-s#bt-on-a2dp-open-event), [rsi_bt_classic_cb_s::bt_on_a2dp_pcm_data_event](rsi-bt-classic-cb-s#bt-on-a2dp-pcm-data-event), [rsi_bt_classic_cb_s::bt_on_a2dp_reconfig_event](rsi-bt-classic-cb-s#bt-on-a2dp-reconfig-event), [rsi_bt_classic_cb_s::bt_on_a2dp_start_event](rsi-bt-classic-cb-s#bt-on-a2dp-start-event), [rsi_bt_classic_cb_s::bt_on_a2dp_suspend_event](rsi-bt-classic-cb-s#bt-on-a2dp-suspend-event), [rsi_bt_classic_cb_s::bt_on_ar_stats_event](rsi-bt-classic-cb-s#bt-on-ar-stats-event), [rsi_bt_classic_cb_s::bt_on_auth_complete_event](rsi-bt-classic-cb-s#bt-on-auth-complete-event), [rsi_bt_classic_cb_s::bt_on_avdtp_stats_event](rsi-bt-classic-cb-s#bt-on-avdtp-stats-event), [rsi_bt_classic_cb_s::bt_on_avrcp_batt_status](rsi-bt-classic-cb-s#bt-on-avrcp-batt-status), [rsi_bt_classic_cb_s::bt_on_avrcp_connect_event](rsi-bt-classic-cb-s#bt-on-avrcp-connect-event), [rsi_bt_classic_cb_s::bt_on_avrcp_disconnect_event](rsi-bt-classic-cb-s#bt-on-avrcp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_avrcp_gat_cap](rsi-bt-classic-cb-s#bt-on-avrcp-gat-cap), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_list](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-list), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_text](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-text), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_vals_list](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-vals-list), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_att_vals_text](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-att-vals-text), [rsi_bt_classic_cb_s::bt_on_avrcp_get_app_cur_att_val](rsi-bt-classic-cb-s#bt-on-avrcp-get-app-cur-att-val), [rsi_bt_classic_cb_s::bt_on_avrcp_get_elem_attr_resp_event](rsi-bt-classic-cb-s#bt-on-avrcp-get-elem-attr-resp-event), [rsi_bt_classic_cb_s::bt_on_avrcp_get_folder_items](rsi-bt-classic-cb-s#bt-on-avrcp-get-folder-items), [rsi_bt_classic_cb_s::bt_on_avrcp_get_player_status](rsi-bt-classic-cb-s#bt-on-avrcp-get-player-status), [rsi_bt_classic_cb_s::bt_on_avrcp_get_song_atts](rsi-bt-classic-cb-s#bt-on-avrcp-get-song-atts), [rsi_bt_classic_cb_s::bt_on_avrcp_get_tot_num_items](rsi-bt-classic-cb-s#bt-on-avrcp-get-tot-num-items), [rsi_bt_classic_cb_s::bt_on_avrcp_next_event](rsi-bt-classic-cb-s#bt-on-avrcp-next-event), [rsi_bt_classic_cb_s::bt_on_avrcp_notify_event](rsi-bt-classic-cb-s#bt-on-avrcp-notify-event), [rsi_bt_classic_cb_s::bt_on_avrcp_pause_event](rsi-bt-classic-cb-s#bt-on-avrcp-pause-event), [rsi_bt_classic_cb_s::bt_on_avrcp_play_event](rsi-bt-classic-cb-s#bt-on-avrcp-play-event), [rsi_bt_classic_cb_s::bt_on_avrcp_previous_event](rsi-bt-classic-cb-s#bt-on-avrcp-previous-event), [rsi_bt_classic_cb_s::bt_on_avrcp_reg_notifivation](rsi-bt-classic-cb-s#bt-on-avrcp-reg-notifivation), [rsi_bt_classic_cb_s::bt_on_avrcp_set_abs_vol](rsi-bt-classic-cb-s#bt-on-avrcp-set-abs-vol), [rsi_bt_classic_cb_s::bt_on_avrcp_set_addr_player](rsi-bt-classic-cb-s#bt-on-avrcp-set-addr-player), [rsi_bt_classic_cb_s::bt_on_avrcp_set_app_cur_att_val](rsi-bt-classic-cb-s#bt-on-avrcp-set-app-cur-att-val), [rsi_bt_classic_cb_s::bt_on_avrcp_stop_event](rsi-bt-classic-cb-s#bt-on-avrcp-stop-event), [rsi_bt_classic_cb_s::bt_on_avrcp_supp_char_sets](rsi-bt-classic-cb-s#bt-on-avrcp-supp-char-sets), [rsi_bt_classic_cb_s::bt_on_avrcp_vol_down_event](rsi-bt-classic-cb-s#bt-on-avrcp-vol-down-event), [rsi_bt_classic_cb_s::bt_on_avrcp_vol_up_event](rsi-bt-classic-cb-s#bt-on-avrcp-vol-up-event), [rsi_bt_classic_cb_s::bt_on_chip_memory_stats_event](rsi-bt-classic-cb-s#bt-on-chip-memory-stats-event), [rsi_bt_classic_cb_s::bt_on_confirm_request_event](rsi-bt-classic-cb-s#bt-on-confirm-request-event), [rsi_bt_classic_cb_s::bt_on_conn_status_event](rsi-bt-classic-cb-s#bt-on-conn-status-event), [rsi_bt_classic_cb_s::bt_on_connection_initiated](rsi-bt-classic-cb-s#bt-on-connection-initiated), [rsi_bt_classic_cb_s::bt_on_ctkd_event](rsi-bt-classic-cb-s#bt-on-ctkd-event), [rsi_bt_classic_cb_s::bt_on_disconnect_event](rsi-bt-classic-cb-s#bt-on-disconnect-event), [rsi_bt_classic_cb_s::bt_on_gatt_connection_event](rsi-bt-classic-cb-s#bt-on-gatt-connection-event), [rsi_bt_classic_cb_s::bt_on_gatt_disconnection_event](rsi-bt-classic-cb-s#bt-on-gatt-disconnection-event), [rsi_bt_classic_cb_s::bt_on_get_services_event](rsi-bt-classic-cb-s#bt-on-get-services-event), [rsi_bt_classic_cb_s::bt_on_hfp_answercomplete_event](rsi-bt-classic-cb-s#bt-on-hfp-answercomplete-event), [rsi_bt_classic_cb_s::bt_on_hfp_audio_codecselect_event](rsi-bt-classic-cb-s#bt-on-hfp-audio-codecselect-event), [rsi_bt_classic_cb_s::bt_on_hfp_audioconnected_event](rsi-bt-classic-cb-s#bt-on-hfp-audioconnected-event), [rsi_bt_classic_cb_s::bt_on_hfp_audiodisconnected_event](rsi-bt-classic-cb-s#bt-on-hfp-audiodisconnected-event), [rsi_bt_classic_cb_s::bt_on_hfp_batterylevel_event](rsi-bt-classic-cb-s#bt-on-hfp-batterylevel-event), [rsi_bt_classic_cb_s::bt_on_hfp_callcallerid_event](rsi-bt-classic-cb-s#bt-on-hfp-callcallerid-event), [rsi_bt_classic_cb_s::bt_on_hfp_callheld_event](rsi-bt-classic-cb-s#bt-on-hfp-callheld-event), [rsi_bt_classic_cb_s::bt_on_hfp_callsetup_event](rsi-bt-classic-cb-s#bt-on-hfp-callsetup-event), [rsi_bt_classic_cb_s::bt_on_hfp_callstatus_event](rsi-bt-classic-cb-s#bt-on-hfp-callstatus-event), [rsi_bt_classic_cb_s::bt_on_hfp_callvoicerecogactivated_event](rsi-bt-classic-cb-s#bt-on-hfp-callvoicerecogactivated-event), [rsi_bt_classic_cb_s::bt_on_hfp_callvoicerecogdeactivated_event](rsi-bt-classic-cb-s#bt-on-hfp-callvoicerecogdeactivated-event), [rsi_bt_classic_cb_s::bt_on_hfp_callwait_event](rsi-bt-classic-cb-s#bt-on-hfp-callwait-event), [rsi_bt_classic_cb_s::bt_on_hfp_connect_event](rsi-bt-classic-cb-s#bt-on-hfp-connect-event), [rsi_bt_classic_cb_s::bt_on_hfp_dialcomplete_event](rsi-bt-classic-cb-s#bt-on-hfp-dialcomplete-event), [rsi_bt_classic_cb_s::bt_on_hfp_disconnect_event](rsi-bt-classic-cb-s#bt-on-hfp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_hfp_hangupcomplete_event](rsi-bt-classic-cb-s#bt-on-hfp-hangupcomplete-event), [rsi_bt_classic_cb_s::bt_on_hfp_phoneservice_event](rsi-bt-classic-cb-s#bt-on-hfp-phoneservice-event), [rsi_bt_classic_cb_s::bt_on_hfp_ring_event](rsi-bt-classic-cb-s#bt-on-hfp-ring-event), [rsi_bt_classic_cb_s::bt_on_hfp_roamingstatus_event](rsi-bt-classic-cb-s#bt-on-hfp-roamingstatus-event), [rsi_bt_classic_cb_s::bt_on_hfp_senddtmfcomplete_event](rsi-bt-classic-cb-s#bt-on-hfp-senddtmfcomplete-event), [rsi_bt_classic_cb_s::bt_on_hfp_servicenotfound_event](rsi-bt-classic-cb-s#bt-on-hfp-servicenotfound-event), [rsi_bt_classic_cb_s::bt_on_hfp_signalstrength_event](rsi-bt-classic-cb-s#bt-on-hfp-signalstrength-event), [rsi_bt_classic_cb_s::bt_on_hfp_voice_data_event](rsi-bt-classic-cb-s#bt-on-hfp-voice-data-event), [rsi_bt_classic_cb_s::bt_on_hid_connect_event](rsi-bt-classic-cb-s#bt-on-hid-connect-event), [rsi_bt_classic_cb_s::bt_on_hid_control_event](rsi-bt-classic-cb-s#bt-on-hid-control-event), [rsi_bt_classic_cb_s::bt_on_hid_get_proto](rsi-bt-classic-cb-s#bt-on-hid-get-proto), [rsi_bt_classic_cb_s::bt_on_hid_get_report](rsi-bt-classic-cb-s#bt-on-hid-get-report), [rsi_bt_classic_cb_s::bt_on_hid_handshake_event](rsi-bt-classic-cb-s#bt-on-hid-handshake-event), [rsi_bt_classic_cb_s::bt_on_hid_rx_data_event](rsi-bt-classic-cb-s#bt-on-hid-rx-data-event), [rsi_bt_classic_cb_s::bt_on_hid_set_proto](rsi-bt-classic-cb-s#bt-on-hid-set-proto), [rsi_bt_classic_cb_s::bt_on_hid_set_report](rsi-bt-classic-cb-s#bt-on-hid-set-report), [rsi_bt_classic_cb_s::bt_on_inquiry_complete_event](rsi-bt-classic-cb-s#bt-on-inquiry-complete-event), [rsi_bt_classic_cb_s::bt_on_l2cap_connect_event](rsi-bt-classic-cb-s#bt-on-l2cap-connect-event), [rsi_bt_classic_cb_s::bt_on_l2cap_rx_data_event](rsi-bt-classic-cb-s#bt-on-l2cap-rx-data-event), [rsi_bt_classic_cb_s::bt_on_linkkey_request_event](rsi-bt-classic-cb-s#bt-on-linkkey-request-event), [rsi_bt_classic_cb_s::bt_on_linkkey_save_event](rsi-bt-classic-cb-s#bt-on-linkkey-save-event), [rsi_bt_classic_cb_s::bt_on_mode_change_event](rsi-bt-classic-cb-s#bt-on-mode-change-event), [rsi_bt_classic_cb_s::bt_on_passkey_display_event](rsi-bt-classic-cb-s#bt-on-passkey-display-event), [rsi_bt_classic_cb_s::bt_on_passkey_request_event](rsi-bt-classic-cb-s#bt-on-passkey-request-event), [rsi_bt_classic_cb_s::bt_on_pbap_connect_event](rsi-bt-classic-cb-s#bt-on-pbap-connect-event), [rsi_bt_classic_cb_s::bt_on_pbap_data_event](rsi-bt-classic-cb-s#bt-on-pbap-data-event), [rsi_bt_classic_cb_s::bt_on_pbap_disconnect_event](rsi-bt-classic-cb-s#bt-on-pbap-disconnect-event), [rsi_bt_classic_cb_s::bt_on_pincode_request_event](rsi-bt-classic-cb-s#bt-on-pincode-request-event), [rsi_bt_classic_cb_s::bt_on_remote_name_request_cancel_event](rsi-bt-classic-cb-s#bt-on-remote-name-request-cancel-event), [rsi_bt_classic_cb_s::bt_on_remote_name_resp_event](rsi-bt-classic-cb-s#bt-on-remote-name-resp-event), [rsi_bt_classic_cb_s::bt_on_role_change_status_event](rsi-bt-classic-cb-s#bt-on-role-change-status-event), [rsi_bt_classic_cb_s::bt_on_scan_resp_event](rsi-bt-classic-cb-s#bt-on-scan-resp-event), [rsi_bt_classic_cb_s::bt_on_search_service_event](rsi-bt-classic-cb-s#bt-on-search-service-event), [rsi_bt_classic_cb_s::bt_on_sniff_subrating_event](rsi-bt-classic-cb-s#bt-on-sniff-subrating-event), [rsi_bt_classic_cb_s::bt_on_spp_connect_event](rsi-bt-classic-cb-s#bt-on-spp-connect-event), [rsi_bt_classic_cb_s::bt_on_spp_disconnect_event](rsi-bt-classic-cb-s#bt-on-spp-disconnect-event), [rsi_bt_classic_cb_s::bt_on_spp_rx_data_event](rsi-bt-classic-cb-s#bt-on-spp-rx-data-event), [rsi_bt_classic_cb_s::bt_on_ssp_complete_event](rsi-bt-classic-cb-s#bt-on-ssp-complete-event), [rsi_bt_classic_cb_s::bt_on_unbond_status](rsi-bt-classic-cb-s#bt-on-unbond-status), [rsi_bt_classic_cb_s::bt_pkt_change_stats_event](rsi-bt-classic-cb-s#bt-pkt-change-stats-event), [rsi_bt_global_cb_s::bt_specific_cb](rsi-bt-global-cb-s#bt-specific-cb), [rsi_driver_cb_non_rom::common_cmd_sem](rsi-driver-cb-non-rom#common-cmd-sem), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_bt_event_hid_receive_s::data](rsi-bt-event-hid-receive-s#data), [rsi_bt_get_status](driver14#rsi-bt-get-status), [rsi_common_set_status](common#rsi-common-set-status), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_non_rom_s::switch_proto_callback](rsi-wlan-cb-non-rom-s#switch-proto-callback) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler)

###### rsi_ble_callbacks_handler (heading level 7)

`void rsi_ble_callbacks_handler(rsi_bt_cb_t *ble_cb, uint16_t rsp_type, uint8_t *payload, uint16_t payload_length)`

**Description:** Initailize the BT callbacks register.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_bt_cb_t](rsi-bt-cb-s) *|[in]|ble_cb|- BLE control back|
|uint16_t|[in]|rsp_type|- BLE Packet type|
|uint8_t *|[in]|payload|- Payload|
|uint16_t|[in]|payload_length|- Payload length|

**Returns**

- void

**References:** [rsi_bt_cb_s::async_status](rsi-bt-cb-s#async-status), [rsi_ble_cb_s::ble_ae_adv_set_terminated_event](rsi-ble-cb-s#ble-ae-adv-set-terminated-event), [rsi_ble_cb_s::ble_ae_per_adv_report_event](rsi-ble-cb-s#ble-ae-per-adv-report-event), [rsi_ble_cb_s::ble_ae_per_adv_sync_estbl_event](rsi-ble-cb-s#ble-ae-per-adv-sync-estbl-event), [rsi_ble_cb_s::ble_ae_per_adv_sync_lost_event](rsi-ble-cb-s#ble-ae-per-adv-sync-lost-event), [rsi_ble_cb_s::ble_ae_report_complete_event](rsi-ble-cb-s#ble-ae-report-complete-event), [rsi_ble_cb_s::ble_ae_scan_req_recvd_event](rsi-ble-cb-s#ble-ae-scan-req-recvd-event), [rsi_ble_cb_s::ble_ae_scan_timeout_event](rsi-ble-cb-s#ble-ae-scan-timeout-event), [rsi_ble_cb_s::ble_on_adv_report_event](rsi-ble-cb-s#ble-on-adv-report-event), [rsi_ble_cb_s::ble_on_att_desc_resp](rsi-ble-cb-s#ble-on-att-desc-resp), [rsi_ble_cb_s::ble_on_cbfc_conn_complete_event](rsi-ble-cb-s#ble-on-cbfc-conn-complete-event), [rsi_ble_cb_s::ble_on_cbfc_conn_req_event](rsi-ble-cb-s#ble-on-cbfc-conn-req-event), [rsi_ble_cb_s::ble_on_cbfc_disconn_event](rsi-ble-cb-s#ble-on-cbfc-disconn-event), [rsi_ble_cb_s::ble_on_cbfc_rx_data_event](rsi-ble-cb-s#ble-on-cbfc-rx-data-event), [rsi_ble_cb_s::ble_on_char_services_resp](rsi-ble-cb-s#ble-on-char-services-resp), [rsi_ble_cb_s::ble_on_chip_memory_status_event](rsi-ble-cb-s#ble-on-chip-memory-status-event), [rsi_ble_cb_s::ble_on_cli_smp_response_event](rsi-ble-cb-s#ble-on-cli-smp-response-event), [rsi_ble_cb_s::ble_on_conn_status_event](rsi-ble-cb-s#ble-on-conn-status-event), [rsi_ble_cb_s::ble_on_conn_update_complete_event](rsi-ble-cb-s#ble-on-conn-update-complete-event), [rsi_ble_cb_s::ble_on_directed_adv_report_event](rsi-ble-cb-s#ble-on-directed-adv-report-event), [rsi_ble_cb_s::ble_on_disconnect_event](rsi-ble-cb-s#ble-on-disconnect-event), [rsi_ble_cb_s::ble_on_enhance_conn_status_event](rsi-ble-cb-s#ble-on-enhance-conn-status-event), [rsi_ble_cb_s::ble_on_execute_write_event](rsi-ble-cb-s#ble-on-execute-write-event), [rsi_ble_cb_s::ble_on_gatt_desc_val_resp_event](rsi-ble-cb-s#ble-on-gatt-desc-val-resp-event), [rsi_ble_cb_s::ble_on_gatt_error_resp_event](rsi-ble-cb-s#ble-on-gatt-error-resp-event), [rsi_ble_cb_s::ble_on_gatt_events](rsi-ble-cb-s#ble-on-gatt-events), [rsi_ble_cb_s::ble_on_inc_services_resp](rsi-ble-cb-s#ble-on-inc-services-resp), [rsi_ble_cb_s::ble_on_indicate_confirmation_event](rsi-ble-cb-s#ble-on-indicate-confirmation-event), [rsi_ble_cb_s::ble_on_le_ltk_req_event](rsi-ble-cb-s#ble-on-le-ltk-req-event), [rsi_ble_cb_s::ble_on_le_more_data_req_event](rsi-ble-cb-s#ble-on-le-more-data-req-event), [rsi_ble_cb_s::ble_on_le_ping_time_expired_event](rsi-ble-cb-s#ble-on-le-ping-time-expired-event), [rsi_ble_cb_s::ble_on_le_security_keys_event](rsi-ble-cb-s#ble-on-le-security-keys-event), [rsi_ble_cb_s::ble_on_mtu_event](rsi-ble-cb-s#ble-on-mtu-event), [rsi_ble_cb_s::ble_on_mtu_exchange_info_event](rsi-ble-cb-s#ble-on-mtu-exchange-info-event), [rsi_ble_cb_s::ble_on_phy_update_complete_event](rsi-ble-cb-s#ble-on-phy-update-complete-event), [rsi_ble_cb_s::ble_on_prepare_write_event](rsi-ble-cb-s#ble-on-prepare-write-event), [rsi_ble_cb_s::ble_on_prepare_write_resp_event](rsi-ble-cb-s#ble-on-prepare-write-resp-event), [rsi_ble_cb_s::ble_on_profile_by_uuid_event](rsi-ble-cb-s#ble-on-profile-by-uuid-event), [rsi_ble_cb_s::ble_on_profile_resp](rsi-ble-cb-s#ble-on-profile-resp), [rsi_ble_cb_s::ble_on_profiles_list_event](rsi-ble-cb-s#ble-on-profiles-list-event), [rsi_ble_cb_s::ble_on_profiles_list_resp](rsi-ble-cb-s#ble-on-profiles-list-resp), [rsi_ble_cb_s::ble_on_rcp_resp_rcvd_event](rsi-ble-cb-s#ble-on-rcp-resp-rcvd-event), [rsi_ble_cb_s::ble_on_read_att_value_event](rsi-ble-cb-s#ble-on-read-att-value-event), [rsi_ble_cb_s::ble_on_read_by_char_services_event](rsi-ble-cb-s#ble-on-read-by-char-services-event), [rsi_ble_cb_s::ble_on_read_by_inc_services_event](rsi-ble-cb-s#ble-on-read-by-inc-services-event), [rsi_ble_cb_s::ble_on_read_req_event](rsi-ble-cb-s#ble-on-read-req-event), [rsi_ble_cb_s::ble_on_read_resp](rsi-ble-cb-s#ble-on-read-resp), [rsi_ble_cb_s::ble_on_read_resp_event](rsi-ble-cb-s#ble-on-read-resp-event), [rsi_ble_cb_s::ble_on_remote_conn_params_request_event](rsi-ble-cb-s#ble-on-remote-conn-params-request-event), [rsi_ble_cb_s::ble_on_remote_device_info_event](rsi-ble-cb-s#ble-on-remote-device-info-event), [rsi_ble_cb_s::ble_on_remote_features_event](rsi-ble-cb-s#ble-on-remote-features-event), [rsi_ble_cb_s::ble_on_sc_method_event](rsi-ble-cb-s#ble-on-sc-method-event), [rsi_ble_cb_s::ble_on_sc_passkey](rsi-ble-cb-s#ble-on-sc-passkey), [rsi_ble_cb_s::ble_on_smp_encrypt_started](rsi-ble-cb-s#ble-on-smp-encrypt-started), [rsi_ble_cb_s::ble_on_smp_fail_event](rsi-ble-cb-s#ble-on-smp-fail-event), [rsi_ble_cb_s::ble_on_smp_passkey_display](rsi-ble-cb-s#ble-on-smp-passkey-display), [rsi_ble_cb_s::ble_on_smp_passkey_event](rsi-ble-cb-s#ble-on-smp-passkey-event), [rsi_ble_cb_s::ble_on_smp_request_event](rsi-ble-cb-s#ble-on-smp-request-event), [rsi_ble_cb_s::ble_on_smp_response_event](rsi-ble-cb-s#ble-on-smp-response-event), [rsi_ble_cb_s::ble_on_write_resp](rsi-ble-cb-s#ble-on-write-resp), [rsi_ble_cb_s::ble_on_write_resp_event](rsi-ble-cb-s#ble-on-write-resp-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb), [rsi_remote_ble_info_s::cmd_in_use](rsi-remote-ble-info-s#cmd-in-use), [rsi_remote_ble_info_s::expected_resp](rsi-remote-ble-info-s#expected-resp), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_remote_ble_info_s::remote_dev_bd_addr](rsi-remote-ble-info-s#remote-dev-bd-addr), [rsi_add_remote_ble_dev_info](driver14#rsi-add-remote-ble-dev-info), [rsi_ble_cb_s::rsi_ble_on_data_length_update_event](rsi-ble-cb-s#rsi-ble-on-data-length-update-event), [rsi_ble_update_le_dev_buf](driver14#rsi-ble-update-le-dev-buf), [rsi_bt_get_status](driver14#rsi-bt-get-status), [rsi_remove_remote_ble_dev_info](driver14#rsi-remove-remote-ble-dev-info), [SL_PRINTF](bt-classic1#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler)

###### rsi_ble_on_chip_memory_status_callbacks_register (heading level 7)

`void rsi_ble_on_chip_memory_status_callbacks_register(chip_ble_buffers_stats_handler_t ble_on_chip_memory_status_event)`

**Description:** Chip memory status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|chip_ble_buffers_stats_handler_t|[in]|ble_on_chip_memory_status_event|- Memory status|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_ble_cb_s::ble_on_chip_memory_status_event](rsi-ble-cb-s#ble-on-chip-memory-status-event), [rsi_bt_global_cb_s::ble_specific_cb](rsi-bt-global-cb-s#ble-specific-cb), [rsi_bt_cb_s::bt_global_cb](rsi-bt-cb-s#bt-global-cb) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bt_prepare_common_pkt (heading level 7)

`uint16_t rsi_bt_prepare_common_pkt(uint16_t cmd_type, void *cmd_struct, rsi_pkt_t *pkt)`

**Description:** Form the payload of the BT command packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|cmd_type|- Type of the command|
|void *|[in]|cmd_struct|- Pointer of the command structure|
|[rsi_pkt_t](rsi-pkt-s) *|[out]|pkt|- Pointer of the packet to fill the contents of the payload|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_pkt_s::data](rsi-pkt-s#data), [memcpy](bt-classic1#memcpy), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_cb_s::state](rsi-bt-cb-s#state)

###### rsi_bt_prepare_classic_pkt (heading level 7)

`uint16_t rsi_bt_prepare_classic_pkt(uint16_t cmd_type, void *cmd_struct, rsi_pkt_t *pkt)`

**Description:** Fill the BT Classic command packet payload.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|cmd_type|- Type of the command|
|void *|[in]|cmd_struct|- Pointer of the command structure|
|[rsi_pkt_t](rsi-pkt-s) *|[out]|pkt|- Pointer of the packet to fill the contents of the payload|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [attr_list_s::attr_len](attr-list-s#attr-len), [elem_attr_list_s::attr_list](elem-attr-list-s#attr-list), [attr_list_s::attr_val](attr-list-s#attr-val), [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [attr_list_s::char_set_id](attr-list-s#char-set-id), [rsi_bt_iap_payload_s::data](rsi-bt-iap-payload-s#data), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_bt_avrcp_elem_attr_resp_s::elem_attr_list](rsi-bt-avrcp-elem-attr-resp-s#elem-attr-list), [attr_list_s::id](attr-list-s#id), [rsi_bt_hid_profile_data_s::len](rsi-bt-hid-profile-data-s#len), [rsi_bt_iap_payload_s::len](rsi-bt-iap-payload-s#len), [memcpy](bt-classic1#memcpy), [elem_attr_list_s::num_attrs](elem-attr-list-s#num-attrs), [pcm_mp3_data_len](bt-classic1#pcm-mp3-data-len), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_bt_cb_s::sync_rsp](rsi-bt-cb-s#sync-rsp)

###### rsi_bt_prepare_le_pkt (heading level 7)

`uint16_t rsi_bt_prepare_le_pkt(uint16_t cmd_type, void *cmd_struct, rsi_pkt_t *pkt)`

**Description:** Form the payload of the BT Classic command packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|cmd_type|- Type of the command|
|void *|[in]|cmd_struct|- Pointer of the command structure|
|[rsi_pkt_t](rsi-pkt-s) *|[out]|pkt|- Pointer of the packet to fill the contents of the payload|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_remote_ble_info_s::avail_buf_cnt](rsi-remote-ble-info-s#avail-buf-cnt), [rsi_remote_ble_info_s::ble_buff_mutex](rsi-remote-ble-info-s#ble-buff-mutex), [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_bt_cb_s::buf_status](rsi-bt-cb-s#buf-status), [rsi_remote_ble_info_s::cmd_in_use](rsi-remote-ble-info-s#cmd-in-use), [rsi_bt_cb_s::cmd_status](rsi-bt-cb-s#cmd-status), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_remote_ble_info_s::expected_resp](rsi-remote-ble-info-s#expected-resp), [rsi_remote_ble_info_s::max_buf_cnt](rsi-remote-ble-info-s#max-buf-cnt), [memcpy](bt-classic1#memcpy), [rsi_ble_req_rand_s::rand_addr](rsi-ble-req-rand-s#rand-addr), [rsi_bt_cb_s::remote_ble_index](rsi-bt-cb-s#remote-ble-index), [rsi_bt_cb_s::remote_ble_info](rsi-bt-cb-s#remote-ble-info), [rsi_remote_ble_info_s::remote_dev_bd_addr](rsi-remote-ble-info-s#remote-dev-bd-addr), [rsi_ascii_dev_address_to_6bytes_rev](bt-classic1#rsi-ascii-dev-address-to-6bytes-rev), [rsi_mutex_lock](rsi-os-h#rsi-mutex-lock), [rsi_mutex_unlock](rsi-os-h#rsi-mutex-unlock), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_cb_s::state](rsi-bt-cb-s#state) and [rsi_bt_cb_s::sync_rsp](rsi-bt-cb-s#sync-rsp)

###### rsi_bt_driver_send_cmd (heading level 7)

`int32_t rsi_bt_driver_send_cmd(uint16_t cmd, void *cmd_struct, void *resp)`

**Description:** Fill commands and places into Bt TX queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|cmd|- Type of the command to send|
|void *|[in]|cmd_struct|- Pointer of the packet structure to send|
|void *|[in]|resp|- Pointer of the packet to fill the contents of the payload|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_bt_cb_s::bt_cmd_sem](rsi-bt-cb-s#bt-cmd-sem), [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_bt_clear_wait_bitmap](driver14#rsi-bt-clear-wait-bitmap), [rsi_bt_get_proto_type](driver14#rsi-bt-get-proto-type), [rsi_bt_get_timeout](driver14#rsi-bt-get-timeout), [rsi_bt_set_wait_bitmap](driver14#rsi-bt-set-wait-bitmap), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_bt_cb_s::state](rsi-bt-cb-s#state) and [rsi_common_cb_s::state](rsi-common-cb-s#state)

###### intialize_bt_stack (heading level 7)

`int32_t intialize_bt_stack(uint8_t mode)`

**Description:** Initialize bt stack.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|- Mode|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [SL_PRINTF](bt-classic1#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

##### Device interface APIs

###### Modules

[SDIO](driver1)

[SPI](driver2)

[UART](driver3)

###### SDIO

###### Functions (heading level 7)

###### rsi_frame_read (heading level 8)

`int16_t rsi_frame_read(uint8_t *read_buff)`

**Description:** This API reads the frame from the host interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|read_buff|- The frame contents read from the host interface are populated to this buffer.|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_rd](driver1#rsi-reg-rd) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_frame_write (heading level 8)

`int16 rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame, uint8_t *payloadparam, uint16_t size_param)`

**Description:** This API writes the frame to the host interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_frame_desc_t](rsi-frame-desc-s) *|[in]|uFrameDscFrame|uFrameDscFrame, frame descriptor|
|uint8_t *|[in]|payloadparam|*payloadparam, pointer to the command payload parameter structure|
|uint16_t|[in]|size_param|size_param, size of the payload for the command|

Common function for all the commands.

**Returns**

- 0 - Success <br />
- Negative value - Failure <br />

**Returns**

- Negative Value = Failure 0 = SUCCESS

###### description (heading level 7)

This is a common function used to process a command to the Wi-Fi module. 

**References:** [rsi_frame_desc_s::frame_len_queue_no](rsi-frame-desc-s#frame-len-queue-no), [RSI_SUCCESS](bt-classic1#rsi-success) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_sdio_iface_init (heading level 8)

`int16_t rsi_sdio_iface_init(void)`

**Description:** Initialize the RS9116 SDIO secondary device interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_reg_wr](driver1#rsi-reg-wr), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_sdio_deinit (heading level 8)

`void rsi_sdio_deinit(void)`

**Description:** This API deinitializes SDIO host interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

###### rsi_mem_wr (heading level 8)

`int16_t rsi_mem_wr(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** This API writes contents of dBuf buffer to the device memory address addr for the length len.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Device memory address.|
|uint16_t|[in]|len|- Length of the buffer.|
|uint8_t *|[in]|dBuf|- Data present in this buffer|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_wr](driver1#rsi-reg-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_bl_select_option](driver6#rsi-bl-select-option), [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_clear_interrupt](driver2#rsi-clear-interrupt), [rsi_gpio_read](common#rsi-gpio-read), [rsi_gpio_write](common#rsi-gpio-write), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_set_fast_fw_up](driver5#rsi-set-fast-fw-up), [rsi_set_intr_mask](driver2#rsi-set-intr-mask) and [rsi_set_intr_type](driver2#rsi-set-intr-type)

###### rsi_mem_rd (heading level 8)

`int16_t rsi_mem_rd(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** This API reads the device memory contents present at the address addr into the dBuf buffer for the length len.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Device memory address.|
|uint16_t|[in]|len|- Length of the buffer.|
|uint8_t *|[in]|dBuf|- Destination buffer.|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_wr](driver1#rsi-reg-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_get_ram_dump](common#rsi-get-ram-dump), [rsi_gpio_read](common#rsi-gpio-read), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_set_fast_fw_up](driver5#rsi-set-fast-fw-up) and [rsi_set_intr_type](driver2#rsi-set-intr-type)

###### rsi_device_interrupt_status (heading level 8)

`int16_t rsi_device_interrupt_status(uint8_t *int_status)`

**Description:** This API reads the status register of the host interface layer to validate the interrupt received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|int_status|- Pointer to the buffer of data to be read, assumed to be at least a byte|

Read the USB device status.

**Returns**

- 0 - Success <br />
- Non-zero value - Failure (**Possible Error Codes** - 0xffffffd0, ) <br />

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_rd](driver1#rsi-reg-rd)

**Referenced by:** [rsi_rx_event_handler](driver5#rsi-rx-event-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_reg_rd (heading level 8)

`int16_t rsi_reg_rd(uint8_t regAddr, uint8_t *dBuf)`

**Description:** This API reads the content of the host interface register regAddr to the buffer dBuf.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|regAddr|- Host interface.|
|uint8_t *|[in]|dBuf|- Buffer.|

**Returns**

- 0 - Success <br />

**Referenced by:** [rsi_device_interrupt_status](driver1#rsi-device-interrupt-status) and [rsi_frame_read](driver1#rsi-frame-read)

###### rsi_reg_wr (heading level 8)

`int16_t rsi_reg_wr(uint8_t regAddr, uint8_t *dBuf)`

**Description:** This API writes the content provided by dBuf to the host interface register regAddr.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|regAddr|- Destination address.|
|uint8_t *|[in]|dBuf|- Buffer with the content to be written to the register.|

**Returns**

- 0 - Success <br />

**Referenced by:** [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr), [rsi_sdio_iface_init](driver1#rsi-sdio-iface-init) and [rsi_spi_high_speed_enable](driver2#rsi-spi-high-speed-enable)

###### SPI

###### Functions (heading level 7)

###### rsi_frame_read (heading level 8)

`int16_t rsi_frame_read(uint8_t *pkt_buffer)`

**Description:** Read response for every command and data sent from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|pkt_buffer|- pointer to buffer to which packet has to be read|

This API reads the frame from the host interface.

**Returns**

- 0 - Success <br />
- Non-Zero Failure - Failure <br />

**Note**

- Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload.

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_pkt_rd](driver2#rsi-pkt-rd), [rsi_pre_dsc_rd](driver2#rsi-pre-dsc-rd) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_frame_write (heading level 8)

`int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame, uint8_t *payloadparam, uint16_t size_param)`

**Description:** Process a command to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_frame_desc_t](rsi-frame-desc-s) *|[in]|uFrameDscFrame|- Frame descriptor|
|uint8_t *|[in]|payloadparam|- Pointer to the command payload parameter structure|
|uint16_t|[in]|size_param|- Size of the payload for the command|

This API writes the frame to the host interface.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**Note**

- Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload. <br />

**References:** [rsi_spi_frame_data_wr](driver2#rsi-spi-frame-data-wr), [rsi_spi_frame_dsc_wr](driver2#rsi-spi-frame-dsc-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_pre_dsc_rd (heading level 8)

`int16_t rsi_pre_dsc_rd(uint8_t *dbuf)`

**Description:** Read a pre-frame descriptor.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dbuf|- Pointer to the buffer into which pre-decriptor has to be read|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4), [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_frame_read](driver2#rsi-frame-read)

###### rsi_pkt_rd (heading level 8)

`int16_t rsi_pkt_rd(uint8_t *buf, uint16_t dummy_len, uint16_t total_len)`

**Description:** Read frame descriptor and payload.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|buf|- Pointer to the buffer into which decriptor and payload has to be read|
|uint16_t|[in]|dummy_len|- Number of dummy bytes which can be discarded|
|uint16_t|[in]|total_len|- Number of bytes to be read|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4), [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_frame_read](driver2#rsi-frame-read)

###### rsi_spi_frame_dsc_wr (heading level 8)

`int16_t rsi_spi_frame_dsc_wr(rsi_frame_desc_t *uFrameDscFrame)`

**Description:** Write the frame descriptor.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_frame_desc_t](rsi-frame-desc-s) *|[in]|uFrameDscFrame|- Frame descriptor|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_frame_desc_s::frame_len_queue_no](rsi-frame-desc-s#frame-len-queue-no), [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_frame_write](driver2#rsi-frame-write) and [rsi_secure_ping_pong_wr](driver5#rsi-secure-ping-pong-wr)

###### rsi_spi_frame_data_wr (heading level 8)

`int16_t rsi_spi_frame_data_wr(uint16_t bufLen, uint8_t *dBuf, uint16_t tbufLen, uint8_t *tBuf)`

**Description:** Write frame data.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|bufLen|- Length of the data buffer to write|
|uint8_t *|[in]|dBuf|- Pointer to the buffer of data to write|
|uint16_t|[in]|tbufLen|- Length of the data fragment to write|
|uint8_t *|[in]|tBuf|- Pointer to the buffer of data fragment to write|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_frame_write](driver2#rsi-frame-write) and [rsi_secure_ping_pong_wr](driver5#rsi-secure-ping-pong-wr)

###### rsi_send_c1c2 (heading level 8)

`int16_t rsi_send_c1c2(uint8_t c1, uint8_t c2)`

**Description:** Send the C1 and C2 commands. Check response for C1 command, if busy, should retry.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|c1|- SPI c1 command|
|uint8_t|[in]|c2|- SPI c2 command|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_mem_rd](driver2#rsi-mem-rd), [rsi_mem_wr](driver2#rsi-mem-wr), [rsi_pkt_rd](driver2#rsi-pkt-rd), [rsi_pre_dsc_rd](driver2#rsi-pre-dsc-rd), [rsi_reg_rd](driver2#rsi-reg-rd), [rsi_reg_rd2](driver2#rsi-reg-rd2), [rsi_reg_wr](driver2#rsi-reg-wr), [rsi_spi_frame_data_wr](driver2#rsi-spi-frame-data-wr) and [rsi_spi_frame_dsc_wr](driver2#rsi-spi-frame-dsc-wr)

###### rsi_send_c3c4 (heading level 8)

`int16_t rsi_send_c3c4(uint8_t c3, uint8_t c4)`

**Description:** Send the C3 and C4 commands.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|c3|- SPI c3 command bytes to be sent|
|uint8_t|[in]|c4|- SPI c4 command bytes to be sent|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**Note**

- A succesful [rsi_send_c1c2()](driver2#rsi-send-c1c2) is required before this function.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_mem_rd](driver2#rsi-mem-rd), [rsi_mem_wr](driver2#rsi-mem-wr), [rsi_pkt_rd](driver2#rsi-pkt-rd), [rsi_pre_dsc_rd](driver2#rsi-pre-dsc-rd), [rsi_spi_frame_data_wr](driver2#rsi-spi-frame-data-wr) and [rsi_spi_frame_dsc_wr](driver2#rsi-spi-frame-dsc-wr)

###### rsi_spi_wait_start_token (heading level 8)

`int16_t rsi_spi_wait_start_token(uint32_t timeout, uint8_t mode)`

**Description:** Loop read the SPI until a start token (i.e., 0x55) is received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|timeout|- Timeout for start token.|
|uint8_t|[in]|mode|- To indicate 8-bit/32-bit mode.|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**Note**

- Should issue read commands before using this function

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_mem_rd](driver2#rsi-mem-rd), [rsi_pkt_rd](driver2#rsi-pkt-rd), [rsi_pre_dsc_rd](driver2#rsi-pre-dsc-rd), [rsi_reg_rd](driver2#rsi-reg-rd) and [rsi_reg_rd2](driver2#rsi-reg-rd2)

###### rsi_set_intr_mask (heading level 8)

`int16_t rsi_set_intr_mask(uint8_t interruptMask)`

**Description:** Set the interrupt mask register of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|interruptMask|- The value to set the mask register to|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_mem_wr](driver1#rsi-mem-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_set_intr_type (heading level 8)

`int16_t rsi_set_intr_type(uint32_t interruptMaskVal)`

**Description:** Set the interrupt type of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|interruptMaskVal|- The value to set the mask register|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_clear_interrupt (heading level 8)

`int16_t rsi_clear_interrupt(uint8_t interruptClear)`

**Description:** Clear the interrupt register.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|interruptClear|- The value to set the interrupt clear register to|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_mem_wr](driver1#rsi-mem-wr) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_device_interrupt_status (heading level 8)

`int16_t rsi_device_interrupt_status(uint8_t *int_status)`

**Description:** Read the SPI interrupt register status.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|int_status|- Pointer to the buffer of data to be read, assumed to be at least a byte|

This API reads the status register of the host interface layer to validate the interrupt received.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_rd](driver1#rsi-reg-rd)

###### rsi_spi_pkt_len (heading level 8)

`int16_t rsi_spi_pkt_len(uint16_t *length)`

**Description:** Read the length of the incoming packet to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t *|[in]|length|- Pointer to the buffer of data to write, assumed to be at least 2 bytes long|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_reg_rd2](driver2#rsi-reg-rd2)

###### rsi_spi_high_speed_enable (heading level 8)

`int16_t rsi_spi_high_speed_enable(void)`

**Description:** Configure the module SPI interface to high speed mode.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**Note**

- This API should be called only if the SPI clock frequency is more than 25 MHz and shouldn't be called otherwise.
- SPI initialization has to be done in low-speed mode. After device SPI is configured to high-speed mode using this API, <br />  
   rsi_switch_to_high_clk_freq() will be executed to configure the host SPI to a frequency that is more than 25 MHz. <br />  
   The latter API has to be ported by the user to implement the host clock switch.

**References:** [rsi_reg_wr](driver1#rsi-reg-wr)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_spi_iface_init (heading level 8)

`int16_t rsi_spi_iface_init(void)`

**Description:** Initialize the SPI secondary device interface of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_ulp_wakeup_init (heading level 8)

`int16_t rsi_ulp_wakeup_init(void)`

**Description:** Initialize the SPI secondary device interface of the module on ULP wakeup.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_req_wakeup](driver5#rsi-req-wakeup), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_tx_event_handler](driver8#rsi-tx-event-handler) and [rsi_wait4wakeup](driver5#rsi-wait4wakeup)

###### rsi_mem_wr (heading level 8)

`int16_t rsi_mem_wr(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** Memory write to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address to write to|
|uint16_t|[in]|len|- Number of bytes to write|
|uint8_t *|[in]|dBuf|- Pointer to the buffer of data to write|

This API writes contents of dBuf buffer to the device memory address addr for the length len.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_uint32_to_4bytes](driver12#rsi-uint32-to-4bytes)

###### rsi_mem_rd (heading level 8)

`int16_t rsi_mem_rd(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** Memory read from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address to read from|
|uint16_t|[in]|len|- Number of bytes to read|
|uint8_t *|[in]|dBuf|- Pointer to the buffer to receive the data into|

This API reads the device memory contents present at the address addr into the dBuf buffer for the length len.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_send_c3c4](driver2#rsi-send-c3c4), [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_reg_rd (heading level 8)

`int16_t rsi_reg_rd(uint8_t regAddr, uint8_t *dBuf)`

**Description:** Read from a register in the module from the address specified.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|regAddr|- Address of SPI register to read, address is 6-bits, upper 2 bits must be cleared|
|uint8_t *|[in]|dBuf|- Pointer to the buffer of data to write, assumed to be at least 2 bytes long|

This API reads the content of the host interface register regAddr to the buffer dBuf.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2), [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_reg_rd2 (heading level 8)

`int16_t rsi_reg_rd2(uint8_t regAddr, uint16_t *dBuf)`

**Description:** Read from a register in the wlan module from the address specified.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|regAddr|- Address of SPI register to read, address is 6-bits, upper 2 bits must be cleared|
|uint16_t *|[in]|dBuf|- Pointer to the buffer of data to write, assumed to be at least 2 bytes long|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2) and [rsi_spi_wait_start_token](driver2#rsi-spi-wait-start-token)

**Referenced by:** [rsi_spi_pkt_len](driver2#rsi-spi-pkt-len)

###### rsi_reg_wr (heading level 8)

`int16_t rsi_reg_wr(uint8_t regAddr, uint8_t *dBuf)`

**Description:** Write to a register in the module with an address specified.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|regAddr|- Address of SPI register to be written|
|uint8_t *|[in]|dBuf|- Pointer to the buffer of data to write, assumed to be at least 2 bytes long|

This API writes the content provided by dBuf to the host interface register regAddr.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_send_c1c2](driver2#rsi-send-c1c2) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### UART

###### Functions (heading level 7)

###### rsi_frame_read (heading level 8)

`int16_t rsi_frame_read(uint8_t *pkt_buffer)`

**Description:** Reads response for every command and data from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|pkt_buffer|- pointer to buffer to which packet has to read|

This API reads the frame from the host interface.

**Returns**

- 0 - Success <br />

**References:** [memcpy](bt-classic1#memcpy)

###### rsi_frame_write (heading level 8)

`int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame, uint8_t *payloadparam, uint16_t size_param)`

**Description:** Process a command to the wlan module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_frame_desc_t](rsi-frame-desc-s) *|[in]|uFrameDscFrame|- Frame descriptor|
|uint8_t *|[in]|payloadparam|- Pointer to the command payload parameter structure|
|uint16_t|[in]|size_param|- Size of the payload for the command|

This API writes the frame to the host interface.

**Returns**

- 0 - SUCCESS <br />  
   < 0 - FAILURE <br />

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_uart_init (heading level 8)

`int32_t rsi_uart_init(void)`

**Description:** Initialize the UART interface of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_uart_deinit (heading level 8)

`int32_t rsi_uart_deinit(void)`

**Description:** De-initialize the UART interface of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />

###### USART0_RX_IRQHandler (heading level 8)

`void USART0_RX_IRQHandler(void)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**References:** [memcpy](bt-classic1#memcpy), [rsi_set_event](driver5#rsi-set-event) and [rsi_set_event_from_isr](driver5#rsi-set-event-from-isr)

###### rsi_uart_iface_int (heading level 8)

`short int rsi_uart_iface_int(void)`

**Description:** Initialize the UART interface of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_uart_rx_irq_enable (heading level 8)

`void rsi_uart_rx_irq_enable(void)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

EFX: enable USART0 RX data-valid IRQ (e.g. after rsi_clear_event(RSI_RX_EVENT)). No-op on non-EFX.

##### Driver

Includes 

###### Modules

[Driver](driver5)

[Device Init](driver6)

###### Functions

###### rsi_frame_write (heading level 7)

`int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame, uint8_t *payloadparam, uint16_t size_param)`

**Description:** This API writes the frame to the host interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_frame_desc_t](rsi-frame-desc-s) *|[in]|uFrameDscFrame|- Frame descriptor|
|uint8_t *|[in]|payloadparam|- Pointer to the command payload parameter structure|
|uint16_t|[in]|size_param|- Size of the payload for the command|

Common function for all the commands.

**Returns**

- 0 - Success <br />
- Negative value - Failure <br />

**Returns**

- Negative Value = Failure 0 = SUCCESS

###### description

This is a common function used to process a command to the Wi-Fi module.

This API writes the frame to the host interface.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**Note**

- Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload. <br />

This API writes the frame to the host interface.

**Returns**

- 0 - SUCCESS <br />  
   < 0 - FAILURE <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_frame_read (heading level 7)

`int16_t rsi_frame_read(uint8_t *pkt_buffer)`

**Description:** This API reads the frame from the host interface.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|pkt_buffer|- pointer to buffer to which packet has to read|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />  
   This API reads the frame from the host interface.

**Returns**

- 0 - Success <br />
- Non-Zero Failure - Failure <br />

**Note**

- Enable DEBUG_PACKET_EXCHANGE macro for SPI level packet exchange debug prints and MAX_PRINT_PAYLOAD_LEN for configuring number of bytes of payload to print, by default it will print 8 bytes of payload.

This API reads the frame from the host interface.

**Returns**

- 0 - Success <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_mem_wr (heading level 7)

`int16_t rsi_mem_wr(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** This API writes contents of dBuf buffer to the device memory address addr for the length len.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address to write to|
|uint16_t|[in]|len|- Number of bytes to write|
|uint8_t *|[in]|dBuf|- Pointer to the buffer of data to write|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />  
   This API writes contents of dBuf buffer to the device memory address addr for the length len.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_mem_rd (heading level 7)

`int16_t rsi_mem_rd(uint32_t addr, uint16_t len, uint8_t *dBuf)`

**Description:** This API reads the device memory contents present at the address addr into the dBuf buffer for the length len.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|addr|- Address to read from|
|uint16_t|[in]|len|- Number of bytes to read|
|uint8_t *|[in]|dBuf|- Pointer to the buffer to receive the data into|

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />  
   This API reads the device memory contents present at the address addr into the dBuf buffer for the length len.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_device_interrupt_status](driver4#rsi-device-interrupt-status)

###### rsi_device_interrupt_status (heading level 7)

`int16_t rsi_device_interrupt_status(uint8_t *int_status)`

**Description:** This API reads the status register of the host interface layer to validate the interrupt received.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|int_status|- Pointer to the buffer of data to be read, assumed to be at least a byte|

Read the USB device status.

**Returns**

- 0 - Success <br />
- Non-zero value - Failure (**Possible Error Codes** - 0xffffffd0, ) <br />

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />  
   This API reads the status register of the host interface layer to validate the interrupt received.

**Returns**

- 0 - Success <br />
- Non-Zero value - Failure <br />

**References:** [rsi_mem_rd](driver4#rsi-mem-rd) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### Driver

###### Variables (heading level 7)

###### crypto_desc (heading level 8)

```
rsi_m4ta_desc_t crypto_desc[2]
```

**Referenced by:** [rsi_crypto_event_tx_handler](driver5#rsi-crypto-event-tx-handler)

###### Functions (heading level 7)

###### rsi_common_cb_init (heading level 8)

`int8_t rsi_common_cb_init(rsi_common_cb_t *common_cb)`

**Description:** Initialize common control block structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_common_cb_t](rsi-common-cb-s) *|[in]|common_cb|- pointer to common cb structure|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_non_rom::common_cmd_sem](rsi-driver-cb-non-rom#common-cmd-sem), [rsi_driver_cb_non_rom::common_cmd_send_sem](rsi-driver-cb-non-rom#common-cmd-send-sem), [rsi_common_cb_s::common_mutex](rsi-common-cb-s#common-mutex), [rsi_common_cb_s::common_sem](rsi-common-cb-s#common-sem), [rsi_driver_cb_non_rom::debug_prints_mutex](rsi-driver-cb-non-rom#debug-prints-mutex), [rsi_common_cb_s::expected_response](rsi-common-cb-s#expected-response), [rsi_mutex_create](rsi-os-h#rsi-mutex-create), [rsi_semaphore_create](rsi-os-h#rsi-semaphore-create), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_common_cb_s::status](rsi-common-cb-s#status), [rsi_driver_cb_non_rom::tx_mutex](rsi-driver-cb-non-rom#tx-mutex) and [rsi_common_cb_s::wakeup_gpio_sem](rsi-common-cb-s#wakeup-gpio-sem)

**Referenced by:** [rsi_driver_init](common#rsi-driver-init)

###### rsi_crypto_cb_init (heading level 8)

`int8_t rsi_crypto_cb_init(rsi_crypto_cb_t *crypto_cb)`

**Description:** Initialize crypto control block structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_crypto_cb_t](rsi-crypto-cb-s) *|[in]|crypto_cb|- type of the command to send|
||[in]|pkt|- pointer of packet to send|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

###### rsi_driver_common_send_cmd (heading level 8)

`int32_t rsi_driver_common_send_cmd(rsi_common_cmd_request_t cmd, rsi_pkt_t *pkt)`

**Description:** Fill commands and packets into WLAN TX queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_common_cmd_request_t|[in]|cmd|- type of the command to send|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer of packet to send|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_opermode_s::ble_ext_feature_bit_map](rsi-opermode-s#ble-ext-feature-bit-map), [rsi_opermode_s::ble_feature_bit_map](rsi-opermode-s#ble-feature-bit-map), [rsi_opermode_s::bt_feature_bit_map](rsi-opermode-s#bt-feature-bit-map), [rsi_driver_cb_s::bt_single_tx_q](rsi-driver-cb-s#bt-single-tx-q), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_s::common_tx_q](rsi-driver-cb-s#common-tx-q), [rsi_opermode_s::config_feature_bit_map](rsi-opermode-s#config-feature-bit-map), [rsi_opermode_s::custom_feature_bit_map](rsi-opermode-s#custom-feature-bit-map), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_power_save_req_s::dtim_aligned_type](rsi-power-save-req-s#dtim-aligned-type), [rsi_opermode_s::ext_custom_feature_bit_map](rsi-opermode-s#ext-custom-feature-bit-map), [rsi_opermode_s::ext_tcp_ip_feature_bit_map](rsi-opermode-s#ext-tcp-ip-feature-bit-map), [rsi_opermode_s::feature_bit_map](rsi-opermode-s#feature-bit-map), [rsi_power_save_req_s::listen_interval](rsi-power-save-req-s#listen-interval), [rsi_power_save_req_s::monitor_interval](rsi-power-save-req-s#monitor-interval), [rsi_power_save_req_s::num_of_dtim_skip](rsi-power-save-req-s#num-of-dtim-skip), [rsi_opermode_s::opermode](rsi-opermode-s#opermode), [rsi_power_save_req_s::power_mode](rsi-power-save-req-s#power-mode), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_driver_cb_s::prop_protocol_tx_q](rsi-driver-cb-s#prop-protocol-tx-q), [rsi_wlan_cb_non_rom_s::ps_listen_interval](rsi-wlan-cb-non-rom-s#ps-listen-interval), [rsi_block_queue](driver16#rsi-block-queue), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_bytes4R_to_uint32](driver12#rsi-bytes4-r-to-uint32), [rsi_enqueue_pkt](driver16#rsi-enqueue-pkt), [rsi_set_event](driver5#rsi-set-event), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_uint32_to_4bytes](driver12#rsi-uint32-to-4bytes), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_opermode_s::tcp_ip_feature_bit_map](rsi-opermode-s#tcp-ip-feature-bit-map), [rsi_power_save_req_s::ulp_mode_enable](rsi-power-save-req-s#ulp-mode-enable), [rsi_power_save_s::wlan_psp_mode](rsi-power-save-s#wlan-psp-mode), [rsi_driver_cb_s::wlan_tx_q](rsi-driver-cb-s#wlan-tx-q) and [rsi_driver_cb_s::zigb_tx_q](rsi-driver-cb-s#zigb-tx-q)

###### rsi_driver_process_common_recv_cmd (heading level 8)

`int32_t rsi_driver_process_common_recv_cmd(rsi_pkt_t *pkt)`

**Description:** Process commands received to common block.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer to common block packet|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_common_cb_s::app_buffer](rsi-common-cb-s#app-buffer), [rsi_common_cb_s::app_buffer_length](rsi-common-cb-s#app-buffer-length), [rsi_callback_cb_s::auto_config_rsp_handler](rsi-callback-cb-s#auto-config-rsp-handler), [rsi_wlan_cb_s::auto_config_state](rsi-wlan-cb-s#auto-config-state), [rsi_driver_cb_s::bt_single_tx_q](rsi-driver-cb-s#bt-single-tx-q), [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_cmd_sem](rsi-driver-cb-non-rom#common-cmd-sem), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_power_save_s::current_ps_mode](rsi-power-save-s#current-ps-mode), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_robust_drv_cb_s::enabled](rsi-robust-drv-cb-s#enabled), [memcpy](bt-classic1#memcpy), [rsi_power_save_s::module_state](rsi-power-save-s#module-state), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_power_save_s::power_save_enable](rsi-power-save-s#power-save-enable), [rsi_driver_cb_s::prop_protocol_tx_q](rsi-driver-cb-s#prop-protocol-tx-q), [rsi_common_cb_s::puf_state](rsi-common-cb-s#puf-state), [rsi_driver_cb_non_rom::robust_drv_cb](rsi-driver-cb-non-rom#robust-drv-cb), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_common_set_status](common#rsi-common-set-status), [rsi_callback_cb_s::rsi_max_available_rx_window](rsi-callback-cb-s#rsi-max-available-rx-window), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_unblock_queue](driver16#rsi-unblock-queue), [rsi_common_cb_s::sl_fw_log_callback](rsi-common-cb-s#sl-fw-log-callback), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_robust_drv_cb_s::state](rsi-robust-drv-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_wlan_cb_non_rom_s::switch_proto_callback](rsi-wlan-cb-non-rom-s#switch-proto-callback), [rsi_common_cb_s::sync_mode](rsi-common-cb-s#sync-mode), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb), [rsi_driver_cb_s::wlan_tx_q](rsi-driver-cb-s#wlan-tx-q) and [rsi_driver_cb_s::zigb_tx_q](rsi-driver-cb-s#zigb-tx-q)

###### rsi_handle_slp_wkp (heading level 8)

`void rsi_handle_slp_wkp(uint8_t frame_type)`

**Description:** Handle sleep and wakeup frames.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|frame_type|- Frame type|

**Returns**

- Void

**References:** [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_common_cb_s::expected_response](rsi-common-cb-s#expected-response), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [rsi_power_save_s::module_state](rsi-power-save-s#module-state), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_allow_sleep](driver5#rsi-allow-sleep), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [rsi_set_event](driver5#rsi-set-event), [rsi_unmask_event](driver8#rsi-unmask-event), [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap), [rsi_common_cb_s::state](rsi-common-cb-s#state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_non_rom_s::wlan_radio](rsi-wlan-cb-non-rom-s#wlan-radio)

###### rsi_req_wakeup (heading level 8)

`int16_t rsi_req_wakeup(void)`

**Description:** Set wakeup GPIO high.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_init_timer](driver11#rsi-init-timer), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_ulp_wakeup_init](driver2#rsi-ulp-wakeup-init) and [rsi_common_cb_s::wakeup_gpio_sem](rsi-common-cb-s#wakeup-gpio-sem)

**Referenced by:** [rsi_rx_event_handler](driver5#rsi-rx-event-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_wait4wakeup (heading level 8)

`int16_t rsi_wait4wakeup(void)`

**Description:** Waits for wakeup confirmation pin to be set.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_init_timer](driver11#rsi-init-timer), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_ulp_wakeup_init](driver2#rsi-ulp-wakeup-init), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_common_cb_s::wakeup_gpio_sem](rsi-common-cb-s#wakeup-gpio-sem) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_rx_event_handler](driver5#rsi-rx-event-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_allow_sleep (heading level 8)

`void rsi_allow_sleep(void)`

**Description:** Set wakeup GPIO low.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**Referenced by:** [rsi_handle_slp_wkp](driver5#rsi-handle-slp-wkp) and [rsi_rx_event_handler](driver5#rsi-rx-event-handler)

###### rsi_powersave_gpio_init (heading level 8)

`void rsi_powersave_gpio_init(void)`

**Description:** Initialize GPIOs used in power save .

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_common_packet_transfer_done (heading level 8)

`void rsi_common_packet_transfer_done(rsi_pkt_t *pkt)`

**Description:** Handle packet transfer completion which has an asyncronous response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer to packet|

**Returns**

- Void

**References:** [rsi_common_set_status](common#rsi-common-set-status), [RSI_SUCCESS](bt-classic1#rsi-success) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_sleep_mode_decision (heading level 8)

`int32_t rsi_sleep_mode_decision(rsi_common_cb_t *rsi_common_cb)`

**Description:** Decides the power mode to program.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_common_cb_t](rsi-common-cb-s) *|[in]|rsi_common_cb|- pointer to the common control block|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_power_save_s::bt_psp_mode](rsi-power-save-s#bt-psp-mode), [rsi_power_save_s::current_ps_mode](rsi-power-save-s#current-ps-mode), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_common_cb_s::ps_coex_mode](rsi-common-cb-s#ps-coex-mode), [rsi_send_ps_mode_to_module](driver5#rsi-send-ps-mode-to-module), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_power_save_s::wlan_psp_mode](rsi-power-save-s#wlan-psp-mode), [rsi_power_save_s::wlan_psp_type](rsi-power-save-s#wlan-psp-type) and [rsi_power_save_s::zb_psp_mode](rsi-power-save-s#zb-psp-mode)

**Referenced by:** [rsi_bt_power_save_profile](bt-ble#rsi-bt-power-save-profile) and [rsi_wlan_power_save_with_listen_interval](wlan#rsi-wlan-power-save-with-listen-interval)

###### rsi_send_ps_mode_to_module (heading level 8)

`int32_t rsi_send_ps_mode_to_module(uint8_t selected_ps_mode, uint8_t selected_ps_type)`

**Description:** Send the power save mode and type to module <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|selected_ps_mode|- Select power save mode|
|uint8_t|[in]|selected_ps_type|- Select power save type|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_sleep_mode_decision](driver5#rsi-sleep-mode-decision)

###### rsi_wait_on_common_semaphore (heading level 8)

`rsi_error_t rsi_wait_on_common_semaphore(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for common semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer <br />|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. If timeout_ms is 0 then wait till acquire semaphore.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_common_set_status](common#rsi-common-set-status), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait) and [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb)

**Referenced by:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state) and [rsi_wireless_init](common#rsi-wireless-init)

###### rsi_check_and_update_cmd_state (heading level 8)

`int32_t rsi_check_and_update_cmd_state(uint8_t cmd_type, uint8_t cmd_state)`

**Description:** Check and update the command state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|cmd_type|- Command type <br /><br/> 1 - COMMON_CMD <br /><br/> 2 - WLAN_CMD <br /><br/> 3 - NWK_CMD|
|uint8_t|[in]|cmd_state|- command state <br /><br/> 1 - IN_USE <br /><br/> 2 - ALLOW|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_non_rom::common_cmd_send_sem](rsi-driver-cb-non-rom#common-cmd-send-sem), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_driver_cb_non_rom::crypto_cmd_sem](rsi-driver-cb-non-rom#crypto-cmd-sem), [rsi_driver_cb_non_rom::crypto_wait_bitmap](rsi-driver-cb-non-rom#crypto-wait-bitmap), [rsi_driver_cb_non_rom::device_state](rsi-driver-cb-non-rom#device-state), [rsi_driver_cb_non_rom::nwk_cmd_send_sem](rsi-driver-cb-non-rom#nwk-cmd-send-sem), [rsi_driver_cb_non_rom::nwk_wait_bitmap](rsi-driver-cb-non-rom#nwk-wait-bitmap), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wait_on_common_semaphore](driver5#rsi-wait-on-common-semaphore), [rsi_wait_on_nwk_semaphore](driver9#rsi-wait-on-nwk-semaphore), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_driver_cb_non_rom::wlan_cmd_send_sem](rsi-driver-cb-non-rom#wlan-cmd-send-sem) and [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap)

**Referenced by:** [rsi_aes_pen](crypto#rsi-aes-pen), [rsi_assert](common#rsi-assert), [rsi_calib_read](wlan#rsi-calib-read), [rsi_calib_write](wlan#rsi-calib-write), [rsi_calibrate_dpd](wlan#rsi-calibrate-dpd), [rsi_ccm_pen](crypto#rsi-ccm-pen), [rsi_chachapoly_pen](crypto#rsi-chachapoly-pen), [rsi_cmd_m4_ta_secure_handshake](common#rsi-cmd-m4-ta-secure-handshake), [rsi_cmd_to_wr_comm_flash](common#rsi-cmd-to-wr-comm-flash), [rsi_cmd_uart_flow_ctrl](common#rsi-cmd-uart-flow-ctrl), [rsi_common_debug_log](common#rsi-common-debug-log), [rsi_config_ipaddress](wlan#rsi-config-ipaddress), [rsi_config_timeout](wlan#rsi-config-timeout), [rsi_dhcp_user_class](network1#rsi-dhcp-user-class), [rsi_dns_req_async](network6#rsi-dns-req-async), [rsi_dns_update](network6#rsi-dns-update), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_ecdh_point_addition](crypto#rsi-ecdh-point-addition), [rsi_ecdh_point_affine](crypto#rsi-ecdh-point-affine), [rsi_ecdh_point_double](crypto#rsi-ecdh-point-double), [rsi_ecdh_point_multiplication](crypto#rsi-ecdh-point-multiplication), [rsi_ecdh_point_subtraction](crypto#rsi-ecdh-point-subtraction), [rsi_ecdsa_256_verify_hash](common#rsi-ecdsa-256-verify-hash), [rsi_emb_mqtt_client_init](network2#rsi-emb-mqtt-client-init), [rsi_emb_mqtt_connect](network2#rsi-emb-mqtt-connect), [rsi_emb_mqtt_destroy](network2#rsi-emb-mqtt-destroy), [rsi_emb_mqtt_disconnect](network2#rsi-emb-mqtt-disconnect), [rsi_emb_mqtt_publish](network2#rsi-emb-mqtt-publish), [rsi_emb_mqtt_subscribe](network2#rsi-emb-mqtt-subscribe), [rsi_emb_mqtt_unsubscribe](network2#rsi-emb-mqtt-unsubscribe), [rsi_evm_write](wlan#rsi-evm-write), [rsi_exponentiation](crypto#rsi-exponentiation), [rsi_ftp_connect](network8#rsi-ftp-connect), [rsi_ftp_directory_create](network8#rsi-ftp-directory-create), [rsi_ftp_directory_delete](network8#rsi-ftp-directory-delete), [rsi_ftp_directory_list_async](network8#rsi-ftp-directory-list-async), [rsi_ftp_directory_set](network8#rsi-ftp-directory-set), [rsi_ftp_disconnect](network8#rsi-ftp-disconnect), [rsi_ftp_file_delete](network8#rsi-ftp-file-delete), [rsi_ftp_file_read_aysnc](network8#rsi-ftp-file-read-aysnc), [rsi_ftp_file_rename](network8#rsi-ftp-file-rename), [rsi_ftp_file_size_set](network8#rsi-ftp-file-size-set), [rsi_ftp_file_write](network8#rsi-ftp-file-write), [rsi_ftp_file_write_content](network8#rsi-ftp-file-write-content), [rsi_ftp_mode_set](network8#rsi-ftp-mode-set), [rsi_gcm](crypto#rsi-gcm), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_get_ram_log](common#rsi-get-ram-log), [rsi_get_random_bytes](wlan#rsi-get-random-bytes), [rsi_get_rtc_timer](common#rsi-get-rtc-timer), [rsi_gpio_pininit](common#rsi-gpio-pininit), [rsi_gpio_readpin](common#rsi-gpio-readpin), [rsi_gpio_writepin](common#rsi-gpio-writepin), [rsi_hmac_sha_pen](crypto#rsi-hmac-sha-pen), [rsi_http_client_abort](network9#rsi-http-client-abort), [rsi_http_client_async](network9#rsi-http-client-async), [rsi_http_client_post_data](network9#rsi-http-client-post-data), [rsi_http_client_put_create](network9#rsi-http-client-put-create), [rsi_http_client_put_delete](network9#rsi-http-client-put-delete), [rsi_http_client_put_pkt](network9#rsi-http-client-put-pkt), [rsi_http_client_put_start](network9#rsi-http-client-put-start), [rsi_http_credentials](network9#rsi-http-credentials), [rsi_http_otaf_async](network9#rsi-http-otaf-async), [rsi_json_object_create](network14#rsi-json-object-create), [rsi_json_object_delete](network14#rsi-json-object-delete), [rsi_mdnsd_deinit](network15#rsi-mdnsd-deinit), [rsi_mdnsd_init](network15#rsi-mdnsd-init), [rsi_mdnsd_register_service](network15#rsi-mdnsd-register-service), [rsi_network_app_protocol_config](network5#rsi-network-app-protocol-config), [rsi_ota_firmware_upgradation](network20#rsi-ota-firmware-upgradation), [rsi_req_wireless_fwup](firmware#rsi-req-wireless-fwup), [rsi_robust_drv_start_handshake](common#rsi-robust-drv-start-handshake), [rsi_send_evm_offset](wlan#rsi-send-evm-offset), [rsi_send_feature_frame](common#rsi-send-feature-frame), [rsi_send_feature_frame_dyn](common#rsi-send-feature-frame-dyn), [rsi_send_freq_offset](wlan#rsi-send-freq-offset), [rsi_send_ps_mode_to_module](driver5#rsi-send-ps-mode-to-module), [rsi_send_raw_data](network3#rsi-send-raw-data), [rsi_set_config](common#rsi-set-config), [rsi_set_rtc_timer](common#rsi-set-rtc-timer), [rsi_set_sni_emb_socket](network9#rsi-set-sni-emb-socket), [rsi_sha3_shake_pen](crypto#rsi-sha3-shake-pen), [rsi_sha_pen](crypto#rsi-sha-pen), [rsi_sntp_client_create_async](network12#rsi-sntp-client-create-async), [rsi_sntp_client_delete_async](network12#rsi-sntp-client-delete-async), [rsi_sntp_client_gettime](network12#rsi-sntp-client-gettime), [rsi_sntp_client_gettime_date](network12#rsi-sntp-client-gettime-date), [rsi_sntp_client_server_info](network12#rsi-sntp-client-server-info), [rsi_socket_config](network5#rsi-socket-config), [rsi_switch_proto](common#rsi-switch-proto), [rsi_transmit_test_start](wlan#rsi-transmit-test-start), [rsi_transmit_test_stop](wlan#rsi-transmit-test-stop), [rsi_webpage_erase](network14#rsi-webpage-erase), [rsi_webpage_load](network14#rsi-webpage-load), [rsi_webpage_send](network14#rsi-webpage-send), [rsi_wireless_antenna](common#rsi-wireless-antenna), [rsi_wireless_deinit](common#rsi-wireless-deinit), [rsi_wireless_init](common#rsi-wireless-init), [rsi_wlan_add_profile](wlan#rsi-wlan-add-profile), [rsi_wlan_ap_start](wlan#rsi-wlan-ap-start), [rsi_wlan_ap_stop](wlan#rsi-wlan-ap-stop), [rsi_wlan_beacon_stop](wlan#rsi-wlan-beacon-stop), [rsi_wlan_bgscan_profile](wlan#rsi-wlan-bgscan-profile), [rsi_wlan_buffer_config](wlan#rsi-wlan-buffer-config), [rsi_wlan_connect](wlan#rsi-wlan-connect), [rsi_wlan_connect_async](wlan#rsi-wlan-connect-async), [rsi_wlan_csi_config_async](wlan#rsi-wlan-csi-config-async), [rsi_wlan_delete_profile](wlan#rsi-wlan-delete-profile), [rsi_wlan_disconnect](wlan#rsi-wlan-disconnect), [rsi_wlan_disconnect_stations](wlan#rsi-wlan-disconnect-stations), [rsi_wlan_enable_auto_config](wlan#rsi-wlan-enable-auto-config), [rsi_wlan_execute_post_connect_cmds](wlan#rsi-wlan-execute-post-connect-cmds), [rsi_wlan_filter_broadcast](wlan#rsi-wlan-filter-broadcast), [rsi_wlan_get](wlan#rsi-wlan-get), [rsi_wlan_get_profile](wlan#rsi-wlan-get-profile), [rsi_wlan_ping_async](wlan#rsi-wlan-ping-async), [rsi_wlan_pmk_generate](wlan#rsi-wlan-pmk-generate), [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init), [rsi_wlan_receive_stats_start](wlan#rsi-wlan-receive-stats-start), [rsi_wlan_receive_stats_stop](wlan#rsi-wlan-receive-stats-stop), [rsi_wlan_req_radio](network17#rsi-wlan-req-radio), [rsi_wlan_scan](wlan#rsi-wlan-scan), [rsi_wlan_scan_async](wlan#rsi-wlan-scan-async), [rsi_wlan_scan_async_with_bitmap_options](wlan#rsi-wlan-scan-async-with-bitmap-options), [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options), [rsi_wlan_send_data](wlan#rsi-wlan-send-data), [rsi_wlan_set](wlan#rsi-wlan-set), [rsi_wlan_set_certificate_index](wlan#rsi-wlan-set-certificate-index), [rsi_wlan_set_non_pref_chan](wlan#rsi-wlan-set-non-pref-chan), [rsi_wlan_set_sleep_timer](wlan#rsi-wlan-set-sleep-timer), [rsi_wlan_twt_auto_selection](wlan#rsi-wlan-twt-auto-selection), [rsi_wlan_twt_config](wlan#rsi-wlan-twt-config), [rsi_wlan_update_gain_table](wlan#rsi-wlan-update-gain-table), [rsi_wlan_wps_enter_pin](wlan#rsi-wlan-wps-enter-pin), [rsi_wlan_wps_generate_pin](wlan#rsi-wlan-wps-generate-pin), [rsi_wlan_wps_push_button_event](wlan#rsi-wlan-wps-push-button-event), [sl_attestation_get_token](crypto#sl-attestation-get-token), [trng_entropy](crypto#trng-entropy), [trng_get_random_num](crypto#trng-get-random-num), [trng_init](crypto#trng-init) and [trng_program_key](crypto#trng-program-key)

###### rsi_post_waiting_common_semaphore (heading level 8)

`void rsi_post_waiting_common_semaphore(void)`

**Description:** Release all the common semaphores which are on semaphore wait.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Void

**References:** [rsi_common_cb_s::common_card_ready_sem](rsi-common-cb-s#common-card-ready-sem), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::common_cmd_sem](rsi-driver-cb-non-rom#common-cmd-sem), [rsi_driver_cb_non_rom::common_cmd_send_sem](rsi-driver-cb-non-rom#common-cmd-send-sem), [rsi_common_cb_s::common_sem](rsi-common-cb-s#common-sem), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post) and [rsi_common_cb_s::wakeup_gpio_sem](rsi-common-cb-s#wakeup-gpio-sem)

**Referenced by:** [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore)

###### rsi_post_waiting_bt_semaphore (heading level 8)

`void rsi_post_waiting_bt_semaphore(void)`

**Description:** Release all the BT, BLE protocol semaphores.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Void

**References:** [rsi_driver_cb_s::ble_cb](rsi-driver-cb-s#ble-cb), [rsi_driver_cb_s::bt_classic_cb](rsi-driver-cb-s#bt-classic-cb), [rsi_bt_cb_s::bt_cmd_sem](rsi-bt-cb-s#bt-cmd-sem), [rsi_driver_cb_non_rom::bt_cmd_wait_bitmap](rsi-driver-cb-non-rom#bt-cmd-wait-bitmap), [rsi_driver_cb_s::bt_common_cb](rsi-driver-cb-s#bt-common-cb), [rsi_bt_cb_s::bt_sem](rsi-bt-cb-s#bt-sem), [rsi_driver_cb_non_rom::bt_wait_bitmap](rsi-driver-cb-non-rom#bt-wait-bitmap), [rsi_driver_cb_s::prop_protocol_cb](rsi-driver-cb-s#prop-protocol-cb) and [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post)

**Referenced by:** [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore)

###### rsi_release_waiting_semaphore (heading level 8)

`int32_t rsi_release_waiting_semaphore(void)`

**Description:** Releases all common ,WLAN and network semaphores which are semaphore wait.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**References:** [rsi_common_set_status](common#rsi-common-set-status), [rsi_post_waiting_bt_semaphore](driver5#rsi-post-waiting-bt-semaphore), [rsi_post_waiting_common_semaphore](driver5#rsi-post-waiting-common-semaphore), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore), [rsi_post_waiting_wlan_semaphore](driver13#rsi-post-waiting-wlan-semaphore), [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_driver_cb_non_rom::send_data_sem](rsi-driver-cb-non-rom#send-data-sem), [rsi_driver_cb_non_rom::send_wait_bitmap](rsi-driver-cb-non-rom#send-wait-bitmap), [rsi_driver_cb_s::zigb_cb](rsi-driver-cb-s#zigb-cb) and [rsi_driver_cb_non_rom::zigb_wait_bitmap](rsi-driver-cb-non-rom#zigb-wait-bitmap)

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit) and [rsi_error_timeout_and_clear_events](driver5#rsi-error-timeout-and-clear-events)

###### rsi_check_pkt_queue_and_dequeue (heading level 8)

`void rsi_check_pkt_queue_and_dequeue(void)`

**Description:** Check the packet in queue and dequeue the packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [rsi_driver_cb_s::common_tx_q](rsi-driver-cb-s#common-tx-q), [rsi_check_queue_status](driver16#rsi-check-queue-status) and [rsi_dequeue_pkt](driver16#rsi-dequeue-pkt)

**Referenced by:** [rsi_driver_deinit](common#rsi-driver-deinit) and [rsi_error_timeout_and_clear_events](driver5#rsi-error-timeout-and-clear-events)

###### rsi_free_queue_pkt (heading level 8)

`void rsi_free_queue_pkt(uint8_t pkt_dequeued, rsi_pkt_t *pkt)`

**Description:** Free the queued packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|pkt_dequeued|- pkt to be free|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- pointer of the packet to be free|

**Returns**

- Void

**Referenced by:** [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_error_timeout_and_clear_events (heading level 8)

`void rsi_error_timeout_and_clear_events(int32_t error, uint32_t cmd_type)`

**Description:** Clears the event and gives timeout error.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|error|- Error|
|uint32_t|[in]|cmd_type|- command type <br />|

**Returns**

- Void

**References:** [rsi_driver_cb_non_rom::driver_rx_timer_start](rsi-driver-cb-non-rom#driver-rx-timer-start), [rsi_driver_cb_non_rom::driver_timer_start](rsi-driver-cb-non-rom#driver-timer-start), [rsi_check_pkt_queue_and_dequeue](driver5#rsi-check-pkt-queue-and-dequeue), [rsi_clear_event](driver5#rsi-clear-event), [rsi_release_waiting_semaphore](driver5#rsi-release-waiting-semaphore) and [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb)

**Referenced by:** [rsi_rx_event_handler](driver5#rsi-rx-event-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_check_waiting_cmds (heading level 8)

`void rsi_check_waiting_cmds(rsi_rsp_waiting_cmds_t *response)`

**Description:** Check the commands which are waiting for the response.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_rsp_waiting_cmds_t](rsi-rsp-waiting-cmds-s) *|[in]|reponse|- pointer to the command waiting for response|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_driver_cb_non_rom::bt_wait_bitmap](rsi-driver-cb-non-rom#bt-wait-bitmap), [rsi_driver_cb_non_rom::common_wait_bitmap](rsi-driver-cb-non-rom#common-wait-bitmap), [rsi_driver_cb_non_rom::nwk_wait_bitmap](rsi-driver-cb-non-rom#nwk-wait-bitmap), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_driver_cb_non_rom::rx_driver_flag](rsi-driver-cb-non-rom#rx-driver-flag), [rsi_rsp_waiting_cmds_s::rx_driver_flag](rsi-rsp-waiting-cmds-s#rx-driver-flag), [rsi_driver_cb_non_rom::send_wait_bitmap](rsi-driver-cb-non-rom#send-wait-bitmap), [rsi_rsp_waiting_cmds_s::waiting_cmds](rsi-rsp-waiting-cmds-s#waiting-cmds) and [rsi_driver_cb_non_rom::wlan_wait_bitmap](rsi-driver-cb-non-rom#wlan-wait-bitmap)

###### rsi_secure_ping_pong_wr (heading level 8)

`int16_t rsi_secure_ping_pong_wr(uint32_t ping_pong, uint8_t *src_addr, uint16_t size_param)`

**Description:** Write the given data in the ping or pong buffer to the specified register address in the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|ping_pong|- ping or pong buffer write|
|uint8_t *|[in]|src_addr|- Number of bytes to read. (def: 2 since we have 16 bit regs)|
|uint16_t|[in]|size_param|- pointer contain the buffer of content to be written|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_frame_desc_s::frame_len_queue_no](rsi-frame-desc-s#frame-len-queue-no), [rsi_spi_frame_data_wr](driver2#rsi-spi-frame-data-wr), [rsi_spi_frame_dsc_wr](driver2#rsi-spi-frame-dsc-wr) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_set_fast_fw_up (heading level 8)

`int32_t rsi_set_fast_fw_up(void)`

**Description:** Set fast firmware upgrade.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_bootloader_instructions (heading level 8)

`int16_t rsi_bootloader_instructions(uint8_t type, uint16_t *data)`

**Description:** Send boot instructions to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- type of the insruction to perform <br /><br/> 0xD1 - RSI_REG_READ <br /><br/> 0xD2 - RSI_REG_WRITE <br /><br/> 0xD5 - RSI_PING_WRITE <br /><br/> 0xD4 - RSI_PONG_WRITE <br /><br/> 0x42 - BURN_NWP_FW <br /><br/> 0x31 - LOAD_NWP_FW <br /><br/> 0x71 - LOAD_DEFAULT_NWP_FW_ACTIVE_LOW|
|uint16_t *|[in]|data|- pointer to data which is to be read/write <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xffffffff, 0xfffffffe, 0xffffffe4) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.
- This is a proprietry API and is not recommended to be used

**References:** [rsi_init_timer](driver11#rsi-init-timer), [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr) and [rsi_timer_expired](driver11#rsi-timer-expired)

**Referenced by:** [rsi_bl_select_option](driver6#rsi-bl-select-option), [rsi_bl_upgrade_firmware](common#rsi-bl-upgrade-firmware) and [rsi_bl_waitfor_boardready](driver6#rsi-bl-waitfor-boardready)

###### rsi_interrupt_handler (heading level 8)

`void rsi_interrupt_handler(void)`

**Description:** Handle the interrupt coming from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

###### rsi_mask_ta_interrupt (heading level 8)

`void rsi_mask_ta_interrupt(void)`

**Description:** Mask the TA interrupt.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

###### rsi_unmask_ta_interrupt (heading level 8)

`void rsi_unmask_ta_interrupt(void)`

**Description:** Unmask the TA interrupt.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

###### rsi_rx_event_handler (heading level 8)

`void rsi_rx_event_handler(void)`

**Description:** Read and process the RX packet from the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- Void

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_non_rom::driver_rx_timer_start](rsi-driver-cb-non-rom#driver-rx-timer-start), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_power_save_s::power_save_enable](rsi-power-save-s#power-save-enable), [rsi_allow_sleep](driver5#rsi-allow-sleep), [rsi_callback_cb_s::rsi_assertion_cb](rsi-callback-cb-s#rsi-assertion-cb), [rsi_clear_event](driver5#rsi-clear-event), [rsi_device_interrupt_status](driver1#rsi-device-interrupt-status), [rsi_error_timeout_and_clear_events](driver5#rsi-error-timeout-and-clear-events), [rsi_get_intr_status](common#rsi-get-intr-status), [rsi_init_timer](driver11#rsi-init-timer), [rsi_mem_rd](driver1#rsi-mem-rd), [rsi_mem_wr](driver1#rsi-mem-wr), [rsi_mutex_lock](rsi-os-h#rsi-mutex-lock), [rsi_mutex_unlock](rsi-os-h#rsi-mutex-unlock), [rsi_req_wakeup](driver5#rsi-req-wakeup), [rsi_set_event](driver5#rsi-set-event), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_ulp_wakeup_init](driver2#rsi-ulp-wakeup-init), [rsi_unmask_event](driver8#rsi-unmask-event), [rsi_wait4wakeup](driver5#rsi-wait4wakeup), [rsi_driver_cb_non_rom::rx_timer_start](rsi-driver-cb-non-rom#rx-timer-start), [rsi_driver_cb_non_rom::tx_mask_event](rsi-driver-cb-non-rom#tx-mask-event) and [rsi_driver_cb_non_rom::tx_mutex](rsi-driver-cb-non-rom#tx-mutex)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_crypto_event_tx_handler (heading level 8)

`void rsi_crypto_event_tx_handler(void)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**References:** [rsi_crypto_cb_s::crypto_buffer](rsi-crypto-cb-s#crypto-buffer), [rsi_driver_cb_s::crypto_cb](rsi-driver-cb-s#crypto-cb), [crypto_desc](driver5#crypto-desc), [rsi_crypto_cb_s::crypto_hold_power_save](rsi-crypto-cb-s#crypto-hold-power-save), [rsi_driver_cb_s::crypto_tx_q](rsi-driver-cb-s#crypto-tx-q), [rsi_pkt_s::data](rsi-pkt-s#data), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_clear_event](driver5#rsi-clear-event) and [rsi_dequeue_pkt](driver16#rsi-dequeue-pkt)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_crypto_event_rx_handler (heading level 8)

`void rsi_crypto_event_rx_handler(void)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**References:** [rsi_crypto_cb_s::crypto_buffer](rsi-crypto-cb-s#crypto-buffer), [rsi_driver_cb_s::crypto_cb](rsi-driver-cb-s#crypto-cb), [rsi_crypto_cb_s::crypto_hold_power_save](rsi-crypto-cb-s#crypto-hold-power-save), [rsi_pkt_s::desc](rsi-pkt-s#desc) and [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_set_event (heading level 8)

`void rsi_set_event(uint32_t event_num)`

**Description:** Set an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- Event number to be set|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_set_event](rom-wl-api-s#rsi-set-event) and [rsi_set_event_non_rom](driver8#rsi-set-event-non-rom)

**Referenced by:** [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd), [rsi_get_event_non_rom](driver15#rsi-get-event-non-rom), [rsi_handle_slp_wkp](driver5#rsi-handle-slp-wkp), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_send_large_data_async](network5#rsi-send-large-data-async) and [USART0_RX_IRQHandler](driver3#usart0-rx-irq-handler)

###### rsi_clear_event (heading level 8)

`void rsi_clear_event(uint32_t event_num)`

**Description:** Clear an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- Event number to clear|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_clear_event](rom-wl-api-s#rsi-clear-event)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_crypto_event_tx_handler](driver5#rsi-crypto-event-tx-handler), [rsi_error_timeout_and_clear_events](driver5#rsi-error-timeout-and-clear-events), [rsi_rx_event_handler](driver5#rsi-rx-event-handler) and [rsi_socket_event_handler](network5#rsi-socket-event-handler)

###### rsi_mask_event (heading level 8)

`void rsi_mask_event(uint32_t event_num)`

**Description:** Mask the specified event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- Event number to mask|

**Returns**

- Void

**References:** [ROM_WL_API_S::rsi_mask_event](rom-wl-api-s#rsi-mask-event)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_find_event (heading level 8)

`uint32_t rsi_find_event(uint32_t event_map)`

**Description:** Find the event which is set.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_map|- Event map|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

###### rsi_register_event (heading level 8)

`uint16_t rsi_register_event(uint32_t event_id, void(*event_handler_ptr)(void))`

**Description:** Register the given event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_id|- event number which needs to be registered|
|void(*)(void)|[in]|event_handler_ptr|- event handler which needs to be registered for a given event|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [ROM_WL_API_S::rsi_register_event](rom-wl-api-s#rsi-register-event)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_set_event_from_isr (heading level 8)

`void rsi_set_event_from_isr(uint32_t event_num)`

**Description:** Set the event from isr context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- Event number to mask|

**Returns**

- Void

**References:** [ROM_WL_API_S::rsi_set_event_from_isr](rom-wl-api-s#rsi-set-event-from-isr) and [rsi_set_event_from_isr_non_rom](driver8#rsi-set-event-from-isr-non-rom)

**Referenced by:** [USART0_RX_IRQHandler](driver3#usart0-rx-irq-handler)

###### rsi_events_init (heading level 8)

`void rsi_events_init(void)`

**Description:** Initialize the events.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [rsi_crypto_event_rx_handler](driver5#rsi-crypto-event-rx-handler), [rsi_crypto_event_tx_handler](driver5#rsi-crypto-event-tx-handler), [rsi_register_event](driver5#rsi-register-event), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_socket_event_handler](network5#rsi-socket-event-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### ROM_WL_rsi_set_event (heading level 8)

`void ROM_WL_rsi_set_event(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Set an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to be set|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [global_cb_s::os_enabled](global-cb-s#os-enabled), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb) and [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem)

###### ROM_WL_rsi_clear_event (heading level 8)

`void ROM_WL_rsi_clear_event(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Clear an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to clear|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

###### ROM_WL_rsi_mask_event (heading level 8)

`void ROM_WL_rsi_mask_event(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Mask an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to mask|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

###### ROM_WL_rsi_unmask_event (heading level 8)

`void ROM_WL_rsi_unmask_event(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Unmask an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to unmask|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::os_enabled](global-cb-s#os-enabled), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb) and [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem)

###### ROM_WL_rsi_find_event (heading level 8)

`uint32_t ROM_WL_rsi_find_event(global_cb_t *global_cb_p, uint32_t event_map)`

**Description:** Find the event which is set.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_map|- event map|

**Returns**

- Event number

**References:** [global_cb_s::rsi_max_num_events](global-cb-s#rsi-max-num-events)

###### ROM_WL_rsi_register_event (heading level 8)

`uint16_t ROM_WL_rsi_register_event(global_cb_t *global_cb_p, uint32_t event_id, void(*event_handler_ptr)(void))`

**Description:** Register the event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_id|- event number which needs to be registered|
|void(*)(void)|[in]|event_handler_ptr|- event handler which needs to be registered for a given event|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_event_cb_s::event_handler](rsi-event-cb-s#event-handler), [rsi_driver_cb_s::event_list](rsi-driver-cb-s#event-list), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb) and [global_cb_s::rsi_max_num_events](global-cb-s#rsi-max-num-events)

###### ROM_WL_rsi_set_event_from_isr (heading level 8)

`void ROM_WL_rsi_set_event_from_isr(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Set an event from ISR.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to be set|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [global_cb_s::os_enabled](global-cb-s#os-enabled), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb) and [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem)

###### ROM_WL_rsi_unmask_event_from_isr (heading level 8)

`void ROM_WL_rsi_unmask_event_from_isr(global_cb_t *global_cb_p, uint32_t event_num)`

**Description:** Unmask an event from ISR.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint32_t|[in]|event_num|- event number to unmask|

**Returns**

- Void

**References:** [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::os_enabled](global-cb-s#os-enabled), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb) and [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem)

###### rsi_pkt_pool_init (heading level 8)

`int32_t rsi_pkt_pool_init(rsi_pkt_pool_t *pool_cb, uint8_t *buffer, uint32_t total_size, uint32_t pkt_size)`

**Description:** Initialize/create packet pool from the provided buffer.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer which needs to be initialized <br />|
|uint8_t *|[in]|buffer|- buffer pointer to create pool <br />|
|uint32_t|[in]|total_size|- size of pool to create <br />|
|uint32_t|[in]|pkt_size|- size of each packet in pool <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [ROM_WL_API_S::rsi_pkt_pool_init](rom-wl-api-s#rsi-pkt-pool-init)

**Referenced by:** [rsi_driver_init](common#rsi-driver-init)

###### rsi_pkt_alloc (heading level 8)

`rsi_pkt_t * rsi_pkt_alloc(rsi_pkt_pool_t *pool_cb)`

**Description:** Allocate packet from a given packet pool.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer from which packet needs to be allocated <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

###### rsi_pkt_free (heading level 8)

`int32_t rsi_pkt_free(rsi_pkt_pool_t *pool_cb, rsi_pkt_t *pkt)`

**Description:** Free the packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool to which packet needs to be freed <br />|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be freed|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

###### rsi_is_pkt_available (heading level 8)

`uint32_t rsi_is_pkt_available(rsi_pkt_pool_t *pool_cb)`

**Description:** Number of available packets in pool.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- pool pointer to check available packet count|

**Returns**

- Number of packets in pool (>=0)

**References:** [ROM_WL_API_S::rsi_is_pkt_available](rom-wl-api-s#rsi-is-pkt-available)

###### ROM_WL_rsi_pkt_pool_init (heading level 8)

`int32_t ROM_WL_rsi_pkt_pool_init(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb, uint8_t *buffer, uint32_t total_size, uint32_t pkt_size)`

**Description:** Initialize/create packet pool from the provided buffer.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer which needs to be initialized <br />|
|uint8_t *|[in]|buffer|- buffer pointer to create pool|
|uint32_t|[in]|total_size|- size of pool to create|
|uint32_t|[in]|pkt_size|- size of each packet in pool|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail), [rsi_pkt_pool_s::pkt_sem](rsi-pkt-pool-s#pkt-sem), [rsi_pkt_pool_s::pool](rsi-pkt-pool-s#pool), [rsi_pkt_pool_s::size](rsi-pkt-pool-s#size) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_pkt_alloc_non_blocking (heading level 8)

`rsi_pkt_t * ROM_WL_rsi_pkt_alloc_non_blocking(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb)`

**Description:** Allocate packet from a given packet pool.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer from which packet needs to be allocated|

**Returns**

- Allocated packet pointer - Success <br />
- NULL - Failure

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail), [rsi_pkt_s::next](rsi-pkt-s#next), [rsi_pkt_pool_s::pool](rsi-pkt-pool-s#pool) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_pkt_free_non_blocking (heading level 8)

`int32_t ROM_WL_rsi_pkt_free_non_blocking(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb, rsi_pkt_t *pkt)`

**Description:** Free the packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer from which packet needs to be allocated|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be freed|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail), [rsi_pkt_pool_s::pool](rsi-pkt-pool-s#pool), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_pkt_pool_s::size](rsi-pkt-pool-s#size) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_pkt_alloc (heading level 8)

`rsi_pkt_t * ROM_WL_rsi_pkt_alloc(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb)`

**Description:** Allocate packet from a given packet pool.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool pointer from which packet needs to be allocated|

**Returns**

- Allocated packet pointer - Success <br />
- NULL - Failure

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail), [rsi_pkt_s::next](rsi-pkt-s#next), [rsi_pkt_pool_s::pkt_sem](rsi-pkt-pool-s#pkt-sem), [rsi_pkt_pool_s::pool](rsi-pkt-pool-s#pool) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_pkt_free (heading level 8)

`int32_t ROM_WL_rsi_pkt_free(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb, rsi_pkt_t *pkt)`

**Description:** Free the packet.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- packet pool to which packet needs to be freed|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be freed|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail), [rsi_pkt_pool_s::pkt_sem](rsi-pkt-pool-s#pkt-sem), [rsi_pkt_pool_s::pool](rsi-pkt-pool-s#pool), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_pkt_pool_s::size](rsi-pkt-pool-s#size) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_is_pkt_available (heading level 8)

`uint32_t ROM_WL_rsi_is_pkt_available(global_cb_t *global_cb_p, rsi_pkt_pool_t *pool_cb)`

**Description:** Number of available packets in pool.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_pkt_pool_t](rsi-pkt-pool-s) *|[in]|pool_cb|- pool pointer to check available pakcets count|

**Returns**

- Number of packets in pool

**References:** [rsi_pkt_pool_s::avail](rsi-pkt-pool-s#avail) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### Device Init

###### Functions (heading level 7)

###### rsi_bl_waitfor_boardready (heading level 8)

`int16_t rsi_bl_waitfor_boardready(void)`

**Description:** This API checks for the readiness of the bootloader to receive the commands from the host.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Negative Value - Failure <br />

**References:** [rsi_driver_cb_non_rom::rom_version_info](rsi-driver-cb-non-rom#rom-version-info), [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_bl_select_option (heading level 8)

`int16_t rsi_bl_select_option(uint8_t cmd)`

**Description:** Send firmware load request or update default configurations to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|cmd|- type of configuration to be saved <br /><br/> BURN_NWP_FW - 0x42 <br /><br/> LOAD_NWP_FW - 0x31 <br /><br/> LOAD_DEFAULT_NWP_FW_ACTIVE_LOW - 0x71 <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffff2, 0xfffffff1, 0xffffffe4) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_init_timer](driver11#rsi-init-timer), [rsi_mem_wr](driver1#rsi-mem-wr), [rsi_timer_expired](driver11#rsi-timer-expired) and [rsi_timer_left](driver11#rsi-timer-left)

**Referenced by:** [rsi_device_init](common#rsi-device-init)

###### rsi_get_rom_version (heading level 8)

`int32_t rsi_get_rom_version(void)`

**Description:** Get the ROM version of the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 1 - RSI_ROM_VERSION_1P0 <br />
- 2 - RSI_ROM_VERSION_1P1

**Note**

- The return value of this API can be used to infer chip version of the module. <br />  
   1 - 1.4EVK <br />  
   2 - 1.5EVK

**References:** [rsi_driver_cb_non_rom::rom_version_info](rsi-driver-cb-non-rom#rom-version-info) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_bl_module_power_cycle (heading level 8)

`int16_t rsi_bl_module_power_cycle(void)`

**Description:** Power cycles the module. This API is valid only if there is a power gate, external to the module, which is controlling the power to the module using a GPIO signal of the MCU.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_driver_init()](common#rsi-driver-init) must be called before this API.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_deinit](common#rsi-device-deinit) and [rsi_device_init](common#rsi-device-init)

##### Events

###### Modules

[Events](driver8)

[Set Region AP](driver10)

[Timer](driver11)

[Utils](driver12)

[Scheduler](driver15)

[Queue](driver16)

###### Events

###### Functions (heading level 7)

###### rsi_tx_event_handler (heading level 8)

`void rsi_tx_event_handler(void)`

**Description:** Retrieve the packet from the TX pending queue and forward to the module. and forwards to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [rsi_driver_cb_s::bt_single_tx_q](rsi-driver-cb-s#bt-single-tx-q), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_driver_cb_s::common_tx_q](rsi-driver-cb-s#common-tx-q), [rsi_pkt_s::desc](rsi-pkt-s#desc), [rsi_driver_cb_non_rom::driver_timer_start](rsi-driver-cb-non-rom#driver-timer-start), [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [rsi_queue_cb_s::head](rsi-queue-cb-s#head), [rsi_driver_cb_s::m4_tx_q](rsi-driver-cb-s#m4-tx-q), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_power_save_s::power_save_enable](rsi-power-save-s#power-save-enable), [rsi_driver_cb_s::prop_protocol_tx_q](rsi-driver-cb-s#prop-protocol-tx-q), [rsi_bt_common_tx_done](driver14#rsi-bt-common-tx-done), [rsi_bt_get_ACL_type](driver14#rsi-bt-get-acl-type), [rsi_bt_get_proto_type](driver14#rsi-bt-get-proto-type), [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [rsi_check_common_buffer_full](driver13#rsi-check-common-buffer-full), [rsi_check_queue_status](driver16#rsi-check-queue-status), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_common_packet_transfer_done](driver5#rsi-common-packet-transfer-done), [rsi_dequeue_pkt](driver16#rsi-dequeue-pkt), [rsi_device_interrupt_status](driver1#rsi-device-interrupt-status), [rsi_enqueue_pkt](driver16#rsi-enqueue-pkt), [rsi_error_timeout_and_clear_events](driver5#rsi-error-timeout-and-clear-events), [rsi_frame_write](driver1#rsi-frame-write), [rsi_free_queue_pkt](driver5#rsi-free-queue-pkt), [rsi_init_timer](driver11#rsi-init-timer), [rsi_mask_event](driver5#rsi-mask-event), [rsi_mutex_lock](rsi-os-h#rsi-mutex-lock), [rsi_mutex_unlock](rsi-os-h#rsi-mutex-unlock), [rsi_req_wakeup](driver5#rsi-req-wakeup), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_driver_cb_s::rsi_tx_done_handler](rsi-driver-cb-s#rsi-tx-done-handler), [rsi_ulp_wakeup_init](driver2#rsi-ulp-wakeup-init), [rsi_wait4wakeup](driver5#rsi-wait4wakeup), [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [SL_PRINTF](bt-classic1#sl-printf), [rsi_driver_cb_non_rom::timer_start](rsi-driver-cb-non-rom#timer-start), [rsi_driver_cb_non_rom::tx_mask_event](rsi-driver-cb-non-rom#tx-mask-event), [rsi_driver_cb_non_rom::tx_mutex](rsi-driver-cb-non-rom#tx-mutex), [rsi_driver_cb_s::wlan_tx_q](rsi-driver-cb-s#wlan-tx-q) and [rsi_driver_cb_s::zigb_tx_q](rsi-driver-cb-s#zigb-tx-q)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_set_event_non_rom (heading level 8)

`void rsi_set_event_non_rom(uint32_t event_num)`

**Description:** Set an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- event number to be set|

**Returns**

- void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [global_cb_s::os_enabled](global-cb-s#os-enabled), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_task_notify](rtos#rsi-task-notify) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

**Referenced by:** [rsi_set_event](driver5#rsi-set-event)

###### rsi_set_event_from_isr_non_rom (heading level 8)

`void rsi_set_event_from_isr_non_rom(uint32_t event_num)`

**Description:** Set an event from ISR.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|event_num - event number to be set|

**Returns**

- void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_task_notify_from_isr](rtos#rsi-task-notify-from-isr) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

**Referenced by:** [rsi_set_event_from_isr](driver5#rsi-set-event-from-isr)

###### rsi_unmask_event_from_isr_non_rom (heading level 8)

`void rsi_unmask_event_from_isr_non_rom(uint32_t event_num)`

**Description:** Unmask an event from ISR.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|event_num - event number to unmask|

**Returns**

- void

**References:** [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_task_notify_from_isr](rtos#rsi-task-notify-from-isr) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

**Referenced by:** [rsi_unmask_event_from_isr](driver8#rsi-unmask-event-from-isr)

###### rsi_unmask_event_non_rom (heading level 8)

`void rsi_unmask_event_non_rom(uint32_t event_num)`

**Description:** Unmask an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- event number to unmask|

**Returns**

- void

**References:** [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_task_notify](rtos#rsi-task-notify) and [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb)

**Referenced by:** [rsi_unmask_event](driver8#rsi-unmask-event)

###### rsi_unmask_event (heading level 8)

`void rsi_unmask_event(uint32_t event_num)`

**Description:** Unmask an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- Event number to unmask|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_unmask_event](rom-wl-api-s#rsi-unmask-event) and [rsi_unmask_event_non_rom](driver8#rsi-unmask-event-non-rom)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_handle_slp_wkp](driver5#rsi-handle-slp-wkp) and [rsi_rx_event_handler](driver5#rsi-rx-event-handler)

###### rsi_unmask_event_from_isr (heading level 8)

`void rsi_unmask_event_from_isr(uint32_t event_num)`

**Description:** Unmask an event from ISR context.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_num|- event number to unmask|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_unmask_event_from_isr](rom-wl-api-s#rsi-unmask-event-from-isr) and [rsi_unmask_event_from_isr_non_rom](driver8#rsi-unmask-event-from-isr-non-rom)

###### Set Region AP

###### Functions (heading level 7)

###### extract_setregionap_country_info (heading level 8)

`void extract_setregionap_country_info(rsi_req_set_region_ap_t *rsi_set_region_ap)`

**Description:** Initialize the global parameter structure with parameters used in set region ap command based on the region.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_req_set_region_ap_t](rsi-req-set-region-ap-s) *|[in]|rsi_set_region_ap|- Pointer to the global parameter structure <br />|

**Returns**

- void <br />

**References:** [rsi_req_set_region_ap_s::channel_info](rsi-req-set-region-ap-s#channel-info), [rsi_req_set_region_ap_s::first_channel](rsi-req-set-region-ap-s#first-channel), [rsi_req_set_region_ap_s::max_tx_power](rsi-req-set-region-ap-s#max-tx-power), [rsi_req_set_region_ap_s::no_of_channels](rsi-req-set-region-ap-s#no-of-channels) and [rsi_req_set_region_ap_s::no_of_rules](rsi-req-set-region-ap-s#no-of-rules)

###### rsi_post_waiting_socket_semaphore (heading level 8)

`void rsi_post_waiting_socket_semaphore(int32_t sockID)`

**Description:** Post a socket semaphore which is on wait.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**References:** [rsi_semaphore_post](rsi-os-h#rsi-semaphore-post)

**Referenced by:** [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### Timer

###### Functions (heading level 7)

###### rsi_timer_expiry_interrupt_handler (heading level 8)

`void rsi_timer_expiry_interrupt_handler(void)`

**Description:** Called for every millisecond and increments the timer counter.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- void

**References:** [rsi_driver_cb_non_rom::rsi_spiTimer1](rsi-driver-cb-non-rom#rsi-spi-timer1), [rsi_driver_cb_non_rom::rsi_spiTimer2](rsi-driver-cb-non-rom#rsi-spi-timer2), [rsi_driver_cb_non_rom::rsi_spiTimer3](rsi-driver-cb-non-rom#rsi-spi-timer3) and [rsi_driver_cb_non_rom::timer_counter](rsi-driver-cb-non-rom#timer-counter)

###### rsi_timer_read_counter (heading level 8)

`uint32_t rsi_timer_read_counter(void)`

**Description:** Read the timer counter value.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Timer counter value in milliseconds

**Referenced by:** [rsi_init_timer](driver11#rsi-init-timer), [rsi_timer_expired](driver11#rsi-timer-expired) and [rsi_timer_left](driver11#rsi-timer-left)

###### rsi_init_timer (heading level 8)

`void rsi_init_timer(rsi_timer_instance_t *rsi_timer, uint32_t duration)`

**Description:** Initialize the timer instance.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_timer_instance_t](rsi-timer-instance-s) *|[in]|rsi_timer|- timer instance|
|uint32_t|[in]|duration|- duration in milli seconds <br />|

**Returns**

- Void

**References:** [rsi_timer_read_counter](driver11#rsi-timer-read-counter), [rsi_timer_instance_s::start_time](rsi-timer-instance-s#start-time) and [rsi_timer_instance_s::timeout](rsi-timer-instance-s#timeout)

**Referenced by:** [rsi_bl_select_option](driver6#rsi-bl-select-option), [rsi_bl_upgrade_firmware](common#rsi-bl-upgrade-firmware), [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_device_init](common#rsi-device-init), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_req_wakeup](driver5#rsi-req-wakeup), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_tx_event_handler](driver8#rsi-tx-event-handler), [rsi_wait4wakeup](driver5#rsi-wait4wakeup), [rsi_wireless_init](common#rsi-wireless-init) and [rsi_wlan_get](wlan#rsi-wlan-get)

###### rsi_timer_expired (heading level 8)

`int32_t rsi_timer_expired(rsi_timer_instance_t *timer)`

**Description:** Check if the timer instance is expired.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_timer_instance_t](rsi-timer-instance-s) *|[in]|timer|- timer instance|

**Returns**

- 1 - if timer is expired <br />
- 0 - if timer is not expired

**References:** [rsi_timer_read_counter](driver11#rsi-timer-read-counter), [rsi_timer_instance_s::start_time](rsi-timer-instance-s#start-time) and [rsi_timer_instance_s::timeout](rsi-timer-instance-s#timeout)

**Referenced by:** [rsi_bl_select_option](driver6#rsi-bl-select-option), [rsi_bl_upgrade_firmware](common#rsi-bl-upgrade-firmware), [rsi_bootloader_instructions](driver5#rsi-bootloader-instructions), [rsi_device_init](common#rsi-device-init), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_req_wakeup](driver5#rsi-req-wakeup), [rsi_rx_event_handler](driver5#rsi-rx-event-handler), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_tx_event_handler](driver8#rsi-tx-event-handler), [rsi_wait4wakeup](driver5#rsi-wait4wakeup), [rsi_wireless_init](common#rsi-wireless-init) and [rsi_wlan_get](wlan#rsi-wlan-get)

###### rsi_timer_left (heading level 8)

`uint32_t rsi_timer_left(rsi_timer_instance_t *timer)`

**Description:** Get the remaining time for timer expiry.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_timer_instance_t](rsi-timer-instance-s) *|[in]|timer|- timer instance|

**Returns**

- Positive value - Time left to expire <br />
- 0 - Timer is expired

**References:** [rsi_timer_read_counter](driver11#rsi-timer-read-counter), [rsi_timer_instance_s::start_time](rsi-timer-instance-s#start-time) and [rsi_timer_instance_s::timeout](rsi-timer-instance-s#timeout)

**Referenced by:** [rsi_bl_select_option](driver6#rsi-bl-select-option)

###### Utils

###### Functions (heading level 7)

###### rsi_uint16_to_2bytes (heading level 8)

`void rsi_uint16_to_2bytes(uint8_t *dBuf, uint16_t val)`

**Description:** Convert uint16 to two byte array.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dBuf|- Pointer to buffer to put the data in|
|uint16_t|[in]|val|- Data to convert|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_uint16_to_2bytes](rom-wl-api-s#rsi-uint16-to-2bytes)

**Referenced by:** [rsi_ble_get_att_descriptors](bt-low-energy3#rsi-ble-get-att-descriptors), [rsi_ble_get_att_descriptors_async](bt-low-energy4#rsi-ble-get-att-descriptors-async), [rsi_ble_get_att_value](bt-low-energy3#rsi-ble-get-att-value), [rsi_ble_get_att_value_async](bt-low-energy4#rsi-ble-get-att-value-async), [rsi_ble_get_char_services](bt-low-energy3#rsi-ble-get-char-services), [rsi_ble_get_char_services_async](bt-low-energy4#rsi-ble-get-char-services-async), [rsi_ble_get_char_value_by_uuid](bt-low-energy3#rsi-ble-get-char-value-by-uuid), [rsi_ble_get_char_value_by_uuid_async](bt-low-energy4#rsi-ble-get-char-value-by-uuid-async), [rsi_ble_get_inc_services](bt-low-energy3#rsi-ble-get-inc-services), [rsi_ble_get_inc_services_async](bt-low-energy4#rsi-ble-get-inc-services-async), [rsi_ble_prepare_write](bt-low-energy3#rsi-ble-prepare-write), [rsi_ble_prepare_write_async](bt-low-energy4#rsi-ble-prepare-write-async), [rsi_ble_set_att_cmd](bt-low-energy3#rsi-ble-set-att-cmd), [rsi_ble_set_att_value](bt-low-energy3#rsi-ble-set-att-value), [rsi_ble_set_att_value_async](bt-low-energy4#rsi-ble-set-att-value-async), [rsi_ble_set_long_att_value](bt-low-energy3#rsi-ble-set-long-att-value), [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_fill_config_profile](wlan#rsi-fill-config-profile), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore) and [rsi_setsockopt](network5#rsi-setsockopt)

###### rsi_uint32_to_4bytes (heading level 8)

`void rsi_uint32_to_4bytes(uint8_t *dBuf, uint32_t val)`

**Description:** Convert uint32 to four byte array.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dBuf|- Pointer to buffer to put the data in <br />|
|uint32_t|[in]|val|- Data to convert <br />|

**Returns**

- void <br />

**References:** [ROM_WL_API_S::rsi_uint32_to_4bytes](rom-wl-api-s#rsi-uint32-to-4bytes)

**Referenced by:** [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd), [rsi_fill_config_profile](wlan#rsi-fill-config-profile) and [rsi_mem_wr](driver2#rsi-mem-wr)

###### rsi_bytes2R_to_uint16 (heading level 8)

`uint16_t rsi_bytes2R_to_uint16(uint8_t *dBuf)`

**Description:** Convert a 2 byte array to uint16, first byte in array is LSB. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dBuf|- Pointer to a buffer to get the data from <br />|

**Returns**

- Converted 16 bit data <br />

**References:** [ROM_WL_API_S::rsi_bytes2R_to_uint16](rom-wl-api-s#rsi-bytes2-r-to-uint16)

**Referenced by:** [rsi_bt_common_tx_done](driver14#rsi-bt-common-tx-done), [rsi_crypto_event_rx_handler](driver5#rsi-crypto-event-rx-handler), [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd), [rsi_driver_process_bt_resp](driver14#rsi-driver-process-bt-resp), [rsi_driver_process_bt_resp_handler](driver14#rsi-driver-process-bt-resp-handler), [rsi_driver_process_common_recv_cmd](driver5#rsi-driver-process-common-recv-cmd), [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_frame_read](driver2#rsi-frame-read), [rsi_get_app_socket_descriptor](network5#rsi-get-app-socket-descriptor), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_get_socket_descriptor](network5#rsi-get-socket-descriptor), [rsi_tx_event_handler](driver8#rsi-tx-event-handler) and [rsi_wlan_process_raw_data](driver13#rsi-wlan-process-raw-data)

###### rsi_bytes4R_to_uint32 (heading level 8)

`uint32_t rsi_bytes4R_to_uint32(uint8_t *dBuf)`

**Description:** Convert a 4 byte array to uint32, first byte in array is LSB.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dBuf|- Pointer to a buffer to get the data from <br />|

**Returns**

- Converted 32 bit data

**References:** [ROM_WL_API_S::rsi_bytes4R_to_uint32](rom-wl-api-s#rsi-bytes4-r-to-uint32)

**Referenced by:** [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd)

###### rsi_ascii_hex2num (heading level 8)

`int8_t rsi_ascii_hex2num(int8_t ascii_hex_in)`

**Description:** ASCII to HEX conversion.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t|[in]|ascii_hex_in|- ASCII HEX input|

**Returns**

- HEX number <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_char_hex2dec](driver12#rsi-char-hex2dec)

###### rsi_char_hex2dec (heading level 8)

`int8 rsi_char_hex2dec(int8_t *cBuf)`

**Description:** Convert given ASCII HEX notation to decimal notation (used for MAC address).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|cBuf|- ASCII HEX notation string|

**Returns**

- Integer Value

**References:** [rsi_ascii_hex2num](driver12#rsi-ascii-hex2num)

**Referenced by:** [rsi_ascii_dev_address_to_6bytes_rev](driver12#rsi-ascii-dev-address-to-6bytes-rev)

###### rsi_ascii_dev_address_to_6bytes_rev (heading level 8)

`uint8_t * rsi_ascii_dev_address_to_6bytes_rev(uint8_t *hex_addr, int8_t *ascii_mac_address)`

**Description:** Convert notation MAC address to a 6-byte HEX address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|hex_addr|- Source address to convert, must be a null terminated string. <br />|
|int8_t *|[out]|ascii_mac_address|- Converted HEX address. <br />|

**Returns**

- HEX address

**References:** [rsi_char_hex2dec](driver12#rsi-char-hex2dec)

###### hex_to_ascii (heading level 8)

`int8_t hex_to_ascii(uint8_t hex_num)`

**Description:** Hex to ascii conversion.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|hex_num|- HEX number|

**Returns**

- Ascii value for given HEX value <br />

**Referenced by:** [rsi_6byte_dev_address_to_ascii](driver12#rsi-6byte-dev-address-to-ascii)

###### rsi_6byte_dev_address_to_ascii (heading level 8)

`int8_t * rsi_6byte_dev_address_to_ascii(uint8_t *ascii_mac_address, uint8_t *hex_addr)`

**Description:** Convert given 6-byte HEX address to ASCII Mac address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|ascii_mac_address|- HEX address input.|
|uint8_t *|[out]|hex_addr|- Converted ASCII mac address is returned here.|

**Returns**

- Converted ASCII mac address

**References:** [hex_to_ascii](driver12#hex-to-ascii)

###### lmac_crc8_c (heading level 8)

`uint8_t lmac_crc8_c(uint8_t crc8_din, uint8_t crc8_state, uint8_t end)`

**Description:** Calculate CRC for a given byte and accumulate CRC.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|crc8_din|- CRC byte input <br />|
|uint8_t|[in]|crc8_state|- accumulated CRC <br />|
|uint8_t|[in]|end|- last byte CRC <br />|

**Returns**

- CRC value

**Referenced by:** [multicast_mac_hash](driver12#multicast-mac-hash)

###### multicast_mac_hash (heading level 8)

`uint8_t multicast_mac_hash(uint8_t *mac)`

**Description:** Calculate 6-bit hash value for given MAC address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|mac|- pointer to MAC address <br />|

**Returns**

- 6-bit Hash value

**References:** [lmac_crc8_c](driver12#lmac-crc8-c)

###### convert_lower_case_to_upper_case (heading level 8)

`uint8_t convert_lower_case_to_upper_case(uint8_t lwrcase)`

**Description:** Convert the given lower-case character to upper case.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|lwrcase|- Lower case character to convert <br />|

**Returns**

- Converted Upper case character <br />

**Referenced by:** [rsi_fill_config_profile](wlan#rsi-fill-config-profile) and [string2array](driver12#string2array)

###### string2array (heading level 8)

`void string2array(uint8_t *dst, uint8_t *src, uint32_t length)`

**Description:** Convert the given string to array.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|dst|- Pointer to destination array <br />|
|uint8_t *|[in]|src|- Pointer to source string <br />|
|uint32_t|[in]|length|- Length of the string|

**Returns**

- Void <br />

**References:** [convert_lower_case_to_upper_case](driver12#convert-lower-case-to-upper-case)

###### rsi_itoa (heading level 8)

`uint8_t * rsi_itoa(uint32_t val, uint8_t *str)`

**Description:** Convert integer value into null-terminated string and stores it.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|val|- Value to be converted to a string <br />|
|uint8_t *|[in]|str|- Array in memory where to store the resulting null-terminated string <br />|

**Returns**

- Null-terminated string <br />

###### rsi_atoi (heading level 8)

`int32_t rsi_atoi(const int8_t *str)`

**Description:** Convert string to an integer.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|const int8_t *|[in]|str|- String to be converted to integer|

**Returns**

- Converted Integer <br />

**Referenced by:** [rsi_ascii_dot_address_to_4bytes](driver12#rsi-ascii-dot-address-to-4bytes) and [rsi_parse](wlan#rsi-parse)

###### asciihex_2_num (heading level 8)

`int8_t asciihex_2_num(int8_t ascii_hex_in)`

**Description:** ASCII to hex conversion.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t|[in]|ascii_hex_in|- ASCII hex input <br />|

**Returns**

- HEX number <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success)

**Referenced by:** [rsi_charhex_2_dec](driver12#rsi-charhex-2-dec)

###### rsi_charhex_2_dec (heading level 8)

`int8_t rsi_charhex_2_dec(int8_t *cBuf)`

**Description:** Convert given ASCII HEX notation to decimal notation (used for mac address).

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|cBuf|- ASCII HEX notation string.|

**Returns**

- Integer value <br />

**References:** [asciihex_2_num](driver12#asciihex-2-num)

**Referenced by:** [rsi_ascii_mac_address_to_6bytes](driver12#rsi-ascii-mac-address-to-6bytes)

###### rsi_ascii_mac_address_to_6bytes (heading level 8)

`void rsi_ascii_mac_address_to_6bytes(uint8_t *hexAddr, int8_t *asciiMacAddress)`

**Description:** Convert ASCII notation MAC address to a 6-byte HEX address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|hexAddr|- Source address to convert, must be a null terminated string. <br />|
|int8_t *|[out]|asciiMacAddress|- Converted HEX address is returned here.|

**Returns**

- Void

**References:** [rsi_charhex_2_dec](driver12#rsi-charhex-2-dec)

###### rsi_ascii_dot_address_to_4bytes (heading level 8)

`void rsi_ascii_dot_address_to_4bytes(uint8_t *hexAddr, int8_t *asciiDotAddress)`

**Description:** Convert ASCII notation network address to 4-byte HEX address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|hexAddr|- Source address to convert, must be a null terminated string.|
|int8_t *|[out]|asciiDotAddress|- Output value is passed back in the 4-byte HEX Address.|

**Returns**

- Void <br />

**References:** [rsi_atoi](driver12#rsi-atoi)

###### ip_to_reverse_hex (heading level 8)

`uint64_t ip_to_reverse_hex(char *ip)`

**Description:** Convert IP address to reverse HEX format. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|char *|[in]|ip|- IP address to convert.|

**Returns**

- IP address in reverse HEX format <br />

###### rsi_ntohl (heading level 8)

`uint32_t rsi_ntohl(uint32_t a)`

**Description:** Converts the unsigned integer from network byte order to host byte order.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|a|- Unsigned integer to convert.|

**Returns**

- Unsigned integer in host byte order

###### ascii_to_dec (heading level 8)

`uint8_t ascii_to_dec(uint8_t *num)`

**Description:** Convert ASCII to Decimal Value. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|num|- ASCII input|

**Returns**

- dec_val - value after conversion

###### rsi_reverse (heading level 8)

`void rsi_reverse(char *str, int len)`

**Description:** Reverses the given string.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|char *|[in]|str|- string to be reversed|
|int|[in]|len|- the length of the given string|

**Returns**

- void

**Referenced by:** [rsi_intToStr](driver12#rsi-int-to-str)

###### rsi_intToStr (heading level 8)

`int rsi_intToStr(int x, char str[], int d)`

**Description:** converts the integer into a string.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int|[in]|x|- the string in which the result must be stored|
|char|[in]|str|- the float number that needs to be converted into a string|
|int|[in]|d|- the number of points after the decimal that needs to be printed, should be less than 6.|

Converts a floating-point/double number to a string.

**Returns**

- the lenght of the string

**Returns**

- void

**References:** [rsi_reverse](driver12#rsi-reverse)

**Referenced by:** [rsi_ftoa](driver12#rsi-ftoa)

###### rsi_ftoa (heading level 8)

`void rsi_ftoa(char *res, float n, int afterpoint)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|char *|N/A|res||
|float|N/A|n||
|int|N/A|afterpoint||

**References:** [rsi_intToStr](driver12#rsi-int-to-str)

###### ROM_WL_rsi_uint16_to_2bytes (heading level 8)

`void ROM_WL_rsi_uint16_to_2bytes(global_cb_t *global_cb_p, uint8_t *dBuf, uint16_t val)`

**Description:** Convert uint16 to two byte array.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint8_t *|[in]|dBuf|- pointer to buffer to put the data in|
|uint16_t|[in]|val|- data to convert|

**Returns**

- void

**References:** [global_cb_s::endian](global-cb-s#endian)

###### ROM_WL_rsi_uint32_to_4bytes (heading level 8)

`void ROM_WL_rsi_uint32_to_4bytes(global_cb_t *global_cb_p, uint8_t *dBuf, uint32_t val)`

**Description:** Convert uint32 to four byte array.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint8_t *|[in]|dBuf|- pointer to the buffer to put the data in|
|uint32_t|[in]|val|- data to convert|

**Returns**

- void

**References:** [global_cb_s::endian](global-cb-s#endian)

###### ROM_WL_rsi_bytes2R_to_uint16 (heading level 8)

`uint16_t ROM_WL_rsi_bytes2R_to_uint16(global_cb_t *global_cb_p, uint8_t *dBuf)`

**Description:** Convert a 2 byte array to uint16, first byte in array is LSB.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint8_t *|[in]|dBuf|- pointer to a buffer to get the data from|

**Returns**

- Converted data

**References:** [global_cb_s::endian](global-cb-s#endian)

###### ROM_WL_rsi_bytes4R_to_uint32 (heading level 8)

`uint32_t ROM_WL_rsi_bytes4R_to_uint32(global_cb_t *global_cb_p, uint8_t *dBuf)`

**Description:** Convert a 4 byte array to uint32, first byte in array is LSB.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the common buffer|
|uint8_t *|[in]|dBuf|- pointer to buffer to get the data from|

**Returns**

- Converted data

**References:** [global_cb_s::endian](global-cb-s#endian)

###### Scheduler

###### Functions (heading level 7)

###### rsi_scheduler_init (heading level 8)

`void rsi_scheduler_init(rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Initialize scheduler.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler control block structure|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_scheduler_init](rom-wl-api-s#rsi-scheduler-init)

###### rsi_get_event (heading level 8)

`uint32_t rsi_get_event(rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Get an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler cb structure|

**Returns**

- Current event map

###### rsi_scheduler (heading level 8)

`void rsi_scheduler(rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Handles events.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler cb structure|

**Returns**

- void

**References:** [ROM_WL_API_S::rsi_scheduler](rom-wl-api-s#rsi-scheduler) and [rsi_scheduler_non_rom](driver15#rsi-scheduler-non-rom)

**Referenced by:** [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_get_module_type](common#rsi-get-module-type), [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_wireless_driver_task](common#rsi-wireless-driver-task), [rsi_wireless_init](common#rsi-wireless-init) and [rsi_wlan_get](wlan#rsi-wlan-get)

###### rsi_get_event_non_rom (heading level 8)

`uint32_t rsi_get_event_non_rom(rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Get an event on ROM.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler cb structure|

**Returns**

- Current event map

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [rsi_get_intr_status](common#rsi-get-intr-status) and [rsi_set_event](driver5#rsi-set-event)

###### rsi_scheduler_non_rom (heading level 8)

`void rsi_scheduler_non_rom(rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Handles events.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler cb structure <br />|

**Returns**

- void <br />

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb) and [rsi_task_notify_wait](rtos#rsi-task-notify-wait)

**Referenced by:** [rsi_scheduler](driver15#rsi-scheduler)

###### ROM_WL_rsi_scheduler_init (heading level 8)

`void ROM_WL_rsi_scheduler_init(global_cb_t *global_cb_p, rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Initialize scheduler.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler structure|

**Returns**

- void

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map), [global_cb_s::os_enabled](global-cb-s#os-enabled) and [rsi_scheduler_cb_s::scheduler_sem](rsi-scheduler-cb-s#scheduler-sem)

###### ROM_WL_rsi_get_event (heading level 8)

`uint32_t ROM_WL_rsi_get_event(global_cb_t *global_cb_p, rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Get an event.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler structure|

**Returns**

- Current event map

**References:** [rsi_scheduler_cb_s::event_map](rsi-scheduler-cb-s#event-map), [rsi_scheduler_cb_s::mask_map](rsi-scheduler-cb-s#mask-map) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [ROM_WL_rsi_scheduler](driver15#rom-wl-rsi-scheduler)

###### ROM_WL_rsi_scheduler (heading level 8)

`void ROM_WL_rsi_scheduler(global_cb_t *global_cb_p, rsi_scheduler_cb_t *scheduler_cb)`

**Description:** Handles events.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_scheduler_cb_t](rsi-scheduler-cb-s) *|[in]|scheduler_cb|- pointer to scheduler cb structure|

**Returns**

- void

**References:** [ROM_WL_rsi_get_event](driver15#rom-wl-rsi-get-event) and [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb)

###### Queue

###### Functions (heading level 7)

###### rsi_virtual_to_physical_address (heading level 8)

`void * rsi_virtual_to_physical_address(void *virtual_address)`

**Description:** Map virtual address to physical address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|virtual_address|- pointer to virtual address|

**Returns**

- void

###### rsi_physical_to_virtual_address (heading level 8)

`void * rsi_physical_to_virtual_address(void *physical_address)`

**Description:** Map physical address to virtual address.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|physical_address|- pointer to physical_address|

**Returns**

- void

###### rsi_semaphore_reset (heading level 8)

`rsi_error_t rsi_semaphore_reset(rsi_semaphore_handle_t *semaphore)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|N/A|semaphore||

###### rsi_queues_init (heading level 8)

`void rsi_queues_init(rsi_queue_cb_t *queue)`

**Description:** Initialize queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue|

**Returns**

- void <br />

**References:** [ROM_WL_API_S::rsi_queues_init](rom-wl-api-s#rsi-queues-init)

###### rsi_enqueue_pkt (heading level 8)

`void rsi_enqueue_pkt(rsi_queue_cb_t *queue, rsi_pkt_t *pkt)`

**Description:** Enqueue packet into queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue cb|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be queued|

**Returns**

- void <br />

**References:** [ROM_WL_API_S::rsi_enqueue_pkt](rom-wl-api-s#rsi-enqueue-pkt)

**Referenced by:** [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_dequeue_pkt (heading level 8)

`rsi_pkt_t * rsi_dequeue_pkt(rsi_queue_cb_t *queue)`

**Description:** Dequeue packet from queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- queue pointer from which packet needs to be dequeued <br />|

**Returns**

- Allocated pocket pointer - Success <br />
- NULL - Failure

**References:** [ROM_WL_API_S::rsi_dequeue_pkt](rom-wl-api-s#rsi-dequeue-pkt)

**Referenced by:** [rsi_check_pkt_queue_and_dequeue](driver5#rsi-check-pkt-queue-and-dequeue), [rsi_crypto_event_tx_handler](driver5#rsi-crypto-event-tx-handler) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_check_queue_status (heading level 8)

`uint32_t rsi_check_queue_status(rsi_queue_cb_t *queue)`

**Description:** Return packet pending count in queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue <br />|

**Returns**

- 0 - If queue masked <br />
- Number of packets pending - If queue is not masked

**References:** [ROM_WL_API_S::rsi_check_queue_status](rom-wl-api-s#rsi-check-queue-status)

**Referenced by:** [rsi_check_pkt_queue_and_dequeue](driver5#rsi-check-pkt-queue-and-dequeue), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_tx_event_handler](driver8#rsi-tx-event-handler)

###### rsi_block_queue (heading level 8)

`void rsi_block_queue(rsi_queue_cb_t *queue)`

**Description:** Block the queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue <br />|

**Returns**

- void <br />

**References:** [ROM_WL_API_S::rsi_block_queue](rom-wl-api-s#rsi-block-queue)

**Referenced by:** [rsi_driver_common_send_cmd](driver5#rsi-driver-common-send-cmd)

###### rsi_unblock_queue (heading level 8)

`void rsi_unblock_queue(rsi_queue_cb_t *queue)`

**Description:** Unblock the queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue|

**Returns**

- void <br />

**References:** [ROM_WL_API_S::rsi_unblock_queue](rom-wl-api-s#rsi-unblock-queue)

**Referenced by:** [rsi_driver_process_common_recv_cmd](driver5#rsi-driver-process-common-recv-cmd)

###### ROM_WL_rsi_queues_init (heading level 8)

`void ROM_WL_rsi_queues_init(global_cb_t *global_cb_p, rsi_queue_cb_t *queue)`

**Description:** Initialize queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to queue|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to the global control block|

**Returns**

- void

**References:** [rsi_queue_cb_s::head](rsi-queue-cb-s#head), [rsi_queue_cb_s::pending_pkt_count](rsi-queue-cb-s#pending-pkt-count), [rsi_queue_cb_s::queue_mask](rsi-queue-cb-s#queue-mask), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex), [rsi_queue_cb_s::tail](rsi-queue-cb-s#tail) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_enqueue_pkt (heading level 8)

`void ROM_WL_rsi_enqueue_pkt(global_cb_t *global_cb_p, rsi_queue_cb_t *queue, rsi_pkt_t *pkt)`

**Description:** Enqueue packet into queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue cb|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be queued|

**Returns**

- void

**References:** [rsi_queue_cb_s::head](rsi-queue-cb-s#head), [rsi_pkt_s::next](rsi-pkt-s#next), [rsi_queue_cb_s::pending_pkt_count](rsi-queue-cb-s#pending-pkt-count), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex), [rsi_queue_cb_s::tail](rsi-queue-cb-s#tail) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_dequeue_pkt (heading level 8)

`rsi_pkt_t * ROM_WL_rsi_dequeue_pkt(global_cb_t *global_cb_p, rsi_queue_cb_t *queue)`

**Description:** Dequeue packet from queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- queue pointer from which packet needs to be dequeued|

**Returns**

- Allocated packet pointer - Success <br />
- NULL - Failure

**References:** [rsi_queue_cb_s::head](rsi-queue-cb-s#head), [rsi_pkt_s::next](rsi-pkt-s#next), [rsi_queue_cb_s::pending_pkt_count](rsi-queue-cb-s#pending-pkt-count), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex), [rsi_queue_cb_s::tail](rsi-queue-cb-s#tail) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_check_queue_status (heading level 8)

`uint32_t ROM_WL_rsi_check_queue_status(global_cb_t *global_cb_p, rsi_queue_cb_t *queue)`

**Description:** Return packet pending count in queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue <br />|

**Returns**

- 0 - If queue masked <br />
- Number of packets pending - If queue is not masked

**References:** [rsi_queue_cb_s::pending_pkt_count](rsi-queue-cb-s#pending-pkt-count), [rsi_queue_cb_s::queue_mask](rsi-queue-cb-s#queue-mask), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_block_queue (heading level 8)

`void ROM_WL_rsi_block_queue(global_cb_t *global_cb_p, rsi_queue_cb_t *queue)`

**Description:** Block the queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue|

**Returns**

- void

**References:** [rsi_queue_cb_s::queue_mask](rsi-queue-cb-s#queue-mask), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_unblock_queue (heading level 8)

`void ROM_WL_rsi_unblock_queue(global_cb_t *global_cb_p, rsi_queue_cb_t *queue)`

**Description:** Unblock the queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue|

**Returns**

- void

**References:** [rsi_queue_cb_s::queue_mask](rsi-queue-cb-s#queue-mask), [rsi_queue_cb_s::queue_mutex](rsi-queue-cb-s#queue-mutex) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_rsi_enqueue_pkt_from_isr (heading level 8)

`void ROM_WL_rsi_enqueue_pkt_from_isr(global_cb_t *global_cb_p, rsi_queue_cb_t *queue, rsi_pkt_t *pkt)`

**Description:** Enqueue packet from ISR into queue.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- pointer to the global control block|
|[rsi_queue_cb_t](rsi-queue-cb-s) *|[in]|queue|- pointer to queue cb|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- packet pointer which needs to be queued|

**Returns**

- void

**References:** [rsi_queue_cb_s::head](rsi-queue-cb-s#head), [rsi_pkt_s::next](rsi-pkt-s#next), [rsi_queue_cb_s::pending_pkt_count](rsi-queue-cb-s#pending-pkt-count), [rsi_queue_cb_s::tail](rsi-queue-cb-s#tail) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

#### Network APIs

This section describes the Network APIs 

##### Modules

[DHCP User class](network1)

[Embedded MQTT client](network2)

[Multicast](network3)

[BSD Sockets](network5)

[DNS](network6)

[FTP Client](network8)

[HTTP Client](network9)

[Application Protocol](network10)

##### DHCP User class

###### Functions

###### rsi_dhcp_user_class (heading level 7)

`int32_t rsi_dhcp_user_class(uint8_t mode, uint8_t count, user_class_data_t *user_class_data, void(*dhcp_usr_cls_rsp_handler)(uint16_t status))`

**Description:** Enable DHCP user class. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|- DHCP User Class mode <br /><br/> 1- RFC Compatible mode <br /><br/> 2- Windows Compatible mode|
|uint8_t|[in]|count|- DHCP User Class count|
|[user_class_data_t](user-class-data-s) *|[in]|user_class_data|- The first byte of this buffer is user class data length and then user class data follows|
|void(*)(uint16_t status)|[in]|dhcp_usr_cls_rsp_handler|- DHCP User Class response handler|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_dhcp_usr_cls_rsp_handler](rsi-nwk-callback-s#rsi-dhcp-usr-cls-rsp-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### Embedded MQTT client

###### Functions

###### rsi_emb_mqtt_client_init (heading level 7)

`int32_t rsi_emb_mqtt_client_init(int8_t *server_ip, uint32_t server_port, uint32_t client_port, uint16_t flags, uint16_t keep_alive_interval, int8_t *clientid, int8_t *username, int8_t *password)`

**Description:** Create MQTT objects. TCP level connection happens in this API. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|server_ip|- MQTT client keep alive interval|
|uint32_t|[in]|server_port|- Client ID of MQTT client which should be unique for different clients.|
|uint32_t|[in]|client_port|- User name of the MQTT client which is a credential for logging to MQTT server as an authentication|
|uint16_t|[in]|flags|- Password of the MQTT client which is also credential for MQTT server as an authentication|
|uint16_t|N/A|keep_alive_interval||
|int8_t *|N/A|clientid||
|int8_t *|N/A|username||
|int8_t *|N/A|password||

- [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

|Flags|Description|
|---|---|
|BIT(0) - Clean Session|1 - Enable clean session for clearing the historic data <br />|
|0 - Disable clean session|
|BIT(1) - SSL flag|1 - SSL Enable <br />|
|0 - SSL Disable|
|BIT(2) - Server IP version|1 - IPV6 <br />|
|0 - IPV4|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- RSI_EMB_MQTT_KEEPALIVE_RETRIES - Configures the MQTT Keep-alive retries in case the MQTT Ping response is not received from the MQTT broker within the command acknowledgement time (35 seconds) during the MQTT Keep-alive process.
- In this case, the device notifies the application through RSI_WLAN_NWK_EMB_MQTT_KEEPALIVE_TIMEOUT_CB callback, if it is registered. The MQTT Keep Alive retries happen every 35 seconds until MQTT Ping response is received for MQTT Ping request or until all the MQTT Keep Alive retries elapse.This can be configured in rsi_wlan_config.h.
- This is an optional parameter. If not configured, the default value is 0. In this case, device will not perform MQTT Keep Alive retries, however the MQTT Keep Alive process keeps happening (until MQTT connection is terminated) every Keep Alive Time period configured by the host. <br />
- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- The keep_alive_interval variable supports a range from 36 to 65,535 seconds, with a value of 0 treated as a special case that disables the keep-alive mechanism. However, since most cloud MQTT brokers limit the maximum interval to 60 seconds, it is recommended to use a value between 36 and 60 seconds for optimal compatibility.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_connect (heading level 7)

`int32_t rsi_emb_mqtt_connect(uint8_t mqtt_flags, int8_t *will_topic, uint16_t will_message_len, int8_t *will_message)`

**Description:** Connect to MQTT Server/Broker. MQTT level connection happens in this API. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>mqtt_flags</td>
      <td>- Network flags. Each bit in the flag has its own significance <br />

|Flags|Description|
|---|---|
|BIT(6) - pwdFlag|1 - Enable pwdFlag <br />|
|0 - Disable pwdFlag|
|BIT(7) - usrFlag|1 - Enable usrFlag <br />|
|0 - Disable usrFlag|</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>will_topic</td>
      <td>- Will topic that the MQTT client wants the MQTT Server to publish when disconnected unexpectedly.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>will_message_len</td>
      <td>- Length of will message</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>will_message</td>
      <td>- Will message issued by the MQTT Server for a broken client.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_client_init()](network2#rsi-emb-mqtt-client-init) API needs to be called before this API.
- will_topic and will_message are not supported and should be NULL.
- For connecting Embedded MQTT over SSL : <br />  
   Enable TCP_IP_FEAT_SSL in Opermode parameters as here <br />  
   #define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT). <br />  
   Load the related SSL Certificates in the module using [rsi_wlan_set_certificate()](wlan#rsi-wlan-set-certificate) API.
- Refer to [Error Codes](error-codes) for the description of above error codes. <br />
- Length of the topic Length should not exceed 200 bytes excluding NULL termination character.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [UNUSED_PARAMETER](bt-classic1#unused-parameter) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_publish (heading level 7)

`int32_t rsi_emb_mqtt_publish(int8_t *topic, rsi_mqtt_pubmsg_t *publish_msg)`

**Description:** Publish the given message on the topic specified. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|topic|- Topic string on which MQTT client wants to publish data|
|[rsi_mqtt_pubmsg_t](rsi-mqtt-pubmsg-s) *|[in]|publish_msg|- Publish message|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- Length of the topic Length should not exceed 200 bytes excluding NULL termination character.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_mqtt_pubmsg_s::qos](rsi-mqtt-pubmsg-s#qos), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_subscribe (heading level 7)

`int32_t rsi_emb_mqtt_subscribe(uint8_t qos, int8_t *topic)`

**Description:** Subscribe to the topic specified. Thus, MQTT client will receive any data that is published on this topic. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|qos|- Quality of service of message at MQTT protocol level. Valid values are 0, 1, 2.|
|int8_t *|[in]|topic|- Topic string on which MQTT client wants to subscribe.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- Length of the topic Length should not exceed 200 bytes excluding NULL termination character.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_unsubscribe (heading level 7)

`int32_t rsi_emb_mqtt_unsubscribe(int8_t *topic)`

**Description:** Unsubscribe to the topic specified.Thus, MQTT client will not receive any data published on this topic. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|topic|- Topic string to which MQTT client wants to unsubscribe.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- Length of the topic Length should not exceed 200 bytes excluding NULL termination character.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_disconnect (heading level 7)

`int32_t rsi_emb_mqtt_disconnect()`

**Description:** Disconnect the client from MQTT Server/Broker. TCP and MQTT level disconnection take place here. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|Void||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API needs to be called before this API.
- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_destroy (heading level 7)

`int32_t rsi_emb_mqtt_destroy()`

**Description:** Delete MQTT clients profile configuration. TCP level disconnection happens here, if required. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
||[in]|Void||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0xfffffffb, 0xffffffe0) <br />

**Note**

- **Precondition** - [rsi_emb_mqtt_client_init()](network2#rsi-emb-mqtt-client-init) API needs to be called before this API, based on requirement.This API can also be issued after [rsi_emb_mqtt_disconnect()](network2#rsi-emb-mqtt-disconnect) API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_emb_mqtt_register_call_back (heading level 7)

`int32_t rsi_emb_mqtt_register_call_back(uint32_t callback_id, void(*call_back_handler_ptr)(uint16_t status, uint8_t *buffer, const uint32_t length))`

**Description:** Register callbacks for MQTT Asynchronous messages. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint32_t</td>
      <td>N/A</td>
      <td>callback_id</td>
      <td>If it's a Success - RSI_SUCCESS, else the possible error response codes are 0x0021, 0xFF74, 0xFF40, 0xFF87.</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, uint8_t *buffer, const uint32_t length)</td>
      <td>[in]</td>
      <td>call_back_handler_ptr</td>
      <td>- Callback function pointer</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status</td>
      <td>- Success - RSI_SUCCESS. <br />
 Failure - Possible error codes are : 0x0030, 0x0036, 0x0065, 0xBBF1, 0xBBF2, 0xBBF3, 0xFFF6</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>buffer</td>
      <td>- Pointer to buffer which holds data <br /></td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>length</td>
      <td>- Length of the buffer <br />

- ### Prototypes of the callback functions with given callback id ###  
  |Callback id|Function Description|  
  |---|---|  
  |RSI_WLAN_NWK_EMB_MQTT_REMOTE_TERMINATE_CB|Called to notify the remote termination of embedded MQTT socket <br />|  
  ||</td>
    </tr>
  </tbody>
</table>

- Need to call [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API

RSI_WLAN_NWK_EMB_MQTT_PUB_MSG_CB   

Called when MQTT client receives the data which was published by other clients on the subscribed topic    

- Need to call [rsi_emb_mqtt_subscribe()](network2#rsi-emb-mqtt-subscribe) API

RSI_WLAN_NWK_EMB_MQTT_KEEPALIVE_TIMEOUT_CB   

Called when keep alive timeout has occurred    

- Need to call [rsi_emb_mqtt_connect()](network2#rsi-emb-mqtt-connect) API

**Returns**

- Status of the call_back_handler_ptr

**Note**

- **callback_id**<br />  
  |ID|Description|  
  |---|---|  
  |RSI_WLAN_NWK_EMB_MQTT_REMOTE_TERMINATE_CB|If registered, this callback notifies the application of disconnection with the MQTT broker. <br />|  
  |RSI_WLAN_NWK_EMB_MQTT_PUB_MSG_CB|If registered, this callback provides MQTT publish received data to the application. <br />|  
  |RSI_WLAN_NWK_EMB_MQTT_KEEPALIVE_TIMEOUT_CB|If registered, this callback notifies the application of MQTT keepalive response timeout, i.e., ping response is not received within the MQTT Command ACK Timer. <br />|

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_nwk_callback_s::rsi_emb_mqtt_keep_alive_timeout_callback](rsi-nwk-callback-s#rsi-emb-mqtt-keep-alive-timeout-callback), [rsi_nwk_callback_s::rsi_emb_mqtt_publish_message_callback](rsi-nwk-callback-s#rsi-emb-mqtt-publish-message-callback), [rsi_nwk_callback_s::rsi_emb_mqtt_remote_terminate_handler](rsi-nwk-callback-s#rsi-emb-mqtt-remote-terminate-handler), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_cal_mqtt_packet_len (heading level 7)

`int32_t rsi_cal_mqtt_packet_len(int32_t rem_len)`

**Description:** Calculate length of MQTT packet. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|rem_len|- Length|

**Returns**

- Length of MQTT packet (adjusted rem_len)

**References:** [SL_PRINTF](bt-classic1#sl-printf)

##### Multicast

###### Functions

###### rsi_multicast (heading level 7)

`static int32_t rsi_multicast(uint8_t flags, int8_t *ip_address, uint8_t command_type)`

**Description:** Send multicast group join or leave. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Select IP version. <br /><br/> BIT(0) : 0 - IPv4 , 1 - IPv6|
|int8_t *|[in]|ip_address|- Multicast IP address|
|uint8_t|[in]|command_type|- Type of commands: JOIN/LEAVE|

**Returns**

- 0 - Success <br />
- Negative value - Failure

###### rsi_multicast_join (heading level 7)

`int32_t rsi_multicast_join(uint8_t flags, int8_t *ip_address)`

**Description:** Join to a multicast group. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Select the IP version. <br /><br/> BIT(0): 0 - IPv4 , 1 - IPv6|
|int8_t *|[in]|ip_address|- IPv4/IPv6 address of multicast group.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Device supports only one multicast group. It must leave the previous group, to join a new multicast group.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_multicast_leave (heading level 7)

`int32_t rsi_multicast_leave(uint8_t flags, int8_t *ip_address)`

**Description:** Leave the multicast group. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Select the IP version. <br /><br/> BIT(0) – RSI_IPV6. Set this bit to enable IPv6. By default it is configured to IPv4.|
|int8_t *|[in]|ip_address|- IPv4/IPv6 address of multicast group.|

- [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021,0x002C,0x0015,0xBB16,0xBB17) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Device supports only one multicast group. It must leave the previous group, to join a new multicast group.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_send_raw_data (heading level 7)

`int32_t rsi_send_raw_data(uint8_t *buffer, uint32_t length)`

**Description:** Send raw data to the module. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|buffer|- Pointer to the buffer to send|
|uint32_t|[in]|length|- Length of the buffer to send|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### BSD Sockets

###### Variables

###### RSI_SUCCESS (heading level 7)

```
return RSI_SUCCESS
```

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_state](wlan#rsi-check-state), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_network_app_protocol_config](network5#rsi-network-app-protocol-config), [rsi_select](network5#rsi-select), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_set_sni_emb_socket](network9#rsi-set-sni-emb-socket), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown) and [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown)

###### Functions

###### rsi_web_socket_create (heading level 7)

`int32_t rsi_web_socket_create(int8_t flags, uint8_t *server_ip_addr, uint16_t server_port, uint16_t device_port, uint8_t *webs_resource_name, uint8_t *webs_host_name, int32_t *socket_id, void(*web_socket_data_receive_notify_callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a web socket client. This is a blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t|[in]|flags|- Select IP version and security <br /><br/> BIT(0): RSI_IPV6 - Set this bit to enable IPv6, by default it is configured to IPv4 <br /><br/> BIT(1): RSI_SSL_ENABLE - Set this bit to enable SSL feature <br />|
|uint8_t *|[in]|server_ip_addr|- Web server IP address|
|uint16_t|[in]|server_port|- Web server socket port|
|uint16_t|[in]|device_port|- Local port|
|uint8_t *|[in]|webs_resource_name|- Web resource name|
|uint8_t *|[in]|webs_host_name|- Web host name|
|int32_t *|[in]|socket_id|- Socket ID|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|web_socket_data_receive_notify_callback|- Callback when data packet is received on the created socket|
||[out]|sock_no|- Application socket ID|
||[out]|buffer|- Buffer pointer|
||[out]|length|- Length of data|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [memcpy](bt-classic1#memcpy), [rsi_bind](network5#rsi-bind), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_shutdown](network5#rsi-shutdown), [rsi_socket_async](network5#rsi-socket-async), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_in_addr::s_addr](rsi-in-addr#s-addr), [rsi_sockaddr_in6::sin6_addr](rsi-sockaddr-in6#sin6-addr), [rsi_sockaddr_in6::sin6_family](rsi-sockaddr-in6#sin6-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [rsi_sockaddr_in::sin_addr](rsi-sockaddr-in#sin-addr), [rsi_sockaddr_in::sin_family](rsi-sockaddr-in#sin-family), [rsi_sockaddr_in::sin_port](rsi-sockaddr-in#sin-port) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_web_socket_send_async (heading level 7)

`int32_t rsi_web_socket_send_async(int32_t sockID, uint8_t opcode, int8_t *msg, int32_t msg_length)`

**Description:** Send data from the web socket client. This is a non-blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Application socket ID|
|uint8_t|[in]|opcode|- Type of the packet to be included in web socket header|
|int8_t *|[in]|msg|- Data|
|int32_t|[in]|msg_length|- Data length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_socket_info_s::opcode](rsi-socket-info-s#opcode), [rsi_send](network5#rsi-send), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_web_socket_close (heading level 7)

`int32_t rsi_web_socket_close(int32_t sockID)`

**Description:** Close the web socket client. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket ID of particular socket|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API

**References:** [rsi_shutdown](network5#rsi-shutdown), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_fd_isset (heading level 7)

`int rsi_fd_isset(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Check for the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket ID|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the [rsi_fd_set_s](rsi-fd-set-s) structure|

**Returns**

- Positive Value - Success <br />
- 0 - Failure

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_set_fd (heading level 7)

`void rsi_set_fd(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Set the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket id|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the rsi_fd_set_structure|

**Returns**

- Void

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_fd_clr (heading level 7)

`void rsi_fd_clr(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Clear the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket ID|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the [rsi_fd_set_s](rsi-fd-set-s) structure|

**Returns**

- Void

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_socket_async (heading level 7)

`int32_t rsi_socket_async(int32_t protocolFamily, int32_t type, int32_t protocol, void(*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a socket and register a callback that will be used by the driver to forward the received packets asynchronously to the application (on packet reception) without waiting for [rsi_recv()](network5#rsi-recv) API call. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2) : Select IPv4 <br /><br/> AF_INET6 (3) : Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1) : Select TCP <br /><br/> SOCK_DGRM (2) : Select UDP|
|int32_t|[in]|protocol|- 0: Non SSL sockets <br /><br/> 1: SSL sockets <br /><br/> BIT(5) - Must be enabled to select the certificate index <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1 <br /><br/> Note: Certificates must be loaded in to RAM to select the certificate index feature.|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|callback|- Callback function to read data asynchronously from socket <br />|
||[out]|sock_no|- Application socket number <br />|
||[out]|buffer|- Pointer to buffer that holds data <br />|
||[out]|length|- Length of the buffer|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xFFF8, 0xFF80, 0xFF6D, 0xFF85, 0xBB33, 0xBB22) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_socket (heading level 7)

`int32_t rsi_socket(int32_t protocolFamily, int32_t type, int32_t protocol)`

**Description:** Create and return a socket instance. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2): Select IPv4 <br /><br/> AF_INET6 (3): Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1): Select TCP<br /><br/> TCP SOCK_DGRM (2): Select UDP|
|int32_t|[in]|protocol|- 0: Non SSL sockets <br /><br/> PROTOCOL_DFLT_VERSION: To open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2. <br /><br/> BIT(5) - Must be enabled to select the certificate index <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1 <br /><br/> PROTOCOL_TLS_1_0 - To open an SSL/TLS connection over TCP socket with TLS version 1.0 <br /><br/> PROTOCOL_TLS_1_1 - To open an SSL/TLS connection over TCP socket with TLS version 1.1 <br /><br/> PROTOCOL_TLS_1_2 - To open an SSL/TLS connection over TCP socket with TLS version 1.2 <br /><br/> Note: Certificates must be loaded in to RAM to select the certificate index feature.|

**Returns**

- SOCK_ID - Socket ID of the created socket <br />
- Negative value - Failure (**Possible Error Codes** - 0xfffffffd) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- A maximum of 10 sockets can be opened. Range of socket handles are between 1 to 10.
- If 3 TLS sockets are opened then the remaining 7 could be any combinations of UDP and TCP sockets.
- Module supports a maximum of 3 TLS sockets. These can be a combination of client and server sockets. If the HTTPS client is enabled then the user can open only 2 more TLS socket.

**References:** [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::tls_version](rsi-wlan-cb-non-rom-s#tls-version)

###### rsi_bind (heading level 7)

`int32_t rsi_bind(int32_t sockID, struct rsi_sockaddr *localAddress, int32_t addressLength)`

**Description:** Assign an address to a socket. This is a non-blocking API for TCP and a blocking API for UDP.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|localAddress|- Address assigned to the socket. The format is compatible with BSD socket|
|int32_t|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API.

**References:** [rsi_socket_bind](network5#rsi-socket-bind) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_connect (heading level 7)

`int32_t rsi_connect(int32_t sockID, struct rsi_sockaddr *remoteAddress, int32_t addressLength)`

**Description:** Connect the socket to the specified remote address. This is a non-blocking API, if socket_connect_response handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks), otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|remoteAddress|- Remote peer address. The format is compatible with BSD socket.|
|int32_t|[in]|addressLength|- Length of the address in bytes|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- For asynchronous behaviour, user need to register RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB callback ID.

**References:** [rsi_socket_connect](network5#rsi-socket-connect) and [SL_PRINTF](network5#sl-printf)

###### rsi_listen (heading level 7)

`int32_t rsi_listen(int32_t sockID, int32_t backlog)`

**Description:** Enable socket to listen for a remote connection request in passive mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|backlog|- Maximum length to which the queue of pending connections can be held. This argument is used when multiple client connections over the same server socket are required. <br /><br/> If backlog parameter is issued, then rsi_accept or rsi_accept_async can accept those many client connections over the same server socket <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- When using multiple client/server sockets, the following macros have to be updated in the wlan_config.h file, in TCP_IP_FEATURE_BIT_MAP - If TCP_IP_TOTAL_SOCKETS_x flag is used, then firmware allocates memory for x sockets. If TCP_IP_TOTAL_SOCKETS_x flag is not passed, then a default value of 10 sockets is used.
- When using multiple client/server sockets, the following macros have to be updated in the [rsi_user.h](rsi-user-8h-source#rsi-user-8h-source) file, RSI_NUMBER_OF_LTCP_SOCKETS -> Number of server sockets and RSI_NUMBER_OF_SOCKETS -> Number of client sockets + Number of server sockets.
- If multiple server sockets are created then the memory allocated for client sockets is to be shared across the multiple server sockets. If RSI_NUMBER_OF_LTCP_SOCKETS is 0 and RSI_NUMBER_OF_SOCKETS is x, y is server sockets and x-y client sockets can be created

**References:** [rsi_socket_listen](network5#rsi-socket-listen) and [SL_PRINTF](network5#sl-printf)

###### rsi_accept_non_rom (heading level 7)

`int32_t rsi_accept_non_rom(int32_t sockID, struct rsi_sockaddr *ClientAddress, int32_t *addressLength)`

**Description:** Accept the connection request from the remote peer. This API extracts the connection request from the queue of pending connections on listening socket and accepts it.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|ClientAddress|- Remote peer address|
|int32_t *|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_async](network5#rsi-socket-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_receive_callback](rsi-socket-info-s#sock-receive-callback), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type) and [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port)

**Referenced by:** [rsi_accept](network5#rsi-accept)

###### rsi_accept (heading level 7)

`int32_t rsi_accept(int32_t sockID, struct rsi_sockaddr *ClientAddress, int32_t *addressLength)`

**Description:** Accept the connection request from the remote peer. This API extracts the connection request from the queue of pending connections on listening socket and accepts it. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|ClientAddress|- Remote peer address|
|int32_t *|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- **Precondition** - [rsi_listen()](network5#rsi-listen) API needs to be called before this API.

**References:** [rsi_accept_non_rom](network5#rsi-accept-non-rom) and [SL_PRINTF](network5#sl-printf)

###### rsi_recv_large_data_sync (heading level 7)

`int32_t rsi_recv_large_data_sync(int32_t sockID, int8_t *buffer, int32_t requested_length, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Receive large data on a given socket synchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|int8_t *|[in]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|requested_length|- Requested buffer length|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|fromAddr|- Address of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**References:** [rsi_socket_info_non_rom_s::more_rx_data_pending](rsi-socket-info-non-rom-s#more-rx-data-pending), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_recv](network5#rsi-recv) and [rsi_recvfrom](network5#rsi-recvfrom)

###### rsi_recvfrom (heading level 7)

`int32_t rsi_recvfrom(int32_t sockID, int8_t *buffer, int32_t buffersize, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Retrieve the received data from the remote peer on a given socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|int8_t *|[in]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|buffersize|- Size of the buffer supplied|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|fromAddr|- Address of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API. <br />
- By default, a host can receive a maximum of 1460 bytes of data. If you enable the RSI_PROCESS_MAX_RX_DATA macro in the preprocessor settings, the host will be able to obtain a maximum chunk size of 4380 bytes and The host can request a maximum data length of 16384 bytes

**References:** [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_recv (heading level 7)

`int32_t rsi_recv(int32_t sockID, void *rcvBuffer, int32_t bufferLength, int32_t flags)`

**Description:** Retrieve the data from the remote peer on a specified socket. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|void *|[in]|rcvBuffer|- Pointer to the buffer to hold the data received from the remote peer|
|int32_t|[in]|bufferLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition (TCP client)** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.
- **Precondition (TCP server)** - [rsi_listen()](network5#rsi-listen) and [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- **Precondition (UDP server)** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- **Precondition (UDP client)** - [rsi_socket()](network5#rsi-socket) or [rsi_bind()](network5#rsi-bind) API needs to be called before this API <br />
- By default, a host can receive a maximum of 1460 bytes of data. If you enable the RSI_PROCESS_MAX_RX_DATA macro in the preprocessor settings, the host will be able to obtain a maximum chunk size of 4380 bytes and The host can request a maximum data length of 16384 bytes

**References:** [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_sendto (heading level 7)

`int32_t rsi_sendto(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen)`

**Description:** Send data to the specified remote IP Address on the given socket. This is non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data buffer containing data to send to remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Address of the remote peer to send data|
|int32_t|[in]|destAddrLen|- Length of the address in bytes|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition (TCP client)** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.
- **Precondition (TCP server)** - [rsi_listen()](network5#rsi-listen) and [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- **Precondition (UDP server)** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- **Precondition (UDP client)** - [rsi_socket()](network5#rsi-socket) or [rsi_bind()](network5#rsi-bind) API needs to be called before this API
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom) and [SL_PRINTF](network5#sl-printf)

###### rsi_sendto_async (heading level 7)

`int32_t rsi_sendto_async(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send the data to the specified remote IP Address on the given socket and receive the acknowledgement through the registered call back. This is non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data buffer containing data to send to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Address of the remote peer to send data|
|int32_t|[in]|destAddrLen|- Length of the address in bytes|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|length|- Number of bytes transfered|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**Note**

- The data_transfer_complete_handler callback handler is supported only for TCP data transfer. This handler is supported only when RSI_WLAN_RSP_TCP_ACK_INDICATION feature is enabled in socket_feature_bitmap.

**References:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom)

###### rsi_send (heading level 7)

`int32_t rsi_send(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags)`

**Description:** Sends the data to the remote peer on the given socket. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to the buffer containing data to send to the remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure

**Note**

- **Precondition** - [rsi_connect()](network5#rsi-connect)/ [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_wlan_cb_non_rom_s::rsi_uart_data_ack_check](rsi-wlan-cb-non-rom-s#rsi-uart-data-ack-check) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_send_async](network5#rsi-web-socket-send-async)

###### rsi_reset_per_socket_info (heading level 7)

`void rsi_reset_per_socket_info(int32_t sockID)`

**Description:** Reset all the socket related information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_socket_info_non_rom_s::more_data](rsi-socket-info-non-rom-s#more-data), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_socket_info_non_rom_s::rsi_sock_data_tx_done_cb](rsi-socket-info-non-rom-s#rsi-sock-data-tx-done-cb), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb) and [rsi_send_large_data_async](network5#rsi-send-large-data-async)

###### rsi_send_large_data_sync (heading level 7)

`int32_t rsi_send_large_data_sync(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags)`

**Description:** Send large data on a given socket synchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Positive Value - Success, returns the number of bytes sent successfully <br />
- Negative Value - Failure
- Zero - Socket Close Error

**References:** [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_get_error](rtos#rsi-get-error), [rsi_send_async](network5#rsi-send-async), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send](network5#rsi-send)

###### rsi_network_driver_task (heading level 7)

`void rsi_network_driver_task(void)`

**Description:** network task to send large data to send_async API

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||
||[in]|Void||

**Returns**

- Void

**References:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [rsi_task_destroy](rtos#rsi-task-destroy) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

###### rsi_chunk_data_tx_done_cb (heading level 7)

`void rsi_chunk_data_tx_done_cb(int32_t sockID, const uint16_t length)`

**Description:** Send one chunk of data at a time.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const uint16_t|[in]|length|- Length of data to send|

**Returns**

- Void

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_nwk_callback_s::data_transfer_complete_handler](rsi-nwk-callback-s#data-transfer-complete-handler), [rsi_socket_info_non_rom_s::flags](rsi-socket-info-non-rom-s#flags), [rsi_socket_info_non_rom_s::more_data](rsi-socket-info-non-rom-s#more-data), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_clear_event](driver5#rsi-clear-event), [rsi_get_error](rtos#rsi-get-error), [rsi_mask_event](driver5#rsi-mask-event), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_send_async](network5#rsi-send-async), [rsi_nwk_callback_s::rsi_send_large_data_async_complete_callback](rsi-nwk-callback-s#rsi-send-large-data-async-complete-callback), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_unmask_event](driver8#rsi-unmask-event), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_network_driver_task](network5#rsi-network-driver-task) and [rsi_socket_event_handler](network5#rsi-socket-event-handler)

###### rsi_send_large_data_async (heading level 7)

`int32_t rsi_send_large_data_async(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*rsi_sock_data_tx_done_cb)(int32_t sockID, uint16_t total_data_sent))`

**Description:** Send large data on a given socket. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t total_data_sent)|[in]|rsi_sock_data_tx_done_cb|- Pointer to the callback function that will be called after one chunk of data transfer completion|
||[out]|sockID|- Application socket ID|
||[out]|status|- Status of the data transfer|
||[out]|total_data_sent|- Total length of data sent|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Need to register application callback using The [rsi_wlan_nwk_register_send_large_data_event_cb()](network14#rsi-wlan-nwk-register-send-large-data-event-cb) API to get the complete notify.

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_socket_info_non_rom_s::flags](rsi-socket-info-non-rom-s#flags), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_get_error](rtos#rsi-get-error), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_send_async](network5#rsi-send-async), [rsi_set_event](driver5#rsi-set-event), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

###### rsi_task_create (heading level 7)

`rsi_task_create((rsi_task_function_t) rsi_network_driver_task,(uint8_t *)"network", RSI_NETWORK_TASK_STACK_SIZE, NULL, RSI_NETWORK_TASK_PRIORITY, &network_task_handle)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|(rsi_task_function_t)|N/A|rsi_network_driver_task||
|(uint8_t *)"network"|N/A|undefined||
|RSI_NETWORK_TASK_STACK_SIZE|N/A|undefined||
|NULL|N/A|undefined||
|RSI_NETWORK_TASK_PRIORITY|N/A|undefined||
|&|N/A|network_task_handle||

###### SL_PRINTF (heading level 7)

`SL_PRINTF(SL_SEND_LARGE_DATA_ASYNC_EXIT_2, NETWORK, LOG_INFO)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|SL_SEND_LARGE_DATA_ASYNC_EXIT_2|N/A|undefined||
|NETWORK|N/A|undefined||
|LOG_INFO|N/A|undefined||

**Referenced by:** [rsi_accept](network5#rsi-accept), [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_application_socket_descriptor](network5#rsi-application-socket-descriptor), [rsi_bind](network5#rsi-bind), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_connect](network5#rsi-connect), [rsi_fd_clr](network5#rsi-fd-clr), [rsi_fd_isset](network5#rsi-fd-isset), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [rsi_get_app_socket_descriptor](network5#rsi-get-app-socket-descriptor), [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_get_socket_descriptor](network5#rsi-get-socket-descriptor), [rsi_get_socket_id](network5#rsi-get-socket-id), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_listen](network5#rsi-listen), [rsi_network_app_protocol_config](network5#rsi-network-app-protocol-config), [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_recvfrom](network5#rsi-recvfrom), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_select](network5#rsi-select), [rsi_select_get_status](network5#rsi-select-get-status), [rsi_select_set_status](network5#rsi-select-set-status), [rsi_send](network5#rsi-send), [rsi_send_async](network5#rsi-send-async), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto](network5#rsi-sendto), [rsi_sendto_async](network5#rsi-sendto-async), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_set_fd](network5#rsi-set-fd), [rsi_set_sni_emb_socket](network9#rsi-set-sni-emb-socket), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_shutdown](network5#rsi-shutdown), [rsi_socket](network5#rsi-socket), [rsi_socket_async](network5#rsi-socket-async), [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_create_async](network5#rsi-socket-create-async), [rsi_socket_event_handler](network5#rsi-socket-event-handler), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [rsi_tcp_window_update](network16#rsi-tcp-window-update), [rsi_vap_shutdown](network5#rsi-vap-shutdown), [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown), [rsi_wait_on_socket_semaphore](network5#rsi-wait-on-socket-semaphore), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status) and [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status)

###### rsi_find_socket_data_pending (heading level 7)

`uint32_t rsi_find_socket_data_pending(uint32_t event_map)`

**Description:** Find on which socket the data is pending, according to the event that is set from the event map.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_map|- Event map|

**Returns**

- Socket ID from the event map

**References:** [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_network_driver_task](network5#rsi-network-driver-task) and [rsi_socket_event_handler](network5#rsi-socket-event-handler)

###### rsi_socket_event_handler (heading level 7)

`void rsi_socket_event_handler(void)`

**Description:** Retrieve the packet from TX data pending queue and forward to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_clear_event](driver5#rsi-clear-event), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_send_async (heading level 7)

`int32_t rsi_send_async(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data on a given socket asynchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to the buffer containing data to send to the remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**Note**

- The data_transfer_complete_handler callback handler is supported only for TCP data transfer. This handler is supported only when RSI_WLAN_RSP_TCP_ACK_INDICATION feature is enabled in socket_feature_bitmap.

**References:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_send_large_data_async](network5#rsi-send-large-data-async) and [rsi_send_large_data_sync](network5#rsi-send-large-data-sync)

###### rsi_vap_shutdown (heading level 7)

`int32_t rsi_vap_shutdown(uint8_t vapID)`

**Description:** Closes all the sockets associate with a vap_Id. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|vapID|- Virtual access point ID|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Negative Value - Failure

**References:** [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_wlan_ap_stop](wlan#rsi-wlan-ap-stop)

###### rsi_shutdown (heading level 7)

`int32_t rsi_shutdown(int32_t sockID, int32_t how)`

**Description:** Closes the socket specified in a socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|how|- 0: Close the specified socket <br /><br/> 1: Close all the sockets open on a specified socket's source port number|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_socket_shutdown](network5#rsi-socket-shutdown) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_close](network5#rsi-web-socket-close) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_get_application_socket_descriptor (heading level 7)

`int32_t rsi_get_application_socket_descriptor(int32_t sock_id)`

**Description:** Get the application socket descriptor from module socket descriptor.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sock_id|- Module's socket descriptor ID|

**Returns**

- Positive Value - Success (Application socket descriptor) <br />
- Negative Value - Failure (If module’s socket descriptor is not found)

**References:** [rsi_application_socket_descriptor](network5#rsi-application-socket-descriptor) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done)

###### rsi_clear_sockets (heading level 7)

`void rsi_clear_sockets(int32_t sockID)`

**Description:** Clear socket information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### rsi_fill_tls_extension (heading level 7)

`int rsi_fill_tls_extension(int32_t sockID, int extension_type, const void *option_value, rsi_socklen_t extension_len)`

**Description:** Configure TLS extensions.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int|[in]|extension_type|- Type of TLS extension|
|const void *|[in]|option_value|- TLS extension data|
|rsi_socklen_t|[in]|extension_len|- TLS extension data length|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_socket_info_non_rom_s::extension_offset](rsi-socket-info-non-rom-s#extension-offset), [rsi_tls_tlv_s::length](rsi-tls-tlv-s#length), [memcpy](bt-classic1#memcpy), [rsi_socket_info_non_rom_s::no_of_tls_extensions](rsi-socket-info-non-rom-s#no-of-tls-extensions), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf) and [rsi_tls_tlv_s::type](rsi-tls-tlv-s#type)

**Referenced by:** [rsi_setsockopt](network5#rsi-setsockopt)

###### rsi_setsockopt (heading level 7)

`int rsi_setsockopt(int32_t sockID, int level, int option_name, const void *option_value, rsi_socklen_t option_len)`

**Description:** Set the socket options. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int32_t</td>
      <td>[in]</td>
      <td>sockID</td>
      <td>- Socket descriptor ID</td>
    </tr>
    <tr>
      <td>int</td>
      <td>[in]</td>
      <td>level</td>
      <td>- Set the socket option, take the socket level</td>
    </tr>
    <tr>
      <td>int</td>
      <td>[in]</td>
      <td>option_name</td>
      <td>- Provide the name of the ID. <br />
 SO_MAXRETRY - To Enable max tcp retry count <br />
 SO_SOCK_VAP_ID - To Configure the socket VAP ID. VAP ID to differentiate between station and AP in concurrent mode. 0 – for station, 1 – for Access point <br />
 SO_TCP_KEEP_ALIVE - To configure the TCP keep alive (initial time in seconds) <br />
 SO_RCVBUF - To configure the application buffer for receiving server certificate <br />
 SO_SSL_ENABLE - To open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2 <br />
 SO_SSL_V_1_0_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.0 <br />
 SO_SSL_V_1_1_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.1 <br />
 SO_SSL_V_1_2_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.2 <br />
 SO_TCP_ACK_INDICATION - To enable tcp ack indication feature <br />
 SO_CERT_INDEX - To enable set certificate index <br />
 SO_HIGH_PERFORMANCE_SOCKET - To Configure the high performance socket <br />
 SO_TCP_MSS - To Configure the tcp mss <br />
 SO_TCP_RETRY_TRANSMIT_TIMER - To Configure the tcp retry transmit timer <br />
 SO_TLS_SNI - To Configure the TLS SNI extension <br />
 SO_RCVTIMEO - To configure the socket-receive timeout using this option. If no data is received within this time, the sapi driver will unblock this API. <br />
 SO_CHECK_CONNECTED_STATE - To check for the connected state <br />
 IP_TOS - To configure the type of service value [0-7] 

|User Priority (UP)|Value Description|Access Category (AC)|
|---|---|---|
|0|Best Effort (default)|AC_BE|
|1|Background|AC_BK|
|2|Spare / Background|AC_BK|
|3|Excellent Effort|AC_BE|
|4|Controlled Load|AC_VI|
|5|Video|AC_VI|
|6|Voice|AC_VO|
|7|Network Control|AC_VO|</td>
    </tr>
    <tr>
      <td>const void *</td>
      <td>[in]</td>
      <td>option_value</td>
      <td>- Value of the parameter</td>
    </tr>
    <tr>
      <td>rsi_socklen_t</td>
      <td>[in]</td>
      <td>option_len</td>
      <td>- Length of the parameter</td>
    </tr>
  </tbody>
</table>

- [rsi_setsockopt()](network5#rsi-setsockopt) API needs to be called after rsi_socket command only.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API. <br />
- Default window size is 2920 bytes. To modify window size, user need to configure HIGH_PERFORMANCE socket as option_name in [rsi_setsockopt()](network5#rsi-setsockopt) API

**References:** [rsi_socket_info_s::current_available_buffer_count](rsi-socket-info-s#current-available-buffer-count), [rsi_socket_info_non_rom_s::high_performance_socket](rsi-socket-info-non-rom-s#high-performance-socket), [rsi_socket_info_s::max_available_buffer_count](rsi-socket-info-s#max-available-buffer-count), [rsi_socket_info_non_rom_s::max_retransmission_timeout_value](rsi-socket-info-non-rom-s#max-retransmission-timeout-value), [rsi_socket_info_non_rom_s::max_tcp_retries](rsi-socket-info-non-rom-s#max-tcp-retries), [rsi_socket_info_s::read_time_out](rsi-socket-info-s#read-time-out), [rsi_socket_info_s::recv_buffer](rsi-socket-info-s#recv-buffer), [rsi_socket_info_s::recv_buffer_length](rsi-socket-info-s#recv-buffer-length), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::socket_cert_inx](rsi-socket-info-s#socket-cert-inx), [rsi_socket_info_non_rom_s::ssl_bitmap](rsi-socket-info-non-rom-s#ssl-bitmap), [rsi_socket_info_non_rom_s::ssl_buff_len](rsi-socket-info-non-rom-s#ssl-buff-len), [rsi_socket_info_non_rom_s::tcp_mss](rsi-socket-info-non-rom-s#tcp-mss), [rsi_socket_info_non_rom_s::tcp_retry_transmit_timer](rsi-socket-info-non-rom-s#tcp-retry-transmit-timer), [rsi_socket_info_non_rom_s::tos](rsi-socket-info-non-rom-s#tos), [rsi_timeval::tv_sec](rsi-timeval#tv-sec), [rsi_timeval::tv_usec](rsi-timeval#tv-usec) and [rsi_socket_info_non_rom_s::vap_id](rsi-socket-info-non-rom-s#vap-id)

###### rsi_getsockopt (heading level 7)

`int rsi_getsockopt(int32_t sockID, int level, int option_name, const void *option_value, rsi_socklen_t option_len)`

**Description:** Get the socket options. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int|[in]|level|- Set the socket option, take the socket level|
|int|[in]|option_name|- Provide the name of the ID|
|const void *|[in]|option_value|- Value of the parameter|
|rsi_socklen_t|[in]|option_len|- Length of the parameter|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API.

**References:** [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_select (heading level 7)

`int32_t rsi_select(int32_t nfds, rsi_fd_set *readfds, rsi_fd_set *writefds, rsi_fd_set *exceptfds, struct rsi_timeval *timeout, void(*callback)(rsi_fd_set *fd_read, rsi_fd_set *fd_write, rsi_fd_set *fd_except, int32_t status))`

**Description:** Monitor multiple socket (file descriptors), waiting until one or more of the sockets become ready to perform receive or send operation. If callback is NULL or not provided, it is a blocking API. <br />
 Otherwise, it is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|nfds|- The highest-numbered file descriptor in any of the three sets, plus 1|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|readfds|- Socket descriptors to watch to see if data become available for receive|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|writefds|- Socket descriptors to watch to see if space is available in socket to send data.|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|exceptfds|- Socket descriptors to watch for exception|
|struct [rsi_timeval](rsi-timeval) *|[in]|timeout|- Timeout value to break the wait for select. If both fields of the timeval structure are zero, then select() returns immediately. <br /><br/> (This is useful for polling). If timeout is NULL (no timeout), [rsi_select()](network5#rsi-select) can block indefinitely.|
|void(*)([rsi_fd_set](rsi-fd-set-s) *fd_read, [rsi_fd_set](rsi-fd-set-s) *fd_write, [rsi_fd_set](rsi-fd-set-s) *fd_except, int32_t status)|[in]|callback|- Callback called when asynchronous response reach the select request.|
||[out]|fd_read|- Pointer that holds bitmap for the select on read operation|
||[out]|fd_write|- Pointer that holds bitmap for the select on write operation|
||[out]|fd_except|- Pointer that holds bitmap for the select on exceptional operation|
||[out]|status|- Status code|

**Returns**

- Positive Value - Indicate total number of bits ready across all the descriptor sets <br />
- 0 - Time out <br /><br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_accept()](network5#rsi-accept)/ [rsi_connect()](network5#rsi-connect) API's needs to be called before this API.
- **Precondition** - This API needs to be called before [rsi_recv()](network5#rsi-recv)/ [rsi_recvfrom()](network5#rsi-recvfrom)/ [rsi_send()](network5#rsi-send) API's.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_semaphore_create](rsi-os-h#rsi-semaphore-create), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

###### calculate_buffers_required (heading level 7)

`uint8_t calculate_buffers_required(uint8_t type, uint16_t length)`

**Description:** Calculate the buffers required.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- Type|
|uint16_t|[in]|length|- Length|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [ROM_WL_API_S::calculate_buffers_required](rom-wl-api-s#calculate-buffers-required)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom)

###### rsi_accept_async (heading level 7)

`int32_t rsi_accept_async(int32_t sockID, void(*callback)(int32_t sock_id, int16_t dest_port, uint8_t *ip_addr, int16_t ip_version))`

**Description:** Accept the connection request from the remote peer and register a callback that will be used by the driver to forward the received connection request asynchronously to the application. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|void(*)(int32_t sock_id, int16_t dest_port, uint8_t *ip_addr, int16_t ip_version)|[in]|callback|- Callback function to indicate the socket parameters connected|
||[out]|sock_id|- Socket descriptor ID|
||[out]|dest_port|- Port number of remote peer|
||[out]|ip_addr|- Remote peer address|
||[out]|ip_version|- 4 - IPV4. <br /><br/> 6 - IPV6|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- When attempting to connect multiple clients to the server socket opened on module, i.e., when the backlog parameter is used in [rsi_listen()](network5#rsi-listen) API. [rsi_accept_async()](network5#rsi-accept-async) has to be called again for each of the client connections. <br />  
   The API calling has to be repeated for the next client connection, only after the connection process of the previous client is complete.
- When using multiple client/server sockets, the following macros have to be updated in the wlan_config.h file, in TCP_IP_FEATURE_BIT_MAP - If TCP_IP_TOTAL_SOCKETS_x flag is used, then firmware allocates memory for x sockets. If TCP_IP_TOTAL_SOCKETS_x flag is not passed, then a default value of 10 sockets is used.
- When using multiple client/server sockets, the following macros have to be updated in the [rsi_user.h](rsi-user-8h-source#rsi-user-8h-source) file, RSI_NUMBER_OF_LTCP_SOCKETS -> Number of server sockets and RSI_NUMBER_OF_SOCKETS -> Number of client sockets + Number of server sockets.
- If multiple server sockets are created then the memory allocated for client sockets is to be shared across the multiple server sockets. If RSI_NUMBER_OF_LTCP_SOCKETS is 0 and RSI_NUMBER_OF_SOCKETS is x, y is server sockets and x-y client sockets can be created

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_async](network5#rsi-socket-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_receive_callback](rsi-socket-info-s#sock-receive-callback), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type) and [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port)

###### rsi_get_app_socket_descriptor (heading level 7)

`int32_t rsi_get_app_socket_descriptor(uint8_t *src_port)`

**Description:** Get the application socket descriptor from source port.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|src_port|- Pointer to the socket source port|

**Returns**

- Positive Value - Application socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_get_socket_id (heading level 7)

`int32_t rsi_get_socket_id(uint32_t src_port, uint32_t dst_port)`

**Description:** Get the socket ID from port number.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|src_port|- Socket source port number|
|uint32_t|[in]|dst_port|- Socket destination port number|

**Returns**

- Positive Value - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [SL_PRINTF](network5#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_get_primary_socket_id (heading level 7)

`int32_t rsi_get_primary_socket_id(uint8_t *port_num)`

**Description:** Get the primary socket ID from port number.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|port_num|- Pointer to port number|

**Returns**

- Positive Value - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom) and [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_certificate_valid (heading level 7)

`int32_t rsi_certificate_valid(uint16_t valid, uint16_t socket_id)`

**Description:** Validate the server certificate received from the module. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|valid|- Indicate whether the server certificate is valid or not. <br /><br/> 1 - Indicate that the server certificate is valid. <br /><br/> 0 - Indicate that the server certificate is not valid|
|uint16_t|[in]|socket_id|- Socket identifier|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_socket_create_async (heading level 7)

`int32_t rsi_socket_create_async(int32_t sockID, int32_t type, int32_t backlog)`

**Description:** Send socket create request to the module and receive the response asynchronously. This is a non-blocking API if socket_connect_response_handler is registered. <br />
 Otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Pointer to the global control block|
|int32_t|[in]|type|- Socket descriptor ID|
|int32_t|[in]|backlog|- Type of socket to create|
||[in]|backlog|- Number of backlogs for LTCP socket|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect) and [rsi_socket_listen](network5#rsi-socket-listen)

###### rsi_get_socket_descriptor (heading level 7)

`int32_t rsi_get_socket_descriptor(uint8_t *src_port, uint8_t *dst_port, uint8_t *ip_addr, uint16_t ip_version, uint16_t sockid)`

**Description:** Get the socket descriptor based on source port number, destination port number, destination IP address, and the IP version. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|src_port|- Pointer to source port number|
|uint8_t *|[in]|dst_port|- Pointer to destination port number|
|uint8_t *|[in]|ip_addr|- Pointer to destinaion IP address|
|uint16_t|[in]|ip_version|- IP version either IPv4/IPv6|
|uint16_t|[in]|sockid|- Socket descriptor ID from firmware|

**Returns**

- 0 - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_socket_async_non_rom (heading level 7)

`int32_t rsi_socket_async_non_rom(int32_t protocolFamily, int32_t type, int32_t protocol, void(*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a socket and register a callback that will be used by the driver to forward the received packets asynchronously to the application (on packet reception) <br />
 without waiting for recv API (Add proper API here). This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2) : Select IPv4, <br /><br/> AF_INET6 (3) : Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1) : Select TCP, <br /><br/> SOCK_DGRM (2) : Select UDP|
|int32_t|[in]|protocol|- 0: Non-SSL sockets, 1: SSL sockets. <br /><br/> BIT(5) must be enabled to select the certificate index, <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|callback|- Callback function to read data asynchronously from socket <br />|
||[out]|sock_no|- Application socket number|
||[out]|buffer|- Pointer to buffer holding the data|
||[out]|length|- Length of the response buffer|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_wlan_cb_s::ap_state](rsi-wlan-cb-s#ap-state), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_socket](network5#rsi-socket) and [rsi_socket_async](network5#rsi-socket-async)

###### rsi_socket_connect (heading level 7)

`int32_t rsi_socket_connect(int32_t sockID, struct rsi_sockaddr *remoteAddress, int32_t addressLength)`

**Description:** Connect the socket to specific remote address. This is a non-blocking API, if socket_connect_response_handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks). Otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|remoteAddress|- Remote peer address structure|
|int32_t|[in]|addressLength|- Remote peer address structrue length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [memcpy](bt-classic1#memcpy), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_connect](network5#rsi-connect)

###### rsi_socket_recvfrom (heading level 7)

`int32_t rsi_socket_recvfrom(int32_t sockID, int8_t *buffer, int32_t buffersize, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Retrieve the received data from the remote peer on a given socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[out]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|buffersize|- Size of the buffer supplied|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[out]|fromAddr|- Sddress of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Positive Value - Number of bytes received successfully
- 0 - Socket close error
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API. <br />

**References:** [rsi_socket_info_s::recv_buffer](rsi-socket-info-s#recv-buffer), [rsi_socket_info_s::recv_buffer_length](rsi-socket-info-s#recv-buffer-length), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [global_cb_s::rx_buffer_mem_copy](global-cb-s#rx-buffer-mem-copy), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_recv_available_length](rsi-socket-info-s#sock-recv-available-length), [rsi_socket_info_non_rom_s::socket_terminate_indication](rsi-socket-info-non-rom-s#socket-terminate-indication), [UNUSED_PARAMETER](bt-classic1#unused-parameter), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync) and [rsi_recvfrom](network5#rsi-recvfrom)

###### rsi_socket_listen (heading level 7)

`int32_t rsi_socket_listen(int32_t sockID, int32_t backlog)`

**Description:** Enable socket to listen for remote connection request in passive mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|backlog|- Maximum number of pending connections requests|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_listen](network5#rsi-listen)

###### rsi_vap_sockets_shutdown (heading level 7)

`int32_t rsi_vap_sockets_shutdown(uint8_t vapID)`

**Description:** Close all the sockets associated with a VAP Id. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|vapID|: Virtual Access Point ID|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Note**

- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, though remote socket has terminated connection, socket is disconnected and deleted only if host issues [rsi_shutdown()](network5#rsi-shutdown).

**Returns**

- 0 - Success <br />  
   Negative Value - Failure

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [RSI_SUCCESS](network5#rsi-success) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_vap_shutdown](network5#rsi-vap-shutdown)

###### rsi_socket_shutdown (heading level 7)

`int32_t rsi_socket_shutdown(int32_t sockID, int32_t how)`

**Description:** Close the socket specified in a socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|: Socket descriptor ID|
|int32_t|[in]|how|0: Close the specified socket, <br /><br/> 1: Close all the sockets open on a specified socket's source port number. <br />|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.
- how = 1 is valid for passively open sockets (listen) with more than one backlogs specified. <br />
- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, then to close LTCP socket, argument "how" should be 1. <br />
- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, though remote socket has terminated connection, socket is disconnected and deleted only, if host issues [rsi_shutdown()](network5#rsi-shutdown).

**References:** [rsi_socket_info_non_rom_s::close_pending](rsi-socket-info-non-rom-s#close-pending), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_shutdown](network5#rsi-shutdown) and [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown)

###### rsi_socket_bind (heading level 7)

`int32_t rsi_socket_bind(int32_t sockID, struct rsi_sockaddr *localAddress, int32_t addressLength)`

**Description:** Assign address to the socket. This is a non-blocking API for TCP and a blocking API for UDP.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|localAddress|- Address that needs to be assigned|
|int32_t|[in]|addressLength|- Length of the socket address|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_state](rsi-socket-info-s#sock-state), [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_bind](network5#rsi-bind)

###### rsi_wait_on_socket_semaphore (heading level 7)

`rsi_error_t rsi_wait_on_socket_semaphore(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for network semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. If timeout_ms is 0, then wait till semaphore is acquired.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb) and [SL_PRINTF](network5#sl-printf)

###### rsi_application_socket_descriptor (heading level 7)

`int32_t rsi_application_socket_descriptor(int32_t sock_id)`

**Description:** Get the application socket descriptor from module’s socket descriptor. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sock_id|- Module's socket descriptor ID|

**Returns**

- Positive Value - Application socket descriptor <br />
- Negative Value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom) and [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor)

###### rsi_wlan_socket_get_status (heading level 7)

`int32_t rsi_wlan_socket_get_status(int32_t sockID)`

**Description:** Get WLAN socket status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Application socket ID|

**Returns**

- WLAN socket status

**References:** [SL_PRINTF](network5#sl-printf) and [rsi_socket_info_non_rom_s::socket_status](rsi-socket-info-non-rom-s#socket-status)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_send_large_data_async](network5#rsi-send-large-data-async) and [rsi_send_large_data_sync](network5#rsi-send-large-data-sync)

###### rsi_wlan_socket_set_status (heading level 7)

`void rsi_wlan_socket_set_status(int32_t status, int32_t sockID)`

**Description:** Set WLAN status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status value to be set|
|int32_t|[in]|sockID|- Application socket ID|

**Returns**

- Void

**References:** [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [SL_PRINTF](network5#sl-printf) and [rsi_socket_info_non_rom_s::socket_status](rsi-socket-info-non-rom-s#socket-status)

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore), [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_recvfrom](network5#rsi-recvfrom), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_create_async](network5#rsi-socket-create-async), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [rsi_tcp_window_update](network16#rsi-tcp-window-update) and [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done)

###### rsi_select_get_status (heading level 7)

`int32_t rsi_select_get_status(int32_t selectid)`

**Description:** Get the status of the socket specified in the select ID.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|selectid|- Socket ID to get the status|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_select_info_s::select_status](rsi-socket-select-info-s#select-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_select_set_status (heading level 7)

`void rsi_select_set_status(int32_t status, int32_t selectid)`

**Description:** Set the status of the socket specified in the select ID.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status value to be set|
|int32_t|[in]|selectid|- Socket ID on which the status is set|

**Returns**

- Void

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_socket_select_info_s::select_status](rsi-socket-select-info-s#select-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### rsi_send_async_non_rom (heading level 7)

`int32_t rsi_send_async_non_rom(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data on a given socket asynchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_in6_addr::_S6_u8](rsi-in6-addr#s6-u8), [rsi_in6_addr::_S6_un](rsi-in6-addr#s6-un), [rsi_socket_info_s::destination_ip_addr](rsi-socket-info-s#destination-ip-addr), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_ip_addr_u::ipv4](rsi-ip-addr-u#ipv4), [rsi_ip_addr_u::ipv6](rsi-ip-addr-u#ipv6), [memcpy](bt-classic1#memcpy), [rsi_sendto_async](network5#rsi-sendto-async), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_in_addr::s_addr](rsi-in-addr#s-addr), [rsi_sockaddr_in6::sin6_addr](rsi-sockaddr-in6#sin6-addr), [rsi_sockaddr_in6::sin6_family](rsi-sockaddr-in6#sin6-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [rsi_sockaddr_in::sin_addr](rsi-sockaddr-in#sin-addr), [rsi_sockaddr_in::sin_family](rsi-sockaddr-in#sin-family), [rsi_sockaddr_in::sin_port](rsi-sockaddr-in#sin-port) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send](network5#rsi-send) and [rsi_send_async](network5#rsi-send-async)

###### rsi_sendto_async_non_rom (heading level 7)

`int32_t rsi_sendto_async_non_rom(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data to specific remote peer on a given socket.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Remote peer address to send data|
|int32_t|[in]|destAddrLen|- Remote peer address length|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- Positive Value - Success, Number of bytes sent successfully <br />
- Negative Value - Failure <br />
- 0 - Socket close error

**References:** [calculate_buffers_required](network5#calculate-buffers-required), [rsi_socket_info_s::current_available_buffer_count](rsi-socket-info-s#current-available-buffer-count), [rsi_nwk_callback_s::data_transfer_complete_handler](rsi-nwk-callback-s#data-transfer-complete-handler), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [memcpy](bt-classic1#memcpy), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [global_cb_s::rom_apis_p](global-cb-s#rom-apis-p), [rom_apis_s::ROM_WL_calculate_length_to_send](rom-apis-s#rom-wl-calculate-length-to-send), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_send_data](wlan#rsi-driver-send-data), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type), [UNUSED_PARAMETER](bt-classic1#unused-parameter), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_sendto](network5#rsi-sendto) and [rsi_sendto_async](network5#rsi-sendto-async)

###### rsi_clear_sockets_non_rom (heading level 7)

`void rsi_clear_sockets_non_rom(int32_t sockID)`

**Description:** Clear socket information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_post_waiting_socket_semaphore](driver10#rsi-post-waiting-socket-semaphore), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_state](rsi-socket-info-s#sock-state), [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_network_app_protocol_config (heading level 7)

`uint32_t rsi_network_app_protocol_config(nw_app_protocol protocol, nw_app_config config_type, void *config, uint16_t config_length)`

**Description:** Set the network application protocols configuration. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>nw_app_protocol</td>
      <td>[in]</td>
      <td>protocol</td>
      <td>- The following table lists in below 

|Protocol|Value|
|---|---|
|RSI_HTTP|0|</td>
    </tr>
    <tr>
      <td>nw_app_config</td>
      <td>[in]</td>
      <td>config_type</td>
      <td>- The following table lists in below 

|config_type|Value|
|---|---|
|RSI_CIPHER_SELECTION|0|</td>
    </tr>
    <tr>
      <td>void *</td>
      <td>[in]</td>
      <td>config</td>
      <td>- The following table lists in below 

|Protocol|config_type|config|
|---|---|---|
|RSI_HTTP|RSI_CIPHER_SELECTION|Configure the Cipher values as explained on the [SSL/TLS Cipher Selection](ssl-ciphers-selection) page.|</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>config_length</td>
      <td>- Length of the config parameter</td>
    </tr>
  </tbody>
</table>

- [rsi_network_app_protocol_config()](network5#rsi-network-app-protocol-config) API needs to be called after only.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xffffff82) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Examples : rsi_network_app_protocol_config(RSI_HTTP, RSI_CIPHER_SELECTION, &cipher_value, 4); <br />  
   cipher_value : (SSL_NEW_CIPHERS | BIT_DHE_RSA_GCM | BIT_ECDHE_RSA_GCM ) <br />
- RSI_WLAN_REQ_NWK_APP_PROTOCOL_CONFIG is introduced to pass network application configurations to firmware.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### ROM_WL_rsi_get_application_socket_descriptor (heading level 7)

`int32_t ROM_WL_rsi_get_application_socket_descriptor(global_cb_t *global_cb_p, int32_t sock_id)`

**Description:** Get the application socket descriptor from module’s socket descriptor. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|int32_t|[in]|sock_id|- Module's socket descriptor|

**Returns**

- Positive value - Application socket descriptor <br />
- Negative value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool)

###### ROM_WL_rsi_get_primary_socket_id (heading level 7)

`int32_t ROM_WL_rsi_get_primary_socket_id(global_cb_t *global_cb_p, uint16_t port_number)`

**Description:** Get socket descriptor from port_number. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint16_t|[in]|port_number|- Port number|

**Returns**

- Positive value - Socket descriptor <br />
- Negative value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool)

###### ROM_WL_calculate_buffers_required (heading level 7)

`uint8_t ROM_WL_calculate_buffers_required(global_cb_t *global_cb_p, uint8_t type, uint16_t length)`

**Description:** Calculate number of buffers required for the data packet. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint8_t|[in]|type|- Type of socket to create|
|uint16_t|[in]|length|- Length of the message|

**Returns**

- Number of buffers required for the data packet

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_calculate_length_to_send (heading level 7)

`uint16_t ROM_WL_calculate_length_to_send(global_cb_t *global_cb_p, uint8_t type, uint8_t buffers)`

**Description:** Calculate the length available in the buffers for the message. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint8_t|[in]|type|- Type of the socket stream|
|uint8_t|[in]|buffers|- Available buffers|

**Returns**

- Length available in the buffers for message

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_socket_config (heading level 7)

`int32_t rsi_socket_config(void)`

**Description:** Set the socket configuration parameters. The configurations can be done using the Socket configuration in the rsi_wlan_config.h file. <br />
 Using this API is highly recommended. Based on the socket configuration, module will use available buffers effectively. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021, 0x0025, 0x002C, 0xFF6D) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API and socket creation should be done before this API is called.
- The following parameters are provided by user,  
  |Parameters|Description|  
  |---|---|  
  |total socket|Desired total number of sockets to open|  
  |total_tcp_sockets|Desired total number of TCP sockets to open|  
  |total_udp_sockets|Desired total number of UDP sockets to open|  
  |tcp_tx_only_sockets|Desired total number of TCP sockets to open which are used only for data transmission|  
  |tcp_rx_only_sockets|Desired total number of TCP sockets to open which are used only for data reception|  
  |udp_tx_only_sockets|Desired total number of UDP sockets to open which are used only for data transmission|  
  |udp_rx_only_sockets|Desired total number of UDP sockets to open which are used only for data reception|  
  |tcp_rx_high_performance_sockets|Desired total number of high performance TCP sockets to open. High performance sockets can be <br />|  
  ^ allocated with more buffers based on the buffers availability. This option is valid only for TCP <br />  
   ^ data receive sockets. Socket can be opened as high performance by setting high performance bit in <br />  
   ^ socket create command. tcp_rx_window_size_cap | Desired total to increase the TCP RX window size tcp_ack_window_div_factor | In case of high latency networks to configure the TCP ACK division factor with respective to the <br />  
   ^ window size; Increases the ACK frequency for asynchronous sockets <br />  
   ^ Note: <br />  
   ^ Default value is tcp_rx_window_size_cap.
- The following conditions must be met: <br />
- total_sockets <= Maximum allowed sockets(10) <br />
- (total_tcp_sockets + total_udp_sockets) <= total_sockets <br />
- (total_tcp_tx_only_sockets + total_tcp_rx_only_sockets) <= total_tcp_sockets <br />
- (total_udp_tx_only_sockets + total_udp_rx_only_sockets) <= total_udp_sockets <br />
- total_tcp_rx_high_performance_sockets <= total_tcp_rx_only_sockets <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_socket_config](network5#rsi-socket-config), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_socket_config](network5#rsi-socket-config)

##### DNS

###### Functions

###### rsi_dns_req_async (heading level 7)

`int32_t rsi_dns_req_async(uint8_t ip_version, uint8_t *url_name, uint8_t *primary_server_address, uint8_t *secondary_server_address, void(*dns_response_callback)(int32_t status, const uint8_t *buffer, const uint16_t length))`

**Description:** Query the IP address of a given domain name. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ip_version|- IP version. 4: IPv4, <br /><br/> 6: IPv6|
|uint8_t *|[in]|url_name|- Pointer to the domain name to resolve IP address|
|uint8_t *|[in]|primary_server_address|- IP address of the DNS server. This parameter is optional, if module gets the DNS server address using DHCP. If DNS server address is obtained using DHCP, in that case this parameter should be NULL.|
|uint8_t *|[in]|secondary_server_address|- IP address of the secondary DNS server. In case of no secondary DNS server, IP is NULL.|
|void(*)(int32_t status, const uint8_t *buffer, const uint16_t length)|[in]|dns_response_callback|- Callback that is called when the response for DNS query is received from the module. <br /><br/> The parameters involved are status, buffer, & length. <br />|
||[out]|Status|- Response status. *|
||[out]|Buffer|- Response buffer <br /><br/> *|
||[out]|Length|- The length of the result buffer. /n|

- [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- DNS mode is determined by the value of primary_server_address. If NULL, then DNS mode is set to DHCP (1), else it is set to Static IP Address (0).

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_dns_query_rsp_handler](rsi-nwk-callback-s#rsi-dns-query-rsp-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_dns_req](network6#rsi-dns-req)

###### rsi_dns_req (heading level 7)

`int32_t rsi_dns_req(uint8_t ip_version, uint8_t *url_name, uint8_t *primary_server_address, uint8_t *secondary_server_address, rsi_rsp_dns_query_t *dns_query_resp, uint16_t length)`

**Description:** Query the IP address of a given domain name. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ip_version|- IP version. 4: IPv4, <br /><br/> 6: IPv6|
|uint8_t *|[in]|url_name|- Pointer to the domain name to resolve IP address|
|uint8_t *|[in]|primary_server_address|- IP address of the DNS server. This parameter is optional, if module gets the DNS server address using DHCP. If DNS server address is obtained using DHCP, in that case this parameter should be NULL.|
|uint8_t *|[in]|secondary_server_address|- IP address of the secondary DNS server. In case of no secondary DNS server, IP is NULL.|
|[rsi_rsp_dns_query_t](rsi-rsp-dns-query-s) *|[out]|dns_query_resp|- Pointer to hold DNS query results.|
|uint16_t|[in]|length|- Length of the resultant buffer.|

- [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- DNS mode is determined by the value of primary_server_address. If NULL, then DNS mode is set to DHCP (1), else it is set to Static IP Address (0).

**References:** [rsi_driver_cb_non_rom::nwk_app_buffer](rsi-driver-cb-non-rom#nwk-app-buffer), [rsi_driver_cb_non_rom::nwk_app_buffer_length](rsi-driver-cb-non-rom#nwk-app-buffer-length), [rsi_dns_req_async](network6#rsi-dns-req-async), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_dns_update (heading level 7)

`int32_t rsi_dns_update(uint8_t ip_version, uint8_t *zone_name, uint8_t *host_name, uint8_t *server_address, uint16_t ttl, void(*dns_update_rsp_handler)(uint16_t status))`

**Description:** Update the host name for a given host and zone name. This is non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ip_version|- IP version. 4: IPv4, 6: IPv6|
|uint8_t *|[in]|zone_name|- Pointer to a zone name and to update host name|
|uint8_t *|[in]|host_name|- HOST name of the domain|
|uint8_t *|[in]|server_address|- IP address of the DNS server. This parameter is optional, if module gets DNS server address using DHCP.|
|uint16_t|[in]|ttl|- Time to live value of the host name.|
|void(*)(uint16_t status)|[in]|dns_update_rsp_handler|- Callback function called by driver on reception of DNS update response.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_dns_update_rsp_handler](rsi-nwk-callback-s#rsi-dns-update-rsp-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### FTP Client

###### Functions

###### rsi_ftp_connect (heading level 7)

`int32_t rsi_ftp_connect(uint16_t flags, int8_t *server_ip, int8_t *username, int8_t *password, uint32_t server_port)`

**Description:** Create FTP objects and connect to the FTP server on the given server port. This should be the first command for accessing FTP server. <br />
 This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Network flags. Each bit in the flag has its own significance <br />

|Flags|Description|
|---|---|
|BIT(0) - RSI_IPV6|Set this bit to enable IPv6. By default, it is configured to IPv4|
|BIT(1) to BIT(15)|Reserved for future use|</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>server_ip</td>
      <td>- FTP server IP address to connect</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>username</td>
      <td>- Username for server authentication</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server authentication</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>server_port</td>
      <td>- Port number of FTP server <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- FTP server port is also configurable on a non-standard port
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_disconnect (heading level 7)

`int32_t rsi_ftp_disconnect(void)`

**Description:** Disconnect from the FTP server and destroy the FTP objects. Once the FTP objects are destroyed, FTP server cannot be accessed. <br />
 For further accessing, FTP objects should be created again. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_write (heading level 7)

`int32_t rsi_ftp_file_write(int8_t *file_name)`

**Description:** Open a file in the specified path on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|file_name|- Filename or filename with the path|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_write_content (heading level 7)

`int32_t rsi_ftp_file_write_content(uint16_t flags, int8_t *file_content, int16_t content_length, uint8_t end_of_file)`

**Description:** Write the content into the file that was opened using [rsi_ftp_file_write()](network8#rsi-ftp-file-write) API. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Network flags. <br />

|Flags|Description|
|---|---|
|BIT(0) - RSI_IPV6|Set this bit to enable IPv6. By default, it is configured to IPv4|
|BIT(1) to BIT(15)|Reserved for future use|</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>file_content</td>
      <td>- Data stream to be written into the file</td>
    </tr>
    <tr>
      <td>int16_t</td>
      <td>[in]</td>
      <td>content_length</td>
      <td>- File content length</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>end_of_file</td>
      <td>- Flag that indicates the end of file. <br />
 1 – Represent the end of content to be written into the file, <br />
 0 – Extra data that is pending to write into the file <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- This API can be called multiple times to append data into the same file. <br />
- File content length should not exceed 1344 bytes in case of IPV4 and 1324 bytes in case of IPV6. <br /><br />  
   If exceeded, this API will break the file content and send it in multiple packets. <br /><br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_read_aysnc (heading level 7)

`int32_t rsi_ftp_file_read_aysnc(int8_t *file_name, void(*call_back_handler_ptr)(uint16_t status, uint8_t *file_content, uint16_t content_length, uint8_t end_of_file))`

**Description:** Read the content from the specified file on the FTP server. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|file_name|- Filename or filename with path|
|void(*)(uint16_t status, uint8_t *file_content, uint16_t content_length, uint8_t end_of_file)|[in]|call_back_handler_ptr|- Called when asynchronous response is received from module for file read request|
||[out]|status|- Status code <br />|
||[out]|file_content|- File content|
||[out]|content_length|- Length of file content|
||[out]|end_of_file|- Indicate the end of file. <br /><br/> 1 – No more data, <br /><br/> 0 – More data present|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_nwk_callback_s::ftp_file_read_call_back_handler](rsi-nwk-callback-s#ftp-file-read-call-back-handler), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_delete (heading level 7)

`int32_t rsi_ftp_file_delete(int8_t *file_name)`

**Description:** Delete the file that is present in the specified path on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|file_name|- Filename or filename with path to delete|

- [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_rename (heading level 7)

`int32_t rsi_ftp_file_rename(int8_t *old_file_name, int8_t *new_file_name)`

**Description:** Rename the file with a new name on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|old_file_name|- Filename or filename with path to rename|
|int8_t *|[in]|new_file_name|- New filename|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_directory_create (heading level 7)

`int32_t rsi_ftp_directory_create(int8_t *directory_name)`

**Description:** Create a directory on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|directory_name|- Directory name (with path if required) to create|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_directory_delete (heading level 7)

`int32_t rsi_ftp_directory_delete(int8_t *directory_name)`

**Description:** Delete the directory on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|directory_name|- Directory name (with path if required) to delete|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_directory_set (heading level 7)

`int32_t rsi_ftp_directory_set(int8_t *directory_path)`

**Description:** Change the current working directory to the specified directory path on the FTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|directory_path|- Directory name (with path if required) to create|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_directory_list_async (heading level 7)

`int32_t rsi_ftp_directory_list_async(int8_t *directory_path, void(*call_back_handler_ptr)(uint16_t status, uint8_t *directory_list, uint16_t length, uint8_t end_of_list))`

**Description:** Get the list of directories present in the specified directory on the FTP server. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|directory_path|- Directory path(with path if required) to list|
|void(*)(uint16_t status, uint8_t *directory_list, uint16_t length, uint8_t end_of_list)|[in]|call_back_handler_ptr|- Called when asynchronous response is received from module for directory list request|
||[out]|status|- Status code|
||[out]|directory_list|- Stream of data with directory list as content|
||[out]|length|- Length of content|
||[out]|end_of_list|- Indicate end of list. <br /><br/> 1 – No more data, <br /><br/> 0 – More data present|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_nwk_callback_s::ftp_directory_list_call_back_handler](rsi-nwk-callback-s#ftp-directory-list-call-back-handler), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_mode_set (heading level 7)

`int32_t rsi_ftp_mode_set(uint8_t mode)`

**Description:** Set the FTP client mode - either in Passive mode or Active Mode. <br />
 In active mode, FTP client establishes the command channel, and the server establishes the data channel. <br />
 In passive mode, both the command channel and the data channel are established by the client. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|mode|- Used to select the mode of FTP client if FTP is enabled. <br /><br/> BIT(0) refers FTP client mode and BIT(1) refers FTP transfer mode. <br /><br/> BIT(0) - 0 then active mode is enabled, <br /><br/> BIT(0) - 1 then passive mode is enabled, <br /><br/> BIT(1) - 0 then stream transfer mode is enabled, <br /><br/> BIT(1) - 1 then block transfer mode is enabled|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_ftp_file_size_set (heading level 7)

`int32_t rsi_ftp_file_size_set(uint32_t file_size)`

**Description:** Set the file size.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|file_size|- represents the size of the file in bytes that is to be transferred. <br />|

**Returns**

- 0 - Success <br />
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc, 0x0021, 0x002C, 0x0015) <br /><br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- This API is supported only in 9117
- This API should called before every [rsi_ftp_file_write_content()](network8#rsi-ftp-file-write-content) when the Block transfer mode is in use
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### HTTP Client

###### Functions

###### rsi_http_credentials (heading level 7)

`int32_t rsi_http_credentials(int8_t *username, int8_t *password)`

**Description:** Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|username|- User-given username|
|int8_t *|[in]|password|- User-given password|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_get_async (heading level 7)

`int32_t rsi_http_client_get_async(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, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)`

**Description:** Send HTTP get request to remote HTTP server. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security <br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6, by default it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL featuree|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_V_1_1|Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled|
|BIT(5)|HTTP_POST_DATA|Set this bit to enable Http_post large data feature|
|BIT(6)|HTTP_V_1_1|Set this bit to use HTTP version 1.1|
|BIT(8)|RSI_SSL_V_1_3|Set this bit to support SSL_TLS Version 1.3 if HTTPS is enabled|
|BIT(9)|HTTPS_CERT_INDEX_1|Set this bit to indicate certificate at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate certificate at index 2 to be used for HTTPS|
|BIT(11)|RSI_HTTPS_USE_SNI|Enable this to utilize the SNI extension for HTTPS socket provided by [rsi_set_sni_emb_socket()](network9#rsi-set-sni-emb-socket)|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>port</td>
      <td>- Port number of HTTP server</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Host name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- User-defined extended header, each member header should end by \r`\n`</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server authentication</td>
    </tr>
    <tr>
      <td>#if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler #</td>
      <td>[in]</td>
      <td>endif</td>
      <td>- Callback when asynchronous response comes for the request</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status</td>
      <td>- Status of response from module. This will return failure upon an internal error only.</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>buffer</td>
      <td>- Buffer pointer</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>length</td>
      <td>- Length of data</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>more_data</td>
      <td>- 1 No more data, <br />
 0 More data present</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status_code</td>
      <td>- HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. <br />
 This field is valid only when status field (first argument) is successful, indicating a response is received from HTTP server. <br />
 A status_code equal to 0 indicates that there was no HTTP header in the received packet, probably a continuation of the frame <br />
 body received in the previous chunk. <br />
 This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- HTTP server port is configurable on non-standard port. <br />
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_http_client_async](network9#rsi-http-client-async)

###### rsi_http_client_post_async (heading level 7)

`int32_t rsi_http_client_post_async(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, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*http_client_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)`

**Description:** Send HTTP post request to remote HTTP server. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security <br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6, by default, it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_V_1_1|Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled|
|BIT(5)|HTTP_POST_DATA|Set this bit to enable Http_post large data feature|
|BIT(6)|HTTP_V_1_1|Set this bit to use HTTP version 1.1|
|BIT(8)|RSI_SSL_V_1_3|Set this bit to support SSL_TLS Version 1.3 if HTTPS is enabled|
|BIT(9)|HTTPS_CERT_INDEX_1|Set this bit to indicate certificate at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate certificate at index 2 to be used for HTTPS|
|BIT(11)|RSI_HTTPS_USE_SNI|Enable this to utilize the SNI extension for HTTPS socket provided by [rsi_set_sni_emb_socket()](network9#rsi-set-sni-emb-socket)|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>port</td>
      <td>- Port number of HTTP server</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Host name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- User-defined extended header, each member header should end by \r`\n`</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>post_data</td>
      <td>- HTTP data to be posted to server</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>post_data_length</td>
      <td>- Post data length</td>
    </tr>
    <tr>
      <td>#if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler #</td>
      <td>[in]</td>
      <td>endif</td>
      <td>- Callback when asynchronous response comes for the request</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>status</td>
      <td>- Status of response from module. This will return failure upon an internal error only.</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>buffer</td>
      <td>- Buffer pointer</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>length</td>
      <td>- Length of data</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>moredata</td>
      <td>- 1 No more data, 0 More data present, 2 HTTP post success response</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>status_code</td>
      <td>HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. <br />
 This field is valid only when status field (first argument) is successful, indicating <br />
 a response is received from HTTP server. A status_code equal to 0 indicates that <br />
 there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. <br />
 This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h <br /><br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_http_client_async](network9#rsi-http-client-async)

###### rsi_http_client_async (heading level 7)

`int32_t rsi_http_client_async(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, uint8_t *post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*callback)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)`

**Description:** Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>type</td>
      <td>- 0 RSI_HTTP_GET, 1 RSI_HTTP_POST</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security <br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6, by default, it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_V_1_1|Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled|
|BIT(5)|HTTP_POST_DATA|Set this bit to enable Http_post large data feature|
|BIT(6)|HTTP_V_1_1|Set this bit to use HTTP version 1.1|
|BIT(8)|RSI_SSL_V_1_3|Set this bit to support SSL_TLS Version 1.3 if HTTPS is enabled|
|BIT(9)|HTTPS_CERT_INDEX_1|Set this bit to indicate cert at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate cert at index 2 to be used for HTTPS, Leave both unset for cert index 0|
|BIT(11)|RSI_HTTPS_USE_SNI|Enable this to utilize the SNI extension for HTTPS socket provided by [rsi_set_sni_emb_socket()](network9#rsi-set-sni-emb-socket)|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>port</td>
      <td>- Port number of HTTP server</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource. <br />
 Note: HTTP server port is also configurable on a non-standard port</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Host name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- User-defined extended header, each member header should end by \r`\n`</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>post_data</td>
      <td>- HTTP data to be posted to server</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>post_data_length</td>
      <td>- This is the post data length</td>
    </tr>
    <tr>
      <td>#if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) callback #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) callback #</td>
      <td>[in]</td>
      <td>endif</td>
      <td>- Callback when asynchronous response comes for the request</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status</td>
      <td>- Status of response from module. This will return failure upon an internal error only.</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>buffer</td>
      <td>- Buffer pointer</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>length</td>
      <td>- Length of data</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>moredata</td>
      <td>- 1 - No more data, 0 - More data present</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>status_code</td>
      <td>HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. <br />
 This field is valid only when status field (first argument) is successful, indicating <br />
 a response is received from HTTP server. A status_code equal to 0 indicates that <br />
 there was no HTTP header in the received packet, probably a continuation of the frame body received in the previous chunk. <br />
 This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_nwk_callback_s::http_client_response_handler](rsi-nwk-callback-s#http-client-response-handler), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_http_client_get_async](network9#rsi-http-client-get-async) and [rsi_http_client_post_async](network9#rsi-http-client-post-async)

###### rsi_http_client_abort (heading level 7)

`int32_t rsi_http_client_abort(void)`

**Description:** Abort ongoing HTTP request from the client. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_put_create (heading level 7)

`int32_t rsi_http_client_put_create(void)`

**Description:** Create the HTTP PUT client. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_http_client_put_response_handler](rsi-nwk-callback-s#rsi-http-client-put-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_put_delete (heading level 7)

`int32_t rsi_http_client_put_delete(void)`

**Description:** Delete the created HTTP PUT client. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_put_start (heading level 7)

`int32_t rsi_http_client_put_start(uint16_t flags, uint8_t *ip_address, uint32_t port_number, uint8_t *resource, uint8_t *host_name, uint8_t *extended_header, uint8_t *user_name, uint8_t *password, uint32_t content_length, void(*callback)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt))`

**Description:** Start the HTTP client PUT process. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security <br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6, by default, it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_V_1_1|Set this bit to support SSL_TLS Version 1.1 if HTTPS is enabled|
|BIT(5)|HTTP_POST_DATA|Set this bit to enable Http_post large data feature|
|BIT(6)|HTTP_V_1_1|Set this bit to use HTTP version 1.1|
|BIT(7)|HTTP_USER_DEFINED_CONTENT_TYPE|Set this bit to enable user defined http_content type|
|BIT(9)|HTTPS_CERT_INDEX_1|Set this bit to indicate certificate at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate certificate at index 2 to be used for HTTPS|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>port_number</td>
      <td>- Port number of HTTP server</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Host name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- User-defined extended header, each member header should end by \r`\n`</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server authentication</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>content_length</td>
      <td>- Total length of HTTP data</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt)</td>
      <td>[in]</td>
      <td>callback</td>
      <td>- HTTP data length to be posted to server</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>callback</td>
      <td>- Callback when asyncronous response comes for the request</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>status</td>
      <td>- Status code</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>type</td>
      <td>- HTTP Client PUT command type. <br />
 2 - Put start response, <br />
 3 - Put packet response, <br />
 4 - Put delete response, <br />
 5 - Data from HTTP server</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>buffer</td>
      <td>- Buffer pointer</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>length</td>
      <td>- Length of data</td>
    </tr>
    <tr>
      <td></td>
      <td>[in]</td>
      <td>end_of_put_pkt</td>
      <td>- End of file or HTTP resource content. <br />
 0 - More data is pending from host, <br />
 1 - End of HTTP file/resource content, <br />
 8 - More data pending from server, <br />
 9 - End of HTTP file from server</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API and [rsi_http_client_put_create](network9#rsi-http-client-put-create) API needs to be called before this API.
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_http_client_put_response_handler](rsi-nwk-callback-s#rsi-http-client-put-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_put_pkt (heading level 7)

`int32_t rsi_http_client_put_pkt(uint8_t *file_content, uint16_t current_chunk_length)`

**Description:** Send HTTP data to HTTP server for the created URL resource. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|file_content|- HTTP data content|
|uint16_t|[in]|current_chunk_length|- HTTP data current chunk length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress), [rsi_http_client_put_create()](network9#rsi-http-client-put-create) and [rsi_http_client_put_start()](network9#rsi-http-client-put-start) needs to be called before this API
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_client_post_data (heading level 7)

`int32_t rsi_http_client_post_data(uint8_t *file_content, uint16_t current_chunk_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) #else void(*rsi_http_post_data_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) #endif)`

**Description:** Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|file_content|- User given http file content|
|uint16_t|[in]|current_chunk_length|- Length of the current HTTP data|
|#if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) rsi_http_post_data_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) rsi_http_post_data_response_handler #|[in]|endif|- Callback when asynchronous response comes for the request.|
||[in]|status|- Status of response from module. This will return failure upon an internal error only.|
||[in]|buffer|- Buffer pointer|
||[in]|length|- Length of data|
||[in]|more_data|- 4 - More data is pending from host. <br /><br/> 5 - End of HTTP data from host(Host sent total data content length). <br /><br/> 8 – More data is pending from module to host. Further interrupts may be <br /><br/> raised by the module till all the data is transferred to the Host. <br /><br/> 9 – End of HTTP data from module to host.|
||[in]|status_code|- HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc. <br /><br/> This field is valid only when status field (first argument) is successful, indicating <br /><br/> a response is received from HTTP server. A status_code equal to 0 indicates that <br /><br/> there was no HTTP header in the received packet, probably a continuation of the frame <br /><br/> body received in the previous chunk. <br /><br/> This field is available, if the feature RSI_HTTP_STATUS_INDICATION_EN is enabled in rsi_wlan_config.h <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_http_client_post_data_response_handler](rsi-nwk-callback-s#rsi-http-client-post-data-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_http_otaf_async (heading level 7)

`int32_t rsi_http_otaf_async(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, uint8_t *post_data, uint32_t post_data_length, void(*callback)(uint16_t status, const uint8_t *buffer))`

**Description:** Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>type</td>
      <td>- 0 - HTTPGET <br />

- 1 - HTTPPOST <br /></td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select version and security:<br />

|Flags|Macro|Description|
|---|---|---|
|BIT(0)|RSI_IPV6|Set this bit to enable IPv6 , by default it is configured to IPv4|
|BIT(1)|RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2)|RSI_SSL_V_1_0|Set this bit to support SSL TLS Version 1.0 if HTTPS is enabled|
|BIT(3)|RSI_SSL_V_1_2|Set this bit to support SSL_TLS Version 1.2 if HTTPS is enabled|
|BIT(4)|RSI_SSL_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)|HTTPS_CERT_INDEX_1|Set this bit to indicate certificate at index 1 to be used for HTTPS|
|BIT(10)|HTTPS_CERT_INDEX_2|Set this bit to indicate certificate at index 2 to be used for HTTPS|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_address</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>port</td>
      <td>- Port number, default : 80 - HTTP, 443 - HTTPS</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>resource</td>
      <td>- URL string for requested resource</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>host_name</td>
      <td>- Post name</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>extended_header</td>
      <td>- Extender header if present, after each header member append \r`\n`</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>user_name</td>
      <td>- Username for server Authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- Password for server Authentication</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>post_data</td>
      <td>- HTTP data to be posted to server</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>post_data_length</td>
      <td>- HTTP data length to be posted to server</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, const uint8_t *buffer)</td>
      <td>[in]</td>
      <td>callback</td>
      <td>- Callback is called when asynchronous response is received from module for HTTP firmware update request</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>buffer</td>
      <td>- NULL</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>status</td>
      <td>- This is the status response from module. This returns failure upon an internal error only.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.
- Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0. <br />
- Set both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 to indicate certificate at index 3 to be used for HTTPS. <br />

**References:** [rsi_nwk_callback_s::http_otaf_response_handler](rsi-nwk-callback-s#http-otaf-response-handler), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_http_fw_update](firmware#rsi-http-fw-update)

###### rsi_set_sni_emb_socket (heading level 7)

`int32_t rsi_set_sni_emb_socket(uint8_t app_protocol, uint8_t *hostname, uint16_t length)`

**Description:** Sets the SNI Hostname for internal socket.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|app_protocol|- 1 - HTTP|
|uint8_t *|[in]|hostname|- Pointer to SNI string that needs to be used during SSL handshake|
|uint16_t|[in]|length|- Length of SNI hostname|

**Returns**

- Zero - Success Negative Value - Failure <br />  
   Possible error codes : 0xBB51, 0xFF74

**Note**

- Call this API before HTTP GET/POST. <br />
- RSI_WLAN_REQ_SET_SNI is introduced to provide Server Name Indication information for secure embedded/internal sockets such as HTTPs.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### Application Protocol

###### Modules

[SNTP Client](network12)

[MQTT Client](network13)

[HTTP Server](network14)

[MDNSD](network15)

[Socket configuration](network16)

[rsi_wlan_req_radio](network17)

[rsi_wlan_add_mfi_ie](network18)

[OTA Firmware Client](network20)

###### SNTP Client

###### Functions (heading level 7)

###### rsi_sntp_client_create_async (heading level 8)

`int32_t rsi_sntp_client_create_async(uint8_t flags, uint8_t *server_ip, uint8_t sntp_method, uint16_t sntp_retry_count, void(*rsi_sntp_client_create_response_handler)(uint16_t status, const uint8_t cmd_type, const uint8_t *buffer))`

**Description:** Create SNTP client. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Select IP version and security <br />

|Flags|Description|
|---|---|
|BIT(0) - RSI_IPV6|Set this bit to enable IPv6. Configured to IPv4 by default.|
|BIT(1) - RSI_SSL_ENABLE|Set this bit to enable SSL feature|
|BIT(2) to BIT(7)|Reserved for future use|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>server_ip</td>
      <td>- Server IP address</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>sntp_method</td>
      <td>- SNTP methods to use <br />
 1-For Broadcast method, 2-For Unicast method</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>sntp_retry_count</td>
      <td>- Configures SNTP max retry count <br />
 The number of times the client request is retried when the server response is failed to receive. <br />
 For each retry, the client waits for 5 secs to receive server response before initiating next attempt. <br />
 Need to set the value based on the network quality. <br />
 For ex: The value should be <= 5 for good network quality and > 10 for bad network quality.</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, const uint8_t cmd_type, const uint8_t *buffer)</td>
      <td>[in]</td>
      <td>rsi_sntp_client_create_response_handler</td>
      <td>- Callback function when asynchronous response comes for the request. <br />
 status: Status code. Expected error codes are : 0xBB0A, 0xFF5F, 0xBB0B, 0xBB15, 0xBB10 <br />
 cmd_type: Command type <br />
 buffer: Buffer pointer</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- SNTP broadcast method is currently not supported.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_sntp_client_create_response_handler](rsi-nwk-callback-s#rsi-sntp-client-create-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_sntp_client_gettime (heading level 8)

`int32_t rsi_sntp_client_gettime(uint16_t length, uint8_t *sntp_time_rsp)`

**Description:** Get the current time parameters (NTP epoch time). This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|length|- Length of the buffer|
|uint8_t *|[in]|sntp_time_rsp|- Current time response|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_sntp_client_create_async()](network12#rsi-sntp-client-create-async) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_sntp_client_gettime_date (heading level 8)

`int32_t rsi_sntp_client_gettime_date(uint16_t length, uint8_t *sntp_time_date_rsp)`

**Description:** Get current time in time date format parameters. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|length|- Length of the buffer|
|uint8_t *|[in]|sntp_time_date_rsp|- Current time and date response|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_sntp_client_create_async()](network12#rsi-sntp-client-create-async) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_sntp_client_server_info (heading level 8)

`int32_t rsi_sntp_client_server_info(uint16_t length, uint8_t *sntp_server_response)`

**Description:** Get SNTP server info. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|length|- Reponse buffer length|
|uint8_t *|[in]|sntp_server_response|- Pointer to the SNTP Reponse buffer|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_sntp_client_create_async()](network12#rsi-sntp-client-create-async) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_sntp_client_delete_async (heading level 8)

`int32_t rsi_sntp_client_delete_async(void)`

**Description:** Delete SNTP client. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_sntp_client_create_async()](network12#rsi-sntp-client-create-async) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### MQTT Client

###### Functions (heading level 7)

###### rsi_mqtt_client_init (heading level 8)

`rsi_mqtt_client_info_t * rsi_mqtt_client_init(int8_t *buffer, uint32_t length, int8_t *server_ip, uint32_t server_port, uint32_t client_port, uint16_t flags, uint16_t keep_alive_interval)`

**Description:** Allocate memory for the MQTT for a single client. Returns MQTT Client instance pointer, which is used for further MQTT client operations. This is non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>buffer</td>
      <td>- Buffer pointer to allocate memory for MQTT Client information</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Buffer length</td>
    </tr>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>server_ip</td>
      <td>- IPv4 address of the MQTT broker</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>server_port</td>
      <td>- MQTT broker port number</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>client_port</td>
      <td>- MQTT client port number</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Each bit has its own significance <br />

|Flags|Description|
|---|---|
|Bit(0) - Server IP version|1 - IPv6 <br />|

^ 0 - IPv4</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>keep_alive_interval</td>
      <td>- MQTT client keep alive interval value in seconds <br />
 If there are no transactions between MQTT client and broker within <br />
 this time period, MQTT Broker disconnects the MQTT client <br />
 If 0, Server does not disconnect <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- Positive Value - Success: Returns MQTT client information structure pointer <br />
- NULL - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::client_port](rsi-mqtt-client-info-s#client-port), [rsi_ip_addr_u::ipv4](rsi-ip-addr-u#ipv4), [rsi_ip_addr_u::ipv6](rsi-ip-addr-u#ipv6), [rsi_mqtt_client_info_s::keep_alive_interval](rsi-mqtt-client-info-s#keep-alive-interval), [memcpy](bt-classic1#memcpy), [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client), [rsi_mqtt_client_info_s::mqtt_rx_buffer](rsi-mqtt-client-info-s#mqtt-rx-buffer), [rsi_mqtt_client_info_s::mqtt_tx_buffer](rsi-mqtt-client-info-s#mqtt-tx-buffer), [rsi_mqtt_client_info_s::server_ip](rsi-mqtt-client-info-s#server-ip), [rsi_mqtt_client_info_s::server_port](rsi-mqtt-client-info-s#server-port) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_connect (heading level 8)

`int32_t rsi_mqtt_connect(rsi_mqtt_client_info_t *rsi_mqtt_client, uint16_t flags, int8_t *client_id, int8_t *username, int8_t *password, void(*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Establish TCP connection with the given MQTT client port and establish MQTT protocol level connection. If Callback is provided it is non-blocking API otherwise it is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- Callback handler for asynchronous response. <br />|
|uint16_t|[out]|flags|- Socket descriptor number <br />|
|int8_t *|[out]|client_id|- Buffer <br />|
|int8_t *|[out]|username|- length of buffer <br />|
|int8_t *|[in]|password|- password for the login credentials of MQTT server|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|N/A|callback||

**Note**

- Need to register callback if ASYNC_MQTT is enable For Asynchronous <br />

**Returns**

- Zero - Success <br />  
   Negative value - Failure

**Note**

- Procedure for connecting MQTT over SSL : <br />  
   Enable TCP_IP_FEAT_SSL in Opermode parameters as below <br />  
   #define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT) <br />  
   Load the related SSL Certificates in the module using [rsi_wlan_set_certificate()](wlan#rsi-wlan-set-certificate) API. <br />

**References:** [rsi_mqtt_client_info_s::client_port](rsi-mqtt-client-info-s#client-port), [rsi_mqtt_client_info_s::keep_alive_interval](rsi-mqtt-client-info-s#keep-alive-interval), [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_mqtt_client_info_s::server_ip](rsi-mqtt-client-info-s#server-ip), [rsi_mqtt_client_info_s::server_port](rsi-mqtt-client-info-s#server-port) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_disconnect (heading level 8)

`int32_t rsi_mqtt_disconnect(rsi_mqtt_client_info_t *rsi_mqtt_client)`

**Description:** Disconnect the client from MQTT broker. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- MQTT client information structure pointer that was returned in [rsi_mqtt_client_init()](network13#rsi-mqtt-client-init) API|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_mqtt_connect()](network13#rsi-mqtt-connect) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_publish (heading level 8)

`int32_t rsi_mqtt_publish(rsi_mqtt_client_info_t *rsi_mqtt_client, int8_t *topic, MQTTMessage *publish_msg)`

**Description:** Publish the given message on the given topic. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- MQTT client info structure that was returned in [rsi_mqtt_client_init()](network13#rsi-mqtt-client-init) API|
|int8_t *|[in]|topic|- String of topic|
|MQTTMessage *|[in]|publish_msg|- Message to publish|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_mqtt_connect()](network13#rsi-mqtt-connect) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_subscribe (heading level 8)

`int32_t rsi_mqtt_subscribe(rsi_mqtt_client_info_t *rsi_mqtt_client, uint8_t qos, int8_t *topic, void(*call_back_handler_ptr)(MessageData *md))`

**Description:** Subscribe on the specified topic given. If any other client posts any message on the same topic, that message is received, if MQTT client is subscribed to that topic. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- MQTT client structure info pointer that was returned in [rsi_mqtt_client_init()](network13#rsi-mqtt-client-init) API|
|uint8_t|[in]|qos|- Quality of service of the message|
|int8_t *|[in]|topic|- Topic string|
|void(*)(MessageData *md)|[in]|call_back_handler_ptr|- Callback pointer to call when a message is received from MQTT broker|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_mqtt_connect()](network13#rsi-mqtt-connect) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_unsubscribe (heading level 8)

`int32_t rsi_mqtt_unsubscribe(rsi_mqtt_client_info_t *rsi_mqtt_client, int8_t *topic)`

**Description:** Unsubscribe on the specified topic given. If unsubscribed, any messages on the topic is not received further This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- MQTT client instance that was returned in [rsi_mqtt_client_init()](network13#rsi-mqtt-client-init) API|
|int8_t *|[in]|topic|- Topic string|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_mqtt_connect()](network13#rsi-mqtt-connect) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_mqtt_poll_for_recv_data (heading level 8)

`int32_t rsi_mqtt_poll_for_recv_data(rsi_mqtt_client_info_t *rsi_mqtt_client, int time_out)`

**Description:** Wait for the MQTT messages to receive on the specific MQTT client. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_mqtt_client_info_t](rsi-mqtt-client-info-s) *|[in]|rsi_mqtt_client|- MQTT client instance that was returned in [rsi_mqtt_client_init()](network13#rsi-mqtt-client-init) API|
|int|[in]|time_out|- Time out in milliseconds.|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_mqtt_connect()](network13#rsi-mqtt-connect) API needs to be called before this API

**References:** [rsi_mqtt_client_info_s::mqtt_client](rsi-mqtt-client-info-s#mqtt-client) and [SL_PRINTF](bt-classic1#sl-printf)

###### HTTP Server

###### Functions (heading level 7)

###### rsi_wlan_nwk_register_json_update_cb (heading level 8)

`int16_t rsi_wlan_nwk_register_json_update_cb(uint32_t callback_id, void(*callback_handler_ptr)(uint8_t *filename, uint8_t *json_object, uint32_t length, uint32_t status))`

**Description:** Register the callbacks. This is non blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|callback_id|- Callback ID which needs to be registered|
|void(*)(uint8_t *filename, uint8_t *json_object, uint32_t length, uint32_t status)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|filename|- json object filename|
||[out]|json_object|- json object data|
||[out]|length|- Length of the response buffer.|
||[out]|status|- Response status.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- Please refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_nwk_callback_s::rsi_json_object_update_handler](rsi-nwk-callback-s#rsi-json-object-update-handler) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_wlan_nwk_register_json_event_cb (heading level 8)

`int16_t rsi_wlan_nwk_register_json_event_cb(uint32_t callback_id, void(*callback_handler_ptr)(uint32_t status, uint8_t *json_object, uint32_t length))`

**Description:** Register the event callbacks. This is non blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|callback_id|- Callback ID which needs to be registered|
|void(*)(uint32_t status, uint8_t *json_object, uint32_t length)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|status|- Response status.|
||[out]|json_object|- json object data|
||[out]|length|- Length of the response buffer.|

**Returns**

- 0 - Success <br />
- Positive Value - Failure

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_nwk_callback_s::rsi_json_object_event_handler](rsi-nwk-callback-s#rsi-json-object-event-handler) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_wlan_nwk_register_send_large_data_event_cb (heading level 8)

`int16_t rsi_wlan_nwk_register_send_large_data_event_cb(void(*callback_handler_ptr)(int32_t sock_id, int16_t status, uint16_t length))`

**Description:** Register the event callbacks. This is non blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void(*)(int32_t sock_id, int16_t status, uint16_t length)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|socket_id|- socket id for active connection.|
||[out]|status|- Response status.|
||[out]|length|- Length of the response buffer. <br />|

**Note**

- The callback rsi_wlan_nwk_register_send_large_data_event_cb notifies the application of the success or failure status of rsi_send_large_data_async.

**Returns**

- 0 - Success <br />
- Positive Value - Failure <br />

###### prototypes of the callback functions (heading level 8)

|Prototype|Description|Parameters|
|---|---|---|
|void (*rsi_send_large_data_async_complete_callback)(int32_t sock_id, int16_t status, uint16_t length);|This callback is used to Register rsi_send_large_data complete notify|sock_id => sock_id of the connection<br /><br/> status => status of the response<br /><br/> length => length of the payload.|

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_nwk_callback_s::rsi_send_large_data_async_complete_callback](rsi-nwk-callback-s#rsi-send-large-data-async-complete-callback) and [RSI_SUCCESS](bt-classic1#rsi-success)

###### rsi_wlan_nwk_register_webpage_req_cb (heading level 8)

`int16_t rsi_wlan_nwk_register_webpage_req_cb(uint32_t callback_id, void(*callback_handler_ptr)(uint8_t type, uint8_t *url_name, uint8_t *post_content_buffer, uint32_t post_content_length, uint32_t status))`

**Description:** Register webpage request callbacks. This is non blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|callback_id|- Callback ID which needs to be registered|
|void(*)(uint8_t type, uint8_t *url_name, uint8_t *post_content_buffer, uint32_t post_content_length, uint32_t status)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|type|- Command type|
||[out]|url_name|- URL address of the domain|
||[out]|post_content_buffer|- Response buffer.|
||[out]|post_content_length|- Length of the response buffer.|
||[out]|status|- Response status.|

**Returns**

- 0 - Success <br />
- Positive Value - Failure

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_nwk_callback_s::rsi_webpage_request_handler](rsi-nwk-callback-s#rsi-webpage-request-handler)

###### rsi_wlan_nwk_register_wireless_fw_upgrade_cb (heading level 8)

`int16_t rsi_wlan_nwk_register_wireless_fw_upgrade_cb(uint32_t callback_id, void(*callback_handler_ptr)(uint8_t type, uint32_t status))`

**Description:** Register wireless firmware upgrade callbacks. This is non blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|callback_id|- Callback ID which needs to be registered|
|void(*)(uint8_t type, uint32_t status)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|type|- Command type|
||[out]|status|- Response status.|

**Returns**

- 0 - Success <br />
- Positive Value - Failure

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_nwk_callback_s::rsi_wireless_fw_upgrade_handler](rsi-nwk-callback-s#rsi-wireless-fw-upgrade-handler)

###### rsi_webpage_load (heading level 8)

`int32_t rsi_webpage_load(uint8_t flags, uint8_t *file_name, uint8_t *webpage, uint32_t length)`

**Description:** Load the webpage to the HTTP Server's file system that is present in the module. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- BIT [2] is used to set the webpage that is associated with JSON object|
|uint8_t *|[in]|file_name|- Filename of the HTML webpage|
|uint8_t *|[in]|webpage|- Pointer to the HTML webpage that contains the HTML webpage content|
|uint32_t|[in]|length|- Webpage length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_json_object_create (heading level 8)

`int32_t rsi_json_object_create(uint8_t flags, const char *file_name, uint8_t *json_object, uint32_t length)`

**Description:** Create the JSON object to the webpage that is already present in the module's HTTP server file system. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Reserved|
|const char *|[in]|file_name|- Filename of the JSON object data|
|uint8_t *|[in]|json_object|- Pointer to the JSON object data|
|uint32_t|[in]|length|- Length of the JSON object data|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [UNUSED_PARAMETER](bt-classic1#unused-parameter) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_webpage_erase (heading level 8)

`int32_t rsi_webpage_erase(uint8_t *file_name)`

**Description:** Erase the webpage from HTTP server's file system that is present in the module. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|file_name|- Erase particular/all loaded webpage files from the HTTP server's file system. <br /><br/> file_name - Erase a particular webpage file. <br /><br/> NULL - Erase all loaded webpage files|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_json_object_delete (heading level 8)

`int32_t rsi_json_object_delete(uint8_t *file_name)`

**Description:** Delete the JSON object of the HTTP server's file system that is already present in the module. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|file_name|- Delete a particular JSON object that is already created in the HTTP server's file system|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_webpage_send (heading level 8)

`int32_t rsi_webpage_send(uint8_t flags, uint8_t *webpage, uint32_t length)`

**Description:** Send the webpage to HTTP server's file system. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Reserved|
|uint8_t *|[in]|webpage|- Pointer to the HTML webpage that contains the HTML webpage content|
|uint32_t|[in]|length|- Webpage length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wlan_connect()](wlan#rsi-wlan-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [UNUSED_PARAMETER](bt-classic1#unused-parameter) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### MDNSD

###### Functions (heading level 7)

###### rsi_mdnsd_init (heading level 8)

`int32_t rsi_mdnsd_init(uint8_t ip_version, uint16_t ttl, uint8_t *host_name)`

**Description:** Initialize the MDNSD service in device. It creates MDNS daemon. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|ip_version|- Select the IP version. 4 – to select IPv4, <br /><br/> 6 – to select IPv6|
|uint16_t|[in]|ttl|- Time to live in seconds for which service should be active|
|uint8_t *|[in]|host_name|- Host name that is used as host name in Type A record.|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_mdnsd_register_service (heading level 8)

`int32_t rsi_mdnsd_register_service(uint16_t port, uint16_t ttl, uint8_t more, uint8_t *service_ptr_name, uint8_t *service_name, uint8_t *service_text)`

**Description:** Add a MDNSD service. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|port|- Port number on which service should be added.|
|uint16_t|[in]|ttl|- Time to live. This is time in seconds for which service should be active|
|uint8_t|[in]|more|- This byte should be set to '1' when there are more services to add. <br /><br/> 0 - This is last service, starts MDNS service. <br /><br/> 1 - Still more services will be added.|
|uint8_t *|[in]|service_ptr_name|- Name to be added in Type-PTR record|
|uint8_t *|[in]|service_name|- Name to be added in Type-SRV record (service name)|
|uint8_t *|[in]|service_text|- Text field to be added in Type-TXT record|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Currently, only one service registration is supported

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_mdnsd_deinit (heading level 8)

`int32_t rsi_mdnsd_deinit(void)`

**Description:** Delete the MDNSD service. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Negative value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### Socket configuration

###### Functions (heading level 7)

###### rsi_tcp_window_update (heading level 8)

`int32_t rsi_tcp_window_update(uint32_t sockID, uint32_t new_size_bytes)`

**Description:** Update TCP window size from host. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|sockID|- Socket descriptor ID|
|uint32_t|[in]|new_size_bytes|- Window size to update in bytes|

**Returns**

- Positive Value - Window size updated <br />  
   Negative Value - Failure

**Note**

- **Precondition** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_wlan_req_radio

###### Functions (heading level 7)

###### rsi_wlan_req_radio (heading level 8)

`int32_t rsi_wlan_req_radio(uint8_t enable)`

**Description:** Register and Deregister WLAN radio.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enable|- To register and deregister WLAN radio|
||[out]|RSI_SUCCESS||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_radio_deinit](network17#rsi-wlan-radio-deinit)

###### rsi_wlan_radio_deinit (heading level 8)

`int32_t rsi_wlan_radio_deinit(void)`

**Description:** Deregister WLAN radio. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021,0x0067) <br />

**Note**

- If [rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is called after [rsi_wlan_scan()](wlan#rsi-wlan-scan). Need to call [rsi_wlan_scan()](wlan#rsi-wlan-scan) API again after the [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init). <br />
- If [rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is allowed before WLAN connected state only.<br />

###### Below APIs are allowed after rsi_wlan_radio_deinit() API (heading level 9)

1. [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init)
2. [rsi_wlan_power_save_profile()](wlan#rsi-wlan-power-save-profile)
3. [rsi_wlan_get()](wlan#rsi-wlan-get) In this API only RSI_MAC_ADDRESS and RSI_CONNECTION_STATUS cmd_type are allowed.
4. [rsi_wireless_deinit()](common#rsi-wireless-deinit)
5. [rsi_switch_proto()](common#rsi-switch-proto)
6. [rsi_get_ram_log()](common#rsi-get-ram-log)
7. [rsi_get_fw_version()](common#rsi-get-fw-version)
8. [rsi_common_debug_log()](common#rsi-common-debug-log)
9. [rsi_bt_power_save_profile()](bt-ble#rsi-bt-power-save-profile)**Note**  
   - **Precondition** - The application should be in radio init and unconnected state before calling this function. <br />[rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is called after [rsi_wlan_scan()](wlan#rsi-wlan-scan)

**References:** [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_req_radio](network17#rsi-wlan-req-radio) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wlan_add_mfi_ie

###### Functions (heading level 7)

###### rsi_wlan_add_mfi_ie (heading level 8)

`int32_t rsi_wlan_add_mfi_ie(int8_t *mfi_ie, uint32_t ie_len)`

**Description:** Add the Apple defined IE elements to the beacon command request structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|mfi_ie|- Pointer to the IE element|
|uint32_t|[in]|ie_len|- Length of the IE element|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa)<br />

###### OTA Firmware Client

###### Functions (heading level 7)

###### rsi_ota_firmware_upgradation (heading level 8)

`int32_t rsi_ota_firmware_upgradation(uint8_t flags, uint8_t *server_ip, uint32_t server_port, uint16_t chunk_number, uint16_t timeout, uint16_t tcp_retry_count, void(*ota_fw_up_response_handler)(uint16_t status, uint16_t chunk_number))`

**Description:** Create an OTAF client. Initialize the client with a given configuration. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- Select the IP version. <br /><br/> BIT(0) – RSI_IPV6: Set this bit to enable IPv6 , by default it is configured to IPv4|
|uint8_t *|[in]|server_ip|- OTAF server IP address|
|uint32_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|
|void(*)(uint16_t status, uint16_t chunk_number)|[in]|ota_fw_up_response_handler|- Callback when asynchronous response is received from module for firmware update request. Callback parameters: status and chunk_number|
||[out]|status|- Status code|
||[out]|chunk_number|- Chunk number of the firmware content|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- For safe firmware upgrade via TCP server, <br />  
   it will take approx. 65 sec duration for upgrading the firmware of 1.5 MB file.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_nwk_callback_s::rsi_ota_fw_up_response_handler](rsi-nwk-callback-s#rsi-ota-fw-up-response-handler), [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

#### Wi-Fi APIs

This section describes the Wi-Fi APIs 

##### Modules

[BSD Sockets](network5)

[rsi_wlan_req_radio](network17)

[rsi_wlan_add_mfi_ie](network18)

##### Functions

###### rsi_driver_send_data

`int32_t rsi_driver_send_data(uint32_t sockID, uint8_t *buffer, uint32_t length, struct rsi_sockaddr *destAddr)`

**Description:** Send data packet. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|sockID|- Socket descriptor on which data needs to be send|
|uint8_t *|[in]|buffer|- Pointer to data|
|uint32_t|[in]|length|- Data length|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Pointer to destination socket details|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_driver_send_data_non_rom](driver9#rsi-driver-send-data-non-rom)

**Referenced by:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom)

###### rsi_driver_process_recv_data

`int32_t rsi_driver_process_recv_data(rsi_pkt_t *pkt)`

**Description:** Process received data packet. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[rsi_pkt_t](rsi-pkt-s) *|[in]|pkt|- Pointer to data packet <br />|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom)

###### rsi_nwk_register_callbacks

`int16_t rsi_nwk_register_callbacks(uint32_t callback_id, void(*callback_handler_ptr)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length))`

**Description:** Register the callback. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|callback_id|- This is the Id of the callback function. <br /><br/> Following ids are supported: <br /><br/> 0-RSI_NWK_ERROR_CB, <br /><br/> 1-RSI_WLAN_NWK_URL_REQ_CB, <br /><br/> 2-RSI_WLAN_NWK_JSON_UPDATE_CB, <br /><br/> 3-RSI_WLAN_NWK_FW_UPGRADE_CB, <br /><br/> 4-RSI_WLAN_NWK_JSON_EVENT_CB|
|void(*)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length)|[in]|callback_handler_ptr|- Callback handler which needs to be registered for a given callback|
||[out]|status|- Response status.|
||[out]|buffer|- Response buffer.|
||[out]|length|- Length of the response buffer.|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd) <br />  
   1 - If call_back_id is greater than the maximum callbacks to register <br />

###### prototypes of the callback functions

|callback id|Prototype|Description|Parameters|
|---|---|---|---|
|RSI_NWK_ERROR_CB|void (*nwk_error_call_back_handler)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length);|This callback is used to Register join fail|command_type => command_type of the response<br /><br/> status => status of the response<br /><br/> buffer => payload of the response<br /><br/> length => length of the payload|
|RSI_WLAN_NWK_URL_REQ_CB|void (*rsi_webpage_request_handler)(uint8_t type, uint8_t *url_name,uint8_t *post_content_buffer, uint32_t post_content_length, uint32_t status);|This callback is used to Register webpage request|type => type of the handler<br /><br/> url_name =>url name<br /><br/> post_content_buffer => Webpage content<br /><br/> post_content_lenght => length of webpage content<br /><br/> status => status of the response|
|RSI_WLAN_NWK_JSON_UPDATE_CB|void (*rsi_json_object_update_handler)(uint8_t *file_name, uint8_t *json_object, uint32_t length, uint32_t status);|This callback is used to Register json update|file_name => File name <br /><br/> json_object => Json object<br /><br/> length: length of the json object<br /><br/> status => status of the response|
|RSI_WLAN_NWK_FW_UPGRADE_CB|void (*rsi_wireless_fw_upgrade_handler)(uint8_t type, uint32_t status);|This callback is used to Register wireless firmware upgrade|type => type of the handler<br /><br/> status => status of the response|
|RSI_WLAN_NWK_JSON_EVENT_CB|void (*rsi_json_object_event_handler)(uint32_t status, uint8_t *json_object_str, uint32_t length);|This callback is used to Register json update|status => status of the response<br /><br/> json_object_str => json object string<br /><br/> length => length of the string|

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_nwk_callback_s::nwk_error_call_back_handler](rsi-nwk-callback-s#nwk-error-call-back-handler), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wlan_radio_init

`int32_t rsi_wlan_radio_init(void)`

**Description:** Initializes WLAN radio and supplicant parameters.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API must be called before this API. <br />
- [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) is used if user wants to configure any other parameters, which are supposed to be given before [rsi_wlan_scan()](wlan#rsi-wlan-scan) or [rsi_wlan_scan_async()](wlan#rsi-wlan-scan-async) API
- In AP mode, the behavior of RS9116 modules is as follows,  
  - The device region for modules parts cannot be manually configured by the user. It automatically updates to align with the region of the connected AP.

**References:** [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_config_ipaddress](wlan#rsi-config-ipaddress) and [rsi_transmit_test_start](wlan#rsi-transmit-test-start)

###### rsi_wlan_filter_broadcast

`int32_t rsi_wlan_filter_broadcast(uint16_t beacon_drop_threshold, uint8_t filter_bcast_in_tim, uint8_t filter_bcast_tim_till_next_cmd)`

**Description:** Program the ignore threshold levels of the broadcast packet when station is in power save and is used to achieve low current consumption in standby associated mode. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|beacon_drop_threshold|- LMAC beacon drop threshold(ms):LMAC beacon drop threshold (ms): This is the time the firmware waits to receive the complete beacon. For optimal power performance, use the default value of 5000 ms.|
|uint8_t|[in]|filter_bcast_in_tim|- If this bit is set, then from the next dtim any broadcast data pending bit in TIM indicated will be ignored valid values: 0 - 1 <br /><br/> Validity of this bit is dependent on the filter_bcast_tim_till_next_cmd.|
|uint8_t|[in]|filter_bcast_tim_till_next_cmd|- 0 - filter_bcast_in_tim is valid till disconnect of the STA. <br /><br/> 1 - filter_bcast_in_tim is valid till next update by giving the same command. <br /><br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0x0021) <br />

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_check_state

`int32_t rsi_check_state(int32_t type)`

**Description:** Check if the WLAN is in IP Config state.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|type|- Socket family type|

**Returns**

- 0 - Success: IP config state <br />
- Negative value - Failure: -20 (0xffffffec) - Not in IP config state

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [RSI_SUCCESS](network5#rsi-success) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_sort_scan_results_array_based_on_rssi

`void rsi_sort_scan_results_array_based_on_rssi(struct wpa_scan_results_arr *scan_results_array)`

**Description:** Sort the scan results in the order of RSSI.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|struct [wpa_scan_results_arr](wpa-scan-results-arr) *|[in]|scan_results_array|- Contains the array of scan results that need to be sorted.|

**Returns**

- Void

**Note**

- **Precondition** - [rsi_wlan_scan_with_bitmap_options()](wlan#rsi-wlan-scan-with-bitmap-options) API needs to be called before this API.

**References:** [wpa_scan_res::level](wpa-scan-res#level), [memcpy](bt-classic1#memcpy), [wpa_scan_results_arr::num](wpa-scan-results-arr#num), [wpa_scan_results_arr::res](wpa-scan-results-arr#res) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_config_timeout

`int32_t rsi_config_timeout(uint32_t timeout_type, uint16_t timeout_value)`

**Description:** This API is used to set timeouts. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|timeout_type|- It is used to identify which timeout to be set.<br /><br/> if timeout_type is 1 - set for association and authentication timeout request in ms. 2 - set for the each channel active scan time in ms 3 - is set for the WLAN keep alive time in seconds|
|uint16_t|[in]|timeout_value|- timeout value to be set.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Note**

- Packet is sent as Wlan Keep alive before [rsi_config_ipaddress()](wlan#rsi-config-ipaddress)<br />  
   After [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) it is sent as gratuitous ARP.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [send_timeout](wlan#send-timeout), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### send_timeout

`int32_t send_timeout(uint32_t timeout_bitmap, uint16_t timeout_value)`

**Description:** This API is used to set timeouts. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|timeout_bitmap|- It is used to identify which timeout to be set.<br /><br/> if timeout_bitmap is RSI_ASSOCIATION_AND_AUTHENTICATION_TIMEOUT_MSEC - set for association and authentication timeout request in ms. RSI_CHANNEL_SCAN_TIME_MSEC - set for the each channel active scan time in ms RSI_WLAN_KEEP_ALIVE_TIMEOUT_SEC - is set for the WLAN keep alive time in seconds|
|uint16_t|[in]|timeout_value|- timeout value to be set.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Note**

- Packet is sent as Wlan Keep alive before [rsi_config_ipaddress()](wlan#rsi-config-ipaddress)<br />  
   After [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) it is sent as gratuitous ARP.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [RSI_SUCCESS](bt-classic1#rsi-success) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_config_timeout](wlan#rsi-config-timeout)

###### rsi_wlan_scan_with_bitmap_options

`int32_t rsi_wlan_scan_with_bitmap_options(int8_t *ssid, uint8_t chno, rsi_rsp_scan_t *result, uint32_t length, uint32_t scan_bitmap)`

**Description:** Scan surrounding access points and post scan response. You can call this API to get the scan results. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[out]|ssid|- Buffer address provided by the application to fill the scan response. result is type of rsi_rsp_scan_t .|
|uint8_t|[in]|chno|- The length of the result buffer (3rd parameter of the rsi_rsp_scan_t structure) is measured in bytes to store the scan results. <br /><br/> A minimum buffer size of 514 bytes is required to hold 11 scan results.|
|[rsi_rsp_scan_t](rsi-rsp-scan-s) *|[in]|result|- Scan bitmap options. <br /><br/> BIT[0] (QUICK SCAN feature) - It is valid only if channel number and ssid is given. <br /><br/> BIT[1] (SCAN RESULTS TO HOST) - When it is enabled additional scan results are given to host. <br /><br/> After getting scan results, host has to issue another scan request by disabling this bit in scan feature bitmap in same API <br /><br/> or call [rsi_wlan_scan](wlan#rsi-wlan-scan) API before issuing join command. <br />|
|uint32_t|N/A|length||
|uint32_t|N/A|scan_bitmap||

###### Channels supported in 2.4 GHz Band

|Channel numbers|chno|
|---|---|
|All Channels|0|
|1|1|
|2|2|
|3|3|
|4|4|
|5|5|
|6|6|
|7|7|
|8|8|
|9|9|
|10|10|
|11|11|
|12|12|
|13|13|

###### Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|36|36|
|40|40|
|44|44|
|48|48|
|100|100|
|104|104|
|108|108|
|116|116|
|132|132|
|136|136|
|140|140|
|149|149|
|153|153|
|157|157|
|161|161|
|165|165|

###### DFS Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|52(DFS)|52|
|56(DFS)|56|
|60(DFS)|60|
|64(DFS)|64|
|100(DFS)|100|
|104(DFS)|104|
|108(DFS)|108|
|112(DFS)|112|
|116(DFS)|116|
|120(DFS)|120|
|124(DFS)|124|
|128(DFS)|128|
|132(DFS)|132|
|136(DFS)|136|
|140(DFS)|140|
|144(DFS)|144|

###### Channels supported in 4.9 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|184|184|
|188|188|
|192|192|
|196|196|
|8|8|
|12|12|
|16|16|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_wlan_get_status](wlan#rsi-wlan-get-status), [rsi_wlan_scan_async_with_bitmap_options](wlan#rsi-wlan-scan-async-with-bitmap-options), [SL_PRINTF](bt-classic1#sl-printf), [wpa_scan_res::ssid](wpa-scan-res#ssid), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem)

###### rsi_wlan_scan_async_with_bitmap_options

`int32_t rsi_wlan_scan_async_with_bitmap_options(int8_t *ssid, uint8_t chno, uint32_t bitmap, void(*scan_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))`

**Description:** Scan available access points and post scan response to application. Application must call this API to get the scan results. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|ssid|- Scan feature bitmap <br /><br/> BIT[0] (QUICK SCAN feature) - It is valid only if channel number and ssid is given. <br /><br/> BIT[1] (SCAN RESULTS TO HOST) - When it is enabled additional scan results are given to host. <br /><br/> After getting scan results, host has o issue another scan request by disabling this bit in scan feature bitmap in same api or call [rsi_wlan_scan](wlan#rsi-wlan-scan) api <br /><br/> before issuing join command.|
|uint8_t|[out]|chno|- Callback that is called when the response for scan is received from the module. The parameters involved are status, buffer, & length.|
|uint32_t|[out]|bitmap|- Response status|
|void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length)|[out]|scan_response_handler|- Buffer address provided by the application to fill the scan response.|
||[out]|length|- The length of the result buffer (3rd parameter of the rsi_rsp_scan_t structure) is measured in bytes to store the scan results. <br /><br/> A minimum buffer size of 514 bytes is required to hold 11 scan results.|

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

###### Channels supported in 2.4 GHz Band

|Channel numbers|chno|
|---|---|
|All Channels|0|
|1|1|
|2|2|
|3|3|
|4|4|
|5|5|
|6|6|
|7|7|
|8|8|
|9|9|
|10|10|
|11|11|
|12|12|
|13|13|

###### Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|36|36|
|40|40|
|44|44|
|48|48|
|100|100|
|104|104|
|108|108|
|116|116|
|132|132|
|136|136|
|140|140|
|149|149|
|153|153|
|157|157|
|161|161|
|165|165|

###### DFS Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|52(DFS)|52|
|56(DFS)|56|
|60(DFS)|60|
|64(DFS)|64|
|100(DFS)|100|
|104(DFS)|104|
|108(DFS)|108|
|112(DFS)|112|
|116(DFS)|116|
|120(DFS)|120|
|124(DFS)|124|
|128(DFS)|128|
|132(DFS)|132|
|136(DFS)|136|
|140(DFS)|140|
|144(DFS)|144|

###### Channels supported in 4.9 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|184|184|
|188|188|
|192|192|
|196|196|
|8|8|
|12|12|
|16|16|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c) <br />

**References:** [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_non_rom_s::scan_results_to_host](rsi-wlan-cb-non-rom-s#scan-results-to-host), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options)

###### rsi_wlan_scan

`int32_t rsi_wlan_scan(int8_t *ssid, uint8_t chno, rsi_rsp_scan_t *result, uint32_t length)`

**Description:** Scan the surrounding access points. Invokes [rsi_wlan_scan_async()](wlan#rsi-wlan-scan-async) API, which is an asynchronous call. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[out]|ssid|- Scanned Wi-Fi networks information. <br /><br/> This output contains a maximum of 11 scan results <br /><br/> The structure rsi_rsp_scan_t contains members scan_count, which specifies the number of scan <br /><br/> results followed by an array of structure type rsi_scan_info_t, where each array element contains <br /><br/> information about each network scanned. result is type of rsi_rsp_scan_t|
|uint8_t|[in]|chno|-The length of the result buffer (3rd parameter of the rsi_rsp_scan_t structure) is measured in bytes to store the scan results. <br /><br/> A minimum buffer size of 514 bytes is required to hold 11 scan results.|
|[rsi_rsp_scan_t](rsi-rsp-scan-s) *|N/A|result||
|uint32_t|N/A|length||

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

###### Channels supported in 2.4 GHz Band

|Channel numbers|chno|
|---|---|
|All Channels|0|
|1|1|
|2|2|
|3|3|
|4|4|
|5|5|
|6|6|
|7|7|
|8|8|
|9|9|
|10|10|
|11|11|
|12|12|
|13|13|

###### Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|36|36|
|40|40|
|44|44|
|48|48|
|100|100|
|104|104|
|108|108|
|116|116|
|132|132|
|136|136|
|140|140|
|149|149|
|153|153|
|157|157|
|161|161|
|165|165|

###### DFS Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|52(DFS)|52|
|56(DFS)|56|
|60(DFS)|60|
|64(DFS)|64|
|100(DFS)|100|
|104(DFS)|104|
|108(DFS)|108|
|112(DFS)|112|
|116(DFS)|116|
|120(DFS)|120|
|124(DFS)|124|
|128(DFS)|128|
|132(DFS)|132|
|136(DFS)|136|
|140(DFS)|140|
|144(DFS)|144|

###### Channels supported in 4.9 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|184|184|
|188|188|
|192|192|
|196|196|
|8|8|
|12|12|
|16|16|

**Returns**

- 0 - Success
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c) <br />

###### Scan Info structure

|Structure Fields|Description|
|---|---|
|rf_channel|Access point channel number|
|security_mode|Security modes<br /><br/> 0 : Open <br /><br/> 1 : WPA<br /><br/> 2 : WPA2<br /><br/> 3 : WEP<br /><br/> 4 : WPA Enterprise<br /><br/> 5 : WPA2 Enterprise<br /><br/> 6 : WPA/WPA2 Mixed mode<br /><br/> 7 : WPA3 Personal<br /><br/> 8 : WPA3 Personal Transition Mode|
|rssi_val|RSSI value of the Access Point|
|network_type|This is the type of the network<br /><br/> 1 : Infrastructure mode|
|ssid|SSID of the access point|
|bssid|MAC address of the access point|

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API. <br />
- Refer to [Error Codes](error-codes) for the description of above error codes. <br />
- To set various timeouts, user should change the following macros in rsi_wlan_config.h <br />  
   #define RSI_TIMEOUT_SUPPORT RSI_ENABLE <br />  
   #define RSI_TIMEOUT_BIT_MAP 2 <br />  
   #define RSI_TIMEOUT_VALUE 150 (This macro can be configured based on user requirement) <br />  
  |timeout_bitmap|Description|  
  |---|---|  
  |timeout_bitmap[0]|Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).|  
  |timeout_bitmap[1]|Sets each channel active scan time in ms (default 100ms)|  
  |timeout_bitmap[2]|Used for WLAN keep alive timeout(default value is 30s)|  
  |timeout_bitmap[31-3]|Reserved|

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_wlan_get_status](wlan#rsi-wlan-get-status), [rsi_wlan_scan_async](wlan#rsi-wlan-scan-async), [SL_PRINTF](bt-classic1#sl-printf), [wpa_scan_res::ssid](wpa-scan-res#ssid), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem)

###### rsi_wlan_scan_async

`int32_t rsi_wlan_scan_async(int8_t *ssid, uint8_t chno, void(*scan_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))`

**Description:** Scan the surrounding access points. A scan response handler is registered with it to get the response for scan. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|ssid|- Callback that is called when the response for scan is received from the module. <br /><br/> The parameters involved are status, buffer, & length. <br />|
|uint8_t|[out]|chno|- Response status.|
|void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length)|[out]|scan_response_handler|- Response buffer <br />|
||[out]|Length|- The length of the result buffer (3rd parameter of the rsi_rsp_scan_t structure) is measured in bytes to store the scan results. <br /><br/> A minimum buffer size of 514 bytes is required to hold 11 scan results.|

###### Channels supported in 2.4 GHz Band

|Channel numbers|chno|
|---|---|
|All Channels|0|
|1|1|
|2|2|
|3|3|
|4|4|
|5|5|
|6|6|
|7|7|
|8|8|
|9|9|
|10|10|
|11|11|
|12|12|
|13|13|

###### Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|36|36|
|40|40|
|44|44|
|48|48|
|100|100|
|104|104|
|108|108|
|116|116|
|132|132|
|136|136|
|140|140|
|149|149|
|153|153|
|157|157|
|161|161|
|165|165|

###### DFS Channels supported in 5 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|52(DFS)|52|
|56(DFS)|56|
|60(DFS)|60|
|64(DFS)|64|
|100(DFS)|100|
|104(DFS)|104|
|108(DFS)|108|
|112(DFS)|112|
|116(DFS)|116|
|120(DFS)|120|
|124(DFS)|124|
|128(DFS)|128|
|132(DFS)|132|
|136(DFS)|136|
|140(DFS)|140|
|144(DFS)|144|

###### Channels supported in 4.9 GHz Band (heading level 8)

|Channel numbers|chno|
|---|---|
|All Channels|0|
|184|184|
|188|188|
|192|192|
|196|196|
|8|8|
|12|12|
|16|16|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c) <br />

###### Scan Response structure format (heading level 8)

|Structure Fields|Description|
|---|---|
|scan_count|Number of access points scanned.<br /><br/> scan_count[0] Contains the scan count.<br /><br/> scan_count[3-1] are reserved.|
|scan_info|Information about scanned Access points in rsi_scan_info_t structure.|

###### Scan Info - rsi_scan_info_t structure

|Structure Fields|Description|
|---|---|
|rf_channel|Access point channel number|
|security_mode|Security mode<br /><br/> 0 : Open<br /><br/> 1 : WPA<br /><br/> 2 : WPA2<br /><br/> 3 : WEP<br /><br/> 4 : WPA Enterprise<br /><br/> 5 : WPA2 Enterprise<br /><br/> 6 : WPA/WPA2 Mixed mode<br /><br/> 7 : WPA3 Personal<br /><br/> 8 : WPA3 Personal Transition Mode|
|rssi_val|RSSI value of the Access Point|
|network_type|Type of network<br /><br/> 1 . Infrastructure mode|
|ssid|SSID of the access point|
|bssid|MAC address of the access point|

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- If status is Success , the argument buffer passed to scan_response_handler <br />  
   holds scan results in rsi_rsp_scan_t structure format.
- To set various timeouts, user should change the following macros in rsi_wlan_config.h <br />  
   #define RSI_TIMEOUT_SUPPORT RSI_ENABLE <br />  
   #define RSI_TIMEOUT_BIT_MAP 4 <br />  
   #define RSI_TIMEOUT_VALUE 300

|timeout_bitmap|Description|
|---|---|
|timeout_bitmap[0]|Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).|
|timeout_bitmap[1]|Sets each channel active scan time in ms (default 100ms)|
|timeout_bitmap[2]|Used for WLAN keep alive timeout(default value is 30s)|
|timeout_bitmap[31-3]|Reserved|

**References:** [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_scan](wlan#rsi-wlan-scan)

###### rsi_wlan_connect

`int32_t rsi_wlan_connect(int8_t *ssid, rsi_security_mode_t sec_type, void *secret_key)`

**Description:** Connect to the specified Wi-Fi network. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>ssid</td>
      <td>- SSID of an access point to connect. SSID should be less than or equal to 32 bytes.</td>
    </tr>
    <tr>
      <td>rsi_security_mode_t</td>
      <td>[in]</td>
      <td>sec_type</td>
      <td>- Security type of the access point to connect. <br />

|Value|Security Type|
|---|---|
|0|RSI_OPEN|
|1|RSI_WPA|
|2|RSI_WPA2|
|3|RSI_WEP|
|4|RSI_WPA_EAP|
|5|RSI_WPA2_EAP|
|6|RSI_WPA_WPA2_MIXED|
|7|RSI_WPA_PMK|
|8|RSI_WPA2_PMK|
|9|RSI_WPS_PIN|
|10|RSI_USE_GENERATED_WPSPIN|
|11|RSI_WPS_PUSH_BUTTON|
|12|RSI_WPA_WPA2_MIXED_PMK|
|13|RSI_WPA3|</td>
    </tr>
    <tr>
      <td>void *</td>
      <td>[in]</td>
      <td>secret_key</td>
      <td>- Pointer to a buffer that contains security information based on sec_type. <br />

|Security type(sec_type)|Secret key structure format (secret_key)|
|---|---|
|RSI_OPEN|No secret key in open security mode.|
|RSI_WPA|PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.|
|RSI_WPA2|PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.|
|RSI_WEP|WEP keys should be in the following format:|

^ typedef struct [rsi_wep_keys_s](rsi-wep-keys-s) ^ { ^ uint8_t index[2]; ^ uint8_t key[4][32]; ^ } rsi_wep_keys_t; ^ index: WEP key index to use for TX packet encryption. ^ key: 4 WEP keys, last three WEP keys are optional. If only first WEP key is valid then index should be 0. RSI_WPA_EAP | Enterprise credentials should be in the following format: ^ typedef struct [rsi_eap_credentials_s](rsi-eap-credentials-s) ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for the given username RSI_WPA2_EAP | Enterprise credentials should be in the following format: ^ typedef struct [rsi_eap_credentials_s](rsi-eap-credentials-s) ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for a given username. RSI_WPA_WPA2_MIXED | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes RSI_WPA_PMK | PMK string, should be 32 bytes in length RSI_WPA2_PMK | PMK string, should be 32 bytes in length RSI_WPS_PIN | 8-byte WPS PIN RSI_USE_GENERATED_WPSPIN| NULL string indicate to use PIN generated using rsi_wps_generate_pin API RSI_WPS_PUSH_BUTTON | NULL string indicate to generate push button event RSI_WPA3 | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002,0x0003,0x0005,0x0008,0x0009,0x000A,0x000E,0x0014, <br />  
   0x0015,0x0016,0x0019,0x001A,0x001E,0x0020,0x0021,0x0024,0x0025,0x0026,0x0028,0x0039,0x003C, <br />  
   0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0xFFF8) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- To set various timeouts, user should change the following macros in rsi_wlan_config.h <br />  
   #define RSI_TIMEOUT_SUPPORT RSI_ENABLE. <br />  
   #define RSI_TIMEOUT_BIT_MAP 4. <br />  
   #define RSI_TIMEOUT_VALUE 300. <br />  
  |timeout_bitmap|Description|  
  |---|---|  
  |timeout_bitmap[0]|Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).|  
  |timeout_bitmap[1]|Sets each channel active scan time in ms (default 100ms)|  
  |timeout_bitmap[2]|Used for WLAN keep alive timeout(default value is 30s)|  
  |timeout_bitmap[31-3]|Reserved|
- To set Rejoin parameters, user should configure the following macros in rsi_wlan_config.h <br />  
  |Macro|Description|  
  |---|---|  
  |RSI_REJOIN_PARAMS_SUPPORT|Enable to send rejoin parameters command during Wi-Fi client connection <br />|  
  |RSI_REJOIN_MAX_RETRY|Number of maximum rejoin retries by module<br />|  
  |note|If Max retries is 0 , retries infinity times <br />|  
  |RSI_REJOIN_SCAN_INTERVAL|Periodicity of rejoin attempt <br />|  
  |RSI_REJOIN_BEACON_MISSED_COUNT|Number of consecutive beacon misses after which modules goes to unconnected state <br />|  
  |RSI_REJOIN_FIRST_TIME_RETRY|ENABLE - Try to rejoin in the first attempt after join failure. <br />|  
  DISABLE - Try to rejoin based on maximum rejoin retries configured. <br />
- When RSI_REJOIN_PARAMS_SUPPORT is enabled in the rsi_wlan_config.h, the rejoin frame will be sent to the firmware after the scan is done.
- Rejoin scan interval is in seconds.
- Default beacon missed count is 40, A unicast probe request will be sent from the midpoint of the given beacon missed count. <br />
- For example, <br />  
   If the beacon count is 40, the unicast probe request will be sent from the module to the AP at the midpoint, which is the 21st beacon. This will also occur at the 31st beacon count.
- Recommended to enable RSI_REJOIN_FIRST_TIME_RETRY to minimize join failures, especially in scenarios such as abnormal connection termination caused by a module reset.
- This API internally handles following commands based on wlan_cb state and sends the next command and finally sends the join command. <br />  
   Set MAC address, Band, Timeout, Init, Set region, WMM parameters, Scan, EAP config, WMM PS parameters, WPS method, Set WEP keys, Host PSK, Rejoin params, Join <br />
- For example, <br />  
   after calling [rsi_wireless_init()](common#rsi-wireless-init), wlan_cb state is updated to OPERMODE_DONE state. So when we call this API, it will execute band, init, scan and join commands. <br />
- For example, <br />  
   after calling [rsi_wlan_disconnect()](wlan#rsi-wlan-disconnect) or else after rejoin failure, wlan_cb state is updated to BAND_DONE state. So when we call this API, it will execute init, scan and join commands. <br />
- For example, <br />  
   after calling [rsi_wlan_scan()](wlan#rsi-wlan-scan)/ [rsi_wlan_scan_with_bitmap_options()](wlan#rsi-wlan-scan-with-bitmap-options) API, wlan_cb state is updated to SCAN_DONE state. So when we call this API, it will execute join command directly. <br />
- To avoid IOP issues and connection failures, it is recommended to disable power save before Wi-Fi connection. <br />

###### EAP configuration (heading level 8)

For EAP configuration below arguments are required and are congifured in rsi_wlan_config.h in enterprise_client applicaiton. <br />
 • eap_method, inner_method, user_identity, password, okc, private_key_password <br />
 • eap_method is 32 bytes and it can be any one of the following methods: TLS, TTLS, FAST, PEAP or LEAP, should be given as string in RSI_EAP_METHOD. <br />– PEAP can accept any of the following three values: <br />–`PEAP` – The EAP server may bypass Phase2 authentication (less secure). <br />–`PEAPSAFE1` – If a client certificate (private_key/client_cert) is not used and TLS session resumption is not used, then Phase2 authentication is mandatory. <br />–`PEAPSAFE2` – Requires Phase2 authentication in all cases (most secure). <br />
 • inner_method is 32 bytes, this field is valid only in TTLS/PEAP. In case of TTLS/PEAP supported inner methods are MSCHAP/MSCHAPV2. In case of TLS/FAST/LEAP this field is not valid and it should be fixed to MSCHAPV2. Here MSCHAP/MSCHAPV2 are given in RSI_EAP_INNER_METHOD. <br />
 • user_identity is 64 bytes, this can be configured in USER_IDENTITY of rsi_eap_connectivity.c of enterprise_client application and this should be a string. <br />
 • password is 128 bytes, this can be configured in PASSWORD of rsi_eap_connectivity.c of enterprise_client application and this should be a string. <br />
 • okc is 4 bytes, This argument is used to enable or disable or select multiple features from user this value can be modified by OKC_VALUE macro. <br />

- BIT[0] of OKC is used to enable or disable opportunistic key caching (OKC), <br />–`0` – disable <br />–`1` – enable <br />– When this is enabled, module will use cached PMKID to get MSK(Master Session Key) which is need for generating PMK which is needed for 4-way handshake. <br />
- BIT[1] of OKC is used to enable or disable CA certification for PEAP connection. <br />–`0` – CA certificate is not required. <br />–`1` – CA certificate is required. <br />
- BIT[2-14] of OKC argument are used for Cipher list selection for EAP connection. All possible ciphers are listed below <br />  
  |BIT position|Cipher selected|  
  |---|---|  
  |2|DHE-RSA-AES256-SHA256|  
  |3|DHE-RSA-AES128-SHA256|  
  |4|DHE-RSA-AES256-SHA|  
  |5|DHE-RSA-AES128-SHA|  
  |6|AES256-SHA256|  
  |7|AES128-SHA256|  
  |8|AES256-SHA|  
  |9|AES128-SHA|  
  |10|RC4-SHA|  
  |11|DES-CBC3-SHA|  
  |12|RC4-MD5|  
  |13|ECDHE-RSA-AES256-SHA|  
  |14|ECDHE-RSA-AES128-SHA|
- BIT[15-31] of OKC argument is reserved. <br />
- When user sets BIT[1] and does not provide the CA certificate for PEAP connection then error is thrown. If user provides invalid CA certificate then also error is thrown. User can set either one or multiple bits from BIT[2-14] to provide the cipher's list. When user does not provide any value in OKC's BIT[2-14] then by default all the ciphers are selected. <br />  
   • private_key_password is 82 bytes,This is password for encrypted private key given to the module. Module will use this password during decryption of encrypted private key. password length must be 80 bytes or less. Should be configured in RSI_PRIVATE_KEY_PASSWORD. <br />

**Returns**

- **Success** - RSI_SUCCESS <br />**Failure** - Non-Zero Value <br />  
  ```c  
      `if return value is less than zero :\n  
    
  ```  
  **RSI_ERROR_INVALID_PARAM** - Invalid parameters <br />**RSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE** - Command given in wrong state <br />**RSI_ERROR_PKT_ALLOCATION_FAILURE** - Buffer not available to serve the command <br />  
   `Other expected error code are : <br />**0x0002,0x0003,0x0005,0x0008,0x0009,0x000A,0x000E,0x0014,**<br />**0x0015,0x0016,0x0019,0x001A,0x001E,0x0020,0x0021,0x0024,**<br />**0x0025,0x0026,0x0028,0x0039,0x003C,0x0044,0x0045,0x0046,**<br />**0x0047,0x0048,0x0049,0xFFF8**

**Note**

- WPA3 STA supports both H2E and Hunting-and-pecking for WPA3 authentication. It picks authentication algorithm based on AP's capability. <br />  
   WPA3 STA supports PMKSA caching. If STA has valid PMKID (generated after first connection) with an AP it will trigger OPEN authentication for successive connection attempts. By default the lifetime for PMKSA entry is 12 hours. <br />  
   In WPA3 Personal Transition Mode if both WPA2 and WPA3 APs are available in scan results, STA will pick the AP which has strongest RSSI (it could be either WPA2 or WPA3). <br />  
   If connected WPA3 AP enables Transition Disable Indication, from that moment onwards STA in transistion mode will not try connections to WPA2 APs. This behavior will persist until reset of the STA. <br />
- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wait_on_wlan_semaphore](driver13#rsi-wait-on-wlan-semaphore), [rsi_wlan_connect_async](wlan#rsi-wlan-connect-async), [rsi_wlan_execute_post_connect_cmds](wlan#rsi-wlan-execute-post-connect-cmds), [rsi_wlan_get_status](wlan#rsi-wlan-get-status), [SL_PRINTF](bt-classic1#sl-printf), [wpa_scan_res::ssid](wpa-scan-res#ssid) and [rsi_driver_cb_non_rom::wlan_cmd_sem](rsi-driver-cb-non-rom#wlan-cmd-sem)

###### rsi_wlan_set_non_pref_chan

`int rsi_wlan_set_non_pref_chan(char *non_pref_chan)`

**Description:** Configure the non-preferred channels. This list is not related to the channels used for Wi-Fi scanning. Instead, it is used to inform the serving or candidate AP about the channels in which the STA does not want to operate or prefers not to operate. The AP uses this information when requesting a BSS transition for that specific STA.<br />
 This API should be called after rsi_wlan_scan API once it has returned Success.This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|char *|[in]|non_pref_chan|- This parameter is a list of channels that indicates the operating preference of a Wi-Fi Agile Multiband Station (STA) to a Wi-Fi Agile Multiband Access Point (AP).<br /><br/> This list is space-delimited and each channel is represented by a colon-delimited set of values.<br /><br/> Format : non_pref_chan=<oper_class>:<chan>:<preference>:<reason><br /><br/> Example : non_pref_chan="81:5:1:2 81:1:0:2 81:9:0:2"|

- [rsi_wlan_scan()](wlan#rsi-wlan-scan) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_connect_async

`int32_t rsi_wlan_connect_async(int8_t *ssid, rsi_security_mode_t sec_type, void *secret_key, void(*join_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))`

**Description:** Connect to the specified Wi-Fi network.A join response handler is registered to get the response for join.. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>ssid</td>
      <td>- SSID of an access point to connect. SSID should be less than or equal to 32 bytes.</td>
    </tr>
    <tr>
      <td>rsi_security_mode_t</td>
      <td>[in]</td>
      <td>sec_type</td>
      <td>- Security type of the access point to connect. <br />

|Value|Security Type|
|---|---|
|0|RSI_OPEN|
|1|RSI_WPA|
|2|RSI_WPA2|
|3|RSI_WEP|
|4|RSI_WPA_EAP|
|5|RSI_WPA2_EAP|
|6|RSI_WPA_WPA2_MIXED|
|7|RSI_WPA_PMK|
|8|RSI_WPA2_PMK|
|9|RSI_WPS_PIN|
|10|RSI_USE_GENERATED_WPSPIN|
|11|RSI_WPS_PUSH_BUTTON|
|12|RSI_WPA_WPA2_MIXED_PMK|
|13|RSI_WPA3|</td>
    </tr>
    <tr>
      <td>void *</td>
      <td>[in]</td>
      <td>secret_key</td>
      <td>- Pointer to a buffer that contains security information based on sec_type. <br />

|Security type(sec_type)|Secret key structure format (secret_key)|
|---|---|
|RSI_OPEN|No secret key in open security mode.|
|RSI_WPA|PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.|
|RSI_WPA2|PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.|
|RSI_WEP|WEP keys should be in the following format:|

^ typedef struct [rsi_wep_keys_s](rsi-wep-keys-s) ^ { ^ uint8_t index[2]; ^ uint8_t key[4][32]; ^ } rsi_wep_keys_t; ^ index: WEP key index to use for TX packet encryption. ^ key: 4 WEP keys, last three WEP keys are optional. If only first WEP key is valid then index should be 0. RSI_WPA_EAP | Enterprise credentials should be in the following format: ^ typedef struct [rsi_eap_credentials_s](rsi-eap-credentials-s) ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for the given username RSI_WPA2_EAP | Enterprise credentials should be in the following format: ^ typedef struct [rsi_eap_credentials_s](rsi-eap-credentials-s) ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for a given username. RSI_WPA_WPA2_MIXED | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes RSI_WPA_PMK | PMK string, should be 32 bytes in length RSI_WPA2_PMK | PMK string, should be 32 bytes in length RSI_WPS_PIN | 8-byte WPS PIN RSI_USE_GENERATED_WPSPIN| NULL string indicate to use PIN generated using rsi_wps_generate_pin API RSI_WPS_PUSH_BUTTON | NULL string indicate to generate push button event RSI_WPA3 | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.</td>
    </tr>
    <tr>
      <td>void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length)</td>
      <td>[in]</td>
      <td>join_response_handler</td>
      <td>- Called when the response for join has been received from the module. <br />
 Parameters involved are status, buffer, & length <br /></td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>Status</td>
      <td>- Response status.</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>Buffer</td>
      <td>- Response buffer. On successful execution of the command. <br />
 GO_Status (1 byte, hex): 0x47 (ASCII "G") - If the module becomes a Group Owner (GO) after the GO negotiation stage or becomes an Access Point. <br />
 0x43 (ASCII "C") - If the module does not become a GO after the GO negotiation stage or becomes a client (or station).</td>
    </tr>
    <tr>
      <td></td>
      <td>[out]</td>
      <td>length</td>
      <td>- Length of the response buffer.</td>
    </tr>
  </tbody>
</table>

- [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- The module gets a default IP of 192.168.100.76, if it becomes a Group Owner or Access Point in case of IPv4 and gets a default IP of 2001:db8:0:1:0:0:0:120 in case of IPv6.
- To set various timeouts, user should change the following macros in rsi_wlan_config.h <br />  
   #define RSI_TIMEOUT_SUPPORT RSI_ENABLE. <br />  
   #define RSI_TIMEOUT_BIT_MAP 4. <br />  
   #define RSI_TIMEOUT_VALUE 300. <br />  
  |timeout_bitmap|Description|  
  |---|---|  
  |timeout_bitmap[0]|Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).|  
  |timeout_bitmap[1]|Sets each channel active scan time in ms (default 100ms)|  
  |timeout_bitmap[2]|Used for WLAN keep alive timeout(default value is 30s)|  
  |timeout_bitmap[31-3]|Reserved|
- To set Rejoin parameters, user should configure the following macros in rsi_wlan_config.h <br />  
  |Macro|Description|  
  |---|---|  
  |RSI_REJOIN_PARAMS_SUPPORT|Enable to send rejoin parameters command during Wi-Fi client connection <br />|  
  |RSI_REJOIN_MAX_RETRY|Number of maximum rejoin retries by module<br />|  
  |note|If Max retries is 0 , retries infinity times <br />|  
  |RSI_REJOIN_SCAN_INTERVAL|Periodicity of rejoin attempt <br />|  
  |RSI_REJOIN_BEACON_MISSED_COUNT|Number of consecutive beacon misses after which modules goes to unconnected state <br />|  
  |RSI_REJOIN_FIRST_TIME_RETRY|ENABLE - Try to rejoin in the first attempt after join failure. <br />|  
  DISABLE - Try to rejoin based on maximum rejoin retries configured. <br />
- When RSI_REJOIN_PARAMS_SUPPORT is enabled in the rsi_wlan_config.h, the rejoin frame will be sent to the firmware after the scan is done.
- This API internally handles following commands based on wlan_cb state and sends the next command and finally sends the join command. <br />  
   Set MAC address, Band, Timeout, Init, Set region, WMM parameters, Scan, EAP config, WMM PS parameters, WPS method, Set WEP keys, Host PSK, Rejoin params, Join <br />
- For example, <br />  
   after calling [rsi_wireless_init()](common#rsi-wireless-init), wlan_cb state is updated to OPERMODE_DONE state. So when we call this API, it will execute band, init, scan and join commands. <br />
- For example, <br />  
   after calling [rsi_wlan_disconnect()](wlan#rsi-wlan-disconnect) or else after rejoin failure, wlan_cb state is updated to BAND_DONE state. So when we call this API, it will execute init, scan and join commands. <br />
- For example, <br />  
   after calling [rsi_wlan_scan()](wlan#rsi-wlan-scan)/ [rsi_wlan_scan_with_bitmap_options()](wlan#rsi-wlan-scan-with-bitmap-options) API, wlan_cb state is updated to SCAN_DONE state. So when we call this API, it will execute join command directly.

**References:** [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::sta_state](rsi-wlan-cb-s#sta-state), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_connect](wlan#rsi-wlan-connect)

###### rsi_wlan_bgscan_profile

`int32_t rsi_wlan_bgscan_profile(uint8_t cmd, rsi_rsp_scan_t *result, uint32_t length)`

**Description:** Enable background scan and get the results or disable background scan. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|cmd|- Command given by user, to enable or disable bgscan. <br /><br/> 0 - disable bgscan, <br /><br/> 1 - enable bgscan|
|[rsi_rsp_scan_t](rsi-rsp-scan-s) *|[out]|result|- buffer to store bgscan results|
|uint32_t|[in]|length|- Length of bgscan result buffer|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_wlan_connect()](wlan#rsi-wlan-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_execute_post_connect_cmds

`int32_t rsi_wlan_execute_post_connect_cmds(void)`

**Description:** Enable scan and roaming after connecting the module to the access point. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026) <br />

**Note**

- **Precondition** - [rsi_wlan_connect()](wlan#rsi-wlan-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_connect](wlan#rsi-wlan-connect)

###### rsi_wlan_wps_push_button_event

`int32_t rsi_wlan_wps_push_button_event(int8_t *ssid)`

**Description:** Start the WPS Push button in AP mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|ssid|- SSID of the Access Point. SSID should be same as that of given in AP start API. Length of the SSID should be less than or equal to 32 bytes.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffc,0x0021) <br />

**Note**

- **Precondition** - [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_send_freq_offset

`int32_t rsi_send_freq_offset(int32_t freq_offset_in_khz)`

**Description:** Application to provide feedback of frequency error in KHz. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|freq_offset_in_khz|- Frequency deviation observed in KHz|

**Returns**

- 0 - Success <br /><br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_calib_write

`int32_t rsi_calib_write(uint8_t target, uint32_t flags, int8_t gain_offset_low, int8_t gain_offset_mid, int8_t gain_offset_high, uint8_t xo_ctune)`

**Description:** RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>target</td>
      <td>- 0 - BURN_INTO_EFUSE (Burns calibration data to EFuse) <br />
 1 - BURN_INTO_FLASH (Burns calibration data to Flash) <br /></td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Validate information <br />

|Bit|MACRO|Description|
|---|---|---|
|0|RESERVED_0|Reserved|
|1|BURN_FREQ_OFFSET|1 - Update XO Ctune to calibration data <br /><br/> 0 - Skip XO Ctune update|
|2|SW_XO_CTUNE_VALID|1 - Use XO Ctune provided as argument to update calibration data <br /><br/> 0 - Use XO Ctune value as read from hardware register|
|3|BURN_XO_FAST_DISABLE|Used to apply patch for cold temperature issue(host interface detection) observed on CC0/CC1 modules. appendix|
|4|BURN_GAIN_OFFSET_LOW|1 - Update gain offset for low sub-band (2 GHz) <br /><br/> 0 - Skip low sub-band gain-offset update|
|5|BURN_GAIN_OFFSET_MID|1 - Update gain offset for mid sub-band (2 GHz) <br /><br/> 0 - Skip mid sub-band gain-offset update|
|6|BURN_GAIN_OFFSET_HIGH|1 - Update gain offset for high sub-band (2 GHz) <br /><br/> 0 - Skip high sub-band gain-offset update|
|8|ENABLE_DPD_CALIB|1 - Collect dpd coefficients data <br /><br/> 0 - Skip dpd coefficients calibration|
|9|BURN_DPD_COEFFICIENTS|1 - Burn dpd coefficients data <br /><br/> 0 - Skip dpd coefficients calibration|
|31-4||Reserved|</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>gain_offset_low</td>
      <td>- gain_offset as observed in dBm in channel-1</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>gain_offset_mid</td>
      <td>- gain_offset as observed in dBm in channel-6</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>gain_offset_high</td>
      <td>- gain_offset as observed in dBm in channel-11</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>xo_ctune</td>
      <td>- Allow user to directly update xo_ctune value to calibration data bypassing the freq offset loop, valid only when BURN_FREQ_OFFSET & SW_XO_CTUNE_VALID of flags is set. The range of xo_ctune is [0, 255], and the typical value is 80. <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- The gain offset values present in the NVM will be incremented by the values sent from the host.
- **Precondition** - [rsi_transmit_test_start()](wlan#rsi-transmit-test-start), [rsi_send_freq_offset()](wlan#rsi-send-freq-offset) API needs to be called before this API. This API is relevant in PER mode only.
- For RS9116 Rev 1.5, the user needs to calibrate gain-offset for low sub-band (channel-1), mid sub-band (channel-6), and high sub-band (channel-11) and input the three gain-offsets to this API and set the corresponding flags to validate it. However, for RS9116 Rev 1.4, the user needs to calibrate gain-offset for low sub-band (channel-1) only and input the three gain-offsets to this API with dummy values for mid and high gain offsets and set the flag for low gain offset only to validate it. <br />
- Recalibration is not possible if EFuse is being used instead of flash as calibration data storage

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_calib_read

`int32_t rsi_calib_read(uint8_t target, rsi_calib_read_t *calib_data)`

**Description:** RF calibration process. This API reads the calibration data from the Flash/EFuse storage. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|target|<br /><br/> 0 - READ_FROM_EFUSE (read calibration data from the EFuse) <br /><br/> 1 - READ_FROM_FLASH (read calibration data from the Flash) <br />|
|[rsi_calib_read_t](rsi-calib-read-s) *|[out]|calib_data|- gain_offset in dBm that will be applied for transmissions in channel-1.|
||[out]|gain_offset_mid|- gain_offset in dBm that will be applied for transmissions in channel-6.|
||[out]|gain_offset_high|-gain_offset in dBm that will be applied for transmissions in channel-11.|
||[out]|xo_ctune|- xo_ctune value as read from the target memory.|

- [rsi_wireless_init()](common#rsi-wireless-init) needs to be called prior this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_calibrate_dpd

`int32_t rsi_calibrate_dpd(uint8_t dpd_power_inx)`

**Description:** RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|dpd_power_inx|<br />|

- [rsi_transmit_test_start()](wlan#rsi-transmit-test-start), API needs to be called before this API.This API is relevant in PER mode only.

**Note**

- RSI_WLAN_REQ_GET_DPD_DATA is not supported.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_parse

`int16_t rsi_parse(void *address, uint16_t length, uint8_t *value)`

**Description:** Parse and convert the given value in ASCII to the datatype of a given length.. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void *|[in]|address|- Address|
|uint16_t|[in]|length|- Length|
|uint8_t *|[in]|value|- Value|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_atoi](driver12#rsi-atoi)

###### rsi_wlan_wps_generate_pin

`int32_t rsi_wlan_wps_generate_pin(uint8_t *wps_pin, uint16_t length)`

**Description:** Generate WPS pin. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[out]|wps_pin|- 8-byte WPS pin generated by the device.|
|uint16_t|[in]|length|- This is the length of the resulted buffer measured in bytes to hold WPS pin.|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffc,0x0021,0x002C,0x0025,0x0037,0x0038) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_wps_enter_pin

`int32_t rsi_wlan_wps_enter_pin(int8_t *wps_pin)`

**Description:** Validate WPS pin entered. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|wps_pin|- 8-byte valid wps pin|
||[out]|Same|WPS pin if command is successful|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_beacon_stop

`int32_t rsi_wlan_beacon_stop(uint8_t beacon_stop)`

**Description:** Configure whether the module in AP mode transmits beacons or not when no station is connected. <br />
 The AP will beacon regardless of this configuration when stations are connected. This is a blocking API. <br />
.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|beacon_stop|- 1 - Do not beacon when there are no clients; 0 - Always transmit beacons.|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_get_random_bytes

`int32_t rsi_get_random_bytes(uint8_t *result, uint32_t length)`

**Description:** Get random bytes from the device. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|result|- Pointer to the buffer in which random data are copied from.|
|uint32_t|[in]|length|- Length of the random data required|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_ap_stop

`int32_t rsi_wlan_ap_stop(void)`

**Description:** Disconnect the module from the connected access point. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**Note**

- **Precondition** - [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026)<br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::ap_state](rsi-wlan-cb-s#ap-state), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_vap_shutdown](network5#rsi-vap-shutdown), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_disconnect

`int32_t rsi_wlan_disconnect(void)`

**Description:** Disconnect the module from the connected access point. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined||

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026)<br />

**Note**

- **Precondition** - [rsi_wlan_connect()](wlan#rsi-wlan-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_disconnect_stations

`int32_t rsi_wlan_disconnect_stations(uint8_t *mac_address)`

**Description:** Disconnect a connected station from the module in AP mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|mac_address|- Mac address (6 bytes) of the station to be disconnected.|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffc,0x0013,0x0021,0x002C,0x0015)<br />

**Note**

- **Precondition** - [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_config_ipaddress

`int32_t rsi_config_ipaddress(rsi_ip_version_t version, uint8_t mode, uint8_t *ip_addr, uint8_t *mask, uint8_t *gw, uint8_t *ipconfig_rsp, uint16_t length, uint8_t vap_id)`

**Description:** Configure the IP address to the module. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>rsi_ip_version_t</td>
      <td>[in]</td>
      <td>version</td>
      <td>- IP version to be used. RSI_IP_VERSION_4 (4) – to select IPv4, RSI_IP_VERSION_6 (6) – to select IPv6</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>mode</td>
      <td>- 1 - DHCP mode ; 0 - static mode</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ip_addr</td>
      <td>- Pointer to IP address 

|IPv6 Address Description|Indices in the ip_addr|
|---|---|
|Prefix Length|ip_addr[0]|
|Link Local Address (128 bits)|ip_addr[1] to ip_addr[4]|
|Global Address (128 bits)|ip_addr[5] to ip_addr[8]|
|Gateway Address (128 bits)|ip_addr[9] to ip_addr[12]|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>mask</td>
      <td>- Pointer to network mask</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>gw</td>
      <td>- Pointer to gateway address</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>ipconfig_rsp</td>
      <td>- Hold the IP configuration received using DHCP.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Length of ipconfig_rsp buffer</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>vap_id</td>
      <td>- VAP id to differentiate between AP and station in concurrent mode. 0 – for station, 1 – for Access point</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_wlan_connect()](wlan#rsi-wlan-connect) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_set_certificate_index

`int32_t rsi_wlan_set_certificate_index(uint8_t certificate_type, uint8_t cert_inx, uint8_t *buffer, uint32_t certificate_length)`

**Description:** Write or erase certificate into module. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|certificate_type|- Type of certificate|
|uint8_t|[in]|cert_inx|- Index of certificate|
|uint8_t *|[in]|buffer|- Certificate content|
|uint32_t|[in]|certificate_length|- Certificate length|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0015,0x0021,0x0025,0x0026,0x002C) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API must be called before this API.
- Index-based certificate loading is valid only for storing certificates on to RAM or flash but not both at the same time. <br />
- Enable bit[27] in tcp_ip_feature_bit_map to load SSl certificate into RAM. <br />
- Enable bit[31] in tcp_ip_feature_bit_map and bit[29] in ext_tcp_ip_feature_bit_map to open 3 SSL client sockets. <br />  
   Three SSL client sockets feature is supported only in WLAN mode.
- Enable bit[31] in tcp_ip_feature_bit_map and bit[21] in ext_tcp_ip_feature_bit_map for storing the certificate in index 3. <br />  
   By enabling certificate index 3, Webpage feature is disabled as these are mutually exclusive to each other. <br />  
   Index 3 certificate loading is valid only for storing the certificate on to flash. <br />  
   Certificate index 3 is only used for storing the RSI_SSL_CA_CERTIFICATE certificate type, and this feature is valid only in 9116. <br />  
   Though we can store 4 certificates with this bitmap, the maximum number of SSL sockets is only 3.

**References:** [rsi_cert_info_s::certificate_length](rsi-cert-info-s#certificate-length), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_set_certificate](wlan#rsi-wlan-set-certificate)

###### rsi_wlan_set_certificate

`int32_t rsi_wlan_set_certificate(uint8_t certificate_type, uint8_t *buffer, uint32_t certificate_length)`

**Description:** Load SSL/EAP certificate in the module. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>certificate_type</td>
      <td>- Type of certificate <br />
 These are the certificate types: <br />

|Value|Certificate type|
|---|---|
|1|TLS client certificate <br />|
|2|FAST PAC file <br />|
|3|SSL Client Certificate <br />|
|4|SSL Client Private Key <br />|
|5|SSL CA Certificate <br />|
|6|SSL Server Certificate <br />|
|7|SSL Server Private Key <br />|
|17|EAP Private Key <br />|
|33|EAP Public Key <br />|
|49|EAP CA Certificate <br />|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>buffer</td>
      <td>- Pointer to a buffer which contains the certificate</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>certificate_length</td>
      <td>- Certificate length</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0015,0x0021,0x0025,0x0026,0x002C) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API must be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes. <br />
- For TLS Certificates, the max length is 12280 bytes and for the Private Keys, it is 4088 bytes. <br />  
   Module shares same TLS certificates for all supported SSL sockets. <br />
- For enterprise use case, certificates can be loaded using either of the two methods described below; however, both methods cannot be used at the same time: <br />  
  - User can load a combined certificate, for this user need to generate a combined certificate which contains a combination of 4 certificates <br />    
     in a given fixed order(3 actual and 1 dummy)- one Private Key, one Public Key, one dummy, and one CA certificate. The CA certificate can <br />    
     include a chain of certificates. Make sure each certificate has their respective header and footer of --—BEGIN CERTIFICATE--—<br />    
     and --—END CERTIFICATE--—. The dummy certificate can be a copy of one of the certificates for convenience(but must have header and footer). <br />    
     The dummy certificate is not used for the authentication but is expected by the firmware. <br />    
     The combined certificate can be loaded with CertType as 1. The maximum allowed combined certificate length is 12280 bytes if webpages feature <br />    
     (TCP_IP_FEAT_HTTP_SERVER in tcp_ip_feature_bit_map) is enabled, otherwise it is 20472 bytes. <br /><br />  
  - User can load individual EAP certificates private key, public key, and CA certificates with CertType as 17,33 and 49 respectively. <br />    
     The maximum certificate length for private key and public key is 4088 bytes. The maximum allowed CA certificate length is 4088 bytes if webpages <br />    
     feature (TCP_IP_FEAT_HTTP_SERVER in tcp_ip_feature_bit_map) is enabled, otherwise it is 12280 bytes.
- Prior to implementing either the combined or individual certificate loading method, all certificate storage locations (1, 17, 33, and 49) must be cleared.

**References:** [rsi_cert_info_s::certificate_length](rsi-cert-info-s#certificate-length), [rsi_cert_info_s::certificate_type](rsi-cert-info-s#certificate-type), [rsi_wlan_set_certificate_index](wlan#rsi-wlan-set-certificate-index) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wlan_get_status

`int32_t rsi_wlan_get_status(void)`

**Description:** Check the error code encountered during a call to a WLAN API or BSD sockets functions. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Returns the error code that previously occurred. If no error occurred, returns 0.

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::status](rsi-wlan-cb-s#status) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wireless_init](common#rsi-wireless-init), [rsi_wlan_connect](wlan#rsi-wlan-connect), [rsi_wlan_scan](wlan#rsi-wlan-scan) and [rsi_wlan_scan_with_bitmap_options](wlan#rsi-wlan-scan-with-bitmap-options)

###### rsi_wlan_get

`int32_t rsi_wlan_get(rsi_wlan_query_cmd_t cmd_type, uint8_t *response, uint16_t length)`

**Description:** Get the required information based on the type of command. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>rsi_wlan_query_cmd_t</td>
      <td>[in]</td>
      <td>cmd_type</td>
      <td>- Query command type: <br />

|Value|Command Type|
|---|---|
|1|RSI_FW_VERSION <br />|
|2|RSI_MAC_ADDRESS <br />|
|3|RSI_RSSI <br />|
|4|RSI_WLAN_INFO <br />|
|5|RSI_CONNECTION_STATUS <br />|
|6|RSI_STATIONS_INFO <br />|
|7|RSI_SOCKETS_INFO <br />|
|8|RSI_CFG_GET <br />|
|9|RSI_GET_WLAN_STAT <br />|
|10|RSI_WLAN_EXT_STATS <br />|
|11|RSI_WMM_PARAMS <br />|
|12|RSI_GET_DEVICE_ID <br />|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[out]</td>
      <td>response</td>
      <td>- Response of the requested command. 

|cmd_type|Request Structure|
|---|---|
|RSI_FW_VERSION|uint8_t response[20] <br />|
|RSI_MAC_ADDRESS|uint8_t response[6] <br />|
|RSI_RSSI|uint8_t response[2] <br />|
|RSI_WLAN_INFO|struct [rsi_rsp_wireless_info_s](rsi-rsp-wireless-info-s)<br />|
|RSI_CONNECTION_STATUS|It returns 0x0001 if the WLAN is connected else 0x0000. <br />|
|RSI_STATIONS_INFO|struct [rsi_rsp_stations_info_s](rsi-rsp-stations-info-s)<br />|
|RSI_SOCKETS_INFO|struct [rsi_rsp_sockets_info_s](rsi-rsp-sockets-info-s)<br />|
|RSI_CFG_GET|struct [rsi_cfgGetFrameRcv](rsi-cfg-get-frame-rcv)<br />|
|RSI_GET_WLAN_STAT|struct [rsi_rsp_wlan_stats_s](rsi-rsp-wlan-stats-s)<br />|
|RSI_WLAN_EXT_STATS|struct [rsi_wlan_ext_stats_s](rsi-wlan-ext-stats-s)<br />|
|RSI_WMM_PARAMS|struct [rsi_wmm_ps_parms_s](rsi-wmm-ps-parms-s)<br />|
|RSI_GET_DEVICE_ID|uint8_t response[2] <br /><br/> 0x9116 for 9116 chipsets <br /><br/> 0x917 for 917 chipsets <br />|</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Length of the response buffer in bytes to hold result.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffd,0xfffffffc,0xfffffffa) <br /><br />

**Note**

- **Preconditions** -
- 1. [rsi_wireless_init](common#rsi-wireless-init) () API needs to be called before this API.
- 2. RSI_FW_VERSION, RSI_CONNECTION_STATUS, and RSI_GET_DEVICE_ID commands should be used only after the successful execution of the [rsi_wireless_init()](common#rsi-wireless-init) API. <br />
- 3. RSI_MAC_ADDRESS should be used only after the successful execution of either the [rsi_wlan_scan()](wlan#rsi-wlan-scan) API or the [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API. <br />
- 4. RSI_RSSI, RSI_WLAN_INFO, RSI_GET_WLAN_STAT, and RSI_WMM_PARAMS commands should be used only after establishing a successful WLAN connection. <br />
- The RSI_STATIONS_INFO command type is used to retrieve information about connected WLAN stations in AP mode. <br />  
   It should be used only after a successful WLAN connection. <br />  
   If no stations are connected to the AP, the response will contain zeros. <br />
- The RSI_SOCKETS_INFO command type is used to get information about sockets. <br />  
   The usage depends on the type of socket:  
  - 1. TCP Client: Call this after successfully creating a socket. <br />  
  - 2. TCP Server: Call this after the listen() API. <br />  
  - 3. UDP : Call this after using either the sendto() or bind() API. <br />    
     If no sockets are created, the response will also contain zeros. <br />
- RSI_CFG_GET should be called after successful WLAN connection. <br />  
   Once the CFG parameters are saved in flash memory of module we can give RSI_CFG_GET after wireless_init() API. <br />  
   It will print previously stored configurations. <br />
- RSI_GET_WLAN_STATS gives info on Operating Mode (STA, AP, Concurrent), dtim period, beacon interval. <br />
- RSI_WLAN_EXT_STATS should be used after successful WLAN connection. <br />  
   Gives info on beacon lost count, beacon rx count, Tx and Rx multicast and unicast packets count. <br />
- RSI_STATIONS_INFO is relevant in AP mode <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::app_buffer](rsi-wlan-cb-s#app-buffer), [rsi_wlan_cb_s::app_buffer_length](rsi-wlan-cb-s#app-buffer-length), [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_wlan_cb_s::query_cmd](rsi-wlan-cb-s#query-cmd), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_get_fw_version](common#rsi-get-fw-version), [rsi_init_timer](driver11#rsi-init-timer), [rsi_scheduler](driver15#rsi-scheduler), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_timer_expired](driver11#rsi-timer-expired), [rsi_driver_cb_s::scheduler_cb](rsi-driver-cb-s#scheduler-cb), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_set

`int32_t rsi_wlan_set(rsi_wlan_set_cmd_t cmd_type, uint8_t *request, uint16_t length)`

**Description:** Request configuration based on the command type. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>rsi_wlan_set_cmd_t</td>
      <td>[in]</td>
      <td>cmd_type</td>
      <td>- Set command type: : <br />

|Value|Command Type|
|---|---|
|1|RSI_SET_MAC_ADDRESS <br />|
|2|RSI_MULTICAST_FILTER <br />|
|3|RSI_JOIN_BSSID <br />|
|4|RSI_CFG_SAVE <br />|
|5|RSI_CFG_STORE <br />|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>request</td>
      <td>- Request buffer</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Length of the request buffer in bytes 

|cmd type|Request structure|
|---|---|
|RSI_SET_MAC_ADDRESS|uint8_t mac_address[6]|
|RSI_MULTICAST_FILTER|typedef struct [rsi_req_multicast_filter_info_s](rsi-req-multicast-filter-info-s)|

^ { uint8_t cmd_type; ^ uint8_t mac_address[6]; ^ }rsi_req_multicast_filter_info_t; ^ cmd_type are : <br />
 ^ 1 . RSI_ MULTICAST_MAC_ADD_BIT (To set particular bit in multicast bitmap) ^ 2 . RSI_MULTICAST_MAC_CLEAR_BIT (To reset particular bit in multicast bitmap ^ 3 . RSI_MULTICAST_MAC_CLEAR_ALL (To clear all the bits in multicast bitmap) <br />
 ^ 4 . RSI_MULTICAST_MAC_SET_ALL (To set all the bits in multicast bitmap) <br />
 RSI_JOIN_BSSID | uint8_t join_bssid[6] RSI_CFG_SAVE | This cmd_type is used to save the parameters into non-volatile memory which are used either to join to an Access point (auto-join mode) or to create an Access point(auto-create mode). RSI_CFG_STORE | This cmd_type is used to give the configuration values which are supposed to be stored in the module's non-volatile memory and that are used in auto-join or auto-create modes. ^ User configurations are stored in rsi_user_store_config_t structure. <br /></td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffc,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API. <br />  
   For setting MAC address, call this API immediately after <br />[rsi_wireless_init()](common#rsi-wireless-init) and before calling any other API. <br />[rsi_config_ipaddress()](wlan#rsi-config-ipaddress) needs to be call for RSI_CFG_SAVE and RSI_CFG_STORE.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_wlan_cb_s::mac_address](rsi-wlan-cb-s#mac-address), [memcpy](bt-classic1#memcpy), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_common_cb_s::state](rsi-common-cb-s#state), [UNUSED_PARAMETER](bt-classic1#unused-parameter) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_buffer_config

`int32_t rsi_wlan_buffer_config(void)`

**Description:** Configure the TX and RX global buffers ratio. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|- Configure the dynamic tx ratio|
||[in]|dynamic_rx_pool|- Configure the dynamic rx ratio|
||[in]|dynamic_global_pool|- Configure the dynamic global ratio|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0021) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_ap_start

`int32_t rsi_wlan_ap_start(int8_t *ssid, uint8_t channel, rsi_security_mode_t security_type, rsi_encryption_mode_t encryption_mode, uint8_t *password, uint16_t beacon_interval, uint8_t dtim_period)`

**Description:** Start the module in access point mode with the given configuration. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int8_t *</td>
      <td>[in]</td>
      <td>ssid</td>
      <td>- SSID of the access point. Length of the SSID should be less than or equal to 32 bytes.</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>channel</td>
      <td>- Channel number. Refer the following channels for the valid channel numbers supported: <br />
 2.4GHz Band Channel Mapping, 5GHz Band Channel Mapping <br />
 Channel number 0 is to enable ACS feature. <br />
The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum. 

|Channel numbers (2.4GHz)|Center frequencies for 20MHz channel width|
|---|---|
|1|2412|
|2|2417|
|3|2422|
|4|2427|
|5|2432|
|6|2437|
|7|2442|
|8|2447|
|9|2452|
|10|2457|
|11|2462|
|12|2467|
|13|2472|
|14|2484|

The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum. 

|Channel Numbers(5GHz)|Center frequencies for 20MHz channel width|
|---|---|
|36|5180|
|40|5200|
|44|5220|
|48|5240|
|144|5700|
|149|5745|
|153|5765|
|157|5785|
|161|5805|
|165|5825|</td>
    </tr>
    <tr>
      <td>rsi_security_mode_t</td>
      <td>[in]</td>
      <td>security_type</td>
      <td>- Type of the security modes on which an access point needs to be operated: <br />

|Value|Security type|
|---|---|
|0|RSI_OPEN <br />|
|1|RSI_WPA <br />|
|2|RSI_WPA2 <br />|
|6|RSI_WPA_WPA2_MIXED <br />|
|13|RSI_WPA3_PERSONAL <br />|
|14|RSI_WPA3_PERSONAL_TRANSITION|</td>
    </tr>
    <tr>
      <td>rsi_encryption_mode_t</td>
      <td>[in]</td>
      <td>encryption_mode</td>
      <td>- Type of the encryption mode:<br />

|Value|Encryption mode|
|---|---|
|0|RSI_NONE <br />|
|1|RSI_TKIP <br />|
|2|RSI_CCMP|</td>
    </tr>
    <tr>
      <td>uint8_t *</td>
      <td>[in]</td>
      <td>password</td>
      <td>- PSK to be used in security mode. <br />
 Minimum and maximum length of PSK is 8 bytes and 63 bytes respectively</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>beacon_interval</td>
      <td>- Beacon interval in ms. Allowed values are integers from 100 to 1000 which are multiples of 100.</td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>dtim_period</td>
      <td>- DTIM period. Allowed values are integers between 1 and 255.</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- The module gets a default IP of 192.168.100.76 if it becomes Access Point in case of IPv4. and gets a default IP of 2001:db8:0:1:0:0:0:120 in case of IPv6. If user wants to override the default IP configurations for the AP then [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) should be called before this API. <br />
- DFS channels are not supported in AP mode.
- For AP mode with WPA3 security, only SAE-H2E method is supported. SAE Hunting-and-Pecking method is not supported.
- In WPA3(Personal or Personal transition) security mode, TKIP encryption mode is not supported. Encryption mode is automatically configured to RSI_CCMP.
- Transition Disable Indication(TDI) is supported in WPA3 (Personal or Personal Transition) security in AP mode. In order to enable TDI, bit 4 of encryption_mode should be set.
- In AP mode, the behavior of RS9116 modules is as follows,  
  - The device region for modules parts cannot be manually configured by the user. It automatically updates to align with the region of the connected AP.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::field_valid_bit_map](rsi-wlan-cb-s#field-valid-bit-map), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_power_save_with_listen_interval

`int32_t rsi_wlan_power_save_with_listen_interval(uint8_t psp_mode, uint8_t psp_type, uint16_t listen_interval)`

**Description:** Set the power save profile in WLAN mode with listen interval-based wakeup. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>psp_mode</td>
      <td>- PSP modes available are mentioned below 

|Parameter|Description|
|---|---|
|Active(0)|In this mode, module is active and power save is disabled. <br />|
|RSI_SLEEP_MODE_1 (1)|Connected sleep mode. <br />|

^ In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module. <br />
 RSI_SLEEP_MODE_2 (2) | In this sleep mode, SoC will go to LP/ULP (with/without RAM RETENTION) sleep based on the selected value set for RSI_SELECT_LP_OR_ULP_MODE in rsi_wlan_config.h. <br />
 ^ Therefore handshake is required before sending data to the module. <br />
 RSI_SLEEP_MODE_8 (8) | Deep sleep mode with ULP RAM RETENTION. In deep sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module. <br />
 RSI_SLEEP_MODE_10 (10) | Deep sleep mode without ULP RAM RETENTION. <br /><br /></td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>psp_type</td>
      <td>- PSP types available are mentioned below 

|Parameter|Description|
|---|---|
|RSI_MAX_PSP (0)|This psp_type will be used for max power saving. <br />|
|RSI_FAST_PSP (1)|This psp_type allows module to disable power save for any Tx / Rx packet for monitor interval of time <br />|

^ (monitor interval can be set by RSI_MONITOR_INTERVAL in rsi_wlan_config.h file, default value is 50 ms). <br />
 ^ If there is no data for monitor interval of time then module will again enable power save. <br />
 RSI_UAPSD (2) | This psp_type is used to enable WMM power save.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>listen_interval</td>
      <td>- Used to configure sleep duration in power save and should be less than the listen interval configured by RSI_LISTEN_INTERVAL Macro in join command parameters in rsi_wlan_config.h file. <br />
 Valid only if BIT (7) in join_feature_bit_map is set. This value is given in time units (1024 microsecond). <br /></td>
    </tr>
  </tbody>
</table>

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) (is mandatory for power mode RSI_SLEEP_MODE_8 and RSI_SLEEP_MODE_10) APIs needs to be called in the same order as mentioned before this API. <br />
- RSI_SLEEP_MODE_2 can be used after calling the rsi_radio_init() or [rsi_wlan_connect()](wlan#rsi-wlan-connect) API. If you use it before [rsi_wlan_connect()](wlan#rsi-wlan-connect), be sure to disable power save mode by switching to RSI_ACTIVE to prevent interop protocol issues. However, it's recommended to enable RSI_SLEEP_MODE_2 after calling [rsi_wlan_connect()](wlan#rsi-wlan-connect) to avoid potential problems. <br />
- psp_type is only valid in psp_mode 1 and 2. <br />
- psp_type: RSI_UAPSD is applicable only, if WMM_PS is enabled in rsi_wlan_config.h file. <br />
- In RSI_MAX_PSP mode, Few access points will not aggregate the packets, when power save is enabled from STA. This may cause the drop in throughputs.
- For the power save mode 3, select RSI_SLEEP_MODE_2 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file. <br />
- For the power save mode 9, select RSI_SLEEP_MODE_8 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file. <br />
- For the deep sleep without ram retention case, select RSI_SLEEP_MODE_10 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED for msg_based or GPIO_BASED for gpio_based. <br />
- For LP sleep, select RSI_SLEEP_MODE_2 in psp_mode, select RSI_SELECT_LP_OR_ULP_MODE as RSI_LP_MODE and RSI_HAND_SHAKE_TYPE as MSG_BASED/GPIO_BASED in rsi_wlan_config.h file. <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_driver_cb_s::common_cb](rsi-driver-cb-s#common-cb), [rsi_common_cb_s::power_save](rsi-common-cb-s#power-save), [rsi_wlan_cb_non_rom_s::ps_listen_interval](rsi-wlan-cb-non-rom-s#ps-listen-interval), [rsi_sleep_mode_decision](driver5#rsi-sleep-mode-decision), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_power_save_s::wlan_psp_mode](rsi-power-save-s#wlan-psp-mode) and [rsi_power_save_s::wlan_psp_type](rsi-power-save-s#wlan-psp-type)

**Referenced by:** [rsi_wlan_power_save_profile](wlan#rsi-wlan-power-save-profile)

###### rsi_wlan_power_save_profile

`int32_t rsi_wlan_power_save_profile(uint8_t psp_mode, uint8_t psp_type)`

**Description:** Set the power save profile in WLAN mode. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>psp_mode</td>
      <td>- PSP modes available are mentioned below 

|Parameter|Description|
|---|---|
|Active(0)|In this mode, module is active and power save is disabled. <br />|
|RSI_SLEEP_MODE_1 (1)|Connected sleep mode. <br />|

^ In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module. <br />
 RSI_SLEEP_MODE_2 (2) | In this sleep mode, SoC will go to LP/ULP (with/without RAM RETENTION) sleep based on the selected value set for RSI_SELECT_LP_OR_ULP_MODE in rsi_wlan_config.h. <br />
 ^ Therefore handshake is required before sending data to the module. <br />
 RSI_SLEEP_MODE_8 (8) | Deep sleep mode with ULP RAM RETENTION. In deep sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module. <br />
 RSI_SLEEP_MODE_10 (10) | Deep sleep mode without ULP RAM RETENTION. <br /><br /></td>
    </tr>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>psp_type</td>
      <td>- PSP types available are mentioned below 

|Parameter|Description|
|---|---|
|RSI_MAX_PSP (0)|This psp_type will be used for max power saving. <br />|
|RSI_FAST_PSP (1)|This psp_type allows module to disable power save for any Tx / Rx packet for monitor interval of time <br />|

^ (monitor interval can be set by RSI_MONITOR_INTERVAL in rsi_wlan_config.h file, default value is 50 ms). <br />
 ^ If there is no data for monitor interval of time then module will again enable power save. <br />
 RSI_UAPSD (2) | This psp_type is used to enable WMM power save.</td>
    </tr>
  </tbody>
</table>

###### Enhanced max psp (heading level 7)

Enhanced max PSP is recommended. This is essentially a RSI_MAX_PSP but switches to RSI_FAST_PSP, if AP does not deliver data within 20ms for PS-Poll. <br />
 To enable this mode, follow this procedure: <br />
 Add ENABLE_ENHANCED_MAX_PSP (BIT[26]) in RSI_CONFIG_FEATURE_BITMAP, <br />
 Set psp_type to RSI_FAST_PSP (1) <br />**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) and [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) (is mandatory for power mode RSI_SLEEP_MODE_8 and RSI_SLEEP_MODE_10) APIs needs to be called in the same order as mentioned before this API. <br />
- RSI_SLEEP_MODE_2 can be used after calling the rsi_radio_init() or [rsi_wlan_connect()](wlan#rsi-wlan-connect) API. If you use it before [rsi_wlan_connect()](wlan#rsi-wlan-connect), be sure to disable power save mode by switching to RSI_ACTIVE to prevent interop protocol issues. However, it's recommended to enable RSI_SLEEP_MODE_2 after calling [rsi_wlan_connect()](wlan#rsi-wlan-connect) to avoid potential problems. <br />
- Configure the monitor interval using the RSI_MONITOR_INTERVAL macro in rsi_wlan_config.h file. (default value is 50 ms) <br />
- psp_type is only valid in psp_mode 1 and 2. <br />
- psp_type - UAPSD is applicable only if WMM_PS is enabled in rsi_wlan_config.h file. <br />
- In RSI_MAX_PSP mode, Few Access points won't aggregate the packets, when power save is enabled from STA. This may cause the drop in throughputs.<br />
- For the power save mode 3, select RSI_SLEEP_MODE_2 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.<br />
- For the power save mode 9, select RSI_SLEEP_MODE_8 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.<br />
- For the deep sleep without ram retention case, select RSI_SLEEP_MODE_10 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED for msg_based or GPIO_BASED for gpio_based.<br />
- For LP sleep, select RSI_SLEEP_MODE_2 in psp_mode, select RSI_SELECT_LP_OR_ULP_MODE as RSI_LP_MODE and RSI_HAND_SHAKE_TYPE as MSG_BASED/GPIO_BASED in rsi_wlan_config.h file.<br />
- Powersave handshake option: <br />  
  - When sleep clock source is configured to '32KHz bypass clock on UULP_VBAT_GPIO_3', <br />    
     use UULP_VBAT_GPIO_0 for SLEEP_IND_FROM_DEV <br />    
     set RS9116_SILICON_CHIP_VER in 'RS9116.NB0.WC.GENR.OSI.X.X.X\host\sapis.h' to 'CHIP_VER_1P4_AND_ABOVE' <br />  
  - If not using external clock on UULP_VBAT_GPIO_3' as sleep clock source, <br />    
     use UULP_VBAT_GPIO_3 for SLEEP_IND_FROM_DEV <br />

###### Power save modes description

- **Power Save Mode 0**<br />  
  - In this mode, module is active and power save is disabled. It can be configured any time, while the module is configured in Power Save mode 2 or 8.<br />
- **Power save Mode 1**<br />  
  - Once the module is configured to power save mode 1, it wakes up periodically based upon the DTIM interval configured in connected AP. <br />    
     In power mode 1, only the RF of the module is in power save while SOC continues to work normally. <br />    
     This command has to be given only when module is in connected state (with the AP). After having configured the module to power save mode, the Host can issue subsequent commands. <br />    
     In power save mode 1 the module can receive data from host at any point of time but it can send/receive the data to/from remote terminal only when it is awake at DTIM intervals. <br />
- **Power Save Mode 2**<br />  
  - Once the module is configured to power save mode 2, it can be woken up either by the Host or periodically during its sleep-wakeup cycle. <br />    
     Power Save mode 2 is GPIO based. <br />    
     In case of GPIO based mode, whenever host wants to send data to module, it gives wakeup request by asserting UULP GPIO #2. <br />    
     After wakeup, if the module is ready for data transfer, it sends wakeup indication to host by asserting UULP GPIO #3 or UULP GPIO #0. <br />    
     Host is required to wait until module gives wakeup indication before sending any data to the module. <br />    
     After the completion of data transfer, host can give sleep permission to module by de-asserting UULP GPIO #2. After recognizing sleep permission from host, <br />    
     module gives confirmation to host by de-asserting UULP GPIO #3 or UULP GPIO #0 and again goes back to its sleep-wakeup cycle. <br />    
     Module can send received packets or responses to host at any instant of time. No handshake is required on Rx path. <br />
- **Power Save mode 3**<br />  
  - Power Mode 3 is message based power save. In Power Mode 3, both radio and SOC of RS9116-WiSeConnect are in power save mode. <br />    
     This mode is significant when module is in associated state with AP. Module wakes up periodically upon every DTIM and gives wakeup message ("WKP") to host. <br />    
     Module can not be woken up asynchronously. Every time module intends to go to sleep it sends a sleep request message ("SLP") to the host and expects host to send the acknowledgement message ("ACK"). <br />    
     Host either send acknowledgement ("ACK") or any other pending message. But once ACK is sent, Host should not send any other message unless next wakeup message from module is received. <br />    
     Module shall not go into complete power-save state, if ACK is not received from host for given sleep message. Module can send received packets or responses to host at any instant of time. <br />    
     No handshake is required on Rx path. <br />
- **Power Save mode 8**<br />  
  - In Power save mode 8, both RF and SOC of the module are in complete power save mode. This mode is significant only when module is in un-connected state. <br />    
     Power Save mode 8 can be GPIO based. <br />    
     In case of GPIO based, host can wakeup the module from power save by asserting UULP GPIO #2. <br />    
     After wakeup, if the module is ready for data transfer, it sends wakeup indication to host by asserting UULP GPIO #3 or UULP GPIO #0. <br />    
     Host is required to wait until module gives wakeup indication before sending any data to the module. <br />    
     After the completion of data transfer, host can give sleep permission to module by de-asserting UULP GPIO #2. After recognizing sleep permission from host, module gives confirmation to host by de-asserting UULP GPIO #3 or UULP GPIO #0 and again goes back to its sleep-wakeup cycle. <br />    
     Module can send received packets or responses to host at any instant of time. No handshake is required on Rx path. <br />
- **Power save mode 9**<br />  
  - In Power Mode 9 both Radio and SOC of RS9116-WiSeConnect are in complete power save mode. This mode is significant when module is not connected with any AP. <br />    
     Once power mode 9 command is given, the module sends ("SLP") request to host and wait for the ("ACK") from host and goes to sleep when ACK is given by host. Timer starts when power save command is issued and it can be configured by host using [rsi_wlan_set_sleep_timer](wlan#rsi-wlan-set-sleep-timer) API. <br />    
     If host does not set any sleep time, then the timer is configured for 3sec by default. Upon wakeup module sends a wakeup message to the host and expects host to give ACK before <br />    
     it goes into next sleep cycle. Host either send ACK or any other messages but once ACK is sent no other packet should be sent before receiving next wakeup message. <br />    
     When ulp_mode_enable is set to '2', after waking up from sleep, the module sends WKP FRM SLEEP message to host when RAM retention is not enabled. <br />    
     After receiving WKP FRM SLEEP message, host needs to start giving commands from beginning as module's state is not retained. <br />**Returns**    
    - 0 - Success <br />      
       Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0xfffffffa,0x0021,0x0025,0x002C,0xFFF8,0x0015,0x0026,0x0052) <br />    
    **Note**    
    - If the user wants to enable power save in CoEx mode (WLAN + BT LE) mode - It is mandatory to enable WLAN power save along with BT power save. <br />    
    - In CoEx mode, the device will enter into power save only if both protocol (WLAN, BLE) power save modes are enabled. <br />    
    - Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_power_save_with_listen_interval](wlan#rsi-wlan-power-save-with-listen-interval) and [SL_PRINTF](bt-classic1#sl-printf)

**Referenced by:** [rsi_device_deinit](common#rsi-device-deinit) and [rsi_wlan_power_save_disable_and_enable](wlan#rsi-wlan-power-save-disable-and-enable)

###### rsi_wlan_power_save_disable_and_enable

`int32_t rsi_wlan_power_save_disable_and_enable(uint8_t psp_mode, uint8_t psp_type)`

**Description:** Disable or enable the power save feature. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|psp_mode|- Power save mode|
|uint8_t|[in]|psp_type|- Power save type|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- If RSI_SLEEP_MODE_10 is chosen as the sleep mode, commands should be recalled from driver_init() as this is without RAM retention. <br />

**References:** [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_power_save_profile](wlan#rsi-wlan-power-save-profile) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_transmit_test_start

`int32_t rsi_transmit_test_start(uint16_t power, uint32_t rate, uint16_t length, uint16_t mode, uint16_t channel)`

**Description:** Start the transmit test. This is a blocking API. <br />
 This API is relevant in PER mode.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>power</td>
      <td>- Set TX power in dbm. The valid values are from 2dBm to 18dBm. <br /></td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>rate</td>
      <td>- Set transmit data rate. <br /></td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Configure length of the TX packet. <br />
 The valid values are in the range of 24 to 1500 bytes in the burst mode and range of 24 to 260 bytes in the continuous mode.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>mode</td>
      <td>- Below mentioned are the available modes 

|Value|Parameter|Description|
|---|---|---|
|0|Burst Mode|DUT transmits a burst of packets with the given power, rate, length in the channel configured.|

^ The burst size will be determined by the <number of packets> and if its zero, then DUT keeps transmitting till a rsi_transmit_test_stop API is called. 1 | Continuous Mode | The DUT transmits a unmodulated waveform continuously 2 | Continuous wave Mode (non modulation) in DC mode | The DUT transmits a spectrum only at the center frequency of the channel. ^ A basic signal with no modulation is that of a sine wave and is usually referred to as a continuous wave (CW) signal. ^ A basic signal source produces sine waves. Ideally, the sine wave is perfect. In the frequency domain, it is viewed as a single line at some specified frequency. 3 | Continuous wave Mode (non modulation) in single tone mode (center frequency -2.5MHz) | The DUT transmits a spectrum that is generated at -2.5MHz from the center frequency of the channel selected. ^ Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2409.5MHz 4 | Continuous wave Mode (non modulation) in single tone mode (center frequency +5MHz) | The DUT transmits a spectrum that is generated at 5MHz from the center frequency of the channel selected. Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2417MHz. <br /></td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>channel</td>
      <td>- Set the channel number in 2.4 GHz / 5GHz.</td>
    </tr>
  </tbody>
</table>

**Note**

- User can configure the maximum power level allowed for the given frequncey in the configured region by providing 127 as power level <br />
- User should configure a minimum delay (approx. 10 milliseconds) before and after [rsi_transmit_test_start](wlan#rsi-transmit-test-start) API to observe a stable output at requested dBm level. <br />

###### Data Rates (heading level 7)

|Data rate(Mbps)|Value of rate|
|---|---|
|1|0|
|2|2 <br />|
|5.5|4 <br />|
|11|6 <br />|
|6|139 <br />|
|9|143 <br />|
|12|138 <br />|
|18|142 <br />|
|24|137 <br />|
|36|141 <br />|
|48|136 <br />|
|54|140 <br />|
|MCS0|256 <br />|
|MCS1|257 <br />|
|MCS2|258 <br />|
|MCS3|259 <br />|
|MCS4|260 <br />|
|MCS5|261 <br />|
|MCS6|262 <br />|
|MCS7|263 <br />|

###### The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum. (heading level 7)

|Channel numbers (2.4GHz)|Center frequencies for 20MHz channel width|
|---|---|
|1|2412|
|2|2417|
|3|2422|
|4|2427|
|5|2432|
|6|2437|
|7|2442|
|8|2447|
|9|2452|
|10|2457|
|11|2462|
|12|2467|
|13|2472|

**Note**

- To start transmit test in 12,13 channels, configure set region parameters in rsi_wlan_config.h <br />

###### The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum for 20MHz channel bandwidth. The channel numbers in 5 GHz range is from 36 to 165. (heading level 7)

|Channel Numbers(5GHz)|Center frequencies for 20MHz channel width|
|---|---|
|36|5180|
|40|5200|
|44|5220|
|48|5240|
|52|5260|
|56|5280|
|60|5300|
|64|5320|
|149|5745|
|153|5765|
|157|5785|
|161|5805|
|165|5825|

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- Rate flags can be added in [rsi_wlan_common_config.h](rsi-wlan-common-config-8h-source#rsi-wlan-common-config-8h-source) file. <br />  
   In rate flags, BIT(6) - Immediate Transfer, set this bit to transfer packets immediately ignoring energy/traffic in channel <br />
- Before starting Continuous Wave mode, user must start Continuous mode with power and channel values that are intended to be used in Continuous Wave mode i.e. <br />  
  - Start Continuous mode with intended power value and channel values - Pass any valid values for rate and length. <br />  
  - Stop Continuous mode <br />  
  - Start Continuous Wave mode <br />
- If user wants to switch continuous wave mode, first need to stop the transmit test and again need to give continous wave mode which user wants to switch.
- In 2.4GHz, to start transmit test in 12,13 channels, configure set region parameters in rsi_wlan_config.h <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa,0x000A, 0x0021, 0x0025, 0x002C) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_radio_init](wlan#rsi-wlan-radio-init), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_transmit_test_start_with_number_pkts](wlan#rsi-transmit-test-start-with-number-pkts)

###### rsi_transmit_test_start_with_number_pkts

`int32_t rsi_transmit_test_start_with_number_pkts(uint16_t power, uint32_t rate, uint16_t length, uint16_t mode, uint16_t channel, uint16_t number_pkts)`

**Description:** Start the transmit test. This is a blocking API. <br />
 This API is relevant in PER mode.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>power</td>
      <td>- Set TX power in dbm. The valid values are from 2dBm to 18dBm. <br /></td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>rate</td>
      <td>- Set transmit data rate. <br /></td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>length</td>
      <td>- Configure length of the TX packet. <br />
 The valid values are in the range of 24 to 1500 bytes in the burst mode and range of 24 to 260 bytes in the continuous mode.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>mode</td>
      <td>- Below mentioned are the available modes 

|Value|Parameter|Description|
|---|---|---|
|0|Burst Mode|DUT transmits a burst of packets with the given power, rate, length in the channel configured.|

^ The burst size will be determined by the <number of packets> and if its zero, then DUT keeps transmitting till a rsi_transmit_test_stop API is called. 1 | Continuous Mode | The DUT transmits a unmodulated waveform continuously 2 | Continuous wave Mode (non modulation) in DC mode | The DUT transmits a spectrum only at the center frequency of the channel. ^ A basic signal with no modulation is that of a sine wave and is usually referred to as a continuous wave (CW) signal. ^ A basic signal source produces sine waves. Ideally, the sine wave is perfect. In the frequency domain, it is viewed as a single line at some specified frequency. 3 | Continuous wave Mode (non modulation) in single tone mode (center frequency -2.5MHz) | The DUT transmits a spectrum that is generated at -2.5MHz from the center frequency of the channel selected. ^ Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2409.5MHz 4 | Continuous wave Mode (non modulation) in single tone mode (center frequency +5MHz) | The DUT transmits a spectrum that is generated at 5MHz from the center frequency of the channel selected. Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2417MHz. <br /></td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>channel</td>
      <td>- Set the channel number in 2.4 GHz / 5GHz.</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>number_pkts</td>
      <td>- Set the number packets in TX mode.</td>
    </tr>
  </tbody>
</table>

**Note**

- User can configure the maximum power level allowed for the given frequncey in the configured region by providing 127 as power level <br />
- User should configure a minimum delay (approx. 10 milliseconds) before and after [rsi_transmit_test_start](wlan#rsi-transmit-test-start) API to observe a stable output at requested dBm level. <br />

###### Data Rates (heading level 7)

|Data rate(Mbps)|Value of rate|
|---|---|
|1|0|
|2|2 <br />|
|5.5|4 <br />|
|11|6 <br />|
|6|139 <br />|
|9|143 <br />|
|12|138 <br />|
|18|142 <br />|
|24|137 <br />|
|36|141 <br />|
|48|136 <br />|
|54|140 <br />|
|MCS0|256 <br />|
|MCS1|257 <br />|
|MCS2|258 <br />|
|MCS3|259 <br />|
|MCS4|260 <br />|
|MCS5|261 <br />|
|MCS6|262 <br />|
|MCS7|263 <br />|

###### The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum. (heading level 7)

|Channel numbers (2.4GHz)|Center frequencies for 20MHz channel width|
|---|---|
|1|2412|
|2|2417|
|3|2422|
|4|2427|
|5|2432|
|6|2437|
|7|2442|
|8|2447|
|9|2452|
|10|2457|
|11|2462|
|12|2467|
|13|2472|

**Note**

- To start transmit test in 12,13 channels, configure set region parameters in rsi_wlan_config.h <br />

###### The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum for 20MHz channel bandwidth. The channel numbers in 5 GHz range is from 36 to 165. (heading level 7)

|Channel Numbers(5GHz)|Center frequencies for 20MHz channel width|
|---|---|
|36|5180|
|40|5200|
|44|5220|
|48|5240|
|52|5260|
|56|5280|
|60|5300|
|64|5320|
|149|5745|
|153|5765|
|157|5785|
|161|5805|
|165|5825|

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- Rate flags can be added in [rsi_wlan_common_config.h](rsi-wlan-common-config-8h-source#rsi-wlan-common-config-8h-source) file. <br />  
   In rate flags, BIT(6) - Immediate Transfer, set this bit to transfer packets immediately ignoring energy/traffic in channel <br />
- Before starting Continuous Wave mode, user must start Continuous mode with power and channel values that are intended to be used in Continuous Wave mode i.e. <br />  
  - Start Continuous mode with intended power value and channel values - Pass any valid values for rate and length. <br />  
  - Stop Continuous mode <br />  
  - Start Continuous Wave mode <br />
- If user wants to switch continuous wave mode, first need to stop the transmit test and again need to give continous wave mode which user wants to switch.
- In 2.4GHz, to start transmit test in 12,13,14 channels, configure set region parameters in rsi_wlan_config.h <br />

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa,0x000A, 0x0021, 0x0025, 0x002C) <br />

**Note**

- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_wlan_cb_non_rom_s::number_pkts_tx_mode](rsi-wlan-cb-non-rom-s#number-pkts-tx-mode), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_transmit_test_start](wlan#rsi-transmit-test-start) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_transmit_test_stop

`int32_t rsi_transmit_test_stop(void)`

**Description:** Stops the transmit test. This is a blocking API. <br />
 This API is relevant in PER mode.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success
- Non Zero Value - Failure (**Possible Error Codes** - 0xfffffffa,0x0021, 0x0025, 0x002C) <br /><br />

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- User should configure a minimum delay (approx. 10 milliseconds) before and after [rsi_transmit_test_start](wlan#rsi-transmit-test-start) API to observe a stable output at requested dBm level. <br />
- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_receive_stats_start

`int32_t rsi_wlan_receive_stats_start(uint16_t channel)`

**Description:** Get the Transmit (TX) and Receive (RX) packets statistics. When this API is called by the host with valid channel number, the module gives the statistics to the host for every 1 second asynchronously. If wlan_receive_stats_response_handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks), it's a non blocking API, otherwise, a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|channel|- Valid channel number: 2.4GHz or 5GHz <br />|

**Returns**

- 0 - Success
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa,0x0021, 0x0025, 0x002c, 0x000A) <br />

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_receive_stats_stop

`int32_t rsi_wlan_receive_stats_stop(void)`

**Description:** Stop the Transmit (TX) & Receive(RX) packets statistics. <br />
 If wlan_receive_stats_response_handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks), it's non blocking API, otherwise, a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- 0 - Success
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa,0x0021, 0x0025, 0x002c) <br />

**Note**

- **Precondition** - [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_send_data

`int32_t rsi_wlan_send_data(uint8_t *buffer, uint32_t length)`

**Description:** Send the raw data in TCP/IP bypass mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|buffer|- Pointer to the buffer to send|
|uint32_t|[in]|length|- Length of the buffer to send|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   If return value is less than 0 <br />  
   -2 - Invalid Parameters <br />  
   -4 - Buffer not available to serve the command <br />  
   If return value is greater than 0 <br />  
   0x0021,0x002C,0x0025

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_twt_auto_selection

`int32_t rsi_wlan_twt_auto_selection(uint8_t twt_enable, uint32_t rx_latency, uint32_t tx_latency, uint16_t avg_tx_throughput)`

**Description:** Calculates and configures TWT parameters based on the given inputs. Enables or disables a TWT session. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|twt_enable|- TWT session setup or teardown <br /><br/> 1 - To setup TWT session with given parameters <br /><br/> 0 - To teardown existing TWT session.|
|uint32_t|[in]|rx_latency|- The maximum allowed recieve latency, in milliseconds, when an Rx packet is buffered at the AP. <br /><br/> If rx_latency is less than <= 1sec (except 0), session creation is not possible. For default configuration, input 0.|
|uint32_t|[in]|tx_latency|- The period, in milliseconds, within which the given Tx operation needs to completed. Valid values is either 0 or in the range of [200ms - 6hrs]|
|uint16_t|[in]|avg_tx_throughput|- The expected average throughput, in Kilo Bytes per seconds, to be achieved within the Tx latency. Valid value is 0 to half of Device Throughput ( = 20MBPS / 2).|

- needs to be called after [rsi_wireless_init()](common#rsi-wireless-init) OPERMODE command.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above [Error Codes](error-codes) .

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_twt_config

`int32_t rsi_wlan_twt_config(uint8_t twt_enable, uint8_t twt_flow_id, twt_user_params_t *twt_req_params)`

**Description:** Configures TWT parameters. Enables or disables a TWT session. This is blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|twt_enable|- TWT session setup or teardown <br /><br/> 1 - To setup TWT session with given parameters <br /><br/> 0 - To teardown TWT session with given flow ID.|
|uint8_t|[in]|twt_flow_id|- TWT session flow ID. <br /><br/> 0 - 7 are valid flow IDs. <br /><br/> 0xFF value is used to teardown all active sessions.|
|[twt_user_params_t](twt-user-params-s) *|[in]|twt_req_params|Configurable TWT parameters. Refer [twt_user_params_s](twt-user-params-s).|

- needs to be called after [rsi_wireless_init()](common#rsi-wireless-init) OPERMODE command.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />

**Note**

- Refer Error Codes section for above [Error Codes](error-codes) .

**References:** [twt_user_params_s::implicit_twt](twt-user-params-s#implicit-twt), [twt_user_params_s::req_type](twt-user-params-s#req-type), [twt_user_params_s::restrict_tx_outside_tsp](twt-user-params-s#restrict-tx-outside-tsp), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [twt_user_params_s::triggered_twt](twt-user-params-s#triggered-twt), [twt_user_params_s::twt_channel](twt-user-params-s#twt-channel), [twt_user_params_s::twt_protection](twt-user-params-s#twt-protection), [twt_user_params_s::twt_retry_interval](twt-user-params-s#twt-retry-interval), [twt_user_params_s::twt_retry_limit](twt-user-params-s#twt-retry-limit), [twt_user_params_s::un_announced_twt](twt-user-params-s#un-announced-twt), [twt_user_params_s::wake_duration](twt-user-params-s#wake-duration), [twt_user_params_s::wake_duration_unit](twt-user-params-s#wake-duration-unit), [twt_user_params_s::wake_int_exp](twt-user-params-s#wake-int-exp), [twt_user_params_s::wake_int_exp_tol](twt-user-params-s#wake-int-exp-tol), [twt_user_params_s::wake_int_mantissa](twt-user-params-s#wake-int-mantissa) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_ping_async

`int32_t rsi_wlan_ping_async(uint8_t flags, uint8_t *ip_address, uint16_t size, void(*wlan_ping_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))`

**Description:** Send a ping request to the target IP address. <br />
 If wlan_ping_response_handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks), it's non blocking API, otherwise, a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|flags|- BIT(0): RSI_IPV6 Set this bit to enable IPv6; by default, it is configured to IPv4|
|uint8_t *|[in]|ip_address|- Target IP address. <br /><br/> IPv4 address: 4 Bytes hexa-decimal, <br /><br/> IPv6 address: 16 Bytes hexa-decimal|
|uint16_t|[in]|size|- Ping data size to send. Maximum supported is 300 bytes.|
|void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length)|[in]|wlan_ping_response_handler|- Called when ping response has been received from the module. <br /><br/> Parameters involved are status, buffer, & length.|
||[out]|status|- Response status|
||[out]|buffer|- Response buffer|
||[out]|length|- Length of the response buffer|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffa,0x0015,0xBB21,0xBB4B,0xBB55) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- The module can't receive ping packets whose length is more than 308 bytes.
- Refer to [Error Codes](error-codes) for the description of above error codes.
- If the powersave is enabled on the device, the recommended ping timeout value is 3 seconds to account for the sleep duration and transmission delays depending on the channel conditions.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_register_auto_config_rsp_handler

`void rsi_register_auto_config_rsp_handler(void(*rsi_auto_config_rsp_handler)(uint16_t status, uint8_t state))`

**Description:** Register auto-configuration response handler.. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void(*)(uint16_t status, uint8_t state)|[in]|rsi_auto_config_rsp_handler|- Pointer to rsi_auto_config_rsp_handler.|
||[out]|status|- Response status, 0 if success else failure.|
||[out]|state|- BIT(1) RSI_AUTO_CONFIG_FAILED.<br /><br/><br/>- BIT(2) RSI_AUTO_CONFIG_GOING_ON.<br /><br/>- BIT(3) RSI_AUTO_CONFIG_DONE.|

**Note**

- *RSI_AUTO_CONFIG_FAILED - Auto_configuration failed.
- *RSI_AUTO_CONFIG_GOING_ON - Auto_configuration in progress.
- *RSI_AUTO_CONFIG_DONE - Auto_configuration succeed.

**Returns**

- Void

**Note**

- **rsi_auto_config_rsp_handler must be registered using the rsi_register_auto_config_rsp_handler API.
- **Precondition** - [rsi_driver_init()](common#rsi-driver-init) API needs to be called before this rsi_register_auto_config_rsp_handler API.
- **The callback indicates the state of Auto configuration process asynchronously.
- **User can proceed with the next commands only after either the RSI_AUTO_CONFIG_FAILED or RSI_AUTO_CONFIG_DONE status is recevied. Until then, commands are not accepted by the SAPI driver.

**References:** [rsi_callback_cb_s::auto_config_rsp_handler](rsi-callback-cb-s#auto-config-rsp-handler), [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_wlan_add_profile

`int32_t rsi_wlan_add_profile(uint32_t type, uint8_t *profile)`

**Description:** Add profile for auto configuration. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|type|- profile type. Supported profile types are: <br /><br/> 1.RSI_WLAN_PROFILE_AP, <br /><br/> 2.RSI_WLAN_PROFILE_CLIENT, <br /><br/> 3.RSI_WLAN_PROFILE_EAP, <br /><br/> 4.RSI_WLAN_PROFILE_P2P, <br /><br/> 5.RSI_WLAN_PROFILE_ALL|
|uint8_t *|[in]|profile|- Pointer to config profile and profile structure <br />[ap_profile](ap-profile), <br /><br/> eap_client_profile_t, <br /><br/> client_profile_t, <br /><br/> p2p_profile_t, <br /><br/> rsi_config_profile_t|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa) <br />

**Note**

- **This API is not supported in current release.**
- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_get_state

`uint8_t rsi_wlan_get_state(void)`

**Description:** Get the current WLAN state.. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Current WLAN state. <br />  
   WLAN states are as follows: <br />
- RSI_WLAN_STATE_NONE = 0, <br />
- RSI_WLAN_STATE_OPERMODE_DONE, <br />
- RSI_WLAN_STATE_BAND_DONE, <br />
- RSI_WLAN_STATE_INIT_DONE, <br />
- RSI_WLAN_STATE_SCAN_DONE, <br />
- RSI_WLAN_STATE_CONNECTED, <br />
- RSI_WLAN_STATE_IP_CONFIG_DONE, <br />
- RSI_WLAN_STATE_IPV6_CONFIG_DONE, <br />
- RSI_WLAN_STATE_AUTO_CONFIG_GOING_ON, <br />
- RSI_WLAN_STATE_AUTO_CONFIG_DONE, <br />
- RSI_WLAN_STATE_AUTO_CONFIG_FAILED

**References:** [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_get_profile

`int32_t rsi_wlan_get_profile(uint32_t type, rsi_config_profile_t *profile_rsp, uint16_t length)`

**Description:** Get the stored config profile. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|type|- Config profile type. <br /><br/> Supported profile types are as follows: <br /><br/> RSI_WLAN_PROFILE_AP, <br /><br/> RSI_WLAN_PROFILE_CLIENT, <br /><br/> RSI_WLAN_PROFILE_EAP, <br /><br/> RSI_WLAN_PROFILE_P2P, <br /><br/> RSI_WLAN_PROFILE_ALL|
|[rsi_config_profile_t](rsi-config-profile-s) *|[in]|profile_rsp|- Config profile response in the form of below structure: <br />[ap_profile](ap-profile), <br /><br/> eap_client_profile_t, <br /><br/> client_profile_t, <br /><br /><br/> p2p_profile_t, <br /><br/> rsi_config_profile_t|
|uint16_t|[in]|length|- Length of the config profile response|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.
- **This API is not supported in current release.**
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_fill_config_profile

`uint8_t * rsi_fill_config_profile(uint32_t type, uint8_t *profile_buffer)`

**Description:** Fill the config profile based on the profile type.. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|type|- Profile type|
|uint8_t *|[in]|profile_buffer|- Pointer to profile buffer|

**Returns**

- Profile buffer

**Note**

- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [feature_frame_params_s::afe_type](feature-frame-params-s#afe-type), [ap_profile::band](ap-profile#band), [client_profile::band](client-profile#band), [eap_client_profile::band](eap-client-profile#band), [p2p_profile::band](p2p-profile#band), [ap_profile::beacon_interval](ap-profile#beacon-interval), [ap_profile::channel](ap-profile#channel), [client_profile::channel](client-profile#channel), [eap_client_profile::channel](eap-client-profile#channel), [convert_lower_case_to_upper_case](driver12#convert-lower-case-to-upper-case), [ap_profile::custom_feature_bit_map](ap-profile#custom-feature-bit-map), [client_profile::custom_feature_bit_map](client-profile#custom-feature-bit-map), [eap_client_profile::custom_feature_bit_map](eap-client-profile#custom-feature-bit-map), [p2p_profile::custom_feature_bit_map](p2p-profile#custom-feature-bit-map), [ap_profile::data_rate](ap-profile#data-rate), [client_profile::data_rate](client-profile#data-rate), [eap_client_profile::data_rate](eap-client-profile#data-rate), [p2p_profile::data_rate](p2p-profile#data-rate), [network_profile::default_gw](network-profile#default-gw), [p2p_profile::device_name](p2p-profile#device-name), [network_profile::dhcp_enable](network-profile#dhcp-enable), [ap_profile::dtim_period](ap-profile#dtim-period), [eap_client_profile::eap_method](eap-client-profile#eap-method), [feature_frame_params_s::enable_ppp](feature-frame-params-s#enable-ppp), [ap_profile::encryption_type](ap-profile#encryption-type), [client_profile::encryption_type](client-profile#encryption-type), [feature_frame_params_s::feature_enables](feature-frame-params-s#feature-enables), [ap_profile::feature_frame_params_s](ap-profile#feature-frame-params-s), [client_profile::feature_frame_params_s](client-profile#feature-frame-params-s), [eap_client_profile::feature_frame_params_s](eap-client-profile#feature-frame-params-s), [p2p_profile::feature_frame_params_s](p2p-profile#feature-frame-params-s), [p2p_profile::go_intent](p2p-profile#go-intent), [eap_client_profile::inner_method](eap-client-profile#inner-method), [network_profile::ip_address](network-profile#ip-address), [p2p_profile::join_ssid](p2p-profile#join-ssid), [ap_profile::keep_alive_counter](ap-profile#keep-alive-counter), [ap_profile::keep_alive_type](ap-profile#keep-alive-type), [client_profile::listen_interval](client-profile#listen-interval), [ap_profile::max_no_sta](ap-profile#max-no-sta), [memcpy](bt-classic1#memcpy), [ap_profile::network_profile](ap-profile#network-profile), [client_profile::network_profile](client-profile#network-profile), [eap_client_profile::network_profile](eap-client-profile#network-profile), [p2p_profile::network_profile](p2p-profile#network-profile), [p2p_profile::operating_channel](p2p-profile#operating-channel), [eap_client_profile::passwd](eap-client-profile#passwd), [feature_frame_params_s::pll_mode](feature-frame-params-s#pll-mode), [client_profile::pmk](client-profile#pmk), [ap_profile::psk](ap-profile#psk), [client_profile::psk](client-profile#psk), [p2p_profile::psk_key](p2p-profile#psk-key), [feature_frame_params_s::rf_type](feature-frame-params-s#rf-type), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_uint32_to_4bytes](driver12#rsi-uint32-to-4bytes), [client_profile::scan_chan_bitmap_2_4_ghz](client-profile#scan-chan-bitmap-2-4-ghz), [eap_client_profile::scan_chan_bitmap_2_4_ghz](eap-client-profile#scan-chan-bitmap-2-4-ghz), [client_profile::scan_chan_bitmap_5_0_ghz](client-profile#scan-chan-bitmap-5-0-ghz), [eap_client_profile::scan_chan_bitmap_5_0_ghz](eap-client-profile#scan-chan-bitmap-5-0-ghz), [client_profile::scan_chan_bitmap_magic_code](client-profile#scan-chan-bitmap-magic-code), [eap_client_profile::scan_chan_bitmap_magic_code](eap-client-profile#scan-chan-bitmap-magic-code), [client_profile::scan_feature_bitmap](client-profile#scan-feature-bitmap), [eap_client_profile::scan_feature_bitmap](eap-client-profile#scan-feature-bitmap), [ap_profile::security_type](ap-profile#security-type), [client_profile::security_type](client-profile#security-type), [eap_client_profile::security_type](eap-client-profile#security-type), [SL_PRINTF](bt-classic1#sl-printf), [network_profile::sn_mask](network-profile#sn-mask), [ap_profile::ssid](ap-profile#ssid), [client_profile::ssid](client-profile#ssid), [eap_client_profile::ssid](eap-client-profile#ssid), [client_profile::ssid_len](client-profile#ssid-len), [eap_client_profile::ssid_len](eap-client-profile#ssid-len), [p2p_profile::ssid_postfix](p2p-profile#ssid-postfix), [ap_profile::tcp_ip_feature_bit_map](ap-profile#tcp-ip-feature-bit-map), [client_profile::tcp_ip_feature_bit_map](client-profile#tcp-ip-feature-bit-map), [eap_client_profile::tcp_ip_feature_bit_map](eap-client-profile#tcp-ip-feature-bit-map), [p2p_profile::tcp_ip_feature_bit_map](p2p-profile#tcp-ip-feature-bit-map), [network_profile::tcp_stack_used](network-profile#tcp-stack-used), [ap_profile::tx_power](ap-profile#tx-power), [client_profile::tx_power](client-profile#tx-power), [eap_client_profile::tx_power](eap-client-profile#tx-power), [p2p_profile::tx_power](p2p-profile#tx-power), [eap_client_profile::user_identity](eap-client-profile#user-identity), [feature_frame_params_s::wireless_mode](feature-frame-params-s#wireless-mode), [ap_profile::wlan_feature_bit_map](ap-profile#wlan-feature-bit-map), [client_profile::wlan_feature_bit_map](client-profile#wlan-feature-bit-map), [eap_client_profile::wlan_feature_bit_map](eap-client-profile#wlan-feature-bit-map) and [p2p_profile::wlan_feature_bit_map](p2p-profile#wlan-feature-bit-map)

###### rsi_wlan_delete_profile

`int32_t rsi_wlan_delete_profile(uint32_t type)`

**Description:** Delete stored configuration based on profile type. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|type|- Profile type|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa) <br />

**Note**

- **This API is not supported in current release.**
- **Precondition** - [rsi_wireless_init()](common#rsi-wireless-init) API needs to be called before this API.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_enable_auto_config

`int32_t rsi_wlan_enable_auto_config(uint8_t enable, uint32_t type)`

**Description:** Enable or disable auto-config with respect to profile. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>enable</td>
      <td>- 0 - Disable the auto configuration feature. <br />
 1 - Enable the auto configuration feature on power up. <br />
 2 - Enable the auto configuration for profile based.</td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>type</td>
      <td>- Profile type <br />

|Value|Parameter|Macro|
|---|---|---|
|0|Client profile|RSI_WLAN_PROFILE_CLIENT|
|1|P2P profile|RSI_WLAN_PROFILE_P2P|
|2|EAP profile|RSI_WLAN_PROFILE_EAP|
|6|AP profile|RSI_WLAN_PROFILE_AP|
|0xF|All profiles|RSI_WLAN_PROFILE_ALL|</td>
    </tr>
  </tbody>
</table>

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa) <br />

**Note**

- **Precondition** - [rsi_wlan_set()](wlan#rsi-wlan-set) API needs to be called before this API.
- Currently Profile based feature is not supported.
- If user tries to give any other command during autojoin, then user gets error 0x002C. <br />  
   To avoid this, user have to disable auto_join feature and give other commands.
- The parameters of the following APIs are saved when [rsi_wlan_enable_auto_config()](wlan#rsi-wlan-enable-auto-config) is called: <br />[rsi_wireless_init()](common#rsi-wireless-init), [rsi_wlan_scan()](wlan#rsi-wlan-scan), [rsi_wlan_scan_with_bitmap_options()](wlan#rsi-wlan-scan-with-bitmap-options), [rsi_wlan_connect()](wlan#rsi-wlan-connect), <br />[rsi_config_ipaddress()](wlan#rsi-config-ipaddress), [rsi_wireless_antenna()](common#rsi-wireless-antenna), [rsi_wlan_bgscan_profile()](wlan#rsi-wlan-bgscan-profile), [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start)
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_pmk_generate

`int32_t rsi_wlan_pmk_generate(int8_t type, int8_t *psk, int8_t *ssid, uint8_t *pmk, uint16_t length)`

**Description:** Generate and configure PMK if PSK and SSID are provided. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t|[in]|type|- Possible values of this field are 1, 2, and 3, but we only pass 3 for generation of PMK.|
|int8_t *|[in]|psk|- Expected parameters are pre-shared key(PSK) of the access point|
|int8_t *|[in]|ssid|- Contain the SSID of the access point, this field will be valid only if TYPE value is 3.|
|uint8_t *|[in]|pmk|- PMK array|
|uint16_t|[in]|length|- Length of PMK array|
||[out]|32-byte|PMK|

**Returns**

- 0 - Success (If type value is 3) <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021,0x0025,0x0026,0x0028,0x002C,0x0039,0x003a,0x003b) <br />

**Note**

- **Precondition** - This API should be called before [rsi_wlan_connect()](wlan#rsi-wlan-connect)
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_set_sleep_timer

`int16_t rsi_wlan_set_sleep_timer(uint16_t sleep_time)`

**Description:** Configure the sleep timer mode of the module to go into sleep during power save operation. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|sleep_time|- Sleep Time value in seconds. Minimum value is 1, and maximum value is 2100|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Can be issued any time in case of power save mode 8 with handshake type as MSG_BASED.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_register_callbacks

`uint16_t rsi_wlan_register_callbacks(uint32_t callback_id, void(*callback_handler_ptr)(uint16_t status, uint8_t *buffer, const uint32_t length))`

**Description:** Register the WLAN callback functions. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|N/A|callback_id|Assert Value|
|void(*)(uint16_t status, uint8_t *buffer, const uint32_t length)|N/A|callback_handler_ptr|6|
||[out]|status|- Status of the asynchronous response|
||[out]|buffer|- Payload of the asynchronous response|
||[out]|length|- Length of the payload|

###### Prototypes of the callback functions with given callback id (heading level 7)

|Callback id|Function Description|
|---|---|
|RSI_JOIN_FAIL_CB|Called when asynchronous rejoin failure is received from the firmware. Application should try to re-join to the AP. This is valid in both AP and STA mode This callback is triggered when module fails to connect to AP in STA mode or when AP creation fails. <br />|
|**Note**<br/><br/>- Need to call rsi_scan() API in STA mode, [rsi_wlan_ap_start()](wlan#rsi-wlan-ap-start) API in AP mode.|
||
||
|RSI_IP_FAIL_CB|Called when asynchronous DHCP renewal failure is received from the firmware. Application should retry IP configuration. This is valid in both AP and STA mode. This callback is triggered when module fails to renew the DHCP.|
|**Note**<br/><br/>- Need to call [rsi_wlan_connect()](wlan#rsi-wlan-connect) API.|
||
||
|RSI_REMOTE_SOCKET_TERMINATE_CB|Called when asynchronous remote TCP socket closed is received from the firmware. It is an indication given to application that the socket is terminated from remote. This is valid in both STA and AP mode. This callback is triggered when remote socket is terminated or closed|
|**Note**<br/><br/>- Need to connect to socket.|
||
||
|RSI_IP_CHANGE_NOTIFY_CB|Called when asynchronous IP change notification is received from the firmware. It is an indication given to application that the IP has been modified. This is valid only in STA mode. This callback is triggered when AP changes the IP address.|
|**Note**<br/><br/>- Need to call [rsi_wlan_connect()](wlan#rsi-wlan-connect),[rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API.|
||
||
|RSI_STATIONS_DISCONNECT_NOTIFY_CB|Called when asynchronous station disconnect notification is received from the firmware in AP mode. It is an indication that the AP is disconnect. Application should retry to connect to the AP. This is valid when module acts as AP. This callback is triggered when stations are disconnected.|
|**Note**<br/><br/>- STA need to connect to the Accesspoint 9116.|
||
||
|RSI_STATIONS_CONNECT_NOTIFY_CB|Called when asynchronous station connect notification is received from the firmware in AP mode. It is an indication that the application is connected to the AP. This is valid when 9116 module acts as AP. This callback is triggered when stations are connected.|
|- STA need to connect to the accesspoint 9116.|
||
||
||
|RSI_WLAN_DATA_RECEIVE_NOTIFY_CB|Called when asynchronous data is received from the firmware in TCP/IP bypass mode. This is valid in both AP and STA mode. This callback is triggered when data is received in TCP/IP bypass mode.|
|- Need to connect to socket.|
||
||
|RSI_WLAN_WFD_DISCOVERY_NOTIFY_CB|Called when Wi-Fi direct device discovery notification received from the firmware. This is valid in Wi-Fi Direct Mode only. This callback is triggered when a peer is discovered by the device.|
|- Need to call [rsi_wireless_init()](common#rsi-wireless-init) ,rsi_wlan_wfd_start_discovery API.|
||
||
|RSI_WLAN_RECEIVE_STATS_RESPONSE_CB|Called when asynchronous receive statistics from the firmware in PER mode. This is valid in PER Mode only. This callback is triggered when module wants to receive statistics.|
|- Need to call [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init) API.|
||
||
|RSI_WLAN_WFD_CONNECTION_REQUEST_NOTIFY_CB|Called when Wi-Fi direct connection request from the firmware. This is valid in Wi-Fi Direct Mode only. This call back is triggered when there is a connection request from other peer device.|
|- Need to [rsi_wireless_init()](common#rsi-wireless-init) ,rsi_wlan_wfd_start_discovery() API.|
||
||
||
|RSI_WLAN_RAW_DATA_RECEIVE_HANDLER|Called when raw data packets are received from the firmware. This is valid in both AP and STA mode. This callback is triggered when raw data is received in TCP/IP bypass mode.|
|- Need to connect to socket.|
||
||
|RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB|Called when a socket connection response comes to the host. This is valid in both STA and AP mode. This callback is registered and triggered when socket connects.|
|- Need to create socket.|
||
||
|RSI_WLAN_SERVER_CERT_RECEIVE_NOTIFY_CB|Reserved|
|RSI_WLAN_ASYNC_STATS|Called when asynchronous response comes from the firmware to the host. Host can register this callback to get all the information regarding AP connectivity.|
||
||
|RSI_WLAN_ASSERT_NOTIFY_CB|Called when WLAN assertion is triggered from firmware. It returns the assert value to the application.|
||
||
|RSI_WLAN_MAX_TCP_WINDOW_NOTIFY_CB|Reserved|

###### RSI_WLAN_ASYNC_STATS (heading level 7)

• Asychronous messages are used to indicate module state to host. Asynchronous message are enabled by setting bit 10 of the custom feature bitmap in opermode. <br />
 • In async messages time_stamp, state_code, reason_code, rsi_channel, rsi_rssi and rsi_bssid are logged. <br />

- time_stamp (4 bytes)  
  - This is the value of the time stamp counter at the time of message; timestamps increment at intervals of 100ms. <br />
- state_code (1 byte)  
  - This field indicates the state of the module. `state_code` contains two parts, the upper nibble and lower nibble. <br />  
  - The upper nibble indicates the state of the rejoin process. The following table documents the possible values of the upper nibble of state_code. <br />    
    |State|Upper Nibble|Indication|    
    |---|---|---|    
    |Scan Trigger (State I)|`0x00`|Startup. Initial Roam|    
    |`0x10`|Beacon Loss. Failover Roam|    
    |`0x20`|De-authentication. AP induced roam / Disconnect from supplicant|    
    |Scan Result/Decision (State II)|`0x50`|Current AP is best|    
    |`0x60`|Better AP found|    
    |`0x70`|No AP found|    
    |Final Connection (State III)|`0x80`|Associated|    
    |`0x90`|Unassociated|  
  - The lower nibble of state_code indicates the reason for a state change. The following table documents the possible values of the lower nibble of state_code.    
    |Lower Nibble|Reason for State Change|    
    |---|---|    
    |`0x00`|No reason specified|    
    |`0x01`|No response from AP for authentication request(Authentication denial)|    
    |`0x02`|Association denial|    
    |`0x03`|User configured AP is not present|    
    |`0x05`|EAPOL TX failure|    
    |`0x06`|Deauthentication from user|    
    |`0x07`|PSK not configured|    
    |`0x08`|key-handshake failure during rejoin/roaming/after connection(Disconnection from supplicant)|    
    |`0x09`|Roaming not enabled|
- reason_code (1 byte)  
  - Indicates the reason for a failure. <br />  
  - These failures also include EAP connection errors for certificate parsing. <br />  
  - All supported reason codes are listed below    
    |reason_code|Reason codes|    
    |---|---|    
    |0x00|No reason specified|    
    |0x01|No response from AP for authentication request(Authentication denial)|    
    |0x02|Association denial|    
    |0x03|User configured AP is not present|    
    |0x05|EAPOL TX failure|    
    |0x06|Deauthentication from user|    
    |0x07|PSK not configured|    
    |0x08|key-handshake failure during rejoin/roaming/after connection(Disconnection from supplicant)|    
    |0x09|Roaming not enabled|    
    |0x10|Beacon Loss (failover Roam)|    
    |0x20|De-authentication (AP induced Roam/Deauth from supplicant)|    
    |0x28|TLS CA Cert not present|    
    |0x29|TLS PRIVATE key not present|    
    |0x2A|TLS Client Cert not present|    
    |0x2B|TLS no Cert present|    
    |0x2C|PEAP CA Cert not present|    
    |0x2D|Server Cert Invalid Key Type|    
    |0x2E|Server Intermediate CA Invalid Key Type|    
    |0x2F|Server Root CA Invalid Key Type|    
    |0x30|Client Cert Invalid Key Type|    
    |0x31|Client Root CA Invalid Key Type|    
    |0x32|FIPS Server Cert Invalid Length|    
    |0x33|FIPS Server Intermediate CA Invalid Length|    
    |0x34|FIPS Server Root CA Invalid Length|    
    |0x35|FIPS Client Cert Invlaid Length|    
    |0x36|FIPS Client Root CA Invalid Length|    
    |0x37|Server Cert 4096-bit length support is not enabled|    
    |* 0x38|Server Intermediate CA 4096-bit length support is not enabled|    
    |* 0x39|Server Root CA 4096-bit length support is not enabled|    
    |* 0x3A|Client Cert 4096-bit length support is not enabled|    
    |* 0x3B|Client Root CA 4096-bit length support is not enabled|    
    |0x3C|Server Cert Invalid Sign Alg|    
    |0x3D|Server Intermediate CA Invalid Sign Alg|    
    |0x3E|Server Root CA Invalid Sign Length|    
    |0x3F|Client Cert Invalid Sign Alg|    
    |0x40|Client Root CA Invalid Sign Length|    
    |0x41|Server Intermediate CA not Present|    
    |0x42|Server Root CA Parse Error|    
    |0x43|Server Intermediate Root CA Parse Error|    
    |0x44|Sever Cert Parse Error|    
    |0x45|Client Cert Parse Error|    
    |0x46|Incorrect Private Key Password|    
    |0x47|EAP Failure Received|    
    |0x48|Client Cert Bad Date Error|    
    |0x49|Server Cert Bad Date Error|    
    |0x4A|Server Root CA Bad Date Error|    
    |0x4B|Client Root CA Bad Date Error|    
    |0x4C|Server Intermediate Root CA Bad Date Error|    
    |0x4D|Pem Header Error|    
    |0x4E|Pem Footer Error|    
    |0x4F|Client Intermediate CA Invalid Sign Length|    
    |0x50|Client Intermediate CA Invalid Length|    
    |0x51|FIPS Client Intermediate CA Invalid Length|    
    |0x52|Client Intermediate CA invalid Key Type|    
    |0x53|Pem Error|    
    |0x54|Pathlen certificate is Invalid|  
  - In addition to the above, reason code received in Deauthentication/Disassociation frame from AP is added. This will set the MSB bit of reason_code. <br />  
  - If MSB bit is set in reason code, then mask it with 0x7f to get the acutal reason code received in Deauthentication/Disassociation frame. <br />  
  - In RS9116 Rev 1.4, above reason codes will come only in TCP/IP bypass mode. <br />  
  - Pem Header Error(0x4D) or Pem Footer Error(0x4E) are only applicable if certificates are loaded individually. In case if certificates are loaded combinedly in a single file, only Pem Error(0x53) will be triggered for Header or Footer errors. <br />

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_callback_cb_s::certificate_response_handler](rsi-callback-cb-s#certificate-response-handler), [rsi_callback_cb_s::ip_change_notify_handler](rsi-callback-cb-s#ip-change-notify-handler), [rsi_callback_cb_s::ip_renewal_fail_handler](rsi-callback-cb-s#ip-renewal-fail-handler), [rsi_callback_cb_s::join_fail_handler](rsi-callback-cb-s#join-fail-handler), [rsi_callback_cb_s::raw_data_receive_handler](rsi-callback-cb-s#raw-data-receive-handler), [rsi_callback_cb_s::remote_socket_terminate_handler](rsi-callback-cb-s#remote-socket-terminate-handler), [rsi_callback_cb_s::rsi_assertion_cb](rsi-callback-cb-s#rsi-assertion-cb), [rsi_callback_cb_s::rsi_max_available_rx_window](rsi-callback-cb-s#rsi-max-available-rx-window), [SL_PRINTF](bt-classic1#sl-printf), [rsi_callback_cb_s::socket_connect_response_handler](rsi-callback-cb-s#socket-connect-response-handler), [rsi_callback_cb_s::stations_connect_notify_handler](rsi-callback-cb-s#stations-connect-notify-handler), [rsi_callback_cb_s::stations_disconnect_notify_handler](rsi-callback-cb-s#stations-disconnect-notify-handler), [rsi_callback_cb_s::twt_response_handler](rsi-callback-cb-s#twt-response-handler), [rsi_callback_cb_s::wlan_async_module_state](rsi-callback-cb-s#wlan-async-module-state), [rsi_callback_cb_s::wlan_data_receive_handler](rsi-callback-cb-s#wlan-data-receive-handler), [rsi_callback_cb_s::wlan_receive_csi_data_response_handler](rsi-callback-cb-s#wlan-receive-csi-data-response-handler), [rsi_callback_cb_s::wlan_receive_stats_response_handler](rsi-callback-cb-s#wlan-receive-stats-response-handler), [rsi_callback_cb_s::wlan_wfd_connection_request_notify_handler](rsi-callback-cb-s#wlan-wfd-connection-request-notify-handler) and [rsi_callback_cb_s::wlan_wfd_discovery_notify_handler](rsi-callback-cb-s#wlan-wfd-discovery-notify-handler)

###### rsi_wlan_update_gain_table

`int32_t rsi_wlan_update_gain_table(uint8_t band, uint8_t bandwidth, uint8_t *payload, uint16_t payload_len)`

**Description:** Assign the user configurable channel gain values in different regions to the module from user.This method is used for overwriting default gain tables that are present in firmware. <br />
 Customer can load all the three gain tables (i.e., 2.4GHz-20Mhz, 5GHz-20Mhz, 5GHz-40Mhz) one after other by changing band and bandwidth values. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|band|- 1 ? 2.4GHz <br /><br/> 2 ? 5GHz <br />|
|uint8_t|[in]|bandwidth|- 0 ? 20 MHz <br /><br/> 1 ? Reserved|
|uint8_t *|[in]|payload|- Pass channel gain values for different regions in an given array format.|
|uint16_t|[in]|payload_len|- Max payload length (table size) in 2.4GHz is 128 bytes. <br /><br/> Max payload length (table size) in 5GHz is 64 bytes|

**Note**

- 1. **This frame has to be used by customers who has done FCC/ETSI/TELEC/KCC certification with their own antenna. All other customers should not use this. Inappropriate use of this frame may result in violation of FCC/ETSI/TELEC/KCC or any certifications and Silicon labs is not liable for that**<br />
- Internally firmware maintains two tables : Worldwide table & Region based table. Worldwide table is populated by firmware with Max power values that chip can transmit that meets target specs like EVM. Region based table has default gain value set. <br />  
  1. When certifying with user antenna, Region has to be set to Worldwide and sweep the power from 0 to 21dBm. Arrive at max power level that is passing certification especially band-edge. <br />  
  2. These FCC/ETSI/TELEC/KCC Max power level should be loaded in end-to-end mode via WLAN User Gain table. This has to be called done every boot-up since this information is not saved inside flash. Region based user gain table sent by application is copied onto Region based table .SoC uses this table in FCC/ETSI/TELEC/KCC to limit power and not to violate allowed limits. <br />    
      For Worldwide region firmware uses Worldwide table for Tx. For other regions(FCC/ETSI/TELEC/KCC), Firmware uses min value out of Worldwide & Region based table for Tx. Also there will be part to part variation across chips and offsets are estimated during manufacturing flow which will be applied as correction factor during normal mode of operation. <br />

- rsi_radio_init() API needs to be called before this API

###### Gain Table Payload Format (heading level 7)

```c
           1. Gain table Format for 2.4GHz Band: (Each entry of the table is 1 byte)
              In 2.4GHz, Max Gain/Power obtained from certification should be doubled and loaded.
           <TABLE NAME[]>= {
           <NO.of Regions>,
           <REGION NAME 1>, <CHANNEL_CODE_2G>,
           <CHANNEL NUMBER 1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           <CHANNEL NUMBER 2>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           . 
           . 
           .
           .
           .       
           <CHANNEL NUMBER m-1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER m>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           <REGION NAME 2>, <CHANNEL_CODE_2G>,
           <CHANNEL NUMBER 1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER 2>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           . 
           . 
           . 
           . 
           <CHANNEL NUMBER m-1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER m>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           }; 

           Gain table Format for 5GHz Band (Each entry of the table is 1 byte):
             In 5GHz, Max Gain/Power obtained from certification should be loaded.
            <TABLE NAME[]>= { 
                              <NO.of Regions>, 
                              <REGION NAME 1>, <CHANNEL_CODE_5G>, 
                              <CHANNEL NUMBER IN BAND 1 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                               <BAND_NUMBER 1>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 2 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 2>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 3 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 3>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 4 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 4>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              . 
                              . 
                              . 
                              . 
                              . 
                              <REGION NAME y>, <CHANNEL_CODE_5G>, 
                              }; 
           2. Supported Region names:
                                  FCC, ETSI,TELEC,KCC
                                  The following are the regions and the values to be passed instead of macros in the example.
                                  Region      |          Macro Value
                                  ------------|--------------------
                                  FCC         |            0
                                  ETSI        |            1
                                  TELEC       |            2
                                  KCC         |            4
           3. <CHANNEL_CODE_2G> is a 8 bit value which is encoded as:
              If TX powers of all the channels are same, then use CHANNEL_CODE_2G as 17. In this case, mention channel number as 255.
              Tf TX power is not same for all channels, then indicate CHANNEL_CODE_2G as no-of channels. And specify tx power values for all the channels indicated.
           4. <CHANNEL_CODE_5G> is a 8 bit value encoded as number of rows in a region for 5G band.
               a. 5G is divided into 4 sub bands: 
                     band 1: channel number <= 48 
                     band 2: channel number > 48 and channel number <= 64 
                     band 3: channel number > 64 and channel number <= 144 
                     band 4: channel number > 144 
               b. If any channel in a band has different set of power values, specify the channel number followed by power values. 
               c. If all the channels in a band 1 has same power values, specify the band number as 1 followed by power value. 
               d. If all the channels in a band 2 has same power values, specify the band number as 2 followed by power value. 
               e. If all the channels in a band 3 has same power values, specify the band number as 3 followed by power value. 
               f. If all the channels in a band 4 has same power values, specify the band number as 4 followed by power value.

```

###### Example payload formats (heading level 7)

```c
                     Examples: 
                     For 2.4GHz Band in 20MHz bandwidth
                       {3, //NUM_OF_REGIONS 
                           FCC, 13, //NUM_OF_CHANNELS 
                       //   rate,  11b, 11g, 11n   
                               1,  34,  20,  20,  
                               2,  34,  28,  28,  
                               3,  34,  32,  32,  
                               4,  34,  36,  36,  
                               5,  34,  38,  38,  
                               6,  34,  40,  40,  
                               7,  34,  38,  38,  
                               8,  34,  36,  36,  
                               9,  34,  32,  32,  
                               10, 34,  32,  32,  
                               11, 34,  24,  24,  
                               12, 34,  16,  24,  
                               13, 34,  12,  12,  
                           TELEC, 17, 
                                255, 20,  16, 16, 
                       }; //}}} 

                     For 5GHz band in 20MHz bandwidth
                        {2, 
                        FCC, 6, 
                            1,  9, 10, //band 1 
                            2,  8,  9, //band 2 
                          100,  4,  4, //band 3 
                            3,  6,  8, //band 3 
                          149,  3,  3, //band 4 
                        TELEC, 4, 
                          1, 9, 10, //band 1 
                          2, 8, 10, //band 2   
                          3, 6,  8, //band 3   
                          4, 6,  7, //band 4 
                        };

```

###### Customers using Certified MARS antenna should use the gain table structures below: (heading level 7)

```c
                     For 2.4GHz Band in 20MHz bandwidth
                      {3,//NUM_OF_REGIONS
                          FCC, 0xD,//NUM_OF_CHANNELS
                      //   rate,  11b, 11g, 11n
                              1,  28,  32,  30,
                              2,  28,  32,  30,
                              3,  28,  32,  30,
                              4,  30,  28,  34,
                              5,  30,  28,  34,
                              6,  30,  28,  34,
                              7,  30,  28,  34,
                              8,  30,  28,  34,
                              9,  28,  30,  30,
                              10, 28,  30,  30,
                              11, 28,  30,  30,
                              12, 28,  30,  30,
                              13, 28,  30,  30,
                          TELEC,0x11, //NA
                               255, 20,  16, 16,
                      };

                     For 5GHz band in 20MHz bandwidth
                      {2,
                      FCC, 0x6,
                          1, 12, 12, //band 1
                          2, 11, 11, //band 2   
                        100, 10, 12, //band 3   
                          3, 13, 13, //band 3   
                        140, 10, 11, //band 4   
                          4, 13, 13, //band 4   
                      TELEC, 0x4, //NA
                        1, 9, 10, //band 1
                        2, 8, 10, //band 2   
                        3, 6,  8, //band 3   
                        4, 6,  7, //band 4
                      };

```

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe,0xfffffffd,0x0021,0x003E) <br />

**Note**

- **Precondition** - rsi_radio_init() API needs to be called before this API
- Length of the payload should match with payload_len parameter value.
- 40MHz is not supported in both 2.4GHz and 5GHz
- This API must be used by customers who has done FCC/ETSI/TELEC certification with their own antenna. Inappropriate use of this API may result in violation of FCC/ETSI/TELEC, or any certifications and Silicon labs is not liable for that.
- Internally firmware maintains two gain tables: Worldwide table & Region based table. Worldwide table is populated by firmware with maximum power values that chip can transmit that meets target specifications like EVM. Region based table has default gain value set.
- When certifying with your own antenna, region must be set to Worldwide and sweep the power from 0 to 21dBm. Arrive at maximum power level that is passing certification especially band-edge.
- These FCC/ETSI/TELEC maximum power level should be loaded in end-to-end mode via WLAN User Gain table.
- This API must be called after every boot-up since this information is not saved inside flash.
- Region based user gain table sent by application is copied onto Region based table. SoC uses this table in FCC/ETSI/TELEC to limit power and not to violate allowed limits. For Worldwide region firmware uses Worldwide table for transmit. <br />  
   For other regions (FCC/ETSI/TELEC), firmware uses minimum value of Worldwide and Region based table for transmit.
- There will be part to part variation across chips and offsets are estimated during manufacturing flow which will be applied as correction factor during normal mode of operation.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_wlan_csi_config_async

`int32_t rsi_wlan_csi_config_async(uint8_t enable, uint32_t periodicity, uint8_t num_of_mac_addr, uint8_t(*mac_addr)[6], void(*wlan_csi_data_response_handler)(uint16_t status, uint8_t *buffer, const uint32_t length))`

**Description:** Enable or disable CSI data retrieval with configured periodicity.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[out]|enable|- Response status: 0 - Success, 0x21 - [rsi_wlan_csi_config_async()](wlan#rsi-wlan-csi-config-async) called in wrong state|
|uint32_t|[out]|periodicity|- Response buffer|
|uint8_t|[out]|num_of_mac_addr|- Length of the response buffer. Payload length will be sizeof(rsi_rsp_csi_data_t) bytes.|
|uint8_t(*)|[in]|mac_addr|- Pointer to a 2-D matrix containing the list of MAC addresses.|
|void(*)(uint16_t status, uint8_t *buffer, const uint32_t length)|[in]|wlan_csi_data_response_handler|- Called when CSI data has been received from the module.|

- [rsi_wlan_scan()](wlan#rsi-wlan-scan) API needs to be called before this API.

**Note**

- Callback implementation example - <br />  
   void rsi_wlan_csi_data_response_handler(uint16_t status, rsi_rsp_csi_data_t *payload, const uint32_t payload_length) <br />

**Note**

- [rsi_rsp_csi_data_s](rsi-rsp-csi-data-s) : Structure type supposed to hold incoming CSI data

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure <br />  
   -1 - Callback not registered <br />  
   -4 - Buffer unavailable to serve the command

**Note**

- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes)

**References:** [rsi_wlan_cb_non_rom_s::callback_list](rsi-wlan-cb-non-rom-s#callback-list), [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_callback_cb_s::wlan_receive_csi_data_response_handler](rsi-callback-cb-s#wlan-receive-csi-data-response-handler)

###### rsi_send_evm_offset

`int32_t rsi_send_evm_offset(uint8_t index, int8_t evm_offset_val)`

**Description:** Application to provide feedback of evm_offset error. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|index|- index of EVM,range from[0 to 4]. index | description 0 | Update evm_offset_11B 1 | Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 2 | Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 3 | Update evm_offset_11N_MCS0 4 | Update evm_offset_11N_MCS7 > 4 | Reserved|
|int8_t|[in]|evm_offset_val|- emv_offset value observed.|

**Returns**

- 0 - Success <br />  
   Non zero Value - Failure <br />  
   If return value is less than 0 <br />**RSI_ERROR_INVALID_PARAM** - Invalid parameters <br />

**Note**

- Refer to Error Codes section for the description of the above error codes [Error Codes](error-codes).

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_evm_write

`int32_t rsi_evm_write(uint8_t target, uint32_t flags, int8_t evm_offset_11B, int8_t evm_offset_11G_6M_24M_11N_MCS0_MCS2, int8_t evm_offset_11G_36M_54M_11N_MCS3_MCS7, int8_t evm_offset_11N_MCS0, int8_t evm_offset_11N_MCS7)`

**Description:** RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>uint8_t</td>
      <td>[in]</td>
      <td>target</td>
      <td><br />
 0 - BURN_INTO_EFUSE (Burns calibration data to EFuse)(Not supported) <br />
 1 - BURN_INTO_FLASH (Burns calibration data to Flash) <br /></td>
    </tr>
    <tr>
      <td>uint32_t</td>
      <td>[in]</td>
      <td>flags</td>
      <td>- Validate information <br />

|Bit|MACRO|Description|
|---|---|---|
|0|EVM_OFFSET_CUST_0|1 - Update evm_offset_11B rate calibration data <br /><br/> 0 - Skip evm_offset update|
|1|EVM_OFFSET_CUST_1|1 - Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 rate calibration data <br /><br/> 0 - Skip evm_offset update|
|2|EVM_OFFSET_CUST_2|1 - Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 rate calibration data <br /><br/> 0 - Skip evm_offset update|
|3|EVM_OFFSET_CUST_3|1 - Update evm_offset_11N_MCS0 rate calibration data <br /><br/> 0 - Skip evm_offset update|
|4|EVM_OFFSET_CUST_4|1 - Update evm_offset_11N_MCS7 rate calibration data <br /><br/> 0 - Skip evm_offset update|

31-5| Reserved</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>evm_offset_11B</td>
      <td>- evm_offset for 11B rate</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>evm_offset_11G_6M_24M_11N_MCS0_MCS2</td>
      <td>- evm_offset for 11G_6M_24M_11N_MCS0_MCS2 rate</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>evm_offset_11G_36M_54M_11N_MCS3_MCS7</td>
      <td>- evm_offset for 11G_36M_54M_11N_MCS3_MCS7 rate</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>evm_offset_11N_MCS0</td>
      <td>- evm_offset for 11N_MCS0 rate</td>
    </tr>
    <tr>
      <td>int8_t</td>
      <td>[in]</td>
      <td>evm_offset_11N_MCS7</td>
      <td>- evm_offset for 11N_MCS7 rate Recalibration is not possible if EFuse is being used instead of flash as calibration data storage <br /></td>
    </tr>
  </tbody>
</table>

- [rsi_transmit_test_start()](wlan#rsi-transmit-test-start), [rsi_send_evm_offset()](wlan#rsi-send-evm-offset) API needs to be called before this API.This API is relevant in PER mode only.

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

##### BSD Sockets

###### Variables

###### RSI_SUCCESS (heading level 7)

```
return RSI_SUCCESS
```

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_state](wlan#rsi-check-state), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_network_app_protocol_config](network5#rsi-network-app-protocol-config), [rsi_select](network5#rsi-select), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_set_sni_emb_socket](network9#rsi-set-sni-emb-socket), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown) and [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown)

###### Functions

###### rsi_web_socket_create (heading level 7)

`int32_t rsi_web_socket_create(int8_t flags, uint8_t *server_ip_addr, uint16_t server_port, uint16_t device_port, uint8_t *webs_resource_name, uint8_t *webs_host_name, int32_t *socket_id, void(*web_socket_data_receive_notify_callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a web socket client. This is a blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t|[in]|flags|- Select IP version and security <br /><br/> BIT(0): RSI_IPV6 - Set this bit to enable IPv6, by default it is configured to IPv4 <br /><br/> BIT(1): RSI_SSL_ENABLE - Set this bit to enable SSL feature <br />|
|uint8_t *|[in]|server_ip_addr|- Web server IP address|
|uint16_t|[in]|server_port|- Web server socket port|
|uint16_t|[in]|device_port|- Local port|
|uint8_t *|[in]|webs_resource_name|- Web resource name|
|uint8_t *|[in]|webs_host_name|- Web host name|
|int32_t *|[in]|socket_id|- Socket ID|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|web_socket_data_receive_notify_callback|- Callback when data packet is received on the created socket|
||[out]|sock_no|- Application socket ID|
||[out]|buffer|- Buffer pointer|
||[out]|length|- Length of data|

**Returns**

- 0 - Success <br />
- Negative Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [memcpy](bt-classic1#memcpy), [rsi_bind](network5#rsi-bind), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_shutdown](network5#rsi-shutdown), [rsi_socket_async](network5#rsi-socket-async), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_in_addr::s_addr](rsi-in-addr#s-addr), [rsi_sockaddr_in6::sin6_addr](rsi-sockaddr-in6#sin6-addr), [rsi_sockaddr_in6::sin6_family](rsi-sockaddr-in6#sin6-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [rsi_sockaddr_in::sin_addr](rsi-sockaddr-in#sin-addr), [rsi_sockaddr_in::sin_family](rsi-sockaddr-in#sin-family), [rsi_sockaddr_in::sin_port](rsi-sockaddr-in#sin-port) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_web_socket_send_async (heading level 7)

`int32_t rsi_web_socket_send_async(int32_t sockID, uint8_t opcode, int8_t *msg, int32_t msg_length)`

**Description:** Send data from the web socket client. This is a non-blocking API. <br />

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Application socket ID|
|uint8_t|[in]|opcode|- Type of the packet to be included in web socket header|
|int8_t *|[in]|msg|- Data|
|int32_t|[in]|msg_length|- Data length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_socket_info_s::opcode](rsi-socket-info-s#opcode), [rsi_send](network5#rsi-send), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_web_socket_close (heading level 7)

`int32_t rsi_web_socket_close(int32_t sockID)`

**Description:** Close the web socket client. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket ID of particular socket|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API

**References:** [rsi_shutdown](network5#rsi-shutdown), [RSI_SUCCESS](bt-classic1#rsi-success) and [SL_PRINTF](bt-classic1#sl-printf)

###### rsi_fd_isset (heading level 7)

`int rsi_fd_isset(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Check for the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket ID|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the [rsi_fd_set_s](rsi-fd-set-s) structure|

**Returns**

- Positive Value - Success <br />
- 0 - Failure

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_set_fd (heading level 7)

`void rsi_set_fd(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Set the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket id|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the rsi_fd_set_structure|

**Returns**

- Void

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_fd_clr (heading level 7)

`void rsi_fd_clr(uint32_t fd, struct rsi_fd_set_s *fds_p)`

**Description:** Clear the bit for the file descriptor FD in the file descriptor set rsi_fd_set. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|fd|- Socket ID|
|struct [rsi_fd_set_s](rsi-fd-set-s) *|[in]|fds_p|- Pointer to the [rsi_fd_set_s](rsi-fd-set-s) structure|

**Returns**

- Void

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array) and [SL_PRINTF](network5#sl-printf)

###### rsi_socket_async (heading level 7)

`int32_t rsi_socket_async(int32_t protocolFamily, int32_t type, int32_t protocol, void(*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a socket and register a callback that will be used by the driver to forward the received packets asynchronously to the application (on packet reception) without waiting for [rsi_recv()](network5#rsi-recv) API call. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2) : Select IPv4 <br /><br/> AF_INET6 (3) : Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1) : Select TCP <br /><br/> SOCK_DGRM (2) : Select UDP|
|int32_t|[in]|protocol|- 0: Non SSL sockets <br /><br/> 1: SSL sockets <br /><br/> BIT(5) - Must be enabled to select the certificate index <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1 <br /><br/> Note: Certificates must be loaded in to RAM to select the certificate index feature.|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|callback|- Callback function to read data asynchronously from socket <br />|
||[out]|sock_no|- Application socket number <br />|
||[out]|buffer|- Pointer to buffer that holds data <br />|
||[out]|length|- Length of the buffer|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xFFF8, 0xFF80, 0xFF6D, 0xFF85, 0xBB33, 0xBB22) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_socket (heading level 7)

`int32_t rsi_socket(int32_t protocolFamily, int32_t type, int32_t protocol)`

**Description:** Create and return a socket instance. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2): Select IPv4 <br /><br/> AF_INET6 (3): Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1): Select TCP<br /><br/> TCP SOCK_DGRM (2): Select UDP|
|int32_t|[in]|protocol|- 0: Non SSL sockets <br /><br/> PROTOCOL_DFLT_VERSION: To open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2. <br /><br/> BIT(5) - Must be enabled to select the certificate index <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1 <br /><br/> PROTOCOL_TLS_1_0 - To open an SSL/TLS connection over TCP socket with TLS version 1.0 <br /><br/> PROTOCOL_TLS_1_1 - To open an SSL/TLS connection over TCP socket with TLS version 1.1 <br /><br/> PROTOCOL_TLS_1_2 - To open an SSL/TLS connection over TCP socket with TLS version 1.2 <br /><br/> Note: Certificates must be loaded in to RAM to select the certificate index feature.|

**Returns**

- SOCK_ID - Socket ID of the created socket <br />
- Negative value - Failure (**Possible Error Codes** - 0xfffffffd) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- A maximum of 10 sockets can be opened. Range of socket handles are between 1 to 10.
- If 3 TLS sockets are opened then the remaining 7 could be any combinations of UDP and TCP sockets.
- Module supports a maximum of 3 TLS sockets. These can be a combination of client and server sockets. If the HTTPS client is enabled then the user can open only 2 more TLS socket.

**References:** [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::tls_version](rsi-wlan-cb-non-rom-s#tls-version)

###### rsi_bind (heading level 7)

`int32_t rsi_bind(int32_t sockID, struct rsi_sockaddr *localAddress, int32_t addressLength)`

**Description:** Assign an address to a socket. This is a non-blocking API for TCP and a blocking API for UDP.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|localAddress|- Address assigned to the socket. The format is compatible with BSD socket|
|int32_t|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API.

**References:** [rsi_socket_bind](network5#rsi-socket-bind) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_connect (heading level 7)

`int32_t rsi_connect(int32_t sockID, struct rsi_sockaddr *remoteAddress, int32_t addressLength)`

**Description:** Connect the socket to the specified remote address. This is a non-blocking API, if socket_connect_response handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks), otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|remoteAddress|- Remote peer address. The format is compatible with BSD socket.|
|int32_t|[in]|addressLength|- Length of the address in bytes|

**Returns**

- 0 - Success <br />  
   Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- For asynchronous behaviour, user need to register RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB callback ID.

**References:** [rsi_socket_connect](network5#rsi-socket-connect) and [SL_PRINTF](network5#sl-printf)

###### rsi_listen (heading level 7)

`int32_t rsi_listen(int32_t sockID, int32_t backlog)`

**Description:** Enable socket to listen for a remote connection request in passive mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|backlog|- Maximum length to which the queue of pending connections can be held. This argument is used when multiple client connections over the same server socket are required. <br /><br/> If backlog parameter is issued, then rsi_accept or rsi_accept_async can accept those many client connections over the same server socket <br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- When using multiple client/server sockets, the following macros have to be updated in the wlan_config.h file, in TCP_IP_FEATURE_BIT_MAP - If TCP_IP_TOTAL_SOCKETS_x flag is used, then firmware allocates memory for x sockets. If TCP_IP_TOTAL_SOCKETS_x flag is not passed, then a default value of 10 sockets is used.
- When using multiple client/server sockets, the following macros have to be updated in the [rsi_user.h](rsi-user-8h-source#rsi-user-8h-source) file, RSI_NUMBER_OF_LTCP_SOCKETS -> Number of server sockets and RSI_NUMBER_OF_SOCKETS -> Number of client sockets + Number of server sockets.
- If multiple server sockets are created then the memory allocated for client sockets is to be shared across the multiple server sockets. If RSI_NUMBER_OF_LTCP_SOCKETS is 0 and RSI_NUMBER_OF_SOCKETS is x, y is server sockets and x-y client sockets can be created

**References:** [rsi_socket_listen](network5#rsi-socket-listen) and [SL_PRINTF](network5#sl-printf)

###### rsi_accept_non_rom (heading level 7)

`int32_t rsi_accept_non_rom(int32_t sockID, struct rsi_sockaddr *ClientAddress, int32_t *addressLength)`

**Description:** Accept the connection request from the remote peer. This API extracts the connection request from the queue of pending connections on listening socket and accepts it.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|ClientAddress|- Remote peer address|
|int32_t *|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_async](network5#rsi-socket-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_receive_callback](rsi-socket-info-s#sock-receive-callback), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type) and [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port)

**Referenced by:** [rsi_accept](network5#rsi-accept)

###### rsi_accept (heading level 7)

`int32_t rsi_accept(int32_t sockID, struct rsi_sockaddr *ClientAddress, int32_t *addressLength)`

**Description:** Accept the connection request from the remote peer. This API extracts the connection request from the queue of pending connections on listening socket and accepts it. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|ClientAddress|- Remote peer address|
|int32_t *|[in]|addressLength|- Length of the address measured in bytes|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- **Precondition** - [rsi_listen()](network5#rsi-listen) API needs to be called before this API.

**References:** [rsi_accept_non_rom](network5#rsi-accept-non-rom) and [SL_PRINTF](network5#sl-printf)

###### rsi_recv_large_data_sync (heading level 7)

`int32_t rsi_recv_large_data_sync(int32_t sockID, int8_t *buffer, int32_t requested_length, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Receive large data on a given socket synchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|int8_t *|[in]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|requested_length|- Requested buffer length|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|fromAddr|- Address of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**References:** [rsi_socket_info_non_rom_s::more_rx_data_pending](rsi-socket-info-non-rom-s#more-rx-data-pending), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_recv](network5#rsi-recv) and [rsi_recvfrom](network5#rsi-recvfrom)

###### rsi_recvfrom (heading level 7)

`int32_t rsi_recvfrom(int32_t sockID, int8_t *buffer, int32_t buffersize, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Retrieve the received data from the remote peer on a given socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor|
|int8_t *|[in]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|buffersize|- Size of the buffer supplied|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|fromAddr|- Address of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API. <br />
- By default, a host can receive a maximum of 1460 bytes of data. If you enable the RSI_PROCESS_MAX_RX_DATA macro in the preprocessor settings, the host will be able to obtain a maximum chunk size of 4380 bytes and The host can request a maximum data length of 16384 bytes

**References:** [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_recv (heading level 7)

`int32_t rsi_recv(int32_t sockID, void *rcvBuffer, int32_t bufferLength, int32_t flags)`

**Description:** Retrieve the data from the remote peer on a specified socket. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|void *|[in]|rcvBuffer|- Pointer to the buffer to hold the data received from the remote peer|
|int32_t|[in]|bufferLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition (TCP client)** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.
- **Precondition (TCP server)** - [rsi_listen()](network5#rsi-listen) and [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- **Precondition (UDP server)** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- **Precondition (UDP client)** - [rsi_socket()](network5#rsi-socket) or [rsi_bind()](network5#rsi-bind) API needs to be called before this API <br />
- By default, a host can receive a maximum of 1460 bytes of data. If you enable the RSI_PROCESS_MAX_RX_DATA macro in the preprocessor settings, the host will be able to obtain a maximum chunk size of 4380 bytes and The host can request a maximum data length of 16384 bytes

**References:** [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_sendto (heading level 7)

`int32_t rsi_sendto(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen)`

**Description:** Send data to the specified remote IP Address on the given socket. This is non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data buffer containing data to send to remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Address of the remote peer to send data|
|int32_t|[in]|destAddrLen|- Length of the address in bytes|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition (TCP client)** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.
- **Precondition (TCP server)** - [rsi_listen()](network5#rsi-listen) and [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- **Precondition (UDP server)** - [rsi_bind()](network5#rsi-bind) API needs to be called before this API.
- **Precondition (UDP client)** - [rsi_socket()](network5#rsi-socket) or [rsi_bind()](network5#rsi-bind) API needs to be called before this API
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom) and [SL_PRINTF](network5#sl-printf)

###### rsi_sendto_async (heading level 7)

`int32_t rsi_sendto_async(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send the data to the specified remote IP Address on the given socket and receive the acknowledgement through the registered call back. This is non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data buffer containing data to send to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Address of the remote peer to send data|
|int32_t|[in]|destAddrLen|- Length of the address in bytes|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|length|- Number of bytes transfered|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**Note**

- The data_transfer_complete_handler callback handler is supported only for TCP data transfer. This handler is supported only when RSI_WLAN_RSP_TCP_ACK_INDICATION feature is enabled in socket_feature_bitmap.

**References:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom)

###### rsi_send (heading level 7)

`int32_t rsi_send(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags)`

**Description:** Sends the data to the remote peer on the given socket. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to the buffer containing data to send to the remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure

**Note**

- **Precondition** - [rsi_connect()](network5#rsi-connect)/ [rsi_accept()](network5#rsi-accept) API needs to be called before this API.
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_wlan_cb_non_rom_s::rsi_uart_data_ack_check](rsi-wlan-cb-non-rom-s#rsi-uart-data-ack-check) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_send_async](network5#rsi-web-socket-send-async)

###### rsi_reset_per_socket_info (heading level 7)

`void rsi_reset_per_socket_info(int32_t sockID)`

**Description:** Reset all the socket related information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_socket_info_non_rom_s::more_data](rsi-socket-info-non-rom-s#more-data), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_socket_info_non_rom_s::rsi_sock_data_tx_done_cb](rsi-socket-info-non-rom-s#rsi-sock-data-tx-done-cb), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb) and [rsi_send_large_data_async](network5#rsi-send-large-data-async)

###### rsi_send_large_data_sync (heading level 7)

`int32_t rsi_send_large_data_sync(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags)`

**Description:** Send large data on a given socket synchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|

**Returns**

- Positive Value - Success, returns the number of bytes sent successfully <br />
- Negative Value - Failure
- Zero - Socket Close Error

**References:** [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_get_error](rtos#rsi-get-error), [rsi_send_async](network5#rsi-send-async), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send](network5#rsi-send)

###### rsi_network_driver_task (heading level 7)

`void rsi_network_driver_task(void)`

**Description:** network task to send large data to send_async API

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||
||[in]|Void||

**Returns**

- Void

**References:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [rsi_task_destroy](rtos#rsi-task-destroy) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

###### rsi_chunk_data_tx_done_cb (heading level 7)

`void rsi_chunk_data_tx_done_cb(int32_t sockID, const uint16_t length)`

**Description:** Send one chunk of data at a time.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const uint16_t|[in]|length|- Length of data to send|

**Returns**

- Void

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_nwk_callback_s::data_transfer_complete_handler](rsi-nwk-callback-s#data-transfer-complete-handler), [rsi_socket_info_non_rom_s::flags](rsi-socket-info-non-rom-s#flags), [rsi_socket_info_non_rom_s::more_data](rsi-socket-info-non-rom-s#more-data), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_clear_event](driver5#rsi-clear-event), [rsi_get_error](rtos#rsi-get-error), [rsi_mask_event](driver5#rsi-mask-event), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_send_async](network5#rsi-send-async), [rsi_nwk_callback_s::rsi_send_large_data_async_complete_callback](rsi-nwk-callback-s#rsi-send-large-data-async-complete-callback), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_unmask_event](driver8#rsi-unmask-event), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_network_driver_task](network5#rsi-network-driver-task) and [rsi_socket_event_handler](network5#rsi-socket-event-handler)

###### rsi_send_large_data_async (heading level 7)

`int32_t rsi_send_large_data_async(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*rsi_sock_data_tx_done_cb)(int32_t sockID, uint16_t total_data_sent))`

**Description:** Send large data on a given socket. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t total_data_sent)|[in]|rsi_sock_data_tx_done_cb|- Pointer to the callback function that will be called after one chunk of data transfer completion|
||[out]|sockID|- Application socket ID|
||[out]|status|- Status of the data transfer|
||[out]|total_data_sent|- Total length of data sent|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- Need to register application callback using The [rsi_wlan_nwk_register_send_large_data_event_cb()](network14#rsi-wlan-nwk-register-send-large-data-event-cb) API to get the complete notify.

**References:** [rsi_socket_info_non_rom_s::buffer](rsi-socket-info-non-rom-s#buffer), [rsi_socket_info_non_rom_s::flags](rsi-socket-info-non-rom-s#flags), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_socket_info_non_rom_s::offset](rsi-socket-info-non-rom-s#offset), [rsi_socket_info_non_rom_s::rem_len](rsi-socket-info-non-rom-s#rem-len), [rsi_get_error](rtos#rsi-get-error), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_send_async](network5#rsi-send-async), [rsi_set_event](driver5#rsi-set-event), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

###### rsi_task_create (heading level 7)

`rsi_task_create((rsi_task_function_t) rsi_network_driver_task,(uint8_t *)"network", RSI_NETWORK_TASK_STACK_SIZE, NULL, RSI_NETWORK_TASK_PRIORITY, &network_task_handle)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|(rsi_task_function_t)|N/A|rsi_network_driver_task||
|(uint8_t *)"network"|N/A|undefined||
|RSI_NETWORK_TASK_STACK_SIZE|N/A|undefined||
|NULL|N/A|undefined||
|RSI_NETWORK_TASK_PRIORITY|N/A|undefined||
|&|N/A|network_task_handle||

###### SL_PRINTF (heading level 7)

`SL_PRINTF(SL_SEND_LARGE_DATA_ASYNC_EXIT_2, NETWORK, LOG_INFO)`

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|SL_SEND_LARGE_DATA_ASYNC_EXIT_2|N/A|undefined||
|NETWORK|N/A|undefined||
|LOG_INFO|N/A|undefined||

**Referenced by:** [rsi_accept](network5#rsi-accept), [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_application_socket_descriptor](network5#rsi-application-socket-descriptor), [rsi_bind](network5#rsi-bind), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_connect](network5#rsi-connect), [rsi_fd_clr](network5#rsi-fd-clr), [rsi_fd_isset](network5#rsi-fd-isset), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [rsi_get_app_socket_descriptor](network5#rsi-get-app-socket-descriptor), [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_get_socket_descriptor](network5#rsi-get-socket-descriptor), [rsi_get_socket_id](network5#rsi-get-socket-id), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_listen](network5#rsi-listen), [rsi_network_app_protocol_config](network5#rsi-network-app-protocol-config), [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_recvfrom](network5#rsi-recvfrom), [rsi_reset_per_socket_info](network5#rsi-reset-per-socket-info), [rsi_select](network5#rsi-select), [rsi_select_get_status](network5#rsi-select-get-status), [rsi_select_set_status](network5#rsi-select-set-status), [rsi_send](network5#rsi-send), [rsi_send_async](network5#rsi-send-async), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto](network5#rsi-sendto), [rsi_sendto_async](network5#rsi-sendto-async), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_set_fd](network5#rsi-set-fd), [rsi_set_sni_emb_socket](network9#rsi-set-sni-emb-socket), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_shutdown](network5#rsi-shutdown), [rsi_socket](network5#rsi-socket), [rsi_socket_async](network5#rsi-socket-async), [rsi_socket_async_non_rom](network5#rsi-socket-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_create_async](network5#rsi-socket-create-async), [rsi_socket_event_handler](network5#rsi-socket-event-handler), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [rsi_tcp_window_update](network16#rsi-tcp-window-update), [rsi_vap_shutdown](network5#rsi-vap-shutdown), [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown), [rsi_wait_on_socket_semaphore](network5#rsi-wait-on-socket-semaphore), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status) and [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status)

###### rsi_find_socket_data_pending (heading level 7)

`uint32_t rsi_find_socket_data_pending(uint32_t event_map)`

**Description:** Find on which socket the data is pending, according to the event that is set from the event map.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|event_map|- Event map|

**Returns**

- Socket ID from the event map

**References:** [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_network_driver_task](network5#rsi-network-driver-task) and [rsi_socket_event_handler](network5#rsi-socket-event-handler)

###### rsi_socket_event_handler (heading level 7)

`void rsi_socket_event_handler(void)`

**Description:** Retrieve the packet from TX data pending queue and forward to the module.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined||

**Returns**

- Void

**References:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_clear_event](driver5#rsi-clear-event), [rsi_find_socket_data_pending](network5#rsi-find-socket-data-pending), [SL_PRINTF](network5#sl-printf) and [rsi_wlan_cb_non_rom_s::socket_bitmap](rsi-wlan-cb-non-rom-s#socket-bitmap)

**Referenced by:** [rsi_events_init](driver5#rsi-events-init)

###### rsi_send_async (heading level 7)

`int32_t rsi_send_async(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data on a given socket asynchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to the buffer containing data to send to the remote peer|
|int32_t|[in]|msgLength|- Length of the buffer|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- Number of bytes received successfully – Success
- Negative value – Failure
- 0 – Socket close error

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.
- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**Note**

- The data_transfer_complete_handler callback handler is supported only for TCP data transfer. This handler is supported only when RSI_WLAN_RSP_TCP_ACK_INDICATION feature is enabled in socket_feature_bitmap.

**References:** [rsi_send_async_non_rom](network5#rsi-send-async-non-rom) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_send_large_data_async](network5#rsi-send-large-data-async) and [rsi_send_large_data_sync](network5#rsi-send-large-data-sync)

###### rsi_vap_shutdown (heading level 7)

`int32_t rsi_vap_shutdown(uint8_t vapID)`

**Description:** Closes all the sockets associate with a vap_Id. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|vapID|- Virtual access point ID|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />  
   Negative Value - Failure

**References:** [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_wlan_ap_stop](wlan#rsi-wlan-ap-stop)

###### rsi_shutdown (heading level 7)

`int32_t rsi_shutdown(int32_t sockID, int32_t how)`

**Description:** Closes the socket specified in a socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|how|- 0: Close the specified socket <br /><br/> 1: Close all the sockets open on a specified socket's source port number|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_socket_shutdown](network5#rsi-socket-shutdown) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_web_socket_close](network5#rsi-web-socket-close) and [rsi_web_socket_create](network5#rsi-web-socket-create)

###### rsi_get_application_socket_descriptor (heading level 7)

`int32_t rsi_get_application_socket_descriptor(int32_t sock_id)`

**Description:** Get the application socket descriptor from module socket descriptor.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sock_id|- Module's socket descriptor ID|

**Returns**

- Positive Value - Success (Application socket descriptor) <br />
- Negative Value - Failure (If module’s socket descriptor is not found)

**References:** [rsi_application_socket_descriptor](network5#rsi-application-socket-descriptor) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done)

###### rsi_clear_sockets (heading level 7)

`void rsi_clear_sockets(int32_t sockID)`

**Description:** Clear socket information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### rsi_fill_tls_extension (heading level 7)

`int rsi_fill_tls_extension(int32_t sockID, int extension_type, const void *option_value, rsi_socklen_t extension_len)`

**Description:** Configure TLS extensions.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int|[in]|extension_type|- Type of TLS extension|
|const void *|[in]|option_value|- TLS extension data|
|rsi_socklen_t|[in]|extension_len|- TLS extension data length|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_socket_info_non_rom_s::extension_offset](rsi-socket-info-non-rom-s#extension-offset), [rsi_tls_tlv_s::length](rsi-tls-tlv-s#length), [memcpy](bt-classic1#memcpy), [rsi_socket_info_non_rom_s::no_of_tls_extensions](rsi-socket-info-non-rom-s#no-of-tls-extensions), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf) and [rsi_tls_tlv_s::type](rsi-tls-tlv-s#type)

**Referenced by:** [rsi_setsockopt](network5#rsi-setsockopt)

###### rsi_setsockopt (heading level 7)

`int rsi_setsockopt(int32_t sockID, int level, int option_name, const void *option_value, rsi_socklen_t option_len)`

**Description:** Set the socket options. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>int32_t</td>
      <td>[in]</td>
      <td>sockID</td>
      <td>- Socket descriptor ID</td>
    </tr>
    <tr>
      <td>int</td>
      <td>[in]</td>
      <td>level</td>
      <td>- Set the socket option, take the socket level</td>
    </tr>
    <tr>
      <td>int</td>
      <td>[in]</td>
      <td>option_name</td>
      <td>- Provide the name of the ID. <br />
 SO_MAXRETRY - To Enable max tcp retry count <br />
 SO_SOCK_VAP_ID - To Configure the socket VAP ID. VAP ID to differentiate between station and AP in concurrent mode. 0 – for station, 1 – for Access point <br />
 SO_TCP_KEEP_ALIVE - To configure the TCP keep alive (initial time in seconds) <br />
 SO_RCVBUF - To configure the application buffer for receiving server certificate <br />
 SO_SSL_ENABLE - To open an SSL/TLS connection over TCP socket. By default supports versions of both TLS 1.0 and TLS 1.2 <br />
 SO_SSL_V_1_0_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.0 <br />
 SO_SSL_V_1_1_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.1 <br />
 SO_SSL_V_1_2_ENABLE - To open an SSL/TLS connection over TCP socket with TLS version 1.2 <br />
 SO_TCP_ACK_INDICATION - To enable tcp ack indication feature <br />
 SO_CERT_INDEX - To enable set certificate index <br />
 SO_HIGH_PERFORMANCE_SOCKET - To Configure the high performance socket <br />
 SO_TCP_MSS - To Configure the tcp mss <br />
 SO_TCP_RETRY_TRANSMIT_TIMER - To Configure the tcp retry transmit timer <br />
 SO_TLS_SNI - To Configure the TLS SNI extension <br />
 SO_RCVTIMEO - To configure the socket-receive timeout using this option. If no data is received within this time, the sapi driver will unblock this API. <br />
 SO_CHECK_CONNECTED_STATE - To check for the connected state <br />
 IP_TOS - To configure the type of service value [0-7] 

|User Priority (UP)|Value Description|Access Category (AC)|
|---|---|---|
|0|Best Effort (default)|AC_BE|
|1|Background|AC_BK|
|2|Spare / Background|AC_BK|
|3|Excellent Effort|AC_BE|
|4|Controlled Load|AC_VI|
|5|Video|AC_VI|
|6|Voice|AC_VO|
|7|Network Control|AC_VO|</td>
    </tr>
    <tr>
      <td>const void *</td>
      <td>[in]</td>
      <td>option_value</td>
      <td>- Value of the parameter</td>
    </tr>
    <tr>
      <td>rsi_socklen_t</td>
      <td>[in]</td>
      <td>option_len</td>
      <td>- Length of the parameter</td>
    </tr>
  </tbody>
</table>

- [rsi_setsockopt()](network5#rsi-setsockopt) API needs to be called after rsi_socket command only.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffe, 0xfffffffd, 0xfffffffc) <br />

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API. <br />
- Default window size is 2920 bytes. To modify window size, user need to configure HIGH_PERFORMANCE socket as option_name in [rsi_setsockopt()](network5#rsi-setsockopt) API

**References:** [rsi_socket_info_s::current_available_buffer_count](rsi-socket-info-s#current-available-buffer-count), [rsi_socket_info_non_rom_s::high_performance_socket](rsi-socket-info-non-rom-s#high-performance-socket), [rsi_socket_info_s::max_available_buffer_count](rsi-socket-info-s#max-available-buffer-count), [rsi_socket_info_non_rom_s::max_retransmission_timeout_value](rsi-socket-info-non-rom-s#max-retransmission-timeout-value), [rsi_socket_info_non_rom_s::max_tcp_retries](rsi-socket-info-non-rom-s#max-tcp-retries), [rsi_socket_info_s::read_time_out](rsi-socket-info-s#read-time-out), [rsi_socket_info_s::recv_buffer](rsi-socket-info-s#recv-buffer), [rsi_socket_info_s::recv_buffer_length](rsi-socket-info-s#recv-buffer-length), [rsi_fill_tls_extension](network5#rsi-fill-tls-extension), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_uint16_to_2bytes](driver12#rsi-uint16-to-2bytes), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::socket_cert_inx](rsi-socket-info-s#socket-cert-inx), [rsi_socket_info_non_rom_s::ssl_bitmap](rsi-socket-info-non-rom-s#ssl-bitmap), [rsi_socket_info_non_rom_s::ssl_buff_len](rsi-socket-info-non-rom-s#ssl-buff-len), [rsi_socket_info_non_rom_s::tcp_mss](rsi-socket-info-non-rom-s#tcp-mss), [rsi_socket_info_non_rom_s::tcp_retry_transmit_timer](rsi-socket-info-non-rom-s#tcp-retry-transmit-timer), [rsi_socket_info_non_rom_s::tos](rsi-socket-info-non-rom-s#tos), [rsi_timeval::tv_sec](rsi-timeval#tv-sec), [rsi_timeval::tv_usec](rsi-timeval#tv-usec) and [rsi_socket_info_non_rom_s::vap_id](rsi-socket-info-non-rom-s#vap-id)

###### rsi_getsockopt (heading level 7)

`int rsi_getsockopt(int32_t sockID, int level, int option_name, const void *option_value, rsi_socklen_t option_len)`

**Description:** Get the socket options. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int|[in]|level|- Set the socket option, take the socket level|
|int|[in]|option_name|- Provide the name of the ID|
|const void *|[in]|option_value|- Value of the parameter|
|rsi_socklen_t|[in]|option_len|- Length of the parameter|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket) API needs to be called before this API.

**References:** [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_get_status](network5#rsi-wlan-socket-get-status), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_select (heading level 7)

`int32_t rsi_select(int32_t nfds, rsi_fd_set *readfds, rsi_fd_set *writefds, rsi_fd_set *exceptfds, struct rsi_timeval *timeout, void(*callback)(rsi_fd_set *fd_read, rsi_fd_set *fd_write, rsi_fd_set *fd_except, int32_t status))`

**Description:** Monitor multiple socket (file descriptors), waiting until one or more of the sockets become ready to perform receive or send operation. If callback is NULL or not provided, it is a blocking API. <br />
 Otherwise, it is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|nfds|- The highest-numbered file descriptor in any of the three sets, plus 1|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|readfds|- Socket descriptors to watch to see if data become available for receive|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|writefds|- Socket descriptors to watch to see if space is available in socket to send data.|
|[rsi_fd_set](rsi-fd-set-s) *|[in]|exceptfds|- Socket descriptors to watch for exception|
|struct [rsi_timeval](rsi-timeval) *|[in]|timeout|- Timeout value to break the wait for select. If both fields of the timeval structure are zero, then select() returns immediately. <br /><br/> (This is useful for polling). If timeout is NULL (no timeout), [rsi_select()](network5#rsi-select) can block indefinitely.|
|void(*)([rsi_fd_set](rsi-fd-set-s) *fd_read, [rsi_fd_set](rsi-fd-set-s) *fd_write, [rsi_fd_set](rsi-fd-set-s) *fd_except, int32_t status)|[in]|callback|- Callback called when asynchronous response reach the select request.|
||[out]|fd_read|- Pointer that holds bitmap for the select on read operation|
||[out]|fd_write|- Pointer that holds bitmap for the select on write operation|
||[out]|fd_except|- Pointer that holds bitmap for the select on exceptional operation|
||[out]|status|- Status code|

**Returns**

- Positive Value - Indicate total number of bits ready across all the descriptor sets <br />
- 0 - Time out <br /><br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_accept()](network5#rsi-accept)/ [rsi_connect()](network5#rsi-connect) API's needs to be called before this API.
- **Precondition** - This API needs to be called before [rsi_recv()](network5#rsi-recv)/ [rsi_recvfrom()](network5#rsi-recvfrom)/ [rsi_send()](network5#rsi-send) API's.
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_fd_set_s::fd_array](rsi-fd-set-s#fd-array), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_semaphore_create](rsi-os-h#rsi-semaphore-create), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

###### calculate_buffers_required (heading level 7)

`uint8_t calculate_buffers_required(uint8_t type, uint16_t length)`

**Description:** Calculate the buffers required.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|type|- Type|
|uint16_t|[in]|length|- Length|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [ROM_WL_API_S::calculate_buffers_required](rom-wl-api-s#calculate-buffers-required)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom)

###### rsi_accept_async (heading level 7)

`int32_t rsi_accept_async(int32_t sockID, void(*callback)(int32_t sock_id, int16_t dest_port, uint8_t *ip_addr, int16_t ip_version))`

**Description:** Accept the connection request from the remote peer and register a callback that will be used by the driver to forward the received connection request asynchronously to the application. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|void(*)(int32_t sock_id, int16_t dest_port, uint8_t *ip_addr, int16_t ip_version)|[in]|callback|- Callback function to indicate the socket parameters connected|
||[out]|sock_id|- Socket descriptor ID|
||[out]|dest_port|- Port number of remote peer|
||[out]|ip_addr|- Remote peer address|
||[out]|ip_version|- 4 - IPV4. <br /><br/> 6 - IPV6|

**Returns**

- > 0 - Client socket ID <br />
- <= 0 - Failure

**Note**

- When attempting to connect multiple clients to the server socket opened on module, i.e., when the backlog parameter is used in [rsi_listen()](network5#rsi-listen) API. [rsi_accept_async()](network5#rsi-accept-async) has to be called again for each of the client connections. <br />  
   The API calling has to be repeated for the next client connection, only after the connection process of the previous client is complete.
- When using multiple client/server sockets, the following macros have to be updated in the wlan_config.h file, in TCP_IP_FEATURE_BIT_MAP - If TCP_IP_TOTAL_SOCKETS_x flag is used, then firmware allocates memory for x sockets. If TCP_IP_TOTAL_SOCKETS_x flag is not passed, then a default value of 10 sockets is used.
- When using multiple client/server sockets, the following macros have to be updated in the [rsi_user.h](rsi-user-8h-source#rsi-user-8h-source) file, RSI_NUMBER_OF_LTCP_SOCKETS -> Number of server sockets and RSI_NUMBER_OF_SOCKETS -> Number of client sockets + Number of server sockets.
- If multiple server sockets are created then the memory allocated for client sockets is to be shared across the multiple server sockets. If RSI_NUMBER_OF_LTCP_SOCKETS is 0 and RSI_NUMBER_OF_SOCKETS is x, y is server sockets and x-y client sockets can be created

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_async](network5#rsi-socket-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_receive_callback](rsi-socket-info-s#sock-receive-callback), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type) and [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port)

###### rsi_get_app_socket_descriptor (heading level 7)

`int32_t rsi_get_app_socket_descriptor(uint8_t *src_port)`

**Description:** Get the application socket descriptor from source port.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|src_port|- Pointer to the socket source port|

**Returns**

- Positive Value - Application socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_get_socket_id (heading level 7)

`int32_t rsi_get_socket_id(uint32_t src_port, uint32_t dst_port)`

**Description:** Get the socket ID from port number.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint32_t|[in]|src_port|- Socket source port number|
|uint32_t|[in]|dst_port|- Socket destination port number|

**Returns**

- Positive Value - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [SL_PRINTF](network5#sl-printf) and [UNUSED_PARAMETER](bt-classic1#unused-parameter)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_get_primary_socket_id (heading level 7)

`int32_t rsi_get_primary_socket_id(uint8_t *port_num)`

**Description:** Get the primary socket ID from port number.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|port_num|- Pointer to port number|

**Returns**

- Positive Value - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom) and [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_certificate_valid (heading level 7)

`int32_t rsi_certificate_valid(uint16_t valid, uint16_t socket_id)`

**Description:** Validate the server certificate received from the module. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint16_t|[in]|valid|- Indicate whether the server certificate is valid or not. <br /><br/> 1 - Indicate that the server certificate is valid. <br /><br/> 0 - Indicate that the server certificate is not valid|
|uint16_t|[in]|socket_id|- Socket identifier|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor), [rsi_set_os_errno](rtos#rsi-set-os-errno), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_socket_create_async (heading level 7)

`int32_t rsi_socket_create_async(int32_t sockID, int32_t type, int32_t backlog)`

**Description:** Send socket create request to the module and receive the response asynchronously. This is a non-blocking API if socket_connect_response_handler is registered. <br />
 Otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Pointer to the global control block|
|int32_t|[in]|type|- Socket descriptor ID|
|int32_t|[in]|backlog|- Type of socket to create|
||[in]|backlog|- Number of backlogs for LTCP socket|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_connect()](network5#rsi-connect) API needs to be called before this API.

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect) and [rsi_socket_listen](network5#rsi-socket-listen)

###### rsi_get_socket_descriptor (heading level 7)

`int32_t rsi_get_socket_descriptor(uint8_t *src_port, uint8_t *dst_port, uint8_t *ip_addr, uint16_t ip_version, uint16_t sockid)`

**Description:** Get the socket descriptor based on source port number, destination port number, destination IP address, and the IP version. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t *|[in]|src_port|- Pointer to source port number|
|uint8_t *|[in]|dst_port|- Pointer to destination port number|
|uint8_t *|[in]|ip_addr|- Pointer to destinaion IP address|
|uint16_t|[in]|ip_version|- IP version either IPv4/IPv6|
|uint16_t|[in]|sockid|- Socket descriptor ID from firmware|

**Returns**

- 0 - Socket descriptor <br />
- Negative Value - If socket is not found

**References:** [rsi_bytes2R_to_uint16](driver12#rsi-bytes2-r-to-uint16), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd)

###### rsi_socket_async_non_rom (heading level 7)

`int32_t rsi_socket_async_non_rom(int32_t protocolFamily, int32_t type, int32_t protocol, void(*callback)(uint32_t sock_no, uint8_t *buffer, uint32_t length))`

**Description:** Create a socket and register a callback that will be used by the driver to forward the received packets asynchronously to the application (on packet reception) <br />
 without waiting for recv API (Add proper API here). This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|protocolFamily|- Protocol family to select IPv4 or IPv6. <br /><br/> AF_INET (2) : Select IPv4, <br /><br/> AF_INET6 (3) : Select IPv6|
|int32_t|[in]|type|- Select socket type UDP or TCP. <br /><br/> SOCK_STREAM (1) : Select TCP, <br /><br/> SOCK_DGRM (2) : Select UDP|
|int32_t|[in]|protocol|- 0: Non-SSL sockets, 1: SSL sockets. <br /><br/> BIT(5) must be enabled to select the certificate index, <br /><br/> 0<<12 for index 0, <br /><br/> 1<<12 for index 1|
|void(*)(uint32_t sock_no, uint8_t *buffer, uint32_t length)|[in]|callback|- Callback function to read data asynchronously from socket <br />|
||[out]|sock_no|- Application socket number|
||[out]|buffer|- Pointer to buffer holding the data|
||[out]|length|- Length of the response buffer|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.

**References:** [rsi_wlan_cb_s::ap_state](rsi-wlan-cb-s#ap-state), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_socket](network5#rsi-socket) and [rsi_socket_async](network5#rsi-socket-async)

###### rsi_socket_connect (heading level 7)

`int32_t rsi_socket_connect(int32_t sockID, struct rsi_sockaddr *remoteAddress, int32_t addressLength)`

**Description:** Connect the socket to specific remote address. This is a non-blocking API, if socket_connect_response_handler() is registered through [rsi_wlan_register_callbacks()](wlan#rsi-wlan-register-callbacks). Otherwise it is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|remoteAddress|- Remote peer address structure|
|int32_t|[in]|addressLength|- Remote peer address structrue length|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [memcpy](bt-classic1#memcpy), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_connect](network5#rsi-connect)

###### rsi_socket_recvfrom (heading level 7)

`int32_t rsi_socket_recvfrom(int32_t sockID, int8_t *buffer, int32_t buffersize, int32_t flags, struct rsi_sockaddr *fromAddr, int32_t *fromAddrLen)`

**Description:** Retrieve the received data from the remote peer on a given socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[out]|buffer|- Pointer to buffer to hold receive data|
|int32_t|[in]|buffersize|- Size of the buffer supplied|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[out]|fromAddr|- Sddress of remote peer, from where current packet was received|
|int32_t *|[in]|fromAddrLen|- Pointer that contains remote peer address (fromAddr) length|

**Returns**

- Positive Value - Number of bytes received successfully
- 0 - Socket close error
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API. <br />

**References:** [rsi_socket_info_s::recv_buffer](rsi-socket-info-s#recv-buffer), [rsi_socket_info_s::recv_buffer_length](rsi-socket-info-s#recv-buffer-length), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [global_cb_s::rx_buffer_mem_copy](global-cb-s#rx-buffer-mem-copy), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_recv_available_length](rsi-socket-info-s#sock-recv-available-length), [rsi_socket_info_non_rom_s::socket_terminate_indication](rsi-socket-info-non-rom-s#socket-terminate-indication), [UNUSED_PARAMETER](bt-classic1#unused-parameter), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync) and [rsi_recvfrom](network5#rsi-recvfrom)

###### rsi_socket_listen (heading level 7)

`int32_t rsi_socket_listen(int32_t sockID, int32_t backlog)`

**Description:** Enable socket to listen for remote connection request in passive mode. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int32_t|[in]|backlog|- Maximum number of pending connections requests|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_info_s::backlogs](rsi-socket-info-s#backlogs), [rsi_socket_info_s::ltcp_socket_type](rsi-socket-info-s#ltcp-socket-type), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_listen](network5#rsi-listen)

###### rsi_vap_sockets_shutdown (heading level 7)

`int32_t rsi_vap_sockets_shutdown(uint8_t vapID)`

**Description:** Close all the sockets associated with a VAP Id. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|vapID|: Virtual Access Point ID|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Note**

- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, though remote socket has terminated connection, socket is disconnected and deleted only if host issues [rsi_shutdown()](network5#rsi-shutdown).

**Returns**

- 0 - Success <br />  
   Negative Value - Failure

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [RSI_SUCCESS](network5#rsi-success) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_vap_shutdown](network5#rsi-vap-shutdown)

###### rsi_socket_shutdown (heading level 7)

`int32_t rsi_socket_shutdown(int32_t sockID, int32_t how)`

**Description:** Close the socket specified in a socket descriptor. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|: Socket descriptor ID|
|int32_t|[in]|how|0: Close the specified socket, <br /><br/> 1: Close all the sockets open on a specified socket's source port number. <br />|

- [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.
- how = 1 is valid for passively open sockets (listen) with more than one backlogs specified. <br />
- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, then to close LTCP socket, argument "how" should be 1. <br />
- If EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE (BIT(16)) in RSI_EXT_TCPIP_FEATURE_BITMAP is enabled, though remote socket has terminated connection, socket is disconnected and deleted only, if host issues [rsi_shutdown()](network5#rsi-shutdown).

**References:** [rsi_socket_info_non_rom_s::close_pending](rsi-socket-info-non-rom-s#close-pending), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_shutdown](network5#rsi-shutdown) and [rsi_vap_sockets_shutdown](network5#rsi-vap-sockets-shutdown)

###### rsi_socket_bind (heading level 7)

`int32_t rsi_socket_bind(int32_t sockID, struct rsi_sockaddr *localAddress, int32_t addressLength)`

**Description:** Assign address to the socket. This is a non-blocking API for TCP and a blocking API for UDP.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|localAddress|- Address that needs to be assigned|
|int32_t|[in]|addressLength|- Length of the socket address|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_state](rsi-socket-info-s#sock-state), [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_bind](network5#rsi-bind)

###### rsi_wait_on_socket_semaphore (heading level 7)

`rsi_error_t rsi_wait_on_socket_semaphore(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)`

**Description:** Wait for network semaphore.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|rsi_semaphore_handle_t *|[in]|semaphore|- Semaphore handle pointer|
|uint32_t|[in]|timeout_ms|- Maximum time to wait to acquire semaphore. If timeout_ms is 0, then wait till semaphore is acquired.|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_semaphore_wait](rsi-os-h#rsi-semaphore-wait), [rsi_driver_cb_non_rom::rsi_wait_timeout_handler_error_cb](rsi-driver-cb-non-rom#rsi-wait-timeout-handler-error-cb) and [SL_PRINTF](network5#sl-printf)

###### rsi_application_socket_descriptor (heading level 7)

`int32_t rsi_application_socket_descriptor(int32_t sock_id)`

**Description:** Get the application socket descriptor from module’s socket descriptor. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sock_id|- Module's socket descriptor ID|

**Returns**

- Positive Value - Application socket descriptor <br />
- Negative Value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom) and [rsi_get_application_socket_descriptor](network5#rsi-get-application-socket-descriptor)

###### rsi_wlan_socket_get_status (heading level 7)

`int32_t rsi_wlan_socket_get_status(int32_t sockID)`

**Description:** Get WLAN socket status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Application socket ID|

**Returns**

- WLAN socket status

**References:** [SL_PRINTF](network5#sl-printf) and [rsi_socket_info_non_rom_s::socket_status](rsi-socket-info-non-rom-s#socket-status)

**Referenced by:** [rsi_chunk_data_tx_done_cb](network5#rsi-chunk-data-tx-done-cb), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_send_large_data_async](network5#rsi-send-large-data-async) and [rsi_send_large_data_sync](network5#rsi-send-large-data-sync)

###### rsi_wlan_socket_set_status (heading level 7)

`void rsi_wlan_socket_set_status(int32_t status, int32_t sockID)`

**Description:** Set WLAN status. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status value to be set|
|int32_t|[in]|sockID|- Application socket ID|

**Returns**

- Void

**References:** [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [SL_PRINTF](network5#sl-printf) and [rsi_socket_info_non_rom_s::socket_status](rsi-socket-info-non-rom-s#socket-status)

**Referenced by:** [rsi_accept_async](network5#rsi-accept-async), [rsi_accept_non_rom](network5#rsi-accept-non-rom), [rsi_certificate_valid](network5#rsi-certificate-valid), [rsi_check_wlan_buffer_full](driver13#rsi-check-wlan-buffer-full), [rsi_clear_sockets_non_rom](network5#rsi-clear-sockets-non-rom), [rsi_driver_process_recv_data_non_rom](driver9#rsi-driver-process-recv-data-non-rom), [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd), [rsi_getsockopt](network5#rsi-getsockopt), [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore), [rsi_recv](network5#rsi-recv), [rsi_recv_large_data_sync](network5#rsi-recv-large-data-sync), [rsi_recvfrom](network5#rsi-recvfrom), [rsi_send_async_non_rom](network5#rsi-send-async-non-rom), [rsi_send_large_data_async](network5#rsi-send-large-data-async), [rsi_send_large_data_sync](network5#rsi-send-large-data-sync), [rsi_sendto_async_non_rom](network5#rsi-sendto-async-non-rom), [rsi_setsockopt](network5#rsi-setsockopt), [rsi_socket_bind](network5#rsi-socket-bind), [rsi_socket_connect](network5#rsi-socket-connect), [rsi_socket_create_async](network5#rsi-socket-create-async), [rsi_socket_listen](network5#rsi-socket-listen), [rsi_socket_recvfrom](network5#rsi-socket-recvfrom), [rsi_socket_shutdown](network5#rsi-socket-shutdown), [rsi_tcp_window_update](network16#rsi-tcp-window-update) and [rsi_wlan_packet_transfer_done](driver13#rsi-wlan-packet-transfer-done)

###### rsi_select_get_status (heading level 7)

`int32_t rsi_select_get_status(int32_t selectid)`

**Description:** Get the status of the socket specified in the select ID.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|selectid|- Socket ID to get the status|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**References:** [rsi_socket_select_info_s::select_status](rsi-socket-select-info-s#select-status) and [SL_PRINTF](network5#sl-printf)

###### rsi_select_set_status (heading level 7)

`void rsi_select_set_status(int32_t status, int32_t selectid)`

**Description:** Set the status of the socket specified in the select ID.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|status|- Status value to be set|
|int32_t|[in]|selectid|- Socket ID on which the status is set|

**Returns**

- Void

**Note**

- **Precondition** - [rsi_socket()](network5#rsi-socket)/ [rsi_socket_async()](network5#rsi-socket-async) API needs to be called before this API.

**References:** [rsi_wlan_set_status](driver13#rsi-wlan-set-status), [rsi_socket_select_info_s::select_status](rsi-socket-select-info-s#select-status) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_driver_process_wlan_recv_cmd](driver13#rsi-driver-process-wlan-recv-cmd) and [rsi_post_waiting_semaphore](driver13#rsi-post-waiting-semaphore)

###### rsi_send_async_non_rom (heading level 7)

`int32_t rsi_send_async_non_rom(int32_t sockID, const int8_t *msg, int32_t msgLength, int32_t flags, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data on a given socket asynchronously.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|const int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- 0 - Success <br />
- Negative Value - Failure

**Note**

- The following table lists the maximum individual chunk of data that can be sent over each supported protocol.

|Protocol|Maximum data chunk (bytes)|
|---|---|
|TCP/LTCP socket|1460|
|LUDP socket|1472|
|Web socket|1450|
|TCP-SSL/LTCP-SSL|1370|
|Web socket over SSL|1362|

**References:** [rsi_in6_addr::_S6_u8](rsi-in6-addr#s6-u8), [rsi_in6_addr::_S6_un](rsi-in6-addr#s6-un), [rsi_socket_info_s::destination_ip_addr](rsi-socket-info-s#destination-ip-addr), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_ip_addr_u::ipv4](rsi-ip-addr-u#ipv4), [rsi_ip_addr_u::ipv6](rsi-ip-addr-u#ipv6), [memcpy](bt-classic1#memcpy), [rsi_sendto_async](network5#rsi-sendto-async), [rsi_set_os_errno](rtos#rsi-set-os-errno), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_in_addr::s_addr](rsi-in-addr#s-addr), [rsi_sockaddr_in6::sin6_addr](rsi-sockaddr-in6#sin6-addr), [rsi_sockaddr_in6::sin6_family](rsi-sockaddr-in6#sin6-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [rsi_sockaddr_in::sin_addr](rsi-sockaddr-in#sin-addr), [rsi_sockaddr_in::sin_family](rsi-sockaddr-in#sin-family), [rsi_sockaddr_in::sin_port](rsi-sockaddr-in#sin-port) and [SL_PRINTF](network5#sl-printf)

**Referenced by:** [rsi_send](network5#rsi-send) and [rsi_send_async](network5#rsi-send-async)

###### rsi_sendto_async_non_rom (heading level 7)

`int32_t rsi_sendto_async_non_rom(int32_t sockID, int8_t *msg, int32_t msgLength, int32_t flags, struct rsi_sockaddr *destAddr, int32_t destAddrLen, void(*data_transfer_complete_handler)(int32_t sockID, uint16_t length))`

**Description:** Send data to specific remote peer on a given socket.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|
|int8_t *|[in]|msg|- Pointer to data that needs to be sent to remote peer|
|int32_t|[in]|msgLength|- Length of data to send|
|int32_t|[in]|flags|- Reserved|
|struct [rsi_sockaddr](rsi-sockaddr) *|[in]|destAddr|- Remote peer address to send data|
|int32_t|[in]|destAddrLen|- Remote peer address length|
|void(*)(int32_t sockID, uint16_t length)|[in]|data_transfer_complete_handler|- Pointer to callback function called after complete data transfer|
||[out]|sockID|- Socket Descriptor ID|
||[out]|length|- Number of bytes transfered|

**Returns**

- Positive Value - Success, Number of bytes sent successfully <br />
- Negative Value - Failure <br />
- 0 - Socket close error

**References:** [calculate_buffers_required](network5#calculate-buffers-required), [rsi_socket_info_s::current_available_buffer_count](rsi-socket-info-s#current-available-buffer-count), [rsi_nwk_callback_s::data_transfer_complete_handler](rsi-nwk-callback-s#data-transfer-complete-handler), [rsi_socket_info_s::destination_port](rsi-socket-info-s#destination-port), [rsi_wlan_cb_s::expected_response](rsi-wlan-cb-s#expected-response), [memcpy](bt-classic1#memcpy), [rsi_socket_info_non_rom_s::mss](rsi-socket-info-non-rom-s#mss), [rsi_wlan_cb_non_rom_s::nwk_callbacks](rsi-wlan-cb-non-rom-s#nwk-callbacks), [global_cb_s::rom_apis_p](global-cb-s#rom-apis-p), [rom_apis_s::ROM_WL_calculate_length_to_send](rom-apis-s#rom-wl-calculate-length-to-send), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_driver_send_data](wlan#rsi-driver-send-data), [rsi_get_error](rtos#rsi-get-error), [rsi_set_os_errno](rtos#rsi-set-os-errno), [rsi_socket_create_async](network5#rsi-socket-create-async), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [rsi_sockaddr::sa_family](rsi-sockaddr#sa-family), [rsi_sockaddr_in6::sin6_port](rsi-sockaddr-in6#sin6-port), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_bitmap](rsi-socket-info-s#sock-bitmap), [rsi_socket_info_s::sock_type](rsi-socket-info-s#sock-type), [UNUSED_PARAMETER](bt-classic1#unused-parameter), [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb) and [rsi_wlan_cb_s::wlan_mutex](rsi-wlan-cb-s#wlan-mutex)

**Referenced by:** [rsi_sendto](network5#rsi-sendto) and [rsi_sendto_async](network5#rsi-sendto-async)

###### rsi_clear_sockets_non_rom (heading level 7)

`void rsi_clear_sockets_non_rom(int32_t sockID)`

**Description:** Clear socket information.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int32_t|[in]|sockID|- Socket descriptor ID|

**Returns**

- Void

**References:** [rsi_socket_info_s::backlog_current_count](rsi-socket-info-s#backlog-current-count), [rsi_wlan_cb_s::opermode](rsi-wlan-cb-s#opermode), [global_cb_s::rsi_driver_cb](global-cb-s#rsi-driver-cb), [rsi_get_primary_socket_id](network5#rsi-get-primary-socket-id), [rsi_post_waiting_socket_semaphore](driver10#rsi-post-waiting-socket-semaphore), [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool), [RSI_SUCCESS](network5#rsi-success), [rsi_wlan_socket_set_status](network5#rsi-wlan-socket-set-status), [SL_PRINTF](network5#sl-printf), [rsi_socket_info_s::sock_state](rsi-socket-info-s#sock-state), [rsi_socket_info_s::source_port](rsi-socket-info-s#source-port) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### rsi_network_app_protocol_config (heading level 7)

`uint32_t rsi_network_app_protocol_config(nw_app_protocol protocol, nw_app_config config_type, void *config, uint16_t config_length)`

**Description:** Set the network application protocols configuration. This is a non-blocking API.

**Parameters:**

<table>
  <thead>
    <th>Type</th>
    <th>Direction</th>
    <th>Argument Name</th>
    <th>Description</th>
  </thead>
  <tbody>
    <tr>
      <td>nw_app_protocol</td>
      <td>[in]</td>
      <td>protocol</td>
      <td>- The following table lists in below 

|Protocol|Value|
|---|---|
|RSI_HTTP|0|</td>
    </tr>
    <tr>
      <td>nw_app_config</td>
      <td>[in]</td>
      <td>config_type</td>
      <td>- The following table lists in below 

|config_type|Value|
|---|---|
|RSI_CIPHER_SELECTION|0|</td>
    </tr>
    <tr>
      <td>void *</td>
      <td>[in]</td>
      <td>config</td>
      <td>- The following table lists in below 

|Protocol|config_type|config|
|---|---|---|
|RSI_HTTP|RSI_CIPHER_SELECTION|Configure the Cipher values as explained on the [SSL/TLS Cipher Selection](ssl-ciphers-selection) page.|</td>
    </tr>
    <tr>
      <td>uint16_t</td>
      <td>[in]</td>
      <td>config_length</td>
      <td>- Length of the config parameter</td>
    </tr>
  </tbody>
</table>

- [rsi_network_app_protocol_config()](network5#rsi-network-app-protocol-config) API needs to be called after only.

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xffffff82) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API needs to be called before this API.
- Examples : rsi_network_app_protocol_config(RSI_HTTP, RSI_CIPHER_SELECTION, &cipher_value, 4); <br />  
   cipher_value : (SSL_NEW_CIPHERS | BIT_DHE_RSA_GCM | BIT_ECDHE_RSA_GCM ) <br />
- RSI_WLAN_REQ_NWK_APP_PROTOCOL_CONFIG is introduced to pass network application configurations to firmware.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](network5#rsi-success), [SL_PRINTF](network5#sl-printf) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

###### ROM_WL_rsi_get_application_socket_descriptor (heading level 7)

`int32_t ROM_WL_rsi_get_application_socket_descriptor(global_cb_t *global_cb_p, int32_t sock_id)`

**Description:** Get the application socket descriptor from module’s socket descriptor. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|int32_t|[in]|sock_id|- Module's socket descriptor|

**Returns**

- Positive value - Application socket descriptor <br />
- Negative value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool)

###### ROM_WL_rsi_get_primary_socket_id (heading level 7)

`int32_t ROM_WL_rsi_get_primary_socket_id(global_cb_t *global_cb_p, uint16_t port_number)`

**Description:** Get socket descriptor from port_number. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint16_t|[in]|port_number|- Port number|

**Returns**

- Positive value - Socket descriptor <br />
- Negative value - If socket is not found

**References:** [global_cb_s::rsi_socket_pool](global-cb-s#rsi-socket-pool)

###### ROM_WL_calculate_buffers_required (heading level 7)

`uint8_t ROM_WL_calculate_buffers_required(global_cb_t *global_cb_p, uint8_t type, uint16_t length)`

**Description:** Calculate number of buffers required for the data packet. <br />
 This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint8_t|[in]|type|- Type of socket to create|
|uint16_t|[in]|length|- Length of the message|

**Returns**

- Number of buffers required for the data packet

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### ROM_WL_calculate_length_to_send (heading level 7)

`uint16_t ROM_WL_calculate_length_to_send(global_cb_t *global_cb_p, uint8_t type, uint8_t buffers)`

**Description:** Calculate the length available in the buffers for the message. This is a non-blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|[global_cb_t](global-cb-s) *|[in]|global_cb_p|- Pointer to the global control block|
|uint8_t|[in]|type|- Type of the socket stream|
|uint8_t|[in]|buffers|- Available buffers|

**Returns**

- Length available in the buffers for message

**References:** [UNUSED_PARAMETER](bt-classic1#unused-parameter)

###### rsi_socket_config (heading level 7)

`int32_t rsi_socket_config(void)`

**Description:** Set the socket configuration parameters. The configurations can be done using the Socket configuration in the rsi_wlan_config.h file. <br />
 Using this API is highly recommended. Based on the socket configuration, module will use available buffers effectively. <br />
 This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|N/A|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021, 0x0025, 0x002C, 0xFF6D) <br />

**Note**

- **Precondition** - [rsi_config_ipaddress()](wlan#rsi-config-ipaddress) API and socket creation should be done before this API is called.
- The following parameters are provided by user,  
  |Parameters|Description|  
  |---|---|  
  |total socket|Desired total number of sockets to open|  
  |total_tcp_sockets|Desired total number of TCP sockets to open|  
  |total_udp_sockets|Desired total number of UDP sockets to open|  
  |tcp_tx_only_sockets|Desired total number of TCP sockets to open which are used only for data transmission|  
  |tcp_rx_only_sockets|Desired total number of TCP sockets to open which are used only for data reception|  
  |udp_tx_only_sockets|Desired total number of UDP sockets to open which are used only for data transmission|  
  |udp_rx_only_sockets|Desired total number of UDP sockets to open which are used only for data reception|  
  |tcp_rx_high_performance_sockets|Desired total number of high performance TCP sockets to open. High performance sockets can be <br />|  
  ^ allocated with more buffers based on the buffers availability. This option is valid only for TCP <br />  
   ^ data receive sockets. Socket can be opened as high performance by setting high performance bit in <br />  
   ^ socket create command. tcp_rx_window_size_cap | Desired total to increase the TCP RX window size tcp_ack_window_div_factor | In case of high latency networks to configure the TCP ACK division factor with respective to the <br />  
   ^ window size; Increases the ACK frequency for asynchronous sockets <br />  
   ^ Note: <br />  
   ^ Default value is tcp_rx_window_size_cap.
- The following conditions must be met: <br />
- total_sockets <= Maximum allowed sockets(10) <br />
- (total_tcp_sockets + total_udp_sockets) <= total_sockets <br />
- (total_tcp_tx_only_sockets + total_tcp_rx_only_sockets) <= total_tcp_sockets <br />
- (total_udp_tx_only_sockets + total_udp_rx_only_sockets) <= total_udp_sockets <br />
- total_tcp_rx_high_performance_sockets <= total_tcp_rx_only_sockets <br />
- Refer to [Error Codes](error-codes) for the description of above error codes.

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [rsi_socket_config](network5#rsi-socket-config), [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_socket_config](network5#rsi-socket-config)

##### rsi_wlan_req_radio

###### Functions

###### rsi_wlan_req_radio (heading level 7)

`int32_t rsi_wlan_req_radio(uint8_t enable)`

**Description:** Register and Deregister WLAN radio.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|uint8_t|[in]|enable|- To register and deregister WLAN radio|
||[out]|RSI_SUCCESS||

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure

**References:** [rsi_check_and_update_cmd_state](driver5#rsi-check-and-update-cmd-state), [RSI_SUCCESS](bt-classic1#rsi-success), [SL_PRINTF](bt-classic1#sl-printf), [rsi_wlan_cb_s::state](rsi-wlan-cb-s#state) and [rsi_driver_cb_s::wlan_cb](rsi-driver-cb-s#wlan-cb)

**Referenced by:** [rsi_wlan_radio_deinit](network17#rsi-wlan-radio-deinit)

###### rsi_wlan_radio_deinit (heading level 7)

`int32_t rsi_wlan_radio_deinit(void)`

**Description:** Deregister WLAN radio. This is a blocking API.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|void|[in]|undefined|<br />|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0x0021,0x0067) <br />

**Note**

- If [rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is called after [rsi_wlan_scan()](wlan#rsi-wlan-scan). Need to call [rsi_wlan_scan()](wlan#rsi-wlan-scan) API again after the [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init). <br />
- If [rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is allowed before WLAN connected state only.<br />

###### Below APIs are allowed after rsi_wlan_radio_deinit() API (heading level 8)

1. [rsi_wlan_radio_init()](wlan#rsi-wlan-radio-init)
2. [rsi_wlan_power_save_profile()](wlan#rsi-wlan-power-save-profile)
3. [rsi_wlan_get()](wlan#rsi-wlan-get) In this API only RSI_MAC_ADDRESS and RSI_CONNECTION_STATUS cmd_type are allowed.
4. [rsi_wireless_deinit()](common#rsi-wireless-deinit)
5. [rsi_switch_proto()](common#rsi-switch-proto)
6. [rsi_get_ram_log()](common#rsi-get-ram-log)
7. [rsi_get_fw_version()](common#rsi-get-fw-version)
8. [rsi_common_debug_log()](common#rsi-common-debug-log)
9. [rsi_bt_power_save_profile()](bt-ble#rsi-bt-power-save-profile)**Note**  
   - **Precondition** - The application should be in radio init and unconnected state before calling this function. <br />[rsi_wlan_radio_deinit()](network17#rsi-wlan-radio-deinit) API is called after [rsi_wlan_scan()](wlan#rsi-wlan-scan)

**References:** [RSI_SUCCESS](bt-classic1#rsi-success), [rsi_wlan_req_radio](network17#rsi-wlan-req-radio) and [SL_PRINTF](bt-classic1#sl-printf)

##### rsi_wlan_add_mfi_ie

###### Functions

###### rsi_wlan_add_mfi_ie (heading level 7)

`int32_t rsi_wlan_add_mfi_ie(int8_t *mfi_ie, uint32_t ie_len)`

**Description:** Add the Apple defined IE elements to the beacon command request structure.

**Parameters:**

|Type|Direction|Argument Name|Description|
|----|---------|-------------|-----------|
|int8_t *|[in]|mfi_ie|- Pointer to the IE element|
|uint32_t|[in]|ie_len|- Length of the IE element|

**Returns**

- 0 - Success <br />
- Non-Zero Value - Failure (**Possible Error Codes** - 0xfffffffa)<br />

## Example Applications

### WiSeConnect™ Example Applications

The WiSeConnect™ SDK includes a large number of examples that illustrate how to use the RS9116W.  Each example includes ready-made projects for EFx32 and STM32 host MCU's that are simple to import into a target IDE and begin development.

To get started using the example applications, follow the instructions in on one of the getting started guides below:

- [**Getting Started with EFx32 Host**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-efx32/)
- [**Getting Started with STM32 Host**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-stm32/)
- [**Getting Started with PC using AT Commands**]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/)

The examples may be run on many other embedded host MCU's by porting the WiSeConnect™ driver software as described in the [RS9116W SAPI Porting Guide](https://www.silabs.com/documents/login/reference-manuals/rs9116w-sapi-porting-guide.pdf).

The examples included in the WiSeConnect™ SDK are organized into the following types.  Each example includes documentation that describes how to configure and operate the example.  More details are available at the links below:

- [**Featured Examples**]({docSpace}/{docSpaceVersion}/wifibt-wc-featured-examples/) - Full featured projects that demonstrate a common RS9116 use-case or enable you to perform a key aspect of RS9116 evaluation.
- [**Snippet Examples**]({docSpace}/{docSpaceVersion}/wifibt-wc-snippet-examples/) - Smaller projects that focus on one particular feature or API.
- [**AT Command Examples**]({docSpace}/{docSpaceVersion}/wifibt-wc-at-command-examples/) - Pre-built Tera Term scripts used for evaluating the RS9116 directly from a PC.

### AT Command Examples

#### AT Command Examples

The AT-Command examples provided in the WiSeConnect™ SDK are Tera Term scripts that demonstrate basic RS9116W functionality using only a RS9116 Evaluation Kit and a PC.  More details can be found in [Getting Started with PC using AT Commands]({docSpace}/{docSpaceVersion}/wifibt-wc-getting-started-with-pc/)

The scripts are found in the WiSeConnect™ SDK at the path `<SDK>/examples/at_commands`

Details on the configuration and operation of each example are available in the `readme.md` file that is found with the example source code and at the following links:

[**BLE Proximity Profile**](ble-proximity-profile-readme)<br />Demonstrates setting up the device as a BLE Proximity Profile Device.

[**BLE Central**](ble-central-readme)<br />Demonstrates setting up the device as a BLE Central device.

[**Wi-Fi Enterprise Authentication**](wlan-eap-peap-station-readme)<br />Demonstrates connecting to a Wi-Fi access point in station mode using enterprise authenticarion.

[**Wi-Fi Low Power + BLE**](low-power-station-with-ble-readme)<br />Demonstrates Wi-Fi Station standby associated power save functionality along with BLE advertising.

[**Wi-Fi Low Power**](low-power-station-readme)<br />Demonstrates Wi-Fi Station standby associated power save functionality allowing the user to measure and evaluate the low-power consumption of the device.

[**BT SPP Slave**](spp-slave-readme)<br />Demonstrates setting up the device as a Bluetooth Serial Port Profile (SPP) Slave.

[**Wi-Fi Soft AP**](ap-mode-readme)<br />Demonstrates setting up the device as a Wi-Fi Access Point and connecting to it from a mobile phone or PC

[**BLE Heart Rate Profile**](ble-heart-rate-profile-readme)<br />Demonstrates setting up the device as a Bluetooth Low Energy Heart Rate Profile.

[**BT SPP Master**](spp-master-readme)<br />Demonstrates setting up the device as a Bluetooth Serial Port Profile (SPP) master.

[**BT PER**](bt-per-readme)<br />Demonstrates setting up the device as a BT PER Transmit/Receive functionality.

[**BLE PER**](ble-per-readme)<br />Demonstrates setting up the device as a BLE Per device.

[**BLE Peripheral**](ble-peripheral-readme)<br />Demonstrates setting up the device as a BLE Peripheral device.

[**Wi-Fi Station**](station-mode-readme)<br />Demonstrates connecting to a Wi-Fi access point in station mode.

#### BLE Proximity Profile Tera Term Script

This application demonstrates how to use the RS9116W BLE proximity profile with AT commands over UART. A mobile device running the [Silabs EFR Connect app](https://www.silabs.com/developers/efr-connect-mobile-app) is required for the demonstration.

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu, select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm` containing example scripts and select the file `ble_proximity_profile.ttl`.

![Tera Term script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts.png)

**STEP 4.** After running the `ble_proximity_profile.ttl` script, a pop-up appears. Select OK to continue.

![Application Start pop up](/wifibt-wc-at-command-examples/2.14.0/images/starting-popup-message-1.png)

**STEP 5.** The autobaud process runs and shows a pop-up with the text "Firmware Loading Done". Select OK to continue.

![Opermode command success](/wifibt-wc-at-command-examples/2.14.0/images/firmware-update-done-2.png)

**STEP 6.** The command sequence executes in turn, eventually putting the RS9116W into an advertising state.

![Band input prompt](/wifibt-wc-at-command-examples/2.14.0/images/advertising-state-3.png)

**STEP 7.** Using the [Silabs EFR Connect](#using-the-efr-connect-app) app, scan for and connect to the RS9116W

![Init command success](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-connected-4.png)

**STEP 8.** After a successful connection, the script waits for the 'Alert Level' to be set by the EFR Connect app. The alert level is used for proximity alert indication.

![IPConfig Success](/wifibt-wc-at-command-examples/2.14.0/images/alert-level-selection-5.png)

**STEP 9.** Using the EFR Connect app, the alert level can be set to: no alert, mild alert, or high alert. See [Using the EFR Connect App](#using-the-efr-connect-app).

![IPConfig Success](/wifibt-wc-at-command-examples/2.14.0/images/selected-alert-level-6.png)

**STEP 10.** After the alert level is set, the script runs in a loop. If the RS9116W moves too far from the mobile device running the EFR Connect app, an alert shows. The RSSI threshold configured in the script is `-60 dBm`. In the following example, the RSSI is `-52` which is higher than the threshold. In this case, the alert shows as `0x00` which means no alert.

![Security mode input prompt](/wifibt-wc-at-command-examples/2.14.0/images/no-alert-7.png)

**STEP 11.** In the following example, the RSSI is `-62` which is lower than the threshold. In this case, the alert shows as `0x01` causing a mild alert to be generated.

![Security mode input prompt](/wifibt-wc-at-command-examples/2.14.0/images/mild-alert-8.png)

##### Using the EFR Connect App

The [Silabs EFR Connect](https://www.silabs.com/developers/efr-connect-mobile-app) mobile app can be used to connect to the RS9116W.

**STEP 1.**  Open the 'EFR Connect' app, select 'Browser' and scan for the RS9116W device.

![waiting for station to connect](/wifibt-wc-at-command-examples/2.14.0/images/opening-connect-app-1.png)

**STEP 2.** Select 'Connect' to connect with the RS9116W.

![waiting for firmware upgrade](/wifibt-wc-at-command-examples/2.14.0/images/scanning-devices-2.png)

**STEP 3.**  Select the 'Link Loss' service.

![waiting for firmware upgrade](/wifibt-wc-at-command-examples/2.14.0/images/link-loss-service-3.png)

**STEP 4.** The 'Alert Level' characteristic shows.

![waiting for firmware upgrade](/wifibt-wc-at-command-examples/2.14.0/images/alert-char-service-4.png)

**STEP 5.** Select the desired alert level.

![webpage](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-alert-selection-5.png)
![webpage](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-mild-alert-selection-6.png)

**STEP 6.**  In this example, a mild alert is selected.

![Upgrade in progress](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-read-mild-alert-7.png)

**STEP 7.**  As the RSSI increases and decreases, the alert level changes to indicate whether the distance between the RS9116W and mobile device running the EFR Connect app is exceeded.

![Upgrade in progress](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-read-no-alert-8.png)

#### BLE Central (Main) Mode Tera Term Script

This application demonstrates how to connect with a remote BLE device in BLE central mode.

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

To run this example the user will be required to enter the Address type (0- for Public and 1- for random) of the remote device and remote device's BD address(XX-XX-XX-XX-XX-XX).

User needs to have BLE Peripheral. `"EFR Connect"` Mobile App some other Apps or devices of user's choice can be used for this. Refer the "Configuring Remote device as BLE Slave" section to configure the "EFR Connect" as "BLE Advertiser".

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![TeraTerm Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/ble_central` and select the file `ble_central.ttl`.

![Tera Term Script to be loaded](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-ble-central.png)

**STEP 4.** The script will perform the following command sequence:

1. Opermode
2. Setlocalname
3. Get local address

**STEP 5.** After the "scan" command Tera Term will begin outputting advertising reports.

![BLE Central Prompt](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-prompt-scan-enabled.png)

**STEP 6.** Advertise reports  come up with "Address" "RSSI" , "Adv data length" & "Adv data" .

![BLE Central scan disable prompt](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-prompt-scan-disable.png)

**STEP 7.** Enter the address type user needs to enter the Address type(i.e. 0 - Public address and 1 - Random address)  as given below , we share here "Random Address".

![Enter address type](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-prompt-enter-the-address-type.png)

**STEP 8.** After address type selection user is prompted to enter the Remote BLE Device Address to connect to the Silabs BLE Central.

![Connect to BLE central](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-prompt-connect-to-the-ble-central.png)

**STEP 9.** After entering the Remote BLE Device Address Silabs BLE Central device will initiate connection with the Remote BLE Device.

![BLE Device Connected](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-prompt-ble-device-connected.png)

**STEP 10.** When Silabs BLE Central device is connected to the Remote device, the Silicon Labs BLE device will query the profiles  from the Remote device.

**STEP 11.** Next it will ask the input to enter the "Handle" to read the value on Remote device.

![Handle](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-handle-to-read-value.png)

**STEP 12.** When we enter the "Handle" as input to read the value on Remote device, it will read the value.

![Handle](/wifibt-wc-at-command-examples/2.14.0/images/ble-central-mode-handle.png)

##### Configuring Remote device as BLE Peripheral (Slave)

**STEP 1.** Open "EFR Connect" App in the Mobile device.

![Open EFR Connnect App](/wifibt-wc-at-command-examples/2.14.0/images/efr-connect-app-open-1.png)

**STEP 2.** Go to the "GATT Configurator" to create the GATT server with services.

![Open GATT Configurator](/wifibt-wc-at-command-examples/2.14.0/images/gatt-configurator-open-2.png)

**STEP 3.** Create the GATT server and add services to that server.

![Create Gatt Server](/wifibt-wc-at-command-examples/2.14.0/images/create-server-3.png)

**STEP 4.** Click on the created Gatt Server and Add the services using the "Add Service" button.

![Click on created Gatt Server](/wifibt-wc-at-command-examples/2.14.0/images/add-service-4.png)

**STEP 5.** Once you click on the "Add service" button, we will get the window to add the service. Once you add the service, enable the "Add mandatory service requirements" and  save the configuration.

![Add Service](/wifibt-wc-at-command-examples/2.14.0/images/heart-rate-service-adding-5.png)

**STEP 6.** After saving the configuration, you can see the added service under the "GATT Server".

![See the added service unser gatt server](/wifibt-wc-at-command-examples/2.14.0/images/service-added-checking-6.png)

**STEP 7.** Now enable the created GATT server.

![Enable the created Gatt server](/wifibt-wc-at-command-examples/2.14.0/images/enable-gatt-server-7.png)

**STEP 8.** Come back to "home page" of EFR Connect app and open "Advertiser" and create the "Advertiser".

![open the advertiser](/wifibt-wc-at-command-examples/2.14.0/images/open-advertiser-create-advertiser-8.png)

**STEP 9.** Open the created "Advertiser" add the required configuration (such as, "Advertising Data", "Scan Response Data", etc.), then save the configuration.

![Adding configuration in advertiser](/wifibt-wc-at-command-examples/2.14.0/images/open-created-advertiser-set-advert-name-9.png)

**STEP 10.** Click on the created "Advertiser" and see the added configuartion like "Advertising Type", "Flags", etc.

![Checking Advertiser configuration](/wifibt-wc-at-command-examples/2.14.0/images/exapand-advertiser-10.png)

**STEP 11.** Now enable the created "Advertiser" to advertise the device, this device should now be visible to BLE scanners.

![Enable the Advertiser](/wifibt-wc-at-command-examples/2.14.0/images/enable-advertiser-11.png)

#### Wi-Fi Client in Enterprise Security Mode Tera Term Script

This application demonstrates the procedure about how to configure the RS9116W Module in WLAN STA mode where Access Point is configured with Enterprise Security (PEAP MSCHAPv2 Method).

Before continuing, ensure the RS9116 EVK is plugged into your computer and TeraTerm is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/wlan_eap_peap_station` and select the file `wlan_eap_peap_station.ttl`.

For running this script user need to use wlan_eap_peap_station.ttl from the list.

![Tera Term script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-eap-station.png)

**STEP 4.** The first command it will go as `at+rsi_opermode=2,0,4,0` after running the TTL script, This command configures the module as a Wi-Fi client (Enterprise security). The module responds with “OK”.

Tera Term will pop up for input (band) from the user, the user needs to enter the band and hit 'OK', (at+rsi_band=0)This command configures the operating band of the Wi-Fi client to 2.4GHz. The module responds with “OK”

![Band Input prompt](/wifibt-wc-at-command-examples/2.14.0/images/band.png)

**STEP 5.** The next command will go as `at+rsi_init`, This command initializes the Wi-Fi module in the EVB. The module responds with `OK <MAC_Address>`.

**STEP 6.** Tera Term will pop up for input (eap method) from the user. The user needs to enter the EAP method and hit 'OK'.

![EAP Method input](/wifibt-wc-at-command-examples/2.14.0/images/eap-method.png)

**STEP 7.**  Tera Term will pop up for input (EAP inner method) from the user, the user needs to enter the eap inner method and hit 'OK'.

![EAP Inner method input](/wifibt-wc-at-command-examples/2.14.0/images/eap-inner-method.png)

**STEP 8.** Tera Term will pop up for input (User identity) from the user, the user needs to enter the User identity and hit 'OK'.

![User identity](/wifibt-wc-at-command-examples/2.14.0/images/user-identity.png)

**STEP 9.** Tera Term will pop up for input (password) from the user, the user needs to enter the password and hit 'OK'.

![Password entry prompt](/wifibt-wc-at-command-examples/2.14.0/images/enter-password.png)

**STEP 10.** The command will go as `at+rsi_eap=PEAP,MSCHAPV2,user1,test123` This command set the EAP mode for the module and set the authentication credentials (username and password).

**STEP 11.** Tera Term will pop up for scan SSID input from the user, the user needs to enter the SSID to scan and hit 'OK', (`at+rsi_scan=0,linksys`) This command scans for particular Access Point operating in the 2.4 GHz band.

The module responds with information of the Access Points scanned. The data received might have some unreadable characters because of ASCII conversion.

![SSID input prompt](/wifibt-wc-at-command-examples/2.14.0/images/enter-ssid.png)

**STEP 12.** The next command will go as `at+rsi_join=linksys,0,2,6`. This command connects the Wi-Fi client to the Access Point with SSID "linksys”. On successful association, the module responds with OK.

![Join scuccess](/wifibt-wc-at-command-examples/2.14.0/images/join-successful.png)

**STEP 13.** After join successful next command will go as `at+rsi_ipconf=1`, This command configures the IP address of the module.

**STEP 14.** It will open a TCP Server socket on the Wi-Fi Client (EVB) side using the following AT command `at+rsi_ltcp=5001`, The module’s response will look as follows:

`OK<ip_version><socket_type><socket_handle><Lport><module_ipaddr>`

The pop up window will display "Device is now listening for TCP connections on address x.x.x.x and port y" where x.x.x.x is the IP address and 'y' is the port number of the module socket.

![Serve IP address and port](/wifibt-wc-at-command-examples/2.14.0/images/tcp-connection.png)

**STEP 15.** Open a TCP client socket on a remote peer and connect to the Server socket by giving the server IP and port number.

**STEP 16.** Observe that the Teraterm on the Wi-Fi Client-side (EVB) prints the following message, once the TCP connection is set up with the remote peer.

`AT+RSI_LTCP_CONNECT=<ip_version><socket_descriptor><dest_port_no><dest_ipaddr><mss><window_size><src_port_no>`

Note that the data received might have some unreadable characters because of ASCII conversion

**STEP 17.** When the data is received on the Wi-Fi Client (EVB) side, you will see a response (asynchronous) from the module as follows:

![TCP connection and data](/wifibt-wc-at-command-examples/2.14.0/images/data-received-on-wifi-client.png)

#### Low Power Standby Associated Station and BLE Advertising Tera Term Script

This application demonstrates the procedure about how to configure the RS9116W Module in coex mode (WLAN STA + BLE)mode and putting module in low power (WLAN standby associated) state and ble connected power save.

##### Connecting the RS9116 EVK to your PC to the perform current measurements

To do this you will perform the following:

1. Connect the EVK’s UART port to your PC using the included USB A to USB Micro cable.
2. Connect the EVK to your current meter through its “MEASUREMENT” port.

Note: To measure lowest possible power, it is recommended to use UART to issue commands. It allows device to go to its lowest power states. USB-CDC keeps the USB port alive, and USB is not a low power interface.

Your current meter’s positive and negative terminals should be connected as shown in the picture below. This picture also shows the connection of the USB cable between your PC and the EVK board

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/connection-setup-1.png)

##### Performing the current measurement

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

After doing so, start your current meter in continuous DC current measurement mode with a range of 1 A.

As an example, the Keithley DMM6500 current meter was used. It is set as shown below using its PC-based Kickstart interface software.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/keithley-kickstart-software-2.png)

##### Running the Example

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/wlan_low_power_with_ble` and select the file `low_power_station_with_ble.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-low-power-ble.png)

**STEP 4.** Opermode command  configures the module as Wi-Fi Station and BLE operating mode. The module responds with “OK” & “bt_loaded”.

`at+rsi_opermode=851968,20,2147483652,2147483648,2159542272,3221225472,2147483648,1075773440,0,1`

![Opermode command success](/wifibt-wc-at-command-examples/2.14.0/images/opermode-successful.png)

**STEP 5.** Feat_frame command configures to use LP chain in standby associcated mode. Feat_frame Successful pop will come and you confirm by selecting “OK”

![Feature frame command success](/wifibt-wc-at-command-examples/2.14.0/images/featframe-successful.png)

Now Module will be configured to start BLE advertising using following commands. Once success, observe the pop up _“Device is now advertising as a RS9116W_BLE....."_. You can  use Silabs _"EFR Connect"_ Mobile app to check for the same.

`1. Set Local Name`

`2. Get a local BD address.`

`3. Set Advertise Data`

`4. Advertise command.`

![BLE Advertise](/wifibt-wc-at-command-examples/2.14.0/images/ble-adv-name.png)

**STEP 7.**  Now we configure the WLAN Station starting with the 2.4GHz band configuration and the module responds with “OK”.

![Band success](/wifibt-wc-at-command-examples/2.14.0/images/band-success.png)

**STEP 8.** `at+rsi_init` command initializes the RF of the module. The module responds with OK<MAC_Address> (can be seen in Hex)

![init command success](/wifibt-wc-at-command-examples/2.14.0/images/init-success.png)

**STEP 9.**  Pop up comes to provide input for SSID of the AP to be connected, select 'OK' to proceed (make sure SSID is entered correectly),

`at+rsi_scan=0,Silicon_labs`

This command scans for particular Access Point operating in all channels.
The module responds with information of the Access Points scanned.

`The data received might have some unreadable characters because of ASCII conversion.`

![SSID input prompt](/wifibt-wc-at-command-examples/2.14.0/images/enter-ssid.png)

**STEP 10.** Once “scan successful” comes, select “OK”.

![Scan success](/wifibt-wc-at-command-examples/2.14.0/images/scan-successful-low-power-wlan-ble.png)

**STEP 11.** Next pop up asks for pre shared key (PSK) input from the user, enter the PSK of desired Access Point and hit 'OK'.

![PSK Input prompt](/wifibt-wc-at-command-examples/2.14.0/images/enter-psk.png)

**STEP 12.**

`at+rsi_join=Silicon_labs,0,2,6`

This command connects the Wi-Fi client to the Access Point with SSID "Silicon_labs”. On successful association, the module responds with OK.

![AP join success](/wifibt-wc-at-command-examples/2.14.0/images/joined-ap-successfully.png)

**STEP 13.**  After join successful next command will get the IP address from the DHCP server running on AP.

`at+rsi_ipconf=1`

![ipconfig success](/wifibt-wc-at-command-examples/2.14.0/images/sta-coex-ipconfig.png)

**STEP 14.** After successfully getting the IP address module can now enter in low power mode (Standby Associated Mode).
Power save success pop up will come. Go with "ok" response.

![Power save success](/wifibt-wc-at-command-examples/2.14.0/images/sta-coex-power.png)

User can now measure the power consumption if power meter is connected on EVK Jumper J19 "Measurement".

#### WLAN Low Power Standby Associated Station Tera Term Script

This application demonstrates the procedure to connect RS9116W to an Access Point. Once connected put the module in low power (WLAN standby associated) state.

##### Connecting the RS9116 EVK to your PC to the perform current measurements

To do this you will perform the following:

1. Connect the EVK’s UART port to your PC using the included USB A to USB Micro cable.
2. Connect the EVK to your current meter through its “MEASUREMENT” port.

Note: To measure lowest possible power, it is recommended to use UART to issue commands. It allows device to go to its lowest power states. USB-CDC keeps the USB port alive, and USB is not a low-power interface.

Your current meter’s positive and negative terminals should be connected as shown in the picture below. This picture also shows the connection of the USB cable between your PC and the EVK board.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/connection-setup-1.png)

##### Performing the current measurement

Before continuing, ensure the RS9116 EVK is plugged into your computer and TeraTerm is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

After doing so, start your current meter in continuous DC current measurement mode with a range of 1 A.

As an example, the Keithley DMM6500 current meter was used. It is set as shown below using its PC-based Kickstart interface software.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/keithley-kickstart-software-2.png)

##### Running the Example

**STEP 1.** Once the current meter is set to do the measurement, reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu, select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/wlan_low_power`  and select the file `low_power_station.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-low-power-wlan.png)

Note: The OPERMODE in this TTL script is configured default for EVK Version 1.4. If the user wants to run the same TTL script on  EVK version which is older than 1.4, then user has to comment 1.4 EVK Version OPERMODE and uncomment 1.3 EVK Version OPERMODE.

To identify the EVK is the 1.3 or 1.4 version, you can check the J9 Connector on EVK. If the J9 Connector has UULP_0 and UULP_2, it is the 1.4 version. Instead of UULP_0 if it has UULP_3 pin then, it is the 1.3 version.

**STEP 4.** After running wlan_low_power_station, it will pop up as shown.

![Application Start pop up](/wifibt-wc-at-command-examples/2.14.0/images/starting-message-popup-3.png)

**STEP 5.** Initially, the ABRD process will run and you will see a pop-up as “Firmware Loading Done “.

![Opermode command success](/wifibt-wc-at-command-examples/2.14.0/images/firmware-update-done-4.png)

**STEP 6.** You will see the following pop-up window.

![Feature frame command success](/wifibt-wc-at-command-examples/2.14.0/images/opermode-successful-5.png)

**STEP 7.**  You will see the following pop-up window. Enter “0” if you want your module to associate to an AP that is operating in the 2.4 GHz or “1” if you want your module to associate to an AP that is operating in the 5 GHz band. For the purpose of this document, we will select “0” to associate to an AP operating in the 2.4 GHz band as shown below

![Band command success](/wifibt-wc-at-command-examples/2.14.0/images/enter-band-6.png)

**STEP 8.** You will see the following pop-up and message in the Tera Term screen.

![Init command success](/wifibt-wc-at-command-examples/2.14.0/images/band-successful-7.png)

![Init command success](/wifibt-wc-at-command-examples/2.14.0/images/band-message-in-teraterm-8.png)

**STEP 9.** `at+rsi_init` command initializes the RF of the module. The module responds with OK<MAC_Address> (can be seen in Hex).

![init command success](/wifibt-wc-at-command-examples/2.14.0/images/init-successful-9.png)

**STEP 10.** Pop up comes to provide input for SSID of the AP to be connected, select 'OK' to proceed (make sure SSID is entered correectly).

`at+rsi_scan=0,Silicon_labs`

This command scans for particular Access Point operating in all channels.
The module responds with information of the Access Points scanned.

`The data received might have some unreadable characters because of ASCII conversion.`

![Enter SSID](/wifibt-wc-at-command-examples/2.14.0/images/enter-ssid-10.png)

**STEP 11.** Once “scan successful” comes, select “OK”.

![Scan command success}](/wifibt-wc-at-command-examples/2.14.0/images/scan-successful-11.png)
![Scan command success in terminal}](/wifibt-wc-at-command-examples/2.14.0/images/scan-success-in-teraterm-12.png)

**STEP 12.** Next pop up asks for pre shared key (PSK) input from the user, enter the PSK of desired Access Point and hit 'OK'.

![PSK Input prompt](/wifibt-wc-at-command-examples/2.14.0/images/enter-psk-13.png)

**STEP 13.** Now you will see the following pop-ups in succession (click “OK” on them).

![Join Success](/wifibt-wc-at-command-examples/2.14.0/images/join-successful-14.png)

![IPconfig](/wifibt-wc-at-command-examples/2.14.0/images/ipconfig-successful-15.png)

![Power Mode 2](/wifibt-wc-at-command-examples/2.14.0/images/power-mode2-16.png)

![Power mode 2 success](/wifibt-wc-at-command-examples/2.14.0/images/power-mode2-configuration-success-17.png)

**STEP 14.** After the Tera Term macro completed, you will see a command sequence similar to the one shown below having been executed in Tera Term.
![Commands in terminal](/wifibt-wc-at-command-examples/2.14.0/images/power-mode-2-teraterm-18.png)

**STEP 15.** At this point the device is in power save (standby-associated) mode.

![PSK Input prompt](/wifibt-wc-at-command-examples/2.14.0/images/current-measurement-graph-19.png)

Note: The measured current may vary if the scenario is performed in Open Environment. AP to AP variation is also observed.

#### BT SPP Slave Tera Term Script

This example demonstrates how to configure the RS9116W in Bluetooth SPP Slave mode to establish a SPP profile connection with a remote mobile device. Once connected, data can be exchanged between the two BT devices over SPP. This example uses an Android mobile device running a Bluetooth SPP Manager app. An example [Bluetooth SPP Manager App](https://play.google.com/store/apps/details?id=at.rtcmanager) is avalable from the Google Play store.

Before continuing, ensure the RS9116W is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116W EVK.

**STEP 2.** In the Tera Term menu, select `Control->Macro`.
![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/bt_spp_slave` and select the file `spp_slave.ttl`.
![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-spp-slave.png)

At startup, the RS9116W is configured using the following commands:

1. Opermode
2. Set connectable mode
3. Set discoverable mode
4. Set profile mode
5. Set local name

**STEP 4.** When complete, the RS9116W is discoverable by nearby bluetooth devices. Select OK to continue.
![RS9116W device in discoverable and connectable mode](/wifibt-wc-at-command-examples/2.14.0/images/device-discoverablity.png)

##### Connecting RS9116W with an Android mobile via Bluetooth

There are two steps required to connect the RS9116W to a mobile device via Bluetooth using the SPP profile. Firstly, a Bluetooth connection is established, then a SPP connection over Bluetooth is established. These steps are explained in turn in the following sections.

##### Establishing a Bluetooth Connection

**STEP 1.** On the mobile, find the settings page and enable Bluetooth.

**STEP 2.** Scan for nearby Bluetooth devices, the RS9116W appears as `RS9116W_BT_SLAVE`. Select the `RS9116W_BT_SLAVE` to establish a Bluetooth connection with the RS9116W.

![Mobile device bluetooth scan results](/wifibt-wc-at-command-examples/2.14.0/images/mobile-bluetooth-scan-result.png)
![RS9116W device in discoverable and connectable mode](/wifibt-wc-at-command-examples/2.14.0/images/rs9116w-evk-discoverable-mode-1.png)

**STEP 3.** When prompted, enter the PIN `1234` as shown in the following example.

![Mobile device bluetooth connection](/wifibt-wc-at-command-examples/2.14.0/images/connection-process.png)

After entering the PIN, the RS9116W receives a `AT+RSIBT_USRPINCODEREQ` event as shown on the Tera Term console in the following example.

![Bluetooth connection](/wifibt-wc-at-command-examples/2.14.0/images/usr-pin-code-req.png)

**STEP 4.** When the RS9116W receives the `AT+RSIBT_USRPINCODEREQ` event, a Tera Term pop-up appears. Choose the 'Send User Pincode' response and select OK to establish a Bluetooth link between the RS9116W and the mobile.

![Bluetooth connection](/wifibt-wc-at-command-examples/2.14.0/images/physical-level-connection-process.png)
![connection establishment between the mobilephone and the module](/wifibt-wc-at-command-examples/2.14.0/images/physical-level-connection-established.png)

##### Establishing a SPP Connection

**STEP 1.** Open the Bluetooth SPP Manager mobile app and scan for nearby devices. Choose the `RS9116W_BT_SLAVE` and select 'Pair'.
![Device Pairing](/wifibt-wc-at-command-examples/2.14.0/images/device-pairing.png)

**STEP 2.** On the pop-up, choose the appropriate response according to the notification received in the Tera Term console as follows.

|Tera Term console event received|Pop-up Response|
|---|---|
|`RSIBT_USRLINKKEYREQ`|Send User Link Key|
|`RSIBT_USRPINCODEREQ`|Send User PIN Code|

![Device Pairing](/wifibt-wc-at-command-examples/2.14.0/images/link-key-rsp.png)
![Device Pairing](/wifibt-wc-at-command-examples/2.14.0/images/pin-code-rsp.png)

After the pairing process completes, the RS9116W receives a link key save event and the SPP connection is automatically initiated from the mobile with the 'Bluetooth SPP Manager' app.

![Device Pairing](/wifibt-wc-at-command-examples/2.14.0/images/link-key-save.png)

The RS9116W sends a `AT+RSI_SPPCONNECTED` event to Tera Term to indicate the connection is established and data can be sent across the link.

![SPP Connection](/wifibt-wc-at-command-examples/2.14.0/images/script-send-message.png)
![Send Message](/wifibt-wc-at-command-examples/2.14.0/images/send-message.png)
![Receive Message](/wifibt-wc-at-command-examples/2.14.0/images/receive-message.png)

When the mobile disconnects the Bluetooth link, the RS9116W receives a disconnect event as `AT+RSIBT_CLASSIC_DISCONNECTED`.
![Disconnection](/wifibt-wc-at-command-examples/2.14.0/images/disconnection.png)

##### Transmit and Receive Event Sequence

|TX Events| |RX Events|
|---|---|---|
| |←|`AT+RSIBT_USRLINKKEYREQ 34-1C-F0-70-D2-F8`|
|`at+rsibt_usrlinkkey=34-1C-F0-70-D2-F8,0,1234`|→| |
| |←|`AT+RSIBT_USRPINCODEREQ 34-1C-F0-70-D2-F8`|
|`at+rsibt_usrpincode=34-1C-F0-70-D2-F8,1,1234`|→| |
| |←|`AT+RSIBT_USRLINKKEYSAVE 34-1C-F0-70-D2-F8,52,25,EC,DB,9E,82,8A,89,5F,CA,FB,91,E3,B0,CE,A7`|
| |←|`AT+RSIBT_AUTHENTICATION_STATUS 34-1C-F0-70-D2-F8,1`|
| |←|`AT+RSIBT_SPPCONNECTED 34-1C-F0-70-D2-F8`|
|`at+rsibt_spptx=5,Hello`|→| |
| |←|`AT+RSIBT_SPPRX 18,Welcome to silabs`|

#### Access Point Mode Tera Term Script

This application configures an RS9116W device into Access Point mode and runs a DHCP server. This would allow Wi-Fi stations to connect to this AP and exchange data with other devices on that network.

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu, select control-> Macro .

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `./RS9116W.x.x.xx/examples/at_commands/teraterm/wlan_ap_mode`  and select the file `ap_mode.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-ap-mode.png)

**STEP 4.** Opermode command `at+rsi_opermode=6,1,18,0`.

This configures the EVB to function in AP mode. The module responds with “OK".

![Opermode command success](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-opermode.png)

**STEP 5.** Tera Term gives a pop up for input (Band- 2.4 GHz or 5GHz) from the user, user needs to enter the band value(0) and hit 'ok',(`at+rsi_band=0`). This configures the operating band 2.4 GHz.The module responds with "ok".

![Band Command Success](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-band.png)

**STEP 6.** `at+rsi_init` command initializes the RF of the module. The module responds with ok<MAC_Address>.

![Init command success](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-init.png)

**STEP 7.** Module configures to default subnet and gateway unless user sets his own. If a user wants to configure than ipconfig command has to be issued here. e.g.

`at_rsi_ipconfig=0,192.168.0.30,255.255.255.255.0,192.168.0.30`

This command configures the IP (192.168.0.30 in this example) of the AP. The module responds with "ok".
![IPConfig command success](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-ipconfig.png)

**STEP 8.** Tera term will pop up for input(operating channel) from user the user, user can enter any value between 1 to 11 e.g enter the channe(1)and hit 'OK' as shown:

![Input Channel paramter prompt](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-channel.png)

**STEP 9.** Tera Term will now pop up to take input for SSID of the AP which user wants to set (for example, silabs)and hit 'OK':

![SSID input prompt](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-ssid.png)

**STEP 10.** The next pop up is for input of security mode from the user. The user needs to enter the security mode(2) and hit 'OK'.

0 - Open Security

2 - WPA2 PSK Security.

![Secutiy mode input prompt](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-security-mode.png)

**STEP 11.** Tera Term will pop up for input(PSK of the AP)from the user, the user needs to enter the PSK(e.g. 12345678) and hit 'OK'.

![PSK input prompt](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-psk.png)

**STEP 12.** The command will go as at+rsi_apconfig=1,silabs,2,2,12345678,100,3,3"The SSId is configured as "silabs" operate in channel 1 and the WPA2 PSK set is "12345678"

**STEP 13.** The next command will go as `at+rsi_join=silabs,0,2,6`.  This starts the Access point functionality in the module. The module is now configured as an access point. Its IP address is 192.168.0.30.

A remote peer can now scan for networks and the SSID of module, "Silabs" will be displayed in the remote peer's list of scanned APs.  After the remote per connects to the AP, it acquires an IP address over DHCP.

![AP Configuration Success](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-apconfig-sucess.png)

**STEP 14.** It will open a TCP Server socket on the Wi-Fi client(EVB) side using the AT command `at+rsi_ltcp=5001`.

The module's response will look as follows:
`OK<ip_version><Socket_type><socket_handle><Lport><module_ipaddr>`

The pop up window will display "Device is now listening for TCP connections on address 192.168.0.30 and port 5001".

![TCP Connection server IP and port number](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-tcp-connection.png)

**STEP 15.** Open a TCP client socket on the remote peer (e.g., mobile or PC running iperf or any third-Party application) and connect to server socket by giving server IP and port number.

**STEP 16.** Observe that Tera Term on the Wi-Fi Client-side(EVB) prints the follwing message once the TCP connection is set up with the remote peer:

`AT+RSI_LTCP_CONNECT=<ip_version><socket_descriptor><dest_port_no><dest_ipaddr><mss><window_size><src_port_no>`

Note that the data received might have some unreadable characters because of ASCII conversion.

**STEP 17.** When the data is received on the Wi-Fi client(EVB) side, you will see an asychronous response from the module as follows:

![Remote client connection and data received](/wifibt-wc-at-command-examples/2.14.0/images/accesspoint-mode-prompt-ltcp-connection.png)

#### BLE Heart Rate Profile Tera Term Script

This application demonstrates the BLE Heart Rate profile using the RS9116W via AT Commands over UART. The RS9116W is configured as a heart rate sensor; it sends notifications to a remote mobile device when (simulated) heart rate values change.

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu, select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm` containing example scripts and select the file `ble_heart_rate_profile.ttl`.

![Tera Term script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-hrp.png)

**STEP 4.** After running the `ble_heart_rate_profile.ttl` script, a pop-up shows. Select OK to continue.

![Application Start pop up](/wifibt-wc-at-command-examples/2.14.0/images/starting-popup-message-hrp-1.png)

**STEP 5.** The autobaud process runs and shows a pop-up with the text 'Firmware Loading Done'. Select OK to continue.

![Opermode command success](/wifibt-wc-at-command-examples/2.14.0/images/firmware-loading-done-2.png)

**STEP 6.** The command sequence executes in turn, eventually putting the RS9116W into an advertising state.

![Band input prompt](/wifibt-wc-at-command-examples/2.14.0/images/showing-firmware-version-3.png)

**STEP 7.**  Using a mobile app such as [Silabs EFR Connect](https://www.silabs.com/developers/efr-connect-mobile-app), scan for and connect to the RS9116W, see [Using EFR Connect](#using-efr-connect-on-a-mobile-device-with-rs9116-w). After connection, RS9116W fetches the app `MTU` and `LE data length update`.

![Init command success](/wifibt-wc-at-command-examples/2.14.0/images/remote-device-connected-4.png)

**STEP 8.** After a successful connection, the script asks to enable notifications.

![IPConfig Success](/wifibt-wc-at-command-examples/2.14.0/images/enable-notifications-5.png)

**STEP 9.** After notifications are enabled by EFR Connect, RS9116W sends data notifications 10 times and then asks to disable notifications.

![Security mode input prompt](/wifibt-wc-at-command-examples/2.14.0/images/enable-notification-6.png)

![Security mode input prompt](/wifibt-wc-at-command-examples/2.14.0/images/disable-notification-7.png)

Steps 8 and 9 are repeated several times to demonstrate the notification process.

##### Using EFR Connect on a Mobile Device with RS9116W

The [Silabs EFR Connect](https://www.silabs.com/developers/efr-connect-mobile-app) app can be used to connect to the RS9116W.

**STEP 1.**  Open the 'EFR Connect' app, select 'Browser' and scan for the RS9116W device.

![waiting for station to connect](/wifibt-wc-at-command-examples/2.14.0/images/opening-connect-app-1.png)

**STEP 2.** Select 'Connect' to connect with the RS9116W.

![waiting for station to connect](/wifibt-wc-at-command-examples/2.14.0/images/scanning-devices-2.png)

**STEP 3.** After connection is successful, a list of services shows including the Heart rate monitor service `0x180d`

![webpage](/wifibt-wc-at-command-examples/2.14.0/images/heart-rate-service-4.png)

**STEP 4.** Select the heart rate monitor service to see the respective attribute and properties.

![webpage](/wifibt-wc-at-command-examples/2.14.0/images/char-service-5.png)

**STEP 5.**  As noted in Step 8, the Tera Term script prompts to enable notifications after a successful connection. When notifications are enabled, the RS9116W sends the heart rate value.

![Upgrade in progress](/wifibt-wc-at-command-examples/2.14.0/images/enable-disable-notifications-6.png)

#### BT SPP Master Tera Term Script

This example demonstrates how to configure the RS9116W in BT SPP Master mode to establish a SPP profile connection with a remote mobile device. Once connected, data can be exchanged between the two BT devices over SPP. This example uses an Android mobile device running a Bluetooth SPP Manager app. An example [Bluetooth SPP Manager App](https://play.google.com/store/apps/details?id=at.rtcmanager) is available from the Google Play store. To learn how to use the app, see [Using the Bluetooth SPP Manager App](#using-the-bluetooth-spp-manager-app).

Before continuing, ensure the RS9116 EVK is plugged into your computer and Tera Term is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu, select `Control->Macro`.
![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/bt_spp_master` and select the file `spp_master.ttl`.
![Tera Term script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-spp-master.png)

At startup, the RS9116W is configured using the following commands:

1. Opermode
2. Set connectable mode
3. Set discoverable mode
4. Set profile mode
5. Set local name

![Starting ](/wifibt-wc-at-command-examples/2.14.0/images/first-one.png)

**STEP 4.** Configure the mobile device as a Bluetooth SPP slave, refer to the [Bluetooth SPP Manager App](https://play.google.com/store/apps/details?id=at.rtcmanager) documentation.

**STEP 5.** Ensure the mobile device is in connectable mode, then enter the BD address of the mobile device in the format `AA-BB-CC-DD-EE-FF`.

![remote BD Address input](/wifibt-wc-at-command-examples/2.14.0/images/address-entering-2.png)

Note that the mobile BD address is available from the device settings page which is typically at:

- `Settings -> About phone -> All spec -> Status -> Bluetooth Address`
- `Settings -> About phone -> Status -> Bluetooth Address`  
  ![remote BD Address](/wifibt-wc-at-command-examples/2.14.0/images/bluetooth-mac.png)

**STEP 6.** After the 'bond response' and 'link key' request event appears in Tera Term, a popup appears. Choose the 'User link key response' then select OK.

![Send User pin code response](/wifibt-wc-at-command-examples/2.14.0/images/linkkey-3.png)
![Send User Link Key response](/wifibt-wc-at-command-examples/2.14.0/images/linkkey-pop-up-4.png)

**STEP 7.** On the mobile app, enter the pin code `1234`.

![Mobile phone pin code response](/wifibt-wc-at-command-examples/2.14.0/images/pincode-in-mobile.png)

**STEP 8** After the 'pin code request' event appears in Tera Term, a popup appears. Choose the 'User pin code response' then select OK.

![RS9116 pin code response](/wifibt-wc-at-command-examples/2.14.0/images/pincode-5.png)
![RS9116 pin code response popup](/wifibt-wc-at-command-examples/2.14.0/images/pincode-pop-up-6.png)

The mobile app is now paired with the RS9116W.

**STEP 9** In the Tera Term popup, choose the 'SPP Connect' command' The `AT+RSIBT_SPPCONNECTED` event appears in the Term Term window to indicate that the SPP connection was successful. Data can now be sent between the RS9116W and the mobile app.

![SPP Connected](/wifibt-wc-at-command-examples/2.14.0/images/spp-connect-7.png)
![SPP Connect](/wifibt-wc-at-command-examples/2.14.0/images/spp-connected-8.png)

**STEP 10.** In the Tera Term popup, choose the 'Send Data' option to send characters from the RS9116W to the mobile app, then select OK.

![Send Data](/wifibt-wc-at-command-examples/2.14.0/images/send-data-9.png)
![Communication between module and remote device](/wifibt-wc-at-command-examples/2.14.0/images/send-receive-data-9.png)

The characters sent by the RS9116W are displayed on the mobile app.

![Remote device data transfer](/wifibt-wc-at-command-examples/2.14.0/images/data-tx.png)
![Remote device data transfer](/wifibt-wc-at-command-examples/2.14.0/images/data-tx-rx.png)

##### Transmit and Receive Event Sequence

|Transmit Events| |Receive Events|
|---|---|---|
| |←|`AT+RSIBT_USRLINKKEYREQ C0-EE-FB-DA-49-7C`|
|`at+rsibt_usrlinkkey=C0-EE-FB-DA-49-7C,0,1234`|→| |
| |←|`AT+RSIBT_USRPINCODEREQ C0-EE-FB-DA-49-7C`|
|`at+rsibt_usrpincode=C0-EE-FB-DA-49-7C,1,1234`|→| |
| |←|`AT+RSIBT_USRLINKKEYSAVE C0-EE-FB-DA-49-7C,B2,6C,91,49,D7,27,60,82,68,2,78,2,60,78,F8,AE`|
| |←|`AT+RSIBT_AUTHENTICATION_STATUS C0-EE-FB-DA-49-7C,1`|
|`at+rsibt_sppconn=C0-EE-FB-DA-49-7C`|→| |
| |←|`AT+RSIBT_SPPCONNECTED C0-EE-FB-DA-49-7C`|
|`at+rsibt_spptx=5,HELLO`|→| |
| |←|`AT+RSIBT_SPPRX 1,1`|

##### Using the Bluetooth SPP Manager App

**STEP 1.** Using your Android phone, turn on Bluetooth then open the `Bluetooth SPP Manager` app.

**STEP 2.** Select the menu option in the top-right corner of the app (three vertical dots) to open the menu.
![send BT term app settings](/wifibt-wc-at-command-examples/2.14.0/images/mobile-app.png)

**STEP 3.** Select the 'Set Device Discoverable' option.
![send BT term app scan settings](/wifibt-wc-at-command-examples/2.14.0/images/discover-enable.png)
![send BT term app scan settings](/wifibt-wc-at-command-examples/2.14.0/images/discover-enable-allow.png)

**STEP 4.** After the mobile app connects successfully with the RS9116W, data transfer occurs.
![send BT term app scan settings](/wifibt-wc-at-command-examples/2.14.0/images/data-tx.png)
![send BT term app scan settings](/wifibt-wc-at-command-examples/2.14.0/images/data-tx-rx.png)

#### Bluetooth Classic PER Mode Tera Term Script

This application demonstrates how to configure the RS9116W in Bluetooth Classic PER mode.

Before continuing, ensure that the RS9116W EVK is plugged into your computer and is connected via Teraterm as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

##### Contents

- [Bluetooth Classic PER Mode Tera Term Script](#bluetooth-classic-per-mode-tera-term-script)
- [Contents](#contents)
- [Setting Up](#setting-up)
- [Transmit PER Instructions](#transmit-per-instructions)
- [Receive PER Instructions](#receive-per-instructions)

##### Setting Up

**STEP 1.** Reset the RS9116W EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro-1.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/bt_per` containing the example script and select the file `bt_per.ttl`

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-bt-per.png)

**STEP 4.** After selecting the `bt_per.ttl` script, a popup shows to indicate the BLE PER script is running. Two additional popups then show to indicate auto baud and the `opermode` command is successul.

![Script execution start](/wifibt-wc-at-command-examples/2.14.0/images/script-starting-pop-up.png)

![ABRD State](/wifibt-wc-at-command-examples/2.14.0/images/firmware-loading-done.png)

![opermode success](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-opermode.png)

##### Transmit PER Instructions

The following steps describe how to configure the RS9116W for BT Transmit PER measurement.

**Step 1.** Enter `1` to run the script in transmit PER mode.

![select the tarnsmit/receive](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-transmit-4.png)

**STEP 2.** Enter `1` to enable PER mode.

![Enable PER mode](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-enable-5.png)

**Step 3.** Enter a 48-bit address in hex format (e.g., `0023A7010203`). There is no need to enter the device address, however the same address must be used for transmit and receive.

![Enter the device address](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-address-6.png)

**Step 4.** Enter the desired `packet_length` number from the following list:

- `BT_DM1_PAYLOAD_MAX_LEN    : 17  `
- `BT_DM3_PAYLOAD_MAX_LEN    : 121 `
- `BT_DM5_PAYLOAD_MAX_LEN    : 224 `
- `BT_DH1_PAYLOAD_MAX_LEN    : 27  `
- `BT_DH3_PAYLOAD_MAX_LEN    : 183 `
- `BT_DH5_PAYLOAD_MAX_LEN    : 339 `
- `BT_2DH1_PAYLOAD_MAX_LEN   : 54  `
- `BT_2DH3_PAYLOAD_MAX_LEN   : 367 `
- `BT_2DH5_PAYLOAD_MAX_LEN   : 679 `
- `BT_3DH1_PAYLOAD_MAX_LEN   : 83  `
- `BT_3DH3_PAYLOAD_MAX_LEN   : 552 `
- `BT_3DH5_PAYLOAD_MAX_LEN   : 1021`
- `BT_HV1_VOICE_PAYLOAD_LEN  : 10  `
- `BT_HV2_VOICE_PAYLOAD_LEN  : 20  `
- `BT_HV3_VOICE_PAYLOAD_LEN  : 30  `
- `BT_EV3_VOICE_PAYLOAD_LEN  : 30  `
- `BT_2EV3_VOICE_PAYLOAD_LEN : 60  `
- `BT_3EV3_VOICE_PAYLOAD_LEN : 90  `
- `BT_EV4_VOICE_PAYLOAD_LEN  : 120 `
- `BT_EV5_VOICE_PAYLOAD_LEN  : 180 `
- `BT_2EV5_VOICE_PAYLOAD_LEN : 360 `
- `BT_3EV5_VOICE_PAYLOAD_LEN : 540 `

![Phy rate election](/wifibt-wc-at-command-examples/2.14.0/images/enter-pkt-length-7.png)

**Step 5.** Enter the `packet_type` number from the following list:

- `BT_DM1_PKT_TYPE  : 3 `
- `BT_DH1_PKT_TYPE  : 4 `
- `BT_DM3_PKT_TYPE  : 10`
- `BT_DH3_PKT_TYPE  : 11`
- `BT_DM5_PKT_TYPE  : 14`
- `BT_DH5_PKT_TYPE  : 15`
- `BT_2DH1_PKT_TYPE : 4 `
- `BT_2DH3_PKT_TYPE : 10`
- `BT_2DH5_PKT_TYPE : 14`
- `BT_3DH1_PKT_TYPE : 8 `
- `BT_3DH3_PKT_TYPE : 11`
- `BT_3DH5_PKT_TYPE : 15`
- `BT_HV1_PKT_TYPE  : 5 `
- `BT_HV2_PKT_TYPE  : 6 `
- `BT_HV3_PKT_TYPE  : 7 `
- `BT_DV_PKT_TYPE   : 8 `
- `BT_EV3_PKT_TYPE  : 7 `
- `BT_2EV3_PKT_TYPE : 6 `
- `BT_3EV3_PKT_TYPE : 7 `
- `BT_EV4_PKT_TYPE  : 12`
- `BT_2EV5_PKT_TYPE : 12`
- `BT_EV5_PKT_TYPE  : 13`
- `BT_3EV5_PKT_TYPE : 13`

![Packet type](/wifibt-wc-at-command-examples/2.14.0/images/enter-pkt-type-8.png)

**Step 6.** Enter the desired `BR/EDR` mode.

![BR/EDR mode](/wifibt-wc-at-command-examples/2.14.0/images/enter-br-edr-mode-9.png)

**Step 7.** Enter the desired `rx` channel number.

![rx_channel](/wifibt-wc-at-command-examples/2.14.0/images/enter-rx-channel-10.png)

**Step 8.** Enter the desired `tx` channel number.

![tx_channel](/wifibt-wc-at-command-examples/2.14.0/images/enter-tx-channel-11.png)

**Step 9.** Enter the desired `link type`.

![Hopping type](/wifibt-wc-at-command-examples/2.14.0/images/link-type-12.png)

**Step 10.** Enter the scrambler seed according to the PER mode.

![scrambler-seed](/wifibt-wc-at-command-examples/2.14.0/images/scrambler-seed-13.png)

**Step 11.** Enter the desired `hopping type`.

![Hopping-type](/wifibt-wc-at-command-examples/2.14.0/images/hopping-type-14.png)

**Step 12.** Enter the desired `antenna type`.

![Antenna Selection](/wifibt-wc-at-command-examples/2.14.0/images/antenna-sel-15.png)

**Step 13.** Enter the desired `rf chain`.

![tx_power_index](/wifibt-wc-at-command-examples/2.14.0/images/rf-chain-17.png)

**Step 14.** Enter the desired `payload type`.

![Payload_type](/wifibt-wc-at-command-examples/2.14.0/images/payload-type-17.png)

**Step 15.** Enter the `tx_power` index which is listed in the below image.

![tx_power](/wifibt-wc-at-command-examples/2.14.0/images/power-index-18.png)

**Step 16.** Enter the desired PER transmission mode.

![tx_mode](/wifibt-wc-at-command-examples/2.14.0/images/tx-mode-19.png)

**Step 17.** Enter the `number of packets` based on the selected `tx_mode` parameter.

![number of packets](/wifibt-wc-at-command-examples/2.14.0/images/number-of-packets-20.png)

**Step 19.** With all inputs successfully entered, PER packet(s) are transmitted.

![Final screen-shot](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-transmit-done.png)

![Final screen-shot done](/wifibt-wc-at-command-examples/2.14.0/images/bt-per-transmit-final.png)

##### Receive PER Instructions

The following steps describe how to configure the RS9116W for BLE Receive PER measurement.

**Step 1.** Enter `2` to run the script in PER receive mode.

![PER Receive](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-selection.png)

**STEP 2.** Enter `1` to enable PER mode.

![Enable PER mode](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-enable.png)

**Step 3.** Enter a 48-bit address in hex format e.g. `0023A7010203`. There is no need to enter the device address, however the same address must be used for transmit and receive.

![Enter the device address](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-address.png)

**Step 4.** Enter the desired `packet_length` number from the following list:

- `BT_DM1_PAYLOAD_MAX_LEN    : 17  `
- `BT_DM3_PAYLOAD_MAX_LEN    : 121 `
- `BT_DM5_PAYLOAD_MAX_LEN    : 224 `
- `BT_DH1_PAYLOAD_MAX_LEN    : 27  `
- `BT_DH3_PAYLOAD_MAX_LEN    : 183 `
- `BT_DH5_PAYLOAD_MAX_LEN    : 339 `
- `BT_2DH1_PAYLOAD_MAX_LEN   : 54  `
- `BT_2DH3_PAYLOAD_MAX_LEN   : 367 `
- `BT_2DH5_PAYLOAD_MAX_LEN   : 679 `
- `BT_3DH1_PAYLOAD_MAX_LEN   : 83  `
- `BT_3DH3_PAYLOAD_MAX_LEN   : 552 `
- `BT_3DH5_PAYLOAD_MAX_LEN   : 1021`
- `BT_HV1_VOICE_PAYLOAD_LEN  : 10  `
- `BT_HV2_VOICE_PAYLOAD_LEN  : 20  `
- `BT_HV3_VOICE_PAYLOAD_LEN  : 30  `
- `BT_EV3_VOICE_PAYLOAD_LEN  : 30  `
- `BT_2EV3_VOICE_PAYLOAD_LEN : 60  `
- `BT_3EV3_VOICE_PAYLOAD_LEN : 90  `
- `BT_EV4_VOICE_PAYLOAD_LEN  : 120 `
- `BT_EV5_VOICE_PAYLOAD_LEN  : 180 `
- `BT_2EV5_VOICE_PAYLOAD_LEN : 360 `
- `BT_3EV5_VOICE_PAYLOAD_LEN : 540 `

![Phy rate election](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-packet-length.png)

**Step 5.** Enter the `packet_type` number from the following list:

- `BT_DM1_PKT_TYPE  : 3 `
- `BT_DH1_PKT_TYPE  : 4 `
- `BT_DM3_PKT_TYPE  : 10`
- `BT_DH3_PKT_TYPE  : 11`
- `BT_DM5_PKT_TYPE  : 14`
- `BT_DH5_PKT_TYPE  : 15`
- `BT_2DH1_PKT_TYPE : 4 `
- `BT_2DH3_PKT_TYPE : 10`
- `BT_2DH5_PKT_TYPE : 14`
- `BT_3DH1_PKT_TYPE : 8 `
- `BT_3DH3_PKT_TYPE : 11`
- `BT_3DH5_PKT_TYPE : 15`
- `BT_HV1_PKT_TYPE  : 5 `
- `BT_HV2_PKT_TYPE  : 6 `
- `BT_HV3_PKT_TYPE  : 7 `
- `BT_DV_PKT_TYPE   : 8 `
- `BT_EV3_PKT_TYPE  : 7 `
- `BT_2EV3_PKT_TYPE : 6 `
- `BT_3EV3_PKT_TYPE : 7 `
- `BT_EV4_PKT_TYPE  : 12`
- `BT_2EV5_PKT_TYPE : 12`
- `BT_EV5_PKT_TYPE  : 13`
- `BT_3EV5_PKT_TYPE : 13`

![Packet type](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-pkt-type.png)

**Step 6.** Enter the desired `BR/EDR` mode.

![BR/EDR mode](/wifibt-wc-at-command-examples/2.14.0/images/enter-br-edr-mode-9.png)

**Step 7.** Enter the desired `rx channel` number.

![rx_channel](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-channel.png)

**Step 8.** Enter the desired `tx channel` number.

![tx_channel](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-tx-channel.png)

**Step 9.** Enter the desired `link type`.

![Hopping type](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-linktype.png)

**Step 10.** Enter the desired `scrambler seed`.

![scrambler-seed](/wifibt-wc-at-command-examples/2.14.0/images/scrambler-seed-13.png)

**Step 11.** Enter the desired `hopping type`.

![Hopping-type](/wifibt-wc-at-command-examples/2.14.0/images/hopping-type-14.png)

**Step 12.** Enter the desired `antenna selection`.

![Antenna Selection](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-antenna-selection.png)

**Step 13.** Enter the desired `rf chain`.

![tx_power_index](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-chain-selection.png)

**Step 14.** Enter the desired `loop back` mode.

![Loop-back-mode](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-loop-back-mode.png)

**Step 15.** With all inputs successfully entered, the RS9116W waits to receive packets.

![Receive command](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-pop-up.png)

**Step 16.** After successful reception, receive PER statistics are displayed.

![PER Stats command](/wifibt-wc-at-command-examples/2.14.0/images/per-rx-stats.png)

Refer to the [BLUTOOTH Programming Reference Manual](https://docs.silabs.com/rs9116/wiseconnect/rs9116w-bt-classic-at-command-prm/latest/08-bt-classic-commands) for further details on how to change the parameters.

#### BLE PER Mode Tera Term Script

This application demonstrates how to configure the RS9116W EVK in BLE PER mode.

Before continuing, ensure the RS9116W EVK is plugged into your computer and is connected via Tera Term as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-pc/).

##### Contents

- [BLE PER Mode Tera Term Script](#ble-per-mode-tera-term-script)
- [Contents](#contents)
- [Setting up](#setting-up)
- [Transmit PER Instructions](#transmit-per-instructions)
- [Receive PER Instructions](#receive-per-instructions)

##### Setting up

**STEP 1.** Reset the RS9116W EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro-1.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/ble_per` containing the example script and select the file `ble_per.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-ble-per.png)

**STEP 4.** After selecting the `ble_per.ttl` script, a popup shows to indicate the BLE PER script is running. Two additional popups then show to indicate auto baud and the `opermode` command is successul.

![Script execution start](/wifibt-wc-at-command-examples/2.14.0/images/script-start-pop-up.png)

![ABRD State](/wifibt-wc-at-command-examples/2.14.0/images/firmware-loading-done-2.png)

![opermode success](/wifibt-wc-at-command-examples/2.14.0/images/ble-opermode-3.png)

##### Transmit PER Instructions

The following steps describe how to configure the RS9116W for BLE Transmit PER measurement.

**Step 1.** Enter `1` to run the script in transmit PER mode.

![select the tarnsmit/receive](/wifibt-wc-at-command-examples/2.14.0/images/ble-per-transmit-4.png)

**STEP 2.** Enter `1` to enable PER mode.

![Enable PER mode](/wifibt-wc-at-command-examples/2.14.0/images/ble-per-enable-5.png)

**Step 3.** Enter the 32-bit device address in hex format. In the following example, the access address of the BLE PER packet is `0x71764129`.

![Enter the device address](/wifibt-wc-at-command-examples/2.14.0/images/ble-devices-address-6.png)

**Step 4.** Enter the desired PHY data rate.

![Phy rate election](/wifibt-wc-at-command-examples/2.14.0/images/ble-phy-rate-7.png)

**Step 5.** Enter the Receive (Rx) and then Transmit (Tx) channel numbers.

![rx_channel_number](/wifibt-wc-at-command-examples/2.14.0/images/ble-rx-channel-8.png)

![tx_channel_number](/wifibt-wc-at-command-examples/2.14.0/images/ble-tx-channel-9.png)

**Step 6.** Enter the scrambler seed according to the PER mode.

![scrmbler-seed](/wifibt-wc-at-command-examples/2.14.0/images/ble-scrambler-seed-9.png)

**Step 7.** Enter the desired `le channel type`.

![Le_channel_type](/wifibt-wc-at-command-examples/2.14.0/images/ble-channel-type-10.png)

**Step 8.** Enter the desired `hopping type`.

![Hopping type](/wifibt-wc-at-command-examples/2.14.0/images/hopping-type-11.png)

**Step 9.** Enter the desired `antenna type`.

![Antenna_selection](/wifibt-wc-at-command-examples/2.14.0/images/ble-antenna-sel-11.png)

**Step 10.** Enter the desired `rf chain`.

![RFChain selection](/wifibt-wc-at-command-examples/2.14.0/images/ble-rf-chain-12.png)

**Step 11.** Enter the desired `payload type`.

![Packet Length](/wifibt-wc-at-command-examples/2.14.0/images/payload-type-13.png)

**Step 12.** Enter the desired `tx power`.

![tx_power_index](/wifibt-wc-at-command-examples/2.14.0/images/tx-power-index-14.png)

**Step 13.** Enter the desired PER transmission mode.

![tx_mode](/wifibt-wc-at-command-examples/2.14.0/images/ble-tx-mode-15.png)

**Step 14.** Enter the desired number of packets to transmit.

![number of packets](/wifibt-wc-at-command-examples/2.14.0/images/number-of-pkts.png)

**Step 15.** With all inputs successfully entered, PER packet(s) are transmitted.

![Final screen-shot](/wifibt-wc-at-command-examples/2.14.0/images/ble-transmit-executed-16.png)

![Final command prompt](/wifibt-wc-at-command-examples/2.14.0/images/ble-tx-command-prompt-17.png)

##### Receive PER Instructions

The following steps describe how to configure the RS9116W for BLE Receive PER measurement.

**Step 1.** Enter `2` to run the script in PER receive mode.

![PER Receive](/wifibt-wc-at-command-examples/2.14.0/images/ble-per-rx-1.png)

**STEP 2.** Enter `1` to enable PER mode.

![Enable PER mode](/wifibt-wc-at-command-examples/2.14.0/images/ble-per-enable-5.png)

**Step 3.** Enter the 32-bit device address in hex format. In the following example, the access address of the BLE PER packet is `0x71764129`.

![Enter the device address](/wifibt-wc-at-command-examples/2.14.0/images/device-address-rx.png)

**Step 4.** Enter the desired PHY data rate.

![Phy rate election](/wifibt-wc-at-command-examples/2.14.0/images/ble-phy-rate-rx.png)

**Step 5.** Enter the Receive (Rx) and then Transmit (Tx) channel numbers.

![rx_channel_number](/wifibt-wc-at-command-examples/2.14.0/images/rx-channel-rx.png)

![tx_channel_number](/wifibt-wc-at-command-examples/2.14.0/images/tx-channel-rx.png)

**Step 6.** Enter the scrambler seed according to the PER mode.

![scrmbler-seed](/wifibt-wc-at-command-examples/2.14.0/images/ble-scrambler-seed-9.png)

**Step 7.** Enter the desired `le_channel type`.

![Le_channel_type](/wifibt-wc-at-command-examples/2.14.0/images/rate-rx.png)

**Step 8.** Enter the desired `hopping type`.

![Hopping type](/wifibt-wc-at-command-examples/2.14.0/images/hopping-type-rx.png)

**Step 9.** Enter the desired `antenna type`.

![Antenna_selection](/wifibt-wc-at-command-examples/2.14.0/images/antenna-selection-rx.png)

**Step 10.** Enter the desired `rf_chain`.

![RFChain selection](/wifibt-wc-at-command-examples/2.14.0/images/lp-chain-election-rx.png)

**Step 11.** Enter the desired extended data length option.

![Extended data length ind](/wifibt-wc-at-command-examples/2.14.0/images/ble-extended-data-length.png)

**Step 12.** Enter the desired loop back mode option.

![Loop-back-mode](/wifibt-wc-at-command-examples/2.14.0/images/loop-back-mode.png)

**Step 13.** Enter the desired duty cycling option.

![Duty cycling](/wifibt-wc-at-command-examples/2.14.0/images/duty-cycling.png)

**Step 14.** With all inputs successfully entered, the RS9116W waits to receive packets.

![Receive command](/wifibt-wc-at-command-examples/2.14.0/images/ble-receive-success.png)

![PER Stats command](/wifibt-wc-at-command-examples/2.14.0/images/ble-per-stats.png)

Refer to the [BLE Programming Reference Manual](https://docs.silabs.com/rs9116/wiseconnect/rs9116w-ble-at-command-prm/latest/08-ble-commands) for further details on how to change the parameters.

#### BLE Peripheral Mode Tera Term Script

This application demonstrates how to configure the RS9116W Module in simple peripheral mode and how to get connected from the remote Central device.

Before continuing, ensure the RS9116 EVK is plugged into your computer and TeraTerm is connected as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu select `Control->Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `<SDK>/examples/at_commands/teraterm/ble_peripheral` which contains the example script and select the file `ble_peripheral.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-ble-peripheral.png)

**STEP 4.** To run this example, you will need the Silicon Labs 'EFR Connect' mobile BLE App available on the [App Store](https://apps.apple.com/us/app/efr-connect/id1030932759) for iOS, and on the [Google Play Store](https://play.google.com/store/apps/details?id=com.siliconlabs.bledemo) for Android.

**STEP 5.** Command sequence in this script:

1. Opermode
2. Set local name
3. Query local BD address
4. Set advertisement data
5. Add service
6. Add attribute
7. Add attribute
8. Add attribute
9. Query firmware version
10. Advertise

**Step 6.** After executing these commands, the Silabs device with the name "RS9116W_BLE" in Central device appears on the BLE App.
![{"style":"max-width:700px", "class":"material-lifted"}{BLE Peripheral Mode}](/wifibt-wc-at-command-examples/2.14.0/images/ble-peripheral-mode-prompt-adversting.png)

**Step 7.** When the Central device give the connect command, the RS9116 will receive Enhanced

**Step 8.** The connection update event is shown in the following text.

> AT+RSIBT_LE_DEVICE_ENHANCE_CONNECTED=1,6B-63-FE-FE-3D-FD,0,88-DA-1A-9E-81-55,00-00-00-00-00-00

**Step 9.** The data length update event may also appear as shown in teh following text.

> AT+RSIBT_LE_DATA_LENGTH_UPDATE 6B-63-FE-FE-3D-FD,7B,448,7B,448

**Step 10.** After this connection update events will come to the host.

`AT+RSIBT_LE_CONN_UPDATE_COMPLETE 6B-63-FE-FE-3D-FD,0,6,0,1F4`

`AT+RSIBT_LE_CONN_UPDATE_COMPLETE 6B-63-FE-FE-3D-FD,0,24,0,1F4`

![BLE Peripheral mode connection](/wifibt-wc-at-command-examples/2.14.0/images/ble-peripheral-mode-ble-conection.png)

**Step 11.** Once these events come it means Silabs module got connected to the Central device.

**Step 12.** Central can send the data to the Silabs module. And a host will get the event like below.

`AT+RSIBT_WRITE,6B-63-FE-FE-3D-FD,E,6,31,32,33,34,35,36`

Note: Here in this example we have added Service as a Device Information `0x180A` and attribute as a custom characteristic attribute `0x1AA1`. Users can change the services as well as attributes as per requirement.

Refer to the [BLE Programming Reference Manual](docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-programming-reference-manuals/) for further details on how to change the parameters.

#### Station Mode Tera Term Script

This application demonstrates the procedure to configure the RS9116W Module in WLAN STA mode.
The script takes the module through to a connection to a specified Access Point, getting an IP address assigned, and opening a TCP server port.

Before continuing, ensure that the RS9116 EVK is plugged into your computer and TeraTerm is configured as described in [Getting Started with PC using AT Commands](http://docs.silabs.com/rs9116-wiseconnect/2.4/wifibt-wc-getting-started-with-pc/).

**STEP 1.** Reset the RS9116 EVK.

**STEP 2.** In the Tera Term menu select `Control -> Macro`.

![Tera Term Macro](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-macro.png)

**STEP 3.** Navigate to the folder `RS9116W.x.x.xx/examples/at_commands/teraterm/wlan_station_mode` which contains the example scripts and select the file `station_mode.ttl`.

![Tera Term Script to be selected](/wifibt-wc-at-command-examples/2.14.0/images/tera-term-scripts-station-mode.png)

**STEP 4.** Tera Term begins executing the station_mode.ttl script.

**STEP 5** The Opermode command   `at+rsi_opermode=0,1,4,0` configures the module as a Wi-Fi client. The module responds with “OK”.

**STEP 6.** In the pop-up that asks for desired band of operation, enter 0 for the 2.4 GHz band. The command (`at+rsi_band=0`) then configures the operating band of the Wi-Fi client to 2.4GHz. The module responds with "OK".

![Pop up to take input for band](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-band.png)

**STEP 7.** The script issues an `at+rsi_init` command to initialize the RF of the module in the EVK. The module responds with OK <MAC_Address>.
Here 4F 4B is for OK and the remaining data is the MAC Address, ending with a CR and LF.

![Init command succcess](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-init.png)

**STEP 8.** In the next pop-up that requests for an SSID, enter the SSID of the desired AP to be scanned and hit 'OK', (`at+rsi_scan=0, Silicon_labs`). Make sure there is such an AP in range, and that it is set into WPA2-PSK mode.

The module responds with information of the Access Point scanned. The data received might have some unreadable characters because of ASCII conversion.

![Pop up for input for SSID](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-ssid.png)

**STEP 9.** Tera term will pop up a request for the PSK or password of the AP and that should be entered here.

![Pop us for input for PSK](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-psk.png)

**STEP 10.** The next command issued would be `at+rsi_join=Silicon_labs,0,2,6` (or with the specific SSID entered). This command connects the Wi-Fi client to the Access Point with the specified SSID, in this example "Silicon_labs". On successful association, the module responds with OK.

![Join Success](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-join.png)

**STEP 11.** After the join is successful, the next command issued would be `at+rsi_ipconf=1`. This command configures the IP address of the module.

![IPConfig Success](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-ipconfig.png)

**STEP 12.** The script then configures a TCP Server socket on port 5001 on the Wi-Fi Client (EVK) using the following AT command `at+rsi_ltcp=5001`, The module’s response will look as follows:

`OK<ip_version><socket_type><socket_handle><Lport><module_ipaddr>\r\n`

The pop up window would display "Device is now listening for TCP connections on address x.x.x.x and port y". Here x.x.x.x Ip address of the Module and 'y' is the port number of the Module Socket.

![Server IP address and port number confirmation message](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-tcp-connection.png)

**STEP 13.** Open a TCP client socket on a remote peer and connect to the server socket. Users can use "TCP/UDP test tool" application to open the TCP client socket. Enter the server IP and port number that we got from the above pop-up in the remote peer application (here TCP/UDP test tool) in the appropriate fields provided. Note that the remote peer should be connected to the same network to which module is connected.

**STEP 14.** Observe that the following message is printed on the terminal window, once the TCP connection is set up with the remote peer.

`AT+RSI_LTCP_CONNECT=<ip_version><socket_descriptor><dest_port_no><dest_ipaddr><mss><window_size><src_port_no>\r\n`

The data received might have some unreadable characters because of ASCII conversion

**STEP 15.** When data is received by the EVK, the following response would be printed:

![Socket connection and data read](/wifibt-wc-at-command-examples/2.14.0/images/station-mode-prompt-socket-connection.png)

### Featured Examples

#### Featured Examples

Featured examples are complete projects that demonstrate a common RS9116 use-case or enable you to perform a key aspect of RS9116 evaluation.  The featured examples are found in the WiSeConnect™ SDK at the path:  `<SDK>/examples/featured`.

Details on the configuration and operation of each featured example are available in the `readme.md` file that is found with the example source code and at the following links:

[**Throughput Test**](wlan-throughput-readme)<br />Measures Wi-Fi transmit/receive throughput performance using a remote iPerf client/server

[**Powersave Standby Associated**](powersave-standby-associated-readme)<br />Connects to a Wi-Fi Access Point in deep-sleep mode and intermittently wakes to send UDP packets

[**Firmware Update via TCP Server**](firmware-update-readme)<br />Wirelessly updates the RS911x firmware from a remote TCP server

[**Transmit Performance and Regulatory Testing**](wlan-rf-test-readme)<br />Configures the device in a transmit mode that is used for transmit performance and regulatory certification testing (FCC, ETSI, CE, etc.)

[**BT PER - Transmit and Receive Performance and Regulatory Testing**](bt-per-readme)<br />configure the device with necessary parameters to start transmitting or receiving BT PER packets.

[**BLE PER - Transmit and Receive Performance and Regulatory Testing**](ble-per-readme)<br />configure the device with necessary parameters to start transmitting or receiving BLE PER packets.

[**AWS IoT Device Shadow**](aws-device-shadow-readme)<br />Creates an AWS IoT 'thing' that connects to the AWS IoT device shadow service using the MQTT protocol

#### WLAN Throughput

##### Introduction

This application demonstrates the procedure to measure WLAN UDP/TCP/SSL throughput by configuring the RS9116W in client/server role.
In this application, the RS9116W connects to a Wi-Fi access point, obtains an IP address, connects to Iperf server/client running on a remote PC and measures Tx/Rx throughput transmitted/received from remote PC.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- A computer running Iperf (may be the same PC or Mac used to program the Host MCU)
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wi-Fi Access Point

![Figure: Setup Diagram for WLAN Throughput Example](/wifibt-wc-featured-examples/2.14.0/images/image216g.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)
- Installation of Build tools for Linux including the gcc compiler (or equivalent on PC or Mac)  
  - For Ubuntu, use the following command for installation: `user@ubuntu:~$ sudo apt install build-essential`
- If you don't have Linux, [Cygwin for Windows](https://www.cygwin.com/) may be used instead
- A working installation of [iPerf version 2.0.9](https://iperf.fr/iperf-download.php#windows).  **Note:** iPerf version 2.0.9 is the only version that has been verified to work with this example.

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi Configuration

Configure the following parameters in [rsi_throughput_app.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput/rsi_throughput_app.c) to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID           "SILABS_AP"      // Wi-Fi Network Name
#define PSK            "1234567890"     // Wi-Fi Password
#define SECURITY_TYPE  RSI_WPA2         // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
#define CHANNEL_NO     0                // Wi-Fi channel if the softAP is used (0 = auto select)
```

###### RTOS Configuration

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

###### Client/Server IP Settings

```c
#define PORT_NUM           <local_port>   // Local port to use
#define SERVER_PORT        <remote_port>  // Remote server port
#define SERVER_IP_ADDRESS  0x640AA8C0     // Remote server IP address in little endian byte order:
                                          //   192.168.0.100 -> 0x64=100, 0x00=0, 0xA8=168, 0xC0=192
```

##### Throughput Measurement Types

The application may be configured to measure throughput using UDP, TCP or SSL/TLS packets. Choose the measurement type using the `THROUGHPUT_TYPE` macro.

```c
#define THROUGHPUT_TYPE  TCP_TX     // Selects the throughput option; see the following diagrams. 
#define TCP_TX           0			// RS9116W transmits packets to remote TCP client
#define TCP_RX           1			// RS9116W receives packets from remote TCP server
#define UDP_TX           2			// RS9116W transmits packets to remote UDP client
#define UDP_RX           3			// RS9116W receives packets from remote UDP server
#define SSL_TX           4			// RS9116W transmits packets to remote SSL client
#define SSL_RX           5			// RS9116W receives packets from remote SSL server
```

**RS9116 is a TCP Client (sends TCP packets to a remote server) ...**
![Figure: RS9116W Configured in TCP Client Mode](/wifibt-wc-featured-examples/2.14.0/images/image211.png)

**RS9116W is a TCP Server (receives TCP packets from a remote client) ...**
![Figure: RS9116W Configured in TCP Server Mode](/wifibt-wc-featured-examples/2.14.0/images/image212.png)

**RS9116 is a UDP Client (sends UDP packets to a remote server) ...**
![Figure: RS9116W Configured in UDP Client Mode](/wifibt-wc-featured-examples/2.14.0/images/image213.png)

**RS9116 is a UDP Server (receives UDP packets from a remote client) ...**
![Figure: RS9116W Configured in UDP Server Mode](/wifibt-wc-featured-examples/2.14.0/images/image214.png)

**RS9116 is a SSL Client (sends SSL packets to a remote server) ...**
![Figure: RS9116W Configured in SSL Client Mode](/wifibt-wc-featured-examples/2.14.0/images/image215.png)

**RS9116 is a SSL Server (receives SSL packets from a remote client) ...**
![Figure: RS9116W Configured in SSL Server Mode](/wifibt-wc-featured-examples/2.14.0/images/image216.png)

##### Throughput Options

Various options are available to customize throughput measurements. Some options only apply for specific throughput types as secribed in the following sections.

###### Discrete Interval Measurements (UDP Rx and SSL Tx)

```c
#define MAX_TX_PKTS 10000
```

The default value of `MAX_TX_PKTS` is 10000. To measure throughput for higher intervals, make the following changes:

- UDP Rx : Increase the value of `MAX_TX_PKTS` and provide a higher interval in the corresponding iperf command
- SSL Tx : Increase the value of `MAX_TX_PKTS` and update the equivalent value in `SSL_Server_throughput_d.py` located in the  release directory `resources/scripts/`.

###### Discrete Interval Measurements (UDP Tx and TCP Tx)

```c
#define THROUGHPUT_AVG_TIME  30000   // Throughput average time in ms
```

Configure `THROUGHPUT_AVG_TIME` to suit the desired interval.

###### Discrete Interval Measurements (TCP Rx and SSL Rx)

- TCP Rx : Configure the interval desired using the corresponding iperf command
- SSL Rx : Increase the packet count in `SSL_tx_throughput.py` located in the release directory `/resources/scripts/`.

###### Continous Throughput Measurements

```c
#define CONTINUOUS_THROUGHPUT        0
```

**`CONTINUOUS_THROUGHPUT` = `0`** (default value)

- Throughput is calculated only once for interval of :  
  - `THROUGHPUT_AVG_TIME` in case of UDP TX/TCP TX  
  - `MAX_TX_PKTS` in case of UDP RX/SSL TX
- The time interval is provided by the server in case of TCP RX
- Default packet count is provided in server `SSL_tx_throughput.py` in case of `SSL RX`

**`CONTINUOUS_THROUGHPUT` = `1`**.

- The application measures throughput continuously for every interval of `THROUGHPUT_AVG_TIME` regardless of `THROUGHPUT_TYPE`, when provided with the following configuration.  
  - UDP Rx/TCP Rx : Configure high interval greater than `THROUGHPUT_AVG_TIME`  
  - SSL Rx/SSL Tx : Increase packet count to the maximum in the scripts `SSL_tx_throughput.py` and `SSL_Server_throughput_d.py`

---

**Note!**
If `CONTINUOUS_THROUGHPUT` = `1`, ensure that the RS9116W client/server runs with an interval greater than `THROUGHPUT_AVG_TIME`.

---

#### Testing Throughput

There are two 'ends' involved when measuring throughput, data is sent between the client end and the server end. By default, the Iperf protocol sends data from the Client to the Server to measure throughput. Depending on the configuration selected, the RS9116W may be the client or the server. In general, it is advisable to start the server before the client since the client will immediately begin to try to connect to the server to send data.

The following sections describe how to run the RS9116W throughput application together with examples for various Iperf configurations that run on the PC.

##### Running the RS9116 Application

After making any custom configuration changes required, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/).

##### UDP Tx Throughput

To measure UDP Tx throughput, configure the RS9116W as a UDP client and start a UDP server on the remote PC.
The Iperf command to start the UDP server on the PC is:

> `C:\> iperf.exe -s -u -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -u -p 5001 -i 1`

##### UDP Rx Throughput

To measure UDP Rx throughput, configure the RS9116W as a UDP server and start a UDP client on the remote PC.
The Iperf command to start the UDP client is:

> `C:\> iperf.exe -c <Module_IP> -u -p <Module_Port> -i 1 -b <Bandwidth> -t <time interval in seconds>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 192.168.0.100 -u -p 5001 -i 1 -b 50M -t 30`

##### TCP Tx Throuhgput

To measure TCP Tx throughput, configure the RS9116W as a TCP client and start a TCP server on the remote PC.
The Iperf command to start the TCP server is:

> `C:\> iperf.exe -s -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -p 5001 -i 1`

##### TCP Rx Throughput

To measure TCP Rx throughput, configure the RS9116W as TCP server and start a TCP client on the remote PC.
The Iperf command to start the TCP client is:

> `C:\> iperf.exe -c <Module_IP> -p <module_PORT> -i 1 -t <time interval in sec>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 192.168.0.100 -p 5001 -i 1 -t 30`

##### SSL Tx Throughput

To measure SSL Tx throughput, configure the RS9116W as a SSL client and start a SSL server on the remote PC as described in the following bullets:

- Copy the `SSL_Server_throughput_d.py` script from the release `/resources/scripts/` directory to the `/resources/certificates/` directory
- Open a command prompt and cd to the folder `/resources/certificates/`, then run the following command:  
  - `C:\> python SSL_Server_throughput_d.py`

##### SSL Rx Throughput

To measure SSL RX throughput, configure the RS9116W as a SSL server and open a SSL client on the remote PC as described in the following bullets:

- Copy the `SSL_tx_throughput.py` script from the release `/resources/scripts/` directory to the `/resources/certificates/`
- Open a command prompt and cd to the folder `/resources/certificates/`, then run the following command:  
  - `C:\> python SSL_tx_throughput.py`

The RS9116W, which is configured as a UDP/TCP/SSL server/client, connects to the iperf server/client and sends/receives data for configured intervals. While module is transmitting/receiving the data, application prints the throughput numbers in serial console.

---

**Note!**
In this release, due to a low SPI frequency configured for the EFR32, WLAN throughput is lower than the maximum achievable throughput. This will be addressed in the next release.

---

#### Selecting Bare Metal

The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

##### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image216b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image216c.png)

##### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-featured-examples/2.14.0/images/image216a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Powersave Standby Associated

##### Introduction

This application demonstrates the process for configuring the RS9116W WiSeConnect EVK in power save profile mode 2, also providing the steps to configure the RS9116W EVK in station mode and initiate a connection to an Access Point. When the module is in deep sleep, it wakes up in periodic intervals based on DTIM or Listen Interval.

If the UDP data transfer feature is enabled, the application then connects to a remote server to send UDP data in power save mode.

The application also enables the analysis of various power save profiles using a power analyzer during the Associated state with data transfer via UDP.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wi-Fi Access point with a connection to the internet
- PC2 (Remote PC) with UDP server application (iperf)
- 2 wire connectors for GPIO pins
- Power analyzer

![Figure: Setup Diagram for Power Save Standby Example](/wifibt-wc-featured-examples/2.14.0/images/image184.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)
- [Iperf Application](https://iperf.fr/iperf-download.php)

##### Application Build Environment

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### Project Configuration

The Application is provided with the project folder consists of Keil and Simplicity studio (ssl) project files.

- Keil project :  
  - The Keil can be executed on STM32 platform.  
  - Project Path : `<SDK>\examples\featured\powersave_standby_associated\projects\powersave_standby_associated-nucleo-f411re.uvprojx`
- Simplicity Studio :  
  - The Simplicity Studio project can be executed on EFR32MG21.  
  - Project Path :    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>\examples\featured\powersave_standby_associated\projects\device_shadow_logging_stats\projects\powersave_standby_associated-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>\examples\featured\powersave_standby_associated\projects\device_shadow_logging_stats\projects\powersave_standby_associated-brd4180b-mg21.slsproj`  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/featured/powersave_standby_associated/projects/powersave_standby_associated-brd2204a-gg11.slsproj`

###### **For Powersave functionality with NCP expansion (ACX) board**

> **Note:**
> For using powersave functionality with NCP expansion (ACX) board, the following macro has to be enabled:
> 
> While using the NCP expansion (ACX) board, the `EXP_BOARD=1` preprocessor symbol should be added to the list of defined symbols in the preprocessor menu of project settings.
> 
> 1. Open the project in Simplicity Studio
> 2. Right click on the project and choose 'Properties'
> 3. Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Preprocessor' and add the macro `EXP_BOARD=1`
> 4. Select 'Apply' and 'OK' to save the settings

![Figure: Adding pre-processor symbol required for Expansion board](/wifibt-wc-featured-examples/2.14.0/images/exp-board.png)

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

##### Application Configuration Parameters

###### Wi-Fi Configuration

Configure the following parameters in [rsi_wlan_connected_sleep_app.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/powersave_standby_associated/rsi_wlan_connected_sleep_app.c) to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID           "SILABS_AP"      // Wi-Fi Network Name
#define PSK            "1234567890"     // Wi-Fi Password
#define SECURITY_TYPE  RSI_WPA2         // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
```

###### Iperf Configuration

- `SERVER_PORT` is the remote UDP server port number on the PC running Iperf.
- `SERVER_IP_ADDRESS` is the remote UDP server IP address on the PC running Iperf. IP address should be in long format and in little endian byte order Example: To configure "192.168.10.100" as the IP address, update the macro `DEVICE_IP` as `0x640AA8C0`

```c
  #define SERVER_PORT        <remote port>
  #define SERVER_IP_ADDRESS  0x640AA8C0      // 192.168.10.100 => | 0x64 = 100 | 0x0A = 10 | 0xA8 = 168 | 0xC0 = 192 |
```

> **Note!** The feature to connect to a remote UDP server is disabled by default. To enable this feature, see [common steps](#common-steps)

###### Memory & Throughput

- `NUMBER_OF_PACKETS` controls the number of packets sent to the remote UDP server.
- `GLOBAL_BUFF_LEN` sets the application memory size (in bytes) used by the driver.

```c
  #define NUMBER_OF_PACKETS  <number of packets>
  #define GLOBAL_BUFF_LEN    15000
```

###### RTOS Options

The following parameters are configured when FreeRTOS is used.

```c
  #define RSI_WLAN_TASK_PRIORITY        1   // Should be low priority
  #define RSI_DRIVER_TASK_PRIORITY      2   // Should be highest priority 
  #define RSI_WLAN_TASK_STACK_SIZE    500   
  #define RSI_DRIVER_TASK_STACK_SIZE  500
```

###### Major Powersave Options

The primary powersave settings are configured with `PSP_MODE` and `PSP_TYPE`. The default power save mode is set to low power mode 2 (`RSI_SLEEP_MODE_2`) with maximum power save (`RSI_MAX_PSP`) and with message based handshake as follows.

```c
  #define PSP_MODE  RSI_SLEEP_MODE_2
  #define PSP_TYPE  RSI_MAX_PSP
```

`PSP_MODE` refers to the power save profile mode. RS9116W EVK supports the following power modes:

- `RSI_ACTIVE` : In this mode, RS9116W EVK is active and power save is disabled.
- `RSI_SLEEP_MODE_1` : In this mode, RS9116W EVK goes to power save after association with the Access Point. In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the RS9116W EVK.
- `RSI_SLEEP_MODE_2` : In this mode, RS9116W EVK goes to power save after association with the Access Point. In this sleep mode, SoC will go to sleep based on GPIO hand shake or Message exchange, therefore handshake is required before sending data to the RS9116W EVK.
- `RSI_SLEEP_MODE_8` : In this mode, RS9116W EVK goes to power save when it is not in associated state with the Access Point. In this sleep mode, SoC will go to sleep based on GPIO handshake or Message exchange, therefore handshake is required before sending the command to the RS9116W EVK.

---

**Note!**

1. For `RSI_SLEEP_MODE_2` and `RSI_SLEEP_MODE_8` modes, GPIO or Message based handshake can be selected using `RSI_HAND_SHAKE_TYPE` macro which is defined in `rsi_wlan_config.h`.
2. In this example, `RSI_SLEEP_MODE_2` can be verified with a Message-based handshake. To verify other power modes, change the application as well as GPIO handshake signals.

---

`PSP_TYPE` refers to power save profile type. RS9116W EVK supports following power save profile types:

- `RSI_MAX_PSP` : In this mode, RS9116W EVK will be in Maximum power save mode. i.e device will wake up for every DTIM beacon and do data Tx and Rx.
- `RSI_FAST_PSP` : In this mode, RS9116W EVK will disable power save for any Tx/Rx packet for monitor interval of time (monitor interval can be set through macro in `rsi_wlan_config.h` file, default value is 50 ms). If there is no data for monitor interval of time, then RS9116W EVK will again enable power save.
- `RSI_UAPSD` : This `PSP_TYPE` is used to enable WMM power save.

---

**Note!**

1. `PSP_TYPE` is valid only when `PSP_MODE` is set to `RSI_SLEEP_MODE_1` or `RSI_SLEEP_MODE_2` mode.
2. `RSI_UAPSD` power profile type in `PSP_TYPE` is valid only when `RSI_WMM_PS_ENABLE` is enabled in `rsi_wlan_config.h` file.

---

###### Additional Powersave Options

Additional powersave options may be configured in [rsi_wlan_config.h](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/powersave_standby_associated/rsi_wlan_config.h).

```c
  #define CONCURRENT_MODE                     RSI_DISABLE
  #define RSI_FEATURE_BIT_MAP                 (FEAT_SECURITY_OPEN | FEAT_AGGREGATION | FEAT_ULP_GPIO_BASED_HANDSHAKE)
  #define RSI_TCP_IP_BYPASS                   RSI_DISABLE
  #define RSI_TCP_IP_FEATURE_BIT_MAP          (TCP_IP_FEAT_EXTENSION_VALID | TCP_IP_FEAT_DHCPV4_CLIENT)
  #define RSI_CUSTOM_FEATURE_BIT_MAP          FEAT_CUSTOM_FEAT_EXTENTION_VALID
  #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP      (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE)
  #define RSI_EXT_TCPIP_FEATURE_BITMAP        CONFIG_FEAT_EXTENTION_VALID
  #define RSI_CONFIG_FEATURE_BITMAP           RSI_FEAT_SLEEP_GPIO_SEL_BITMAP
  #define RSI_BAND                            RSI_BAND_2P4GHZ
  
  The default configuration of low power_save_mode_2 is:
  
  #define RSI_HAND_SHAKE_TYPE                 GPIO_BASED
  #define RSI_SELECT_LP_OR_ULP_MODE           RSI_ULP_WITH_RAM_RET
  #define RSI_DTIM_ALIGNED_TYPE               0
  #define RSI_MONITOR_INTERVAL                50
  #define RSI_WMM_PS_ENABLE                   RSI_DISABLE
  #define RSI_WMM_PS_TYPE                     0
  #define RSI_WMM_PS_WAKE_INTERVAL            20
  #define RSI_WMM_PS_UAPSD_BITMAP             15
```

The application defaults to the `RSI_SLEEP_MODE_2` configuration. Other powersave options are possible by choosing different powersave modes according to the following description.

- `RSI_HAND_SHAKE_TYPE` is used to select the hand shake type (GPIO or Message) in `RSI_SLEEP_MODE_2` and `RSI_SLEEP_MODE_8` modes.
- `RSI_SELECT_LP_OR_ULP_MODE` is used to select low power mode or ultra-low power mode. Valid configurations are  
  - `RSI_LP_MODE` - RS9116W will be in Ultra low power mode.  
  - `RSI_ULP_WITH_RAM_RET` - RS9116W will be in Ultra low power mode and will remember the previous state after issuing the power save mode command.  
  - `RSI_ULP_WITHOUT_RAM_RET` - RS9116W will be in Ultra low power mode and it will not remember the previous state after issuing power save mode command. After wakeup, RS9116W will give CARD READY indication and user has to issue commands from wireless initialization.
- `RSI_DTIM_ALIGNED_TYPE` is used to decide whether RS9116W has to wake up at normal beacon or DTIM beacon which is just before listen interval.  
  - `RSI_DTIM_ALIGNED_TYPE = 0` - RS9116W will wake up at normal beacon which is just before listen interval.  
  - `RSI_DTIM_ALIGNED_TYPE = 1` - RS9116W will wake up at DTIM beacon which is just before listen interval.
- `RSI_MONITOR_INTERVAL` refers to the amount of time (in ms) to wait for Tx or Rx before giving power save indication to the connected Access Point. This macro is applicable only when `PSP_TYPE` selected as `RSI_FAST_PSP`
- `RSI_WMM_PS_ENABLE` is used to enable or disable WMM power save.
- `RSI_WMM_PS_TYPE` is used to set Tx-based or Periodic-based WMM power save. Set `RSI_WMM_PS_TYPE = 0` for Tx based or `=1` for periodic based WMM power save.
- `RSI_WMM_PS_WAKE_INTERVAL` refers to the periodic time (in ms) in which the module has to wake up when `RSI_WMM_PS_TYPE` is selected as Periodic.
- `RSI_WMM_PS_UAPSD_BITMAP` refers to the UAPSD bitmap. If `RSI_WMM_PS_ENABLE` is enabled, then `PSP_TYPE` must be set to `RSI_UAPSD` in order to WMM power save to work.

##### Testing the Application

Follow the steps below for the successful execution of the application.

###### Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK.

The firmware file is located in `<SDK>/firmware/`

###### Building the Application on Host Platform

###### Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Configure STM32 CN10 header pin-4 should connect to UULP_GPIO_0 and CN10 header pin-2 should connect to UULP_GPIO_2.
- Open the project `<SDK>\examples\featured\powersave_standby_associated\projects\powersave_standby_associated-nucleo-f411re.uvprojx`
- Build and debug the project.
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before Free run.
- Free run the project.
- Then continue the [common steps](#common-steps).

###### Using EFX (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Configure EFX32 J4 pin-9 should connect to UULP_GPIO_0 and EVFX32 J4 pin-7 should connect to UULP_GPIO_2.
- Open Simplicity Studio and import the project `<SDK>\examples\featured\powersave_standby_associated\projects`
- Select the appropriate .slsproj as per the Radio Board type mentioned in [Project Configuration](#project-configuration) for Simplicity Studio.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the [common steps](#common-steps).

###### Common Steps

To enable the feature for data transfer with remote UDP server, follow the steps given below.

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Preprocessor' and add the macro 'ENABLE_DATA_TRANSFER_DEMO=1'
> - Select 'Apply' and 'OK' to save the settings

With the feature now enabled, open a command prompt on the remote PC connected to the Wi-Fi access point.
Start a UDP server using the below command in command prompt.

> `C:\ iperf.exe –s -u -p <SERVER_PORT> -i 1`

![Figure: command prompt on the remote PC](/wifibt-wc-featured-examples/2.14.0/images/image185.png)

When the powersave application runs, RS9116W scans and connect to the Wi-Fi access point and obtains an IP address. After a successful connection, the device goes into configured power save and sends configured number of UDP packets to the remote peer which is connected to access point. The following image shows active reception of UDP data on the UDP server.

![Figure: UDP packets to the remote peer](/wifibt-wc-featured-examples/2.14.0/images/image187.png)

##### Selecting Bare Metal

The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

###### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image184b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image184c.png)

###### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-featured-examples/2.14.0/images/image184a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Firmware Update

##### Introduction

This application demonstrates how to update the RS9116W firmware via Wi-Fi by downloading an image from a remote TCP server. The TCP server may be hosted on a local PC (as demonstrated in this example), or alternately on a cloud service such as Amazon AWS or Microsoft Azure. The update process works as follows:

- The RS9116W connects via Wi-Fi as a TCP client to a TCP update server
- The RS9116W OTA application sends a firmware file request to the server
- The server responds with the firmware file
- The OTA application programs the firmware into the RS9116 flash memory and reboots

##### Setting Up

To test the application, the following hardware, software and project setup is required.

###### Hardware Requirements

- PC or Mac (used to program the Host MCU).
- Linux PC or Cygwin on Windows (to build and run the TCP server source provided)
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - STM32F411 Nucleo
- Wi-Fi Access point with a connection to the internet

![Figure: TCP Firmware Update Block Diagram](/wifibt-wc-featured-examples/2.14.0/images/image156.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)
- Installation of Build tools for Linux including the gcc compiler (or equivalent on PC or Mac)  
  - For Ubuntu, use the following command for installation: `user@ubuntu:~$ sudo apt install build-essential`  
  - If you don't have Linux, [Cygwin for Windows](https://www.cygwin.com/) may be used instead

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.  
  **Note:** This application is under development in EFM32 host platform.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi Configuration

Configure the following parameters in [rsi_firmware_update_app.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/firmware_update/rsi_firmware_update_app.c) to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID           "SILABS_AP"      // Wi-Fi Network Name
#define PSK            "1234567890"     // Wi-Fi Password
#define SECURITY_TYPE  RSI_WPA2         // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
```

###### RTOS Configuration

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE           1024
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

###### TCP Configuration

```c
#define DEVICE_PORT        5001        // TCP client port of the local RS9116 TCP client
#define SERVER_PORT        5001        // TCP server port of the remote TCP server
#define SERVER_IP_ADDRESS  0x6400A8C0  // Server IP address in little endian byte order: 
                                       //   192.168.0.100 -> 0x64=100, 0x00=0, 0xA8=168, 0xC0=192
```

#### Testing Firmware Udpates

Before a test of the RS9116 firwmare update application can be performed, the TCP server first needs to be setup and started.

##### Build and run the TCP Server

1. Copy the TCP server application [firmware_update_tcp_server.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/firmware_update/firmware_update_tcp_server.c) provided with the application source to a Linux PC connected to the Wi-Fi access point.
2. Compile the application  
   - `user@linux:~$ gcc firmware_update_tcp_server.c -o ota_server.bin`
3. Run the application providing the TCP port number (specified in the RS9116 app) together with the firmware file and path  
   - `user@linux:~$ ./ota_server.bin 5001 RS9116.NBZ.WC.GEN.OSI.x.x.x.rps`

... where [RS9116.NBZ.WC.GEN.OSI.x.x.x.rps](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/firmware) is the firmware image to be sent to RS9116.

##### Running the Application

After making any custom configuration changes requried, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/).

When the application runs and connects to the TCP server, the firmware image transfer occurs in chunks. The app requests a firmware chunk, the server sends the chunk, the app requests the next chunk, the server sends the chunk, and so forth until the entire transfer completes. As the transfer proceeds, progress is printed to the serial console. On completion, the console prints 'reach end of file'.

![Figure: Log of firmware transfer](/wifibt-wc-featured-examples/2.14.0/images/image157.png)

When the firmware update completes, the RS9116 should be rebooted after which it may take a few minutes to overwrite the old firmware with the new firmware in flash memory.

#### Selecting Bare Metal

The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

##### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image156b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image156c.png)

##### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-featured-examples/2.14.0/images/image156a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN RF Test

##### Introduction

This application demonstrates how to configure the RS9116W to transmit Wi-Fi packets at varying data rates and power levels. The application can be used to assist with regulatory certification testing.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Spectrum Analyzer and/or Power Analyzer

![Figure: Setup Diagram for Transmit Test Example](/wifibt-wc-featured-examples/2.14.0/images/image217.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi Radio Configuration

Configure the following parameters in [rsi_wlan_rf_test.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_rf_test/rsi_wlan_rf_test.c).

```c
  #define RSI_TX_TEST_POWER    4               // Tx RF power in the range [2:18] dBm
  #define RSI_TX_TEST_RATE     RSI_RATE_1      // WLAN data rate, see sapi/include/rsi_wlan_apis.h for details
  #define RSI_TX_TEST_LENGTH   30              // Tx packet length in the range [24:1500] bytes in burst mode, 
                                               //                               [24:260 ] bytes in continuous mode
  #define RSI_TX_TEST_MODE     RSI_BURST_MODE  // Selects burst mode or continuous mode
  #define RSI_TX_TEST_CHANNEL  1               // Channel number in 2.4 or 5 GHz
  #define RSI_ANTENNA          1               // 0 = RF_OUT2, 1 = RF_OUT1
  #define RSI_ANTENNA_GAIN_2G  0               // Gain in 2.4 GHz band in the range [0:10]
  #define RSI_ANTENNA_GAIN_5G  0               // Gain in 5 GHz band in the range [0:10]
```

Configure the following parameters in [rsi_wlan_config.h](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_rf_test/rsi_wlan_config.h).

```c
   #define RSI_TX_TEST_NUM_PKTS  0               // To configure number of packets to be sent.
                                                // If the macro is set as n, then n number of packets will be 
                                                // sent on-air, after that transmission will be stopped.
                                                // If this macro is set as 0 then packets will be sent 
                                                // continuously until user stops the transmission.
  #define RSI_TX_TEST_RATE_FLAGS   RSI_TX_IMMEDIATE_TRANSFER       // To transfer packets immediately by ignoring CCA, set RSI_TX_IMMEDIATE_TRANSFER flag.
                                                // Default value is '0',i.e., CCA is enabled by default.
```

###### RTOS Configuration

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

#### Run the Application

After making any custom configuration changes required, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/).

When the application runs, the RS9116W starts transmitting using the configuration settings. A power meter or spectrum analyzer may be used to monitor the RF output power and spectrum.

The following images provides example spectrums when the RS9116W is configured to transmit with the settings shown.

##### Transmit Spectrum Example : +4 dBm, 1 Mbit/s (DSSS)

```c
  #define RSI_TX_TEST_POWER    4                // 4 dBm
  #define RSI_TX_TEST_RATE     1                // 1 Mbit/s
  #define RSI_TX_TEST_LENGTH   30               // 30 bytes
  #define RSI_TX_TEST_MODE     RSI_BURST_MODE   // Burst mode
  #define RSI_TX_TEST_CHANNEL  1                // Channel 1 = 2412 MHz
```

![Figure: Spectrum Analyzer speed 1Mbps](/wifibt-wc-featured-examples/2.14.0/images/image218.png)

##### Transmit Spectrum Example : +12 dBm, 6 Mbit/s (OFDM)

```c
#define RSI_TX_TEST_POWER    12               // 12 dBm  
#define RSI_TX_TEST_RATE     6                // 6 Mbit/s 
#define RSI_TX_TEST_LENGTH   30               // 30 bytes 
#define RSI_TX_TEST_MODE     RSI_BURST_MODE   // Burst mode 
#define RSI_TX_TEST_CHANNEL  1                // Channel 1 = 2412 MHz
```

![Figure: Spectrum Analyzer 6Mbps](/wifibt-wc-featured-examples/2.14.0/images/image219.png)

#### Selecting Bare Metal

The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

##### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image217b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image217c.png)

##### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-featured-examples/2.14.0/images/image217a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Bluetooth Classic Packet Error Rate

##### Introduction

This application demonstrates how to configure the necessary parameters to start transmitting or receiving BT PER packets.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI / SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Spectrum Analyzer and/or Power Analyzer

![figureSetup Diagram for BT PER Example](/wifibt-wc-featured-examples/2.14.0/images/images23.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)

##### Application Build Environment

###### Platform

The application is designed to run on any one of the following host platforms

- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)
- [STM32F411 Nucleo](https://st.com/)

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between host platforms EFR32MG21 or STM32F411 Nucleo and RS9116W EVK.
- The application may also be configured to use the SDIO bus for interfacing between the host platform EFM32GG11 and RS9116W EVK.

###### Project Configuration

The Application is provided with the project folder containing Simplicity Studio and Keil project files.

**Simplicity Studio**

- The Simplicity Studio project is used to evaluate the application on EFR32MG21.
- **EFR32 Host Platform**  
  - If the radioboard is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/featured/bt_per/projects/bt_per-brd4180a-mg21.slsproj`  
  - If the radioboard is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/featured/bt_per/projects/bt_per-brd4180b-mg21.slsproj`  
  - The radioboard version is shown in the following image

![EFR Radioboards](/wifibt-wc-featured-examples/2.14.0/images/image23a.png)

- **EFM32GG11 Host Platform**  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/featured/bt_per/projects/bt_per-brd2204a-gg11.slsproj`

**Keil Project**

- The Keil project is used to evaluate the application on STM32.
- Project path: `<SDK>/examples/featured/bt_per/projects/bt_per-nucleo-f411re.uvprojx`

###### Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

###### Modifications to `rsi_bt_per.c`

**Device Name**

```c
  #define RSI_BT_LOCAL_NAME "PER Test"
```

**Transmit mode**

```c
  #define RSI_CONFIG_PER_MODE  RSI_BLE_PER_TRANSMIT_MODE
  #define BT_TRANSMIT_CMD_ID   0x15
```

**Receive mode**

```c
  #define RSI_CONFIG_PER_MODE  RSI_BLE_PER_RECEIVE_MODE
  #define BT_RECEIVE_CMD_ID    0x16
```

**Payload Type**

Defines the transmit payload.

```c
  #define SEQUENCE_0     0   // All 00s
  #define SEQUENCE_1     1   // All FFs
  #define SEQUENCE_2     2   // All 55s
  #define SEQUENCE_F0    3   // All F0s
  #define SEQUENCE_PRBS  4   // PRBS 9 sequence
  #define PAYLOAD_TYPE   SEQUENCE_F0
```

**Transmit Packet Type**

```c
  #define PACKET_TYPE  15   // Types defined by Bluetooth Core 5.0 spec
```

**Transmit Packet Length**

```c
  #define PACKET_LEN  339   // Tx packet length in bytes
```

**Channel numbers**

```c
  #define BT_RX_CHNL_NUM  10   // Receive channel number [0 .. 78]
  #define BT_TX_CHNL_NUM  10   // Transmit channel number [0 .. 78]
```

**Scrambler Seed**

```c
  #define SCRAMBLER_SEED  0   //  Seed for whitening. Must be set to 0. 
```

**Link Type**

```c
  #define ACL_LINK  1
```

**Transmit Mode**

```c
   #define BURST_MODE       0
   #define CONTINUOUS_MODE  1
   #define TX_MODE          BURST_MODE
```

**Hopping Type**

```c
  #define NO_HOPPING      0
  #define FIXED_HOPPING   1
  #define RANDOM_HOPPING  2
  #define HOPPING TYPE    NO_HOPPING
```

**Antenna select**

```c
  #define ONBOARD_ANT_SEL  2
  #define EXT_ANT_SEL      3
  #define ANT_SEL          EXT_ANT_SEL
```

**RF Type**

```c
   #define BLE_EXTERNAL_RF  0
   #define BLE_INTERNAL_RF  1
   #define RF_TYPE          BLE_INTERNAL_RF
```

**RF Chain**

```c
  #define NO_CHAIN_SEL       0
  #define WLAN_HP_CHAIN_BIT  0
  #define WLAN_LP_CHAIN_BIT  1
  #define BT_HP_CHAIN_BIT    2
  #define BT_LP_CHAIN_BIT    3
  #define RF_CHAIN           BT_HP_CHAIN_BIT
```

**PLL Mode**

```c
  #define PLL_MODE_0  0
  #define PLL_MODE_1  1
  #define PLL_MODE    PLL_MODE_0
```

**Loopback Mode**

```c
  #define LOOP_BACK_MODE_DISABLE  0
  #define LOOP_BACK_MODE_ENABLE   1
  #define LOOP_BACK_MODE          LOOP_BACK_MODE_DISABLE
```

**Memory Usage Requirements**

```c
   #define BT_GLOBAL_BUFF_LEN  15000  // The number of bytes required by the application and driver
```

###### Modifications to `rsi_ble_config.h`

Modifications are not needed to run this example, the following is for informational purposes only.

**Opermode command parameters**

```c
   #define RSI_FEATURE_BIT_MAP             FEAT_SECURITY_OPEN
   #define RSI_TCP_IP_BYPASS               RSI_DISABLE
   #define RSI_TCP_IP_FEATURE_BIT_MAP      TCP_IP_FEAT_DHCPV4_CLIENT
   #define RSI_CUSTOM_FEATURE_BIT_MAP      FEAT_CUSTOM_FEAT_EXTENTION_VALID
   #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP  0
```

##### Testing the Application

###### Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### Building the Application on the Host Platform

**EFX32 Platform**

Refer to [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), to setup EFR32 & EFM32 host platforms.

- Import the EFR32/EFM32 project from `<SDK>/examples/eatured/bt_per/projects`  
  - Select the appropriate `.slsproj` to suit your EFRx32 radioboard OR select the `*.brd2204a-gg11.slsproj` project for the EFM32GG11 board.
- Compile and flash the project to the EFx32
- Debug the project and pause execution
- If the RS9116W reset pin is **NOT** connected to the EFx32, press the RS9116W EVK Reset button
- Free run the project
- Proceed to [Verifying Operation](#verifying-operation)

**STM32 Platform**

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/featured/bt_per/projects/bt_per-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project, pause execution
- If the RS9116W reset pin is **NOT** connected to the STM32, press the RS9116W EVK reset button
- Run the project on the STM32
- Proceed to [Verifying Operation](#verifying-operation)

###### Veryifying Operation

A terminal output shows the following text during receive testing. Receive PER statistics are regularly printed to the terminal.
![Prints in Coolterm window](/wifibt-wc-featured-examples/2.14.0/images/images23-rxlog.png)

A terminal output shows the following text during transmit testing.
![Prints in Coolterm window](/wifibt-wc-featured-examples/2.14.0/images/image23-txlog.png)

When transmitting, a spectrum analyser may be used to see transmitted packets (and the transmit spectrum) as shown in the following image.<br />![Figure: Spectrum Analyzer BR Mode](/wifibt-wc-featured-examples/2.14.0/images/image23-spectrum.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Packet Error Rate

##### Introduction

This application demonstrates how to configure the necessary parameters to start transmitting or receiving BLE PER packets.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI / SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Spectrum Analyzer and/or Power Analyzer

![Figure: Setup Diagram for BLE PER Example](/wifibt-wc-featured-examples/2.14.0/images/images23.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)

##### Application Build Environment

###### Platform

The application is designed to run on any one of the following host platforms

- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)
- [STM32F411 Nucleo](https://st.com/)

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between host platforms EFR32MG21 or STM32F411 Nucleo and RS9116W EVK.
- The application may also be configured to use the SDIO bus for interfacing between the host platform EFM32GG11 and RS9116W EVK.

###### Project Configuration

The Application is provided with the project folder containing Simplicity Studio and Keil project files.

**Simplicity Studio**

- The Simplicity Studio project is used to evaluate the application on EFR32MG21.
- **EFR32 Host Platform**  
  - If the radioboard is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/featured/ble_per/projects/ble_per-brd4180a-mg21.slsproj`  
  - If the radioboard is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/featured/ble_per/projects/ble_per-brd4180b-mg21.slsproj`  
  - The radioboard version is shown in the following image

![EFR Radioboards](/wifibt-wc-featured-examples/2.14.0/images/image23a.png)

- **EFM32GG11 Host Platform**  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path `<SDK>/examples/featured/ble_per/projects/ble_per-brd2204a-gg11.slsproj`

**Keil Project**

- The Keil project is used to evaluate the application on STM32.
- Project path: `<SDK>/examples/featured/ble_per/projects/bt_per-nucleo-f411re.uvprojx`

###### Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Simplicity Studio and Keil) are provided with bare metal configuration.

##### Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

###### Modifications to `rsi_ble_per.c`

**Transmit mode**

```c
  #define RSI_CONFIG_PER_MODE  RSI_BLE_PER_TRANSMIT_MODE
  #define BLE_TRANSMIT_CMD_ID  0x13
```

**Receive mode**

```c
  #define RSI_CONFIG_PER_MODE  RSI_BLE_PER_RECEIVE_MODE
  #define BLE_RECEIVE_CMD_ID   0x14
```

**Payload type**

```c
  #define DATA_PRBS9                  0x00
  #define DATA_FOUR_ONES_FOUR_ZEROES  0x01
  #define DATA_ALT_ONES_AND_ZEROES    0x02
  #define DATA_PRSB15                 0x03
  #define DATA_ALL_ONES               0x04
  #define DATA_ALL_ZEROES             0x05
  #define DATA_FOUR_ZEROES_FOUR_ONES  0x06
  #define DATA_ALT_ZEROES_AND_ONES    0x07
```

**Channel type**

```c
  #define LE_ADV_CHNL_TYPE  0   // Advertising channel
  #define LE_DATA_CHNL_TYPE 1   // Data channel
```

**Transmit Packet Length**

```c
  #define BLE_TX_PKT_LEN 32   // Length of Tx packet [0 .. 255]
```

**Channel numbers**

```c
  #define BLE_RX_CHNL_NUM  10   // Receive channel number [0 .. 39]
  #define BLE_TX_CHNL_NUM  10   // Transmit channel number [0 .. 39]
```

**BLE PHY Rate**

```c
  #define LE_ONE_MBPS        1
  #define LE_TWO_MBPS        2
  #define LE_125_KBPS_CODED  4
  #define LE_500_KBPS_CODED  8
  #define BLE_PHY_RATE       LE_ONE_MBPS
```

**Scrambler seed**

```c
  #define SCRAMBLER_SEED  0   // Seed for whitening. 0 = disable whitening.
```

**Transmit Mode**

```c
   #define BURST_MODE       0
   #define CONTINUOUS_MODE  1
   #define TX_MODE          BURST_MODE
```

**Hopping Type**

```c
  #define NO_HOPPING      0
  #define FIXED_HOPPING   1
  #define RANDOM_HOPPING  2
  #define HOPPING TYPE    NO_HOPPING
```

**Antenna select**

```c
  #define ONBOARD_ANT_SEL  2
  #define EXT_ANT_SEL      3
  #define ANT_SEL          EXT_ANT_SEL
```

**RF Type**

```c
   #define BLE_EXTERNAL_RF  0
   #define BLE_INTERNAL_RF  1
   #define RF_TYPE          BLE_INTERNAL_RF
```

**RF Chain**

```c
  #define NO_CHAIN_SEL       0
  #define WLAN_LP_CHAIN_BIT  1
  #define BT_HP_CHAIN_BIT    2
  #define BT_LP_CHAIN_BIT    3
  #define RF CHAIN           BT_HP_CHAIN_BIT
```

**PLL Mode**

```c
  #define PLL_MODE_0  0
  #define PLL_MODE_1  1
  #define PLL_MODE    PLL_MODE_0
```

**Loopback Mode**

```c
  #define LOOP_BACK_MODE_DISABLE  0
  #define LOOP_BACK_MODE_ENABLE   1
  #define LOOP_BACK_MODE          LOOP_BACK_MODE_DISABLE
```

**Memory Usage Requirements**

```c
   #define BT_GLOBAL_BUFF_LEN  15000  // The number of bytes required by the application and driver
```

###### Modifications to `rsi_ble_config.h`

Modifications are not needed to run this example, the following is for informational purposes only.

```c
   #define RSI_BLE_PWR_INX           30
   #define RSI_BLE_PWR_SAVE_OPTIONS  BLE_DISABLE_DUTY_CYCLING
```

**Opermode command parameters**

```c
   #define RSI_FEATURE_BIT_MAP             FEAT_SECURITY_OPEN
   #define RSI_TCP_IP_BYPASS               RSI_DISABLE
   #define RSI_TCP_IP_FEATURE_BIT_MAP      TCP_IP_FEAT_DHCPV4_CLIENT
   #define RSI_CUSTOM_FEATURE_BIT_MAP      FEAT_CUSTOM_FEAT_EXTENTION_VALID
   #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP  0
```

##### Testing the Application

###### Loading the RS9116W Firmware

See [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in the directory `<SDK>/firmware/`

###### Building the Application on the Host Platform

**EFX32 Platform**

Refer to [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), to setup EFR32 & EFM32 host platforms.

- Import the EFR32/EFM32 project from `<SDK>/examples/eatured/ble_per/projects`  
  - Select the appropriate `.slsproj` project file to suit your EFRx32 radioboard OR select the `*.brd2204a-gg11.slsproj` project for the EFM32GG11 board.
- Compile and flash the project to the EFx32
- Debug the project and pause execution
- If the RS9116W reset pin is **NOT** connected to the EFx32, press the RS9116W EVK Reset button
- Free run the project
- Proceed to [Verifying Operation](#verifying-operation)

**STM32 Platform**

Refer to [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/featured/ble_per/projects/ble_per-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project, pause execution
- If the RS9116W reset pin is **NOT** connected to the STM32, press the RS9116W EVK reset button
- Run the project on the STM32
- Proceed to [Verifying Operation](#verifying-operation)

###### Verifying Operation

A terminal output shows the following text during receive testing. Receive PER statistics are regularly printed to the terminal.
![Prints in Coolterm window](/wifibt-wc-featured-examples/2.14.0/images/images23-rxlog.png)

A terminal output shows the following text during transmit testing.
![Prints in Coolterm window](/wifibt-wc-featured-examples/2.14.0/images/image23-txlog.png)

When transmitting, a spectrum analyser may be used to see transmitted packets (and the transmit spectrum) as shown in the following image.<br />![Figure: Spectrum Analyzer 1 Mbps](/wifibt-wc-featured-examples/2.14.0/images/image23-spectrum.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### AWS IoT Device Shadow

##### Introduction

This application demonstrates how to securely connect a Silicon Labs RS911x Wi-Fi device to AWS IoT Core to send and receive data.
To successfully use this application, developers should be familiar with the operation of [AWS IoT Core](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) and the [AWS IoT Device Shadow Service](https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html).
If you are new to AWS IoT Core, we recommend running through the [AWS IoT Core Tutorial](https://docs.aws.amazon.com/iot/latest/developerguide/iot-tutorials.html) before proceeding.
In the following text, 'AWS IoT Core' is referred to as 'AWS' for brevity.

AWS refer to a 'Device Shadow' as a persistent, virtual representation of a device that can be accessed even if the physical device is offline.
The device state is captured in its 'shadow' and is represented as a JSON document.
The physical device can send commands using the MQTT protocol to get, update and delete the state of the shadow as well as receive notifications via MQTT about changes in the state pf the shadow.

The AWS IoT Device Shadow application publishes temperature and window open/close status on the topic `$aws/things/thingname/shadow/update`.
The room temperature and the window open/close status is available on the AWS cloud.

Additionally, the application subscribes to the shadow update topics:

```sh
  $aws/things/thingName/shadow/name/shadowName/update/accepted
  $aws/things/thingName/shadow/name/shadowName/update/rejected
  $aws/things/thingName/shadow/name/shadowName/update/delta
```

##### Overview of AWS SDK

AWS IoT Core is a cloud platform that connects devices across AWS cloud services. AWS IoT provides an interface that allows devices to communicate securely and reliably in bi-directional ways to AWS touch-points, even when devices are offline.

The AWS IoT Device SDK allow applications to securely connect to the AWS IoT platform.

![Figure: Setup Diagram for Device Shadow Example](/wifibt-wc-featured-examples/2.14.0/images/image431a.png)

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - STM32F411 Nucleo
- Wi-Fi Access point with a connection to the internet

![Figure: Setup Diagram for Device Shadow Example](/wifibt-wc-featured-examples/2.14.0/images/image91.png)

###### Software Requirements

- [Amazon AWS](https://aws.amazon.com/) account
- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- [Python 3](https://www.python.org/downloads/) installation
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)

###### Cloud Setup

This example requires your RS911x Wi-Fi device to be provisioned on AWS; you will need the device certificate and private key.
For brief provisioning instructions, see [AWS IoT Setup](#aws-iot-setup).

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi & Cloud Configuration

Configure the following parameters in [rsi_aws_device_shadow.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/aws_device_shadow/rsi_aws_device_shadow.c) to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID           "SILABS_AP"      // Wi-Fi Network Name
#define PSK            "1234567890"     // Wi-Fi Password
#define SECURITY_TYPE  RSI_WPA2         // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
```

###### RTOS Configuration

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE           512 * 4
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         512 * 2
```

Configure `AWS_IOT_MQTT_HOST` in the file [aws_iot_config.h](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/aws_device_shadow/rsi_aws_iot_config.h) to match the endpoint for your device in AWS.

```c
#define AWS_IOT_MQTT_HOST "xxxxxxxxxxxxx-ats.iot.us-east-2.amazonaws.com"
```

###### Power Save Configuration

Configure below parameter in [rsi_wlan_config.h](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/aws_device_shadow/rsi_wlan_config.h) to enable power save mode

```c
#define ENABLE_POWER_SAVE 1
```

###### Setting up Security Certificates

To authenticate and securely connect with AWS, your Wi-Fi device requires a unique x.509 security certificate and private key, as well as a CA certificate which is used to verify the AWS server. Security credentials need to be converted into a C-array rather than [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) provided by AWS; they also need to be added to your project.

The RS9116 SDK provides a conversion script (written in Python 3) to make the conversion straightforward. The script is provided in the SDK 'resources' directory and is called [certificate_to_array.py](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/).

To convert the device certificate and private key to C arrays, open a system command prompt and use the script as indicated in the following examples.

```sh
$> python3 certificate_to_array.py <input filename> <output arrayname>

For example:
$> python3 certificate_to_array.py d8f3a44d3f.cert.pem    aws_client_certificate
$> python3 certificate_to_array.py d8f3a44d3f.private.key aws_client_private_certificate
```

After running the script on the certificate and private key, two new files are created.

```sh
aws_client_certificate.pem.crt.h
aws_client_private_key.pem.key.h
```

Before proceeding, copy both of the new files to the WiSeConnect directory: `<SDK>/resources/certificates`<br />Go ahead and overwrite any existing files with the same name in that directory, the originals are not needed.

The Root CA certificate used by your Wi-Fi device to verify the AWS server is already included in the RS9116 SDK; no additional setup is required.
For reference, Amazon uses [Starfield Technologies](https://www.starfieldtech.com/) to secure the AWS website, the RS9116 SDK includes the [Starfield CA Certificate](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/aws_starfield_ca.pem.h).

##### Testing the Application

After making any custom configuration changes, and updating the device certificate and private key, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/).

After successful execution, device updates written to AWS can be observed in the AWS thing shadow.
![Figure: Shadow Update Activity](/wifibt-wc-featured-examples/2.14.0/images/image94.png)

The following debug prints are displayed when the application runs successfully.
![Figure: Debug Prints](/wifibt-wc-featured-examples/2.14.0/images/image95.png)

---

##### AWS IoT Setup

###### Create an AWS Thing

Create a thing in the AWS IoT registry to represent your IoT Device.

In the [AWS IoT console](https://console.aws.amazon.com/iot/home), in the navigation pane, choose Manage, and then choose Things.

![Figure: AWS console](/wifibt-wc-featured-examples/2.14.0/images/image422.png)

If a dialog box **"You don't have any things yet"** appears, choose **Register a thing**. Otherwise, choose **Create**.

![Figure: AWS Thing](/wifibt-wc-featured-examples/2.14.0/images/image423.png)

On the **Creating AWS IoT things** page, choose **Create a single thing**.

![Figure: AWS thing creation](/wifibt-wc-featured-examples/2.14.0/images/image424.png)

On the **Add your device to the device registry** page, enter a name for your IoT thing (for example, **Test_IoT**), and then choose **Next**. You can't change the name of a thing after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.

![Figure: Add Device](/wifibt-wc-featured-examples/2.14.0/images/image425.png)

On the **Add a certificate for your thing page**, choose **Create certificate**.

![Figure: Figure: Add certificate](/wifibt-wc-featured-examples/2.14.0/images/image426.png)

Choose the **Download** links to download the certificate, private key, and root CA certificate.
> **Warning:** This is the only instance you can download your certificate and private key. Make sure to save them safely.

Choose **Activate**.

Choose **Attach a policy**.
![Figure: Attach Policy](/wifibt-wc-featured-examples/2.14.0/images/image427.png)

Choose the Policy created and then choose **Register Thing**.

**Note!** If you don't have any policy created, follow the steps in **Create Policy** section in the below and then choose the created Policy

View list of devices as shown
![Figure: Register Thing](/wifibt-wc-featured-examples/2.14.0/images/image428.png)

###### Create Policy

1. Navigate to **AWS IoT console**
2. Choose **Policies** under **Secure**  
   ![Figure: Register Thing](/wifibt-wc-featured-examples/2.14.0/images/image429.png)
3. Click on **Create**.  
   ![Figure: Register Thing](/wifibt-wc-featured-examples/2.14.0/images/image430.png)
4. Give the **Name** to your Policy, Fill **Action** and **Resource ARN** as shown in below image, Click on **Allow** under **Effect** and click **Create**  
   ![Figure: Register Thing](/wifibt-wc-featured-examples/2.14.0/images/image431.png)

##### Selecting Bare Metal

The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

###### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image91b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-featured-examples/2.14.0/images/image91c.png)

###### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-featured-examples/2.14.0/images/image91a.png)

###### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

### Snippet Examples

#### Snippet Examples

Snippet examples are small projects that demonstrate one particular RS9116 feature or API.  The snippet examples are found in the WiSeConnect™ SDK at the path:  `<SDK>/examples/snippets` and are categorized by the feature that they demonstrate.

Details on the configuration and operation of each snippet example are available in the `readme.md` file that is found with the example source code and at the following links:

###### Bluetooth Examples

[**bt-power-save**](bt-bt-power-save-readme)<br />[**bt-spp-dual-role-with-secure-pairing**](bt-bt-spp-dual-role-with-secure-pairing-readme)

###### BLE Examples

[**ble-multiconnection-gatt-test**](ble-ble-multiconnection-gatt-test-readme)<br />[**ble-central**](ble-ble-central-readme)<br />[**ble-secureconnection**](ble-ble-secureconnection-readme)<br />[**ble-testmodes**](ble-ble-testmodes-readme)<br />[**ble-datalength**](ble-ble-datalength-readme)<br />[**ble-unified-ae-coex-app**](ble-unified-ae-coex-app-readme)<br />[**ble-throughput-app**](ble-ble-throughput-app-readme)<br />[**ble-power-save**](ble-ble-power-save-readme)<br />[**ble-hid-on-gatt**](ble-hid-on-gatt-readme)<br />[**ble-longrange-2mbps**](ble-ble-longrange-2mbps-readme)<br />[**ble-gatt-long-read**](ble-gatt-long-read-readme)<br />[**ble-privacy**](ble-ble-privacy-readme)<br />[**ble-heart-rate-profile**](ble-ble-heart-rate-profile-readme)<br />[**ble-ae-peripheral**](ble-ble-ae-peripheral-readme)<br />[**ble-accept-list**](ble-ble-accept-list-readme)<br />[**ble-dual-role**](ble-ble-dual-role-readme)<br />[**ble-ibeacon**](ble-ble-ibeacon-readme)<br />[**ble-ae-central**](ble-ble-ae-central-readme)

###### Wi-Fi + BLE Examples

[**wlan-ble-power-save**](wlan-ble-wlan-ble-power-save-readme)<br />[**wlan-station-ble-provisioning-select**](wlan-ble-wlan-station-ble-provisioning-select-readme)<br />[**wlan-ble-ae-coex-app**](wlan-ble-wlan-ble-ae-coex-app-readme)<br />[**wlan-station-ble-provisioning**](wlan-ble-wlan-station-ble-provisioning-readme)<br />[**wlan-station-ble-bridge**](wlan-ble-wlan-station-ble-bridge-readme)<br />[**wlan-station-ble-provisioning-AWS**](wlan-ble-wlan-station-ble-provisioning-aws-readme)

###### Wi-Fi Examples

[**wlan-tls-client**](wlan-tls-client-readme)<br />[**wlan-http-client-v6**](wlan-http-client-v6-readme)<br />[**wlan-access-point-v6**](wlan-access-point-v6-readme)<br />[**wlan-socket-select-app-udp**](wlan-socket-select-app-udp-readme)<br />[**wlan-sntp-client-v6**](wlan-sntp-client-v6-readme)<br />[**wlan-index-based-ssl-client-sockets**](wlan-index-based-ssl-client-sockets-readme)<br />[**wlan-ftp-client**](wlan-ftp-client-readme)<br />[**wlan-station-ping**](wlan-station-ping-readme)<br />[**wlan-station-ping-v6**](wlan-station-ping-v6-readme)<br />[**wlan-access-point**](wlan-access-point-readme)<br />[**wlan-throughput-dual-ip-v4-v6**](wlan-throughput-dual-ip-v4-v6-readme)<br />[**wlan-socket-select-app**](wlan-socket-select-app-readme)<br />[**wlan-calibration-app**](wlan-calibration-app-readme)<br />[**wlan-mqtt-client-v6**](wlan-mqtt-client-v6-readme)<br />[**wlan-concurrent-mode**](wlan-concurrent-mode-readme)<br />[**wlan-mqtt-client**](wlan-mqtt-client-readme)<br />[**wlan-tcp-logging-stats**](wlan-tcp-logging-stats-readme)<br />[**wlan-embedded-mqtt**](wlan-embedded-mqtt-readme)<br />[**wlan-enterprise-client**](wlan-enterprise-client-readme)<br />[**wlan-http-otaf**](wlan-http-otaf-readme)<br />[**wlan-throughput-v6**](wlan-wlan-throughput-v6-readme)<br />[**wlan-concurrent-mode-dual-ip**](wlan-concurrent-mode-dual-ip-readme)<br />[**wlan-power-save-deep-sleep**](wlan-power-save-deep-sleep-readme)<br />[**wlan-device-shadow-logging-stats**](wlan-cloud-apps-aws-iot-device-shadow-logging-stats-readme)<br />[**wlan-aws-iot-mqtt**](wlan-cloud-apps-aws-iot-mqtt-readme)<br />[**wlan-azure-iot**](wlan-cloud-apps-azure-iot-readme)<br />[**wlan-three-ssl-concurrent-client-sockets**](wlan-three-ssl-concurrent-client-sockets-readme)

###### Debug Utility Examples

[**debug-utils-ram-dump**](debug-utils-ram-dump-readme)

###### Wi-Fi + Dual Mode Bluetooth Examples

[**wlan-throughput-bt-spp-ble-dual-role**](wlan-bt-ble-wlan-throughput-bt-spp-ble-dual-role-readme)<br />[**wlan-https-bt-spp-ble-dual-role**](wlan-bt-ble-wlan-https-bt-spp-ble-dual-role-readme)

###### Dual Mode Bluetooth Examples

[**bt-ble-dual-mode**](bt-ble-bt-ble-dual-mode-readme)<br />[**bt-ble-update-gain-table**](bt-ble-update-gain-table-readme)

#### BT Powersave

##### 1. Purpose / Scope

This application demonstrates the process of configuring the device in power save in BT connected mode in bt_power_save example.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Smartphone with spp manager app
- Agilent power analyzer

![Setup Diagram for BT PowerSave Example](/wifibt-wc-snippet-examples/2.14.0/images/image7.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_IN) in the android smart phones for testing BT applications. Users can also use their choice of BT apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms:

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/bt/bt_power_save/projects/bt_power_save-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/bt/bt_power_save/projects/bt_power_save-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/bt/bt_power_save/projects/bt_power_save-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below:        
        ![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image7a.png)
- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/bt/bt_power_save/projects/bt_power_save-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** `rsi_bt_power_save_profile.c` file and update/modify following macros.

1. RSI_BT_LOCAL_NAME **-** Name of the Wyzbee (Master) device
2. PIN_CODE - Four-byte string required for pairing process.
3. PSP_TYPE – Power save profile type.  
   **Note:**  
   1. PSP_TYPE is only valid RSI_SLEEP_MODE_2.  
   2. RSI_MAXRSI_MAX_PSP is only valid in case of BT._PSP is only valid in case of BT.
4. SNIFF_MAX_INTERVAL - Sniff Maximum interval value
5. SNIFF_MIN_INTERVAL – Sniff Minimum interval value
6. SNIFF_ATTEMPT - Sniff Attempt Value
7. SNIFF_TIME_OUT – Sniff Timeout Value
8. **To Enable Power Save**  
   **PSP_MODE** refers power save profile mode. The WiSeConnect device supports following power modes in BT  
   **RSI_ACTIVE (0):** In this mode, the module is active and power save is disabled.  
   **RSI_SLEEP_MODE_2 (1):** This mode is applicable when the module is connected state. In this sleep mode, SoC will go to sleep based on GPIO handshake or Message exchange, therefore handshake is required before sending data to the module.  
   **RSI_SLEEP_MODE_8 (8):** In this power mode, the module goes to power save when it is in the unassociated state with the remote device. In this sleep mode, SoC will go to sleep based on GPIO handshake or Message exchange, therefore handshake is required before sending the command to the module.  
   ```c  
   #define PSP_MODE                                      RSI_SLEEP_MODE_2  
   ```  
   **Note:** For **RSI**_**SLEEP_MODE_2**_ _and_ _**RSI_SLEEP_MODE_8**_ _modes_***,*** _GPIO or Message based handshake can be selected using_ _**RSI_HAND_SHAKE_TYPE**_ _macro which is defined in_ _**rsi_bt_config.h**_  
   **Note:** In this example, user can verify RSI_SLEEP_MODE_2 with Message based handshake. If the user wants to verify other power modes, the user has to change the application as well as GPIO handshake signals  
   **PSP_TYPE** refers power save profile type. The WiSeConnect device supports following power save profile types in BT mode,  
   RSI_MAX_PSP (0): In this mode, the WiSeConnect device will be in Maximum power save mode. i.e. Device wakes up for every DTIM beacon and does data Tx and Rx.  
   ```c  
   #define PSP_TYPE                                      RSI_MAX_PSP  
   ```

**4.2**  Open `rsi_bt_config.h` file and update/modify following macros:

```c
#define RSI_FEATURE_BIT_MAP                           FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                             RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                    TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                    FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                (EXT_FEAT_LOW_POWER_MODE\|EXT_FEAT_XTAL_CLK_ENABLE\|RAM_LEVEL_NWP_ALL_MCU_ZERO)
```

`RSI_HAND_SHAKE_TYPE` is used to select GPIO or Message based handshake in `RS_SLEEP_MODE_2` and `RSI_SLEEP_MODE_8` modes**.**

```c
#define RSI_HAND_SHAKE_TYPE                           GPIO_BASED
```

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/bt/bt_power_save/projects/bt_power_save-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the project from `<SDK>/examples/snippets/bt/bt_power_save/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

##### 5.3 Common Steps

1. After the program gets executed, Silicon Labs module initializes the SPP profile and waits for the incoming connection.
2. Open Bluetooth SPP manager app on mobile and do the scan until Silicon Labs module (Ex: "SPP_SLAVE") gets present in the scan list  
   ![Scan on Bluetooth SPP manager app](/wifibt-wc-snippet-examples/2.14.0/images/image18a.png)
3. After the successful scan, select the device and initiate pairing to Silicon Labs module.
4. After initiating pairing, Pairing request will pop-up at smartphone side and issue secret key which is given at Silicon Labs module (PIN_CODE) side.  
   ![Pairing request pop-up at smartphone side](/wifibt-wc-snippet-examples/2.14.0/images/image18b.png)
5. After successful pair, initiate SPP connection to Silicon Labs module and give the secret key for receiving pairing request at remote device side.  
   ![Initiate SPP connection to Silicon Labs module](/wifibt-wc-snippet-examples/2.14.0/images/image18c.png)
6. After successful SPP Connection, Module go to sleep depending on the selected type of PSP TYPE.
7. Send some data (Ex: "Silicon Labs") from the remote device to Silicon Labs device and same data will send back from Silicon Labs device to remote device. Refer the given image for sending and receiving data from the remote device.  
   ![Send some data from the remote device to Silicon Labs device](/wifibt-wc-snippet-examples/2.14.0/images/image18d.png)
8. Note down power measurement by connecting the module to Agilent Power Meter.

##### 6. Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide).

#### BT SPP Dual Role with Secure Pairing

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK in Master/Slave mode and establish SPP profile connection with remote Master/Slave device using secure simple paring (SSP) and data exchange between two devices using SPP profile.

In this Application, the module configures in Master mode and waits to accept SPP profile level connection using secure simple pairing (SSP) from remote device. After successful SPP connection, Application will wait for data to receive from connected remote device. If remote device sends data to module, the module receives the data and send back the same data to remote device using SPP profile.

And also in this Application, the module configures in Slave mode and waits to accept SPP profile level connection using secure simple pairing (SSP) from remote device. After successful SPP connection, Application will wait for data to receive from connected remote device. If remote device sends data to module, the module receives the data and send back the same data to remote device using SPP profile.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)

![Setup Diagram for BT SPP Master Example ](/wifibt-wc-snippet-examples/2.14.0/images/image15.png)<br />**Setup Diagram for BT SPP Master Example**

![Setup Diagram for BT SPP Slave Example ](/wifibt-wc-snippet-examples/2.14.0/images/image15a.png)<br />**Setup Diagram for BT SPP Slave Example**

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_IN) in the android smart phones for testing BT applications. Users can also use their choice of BT apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects/bt_spp_dual_role_with_secure_pairing-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects/bt_spp_dual_role_with_secure_pairing-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects/bt_spp_dual_role_with_secure_pairing-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image15b.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects/bt_spp_dual_role_with_secure_pairing-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal/RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_spp_master_slave.c` file and update/modify following macros,

**4.1.1** User must update the below parameters

**SPP_MODE** refers to type of module mode, whether it's master/slave.

```c
#define SPP_SLAVE                      0
#define SPP_MASTER                     1

#define SPP_MODE                       SPP_MASTER
#if (SPP_MODE == SPP_MASTER)
#define RSI_BT_LOCAL_NAME             "SPP_MASTER"
#else
#define RSI_BT_LOCAL_NAME             "SPP_SLAVE"
#endif 
```

**PIN_CODE** refers four bytes string required for pairing process.

```c
#define PIN_CODE                                     "4321"
```

`REMOTE_BD_ADDR` refers Remote device BD address to connect.

Provide the Smart phone BD address,

```c
#define REMOTE_BD_ADDR                               "00:1B:DC:07:2C:F0"
```

**Note:** In the smartphone, User Can check the BD address of Bluetooth device in the following location: Settings/About phone/status/Bluetooth Address

![Bluetooth Address](/wifibt-wc-snippet-examples/2.14.0/images/image16.png)

`ENABLE_POWER_SAVE` refers Module to configure in power save mode

```c
#define ENABLE_POWER_SAVE                            0 
```

**Note:** By default this macro is disabled. User can enable this macro to configure the module in power save.

Following are the **non-configurable** macros in the application.

`BT_GLOBAL_BUFF_LEN` refers the number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                           15000
```

**4.1.2** Open `rsi_bt_config.h` file and update/modify following macros:

```c
#define RSI_FEATURE_BIT_MAP                          FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                            RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                   TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                   FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP               RAM_LEVEL_NWP_ALL_MCU_ZERO
```

**Role Switch Configuration**

Following 3 API's used to get the role, to set the role and to know the status of the role switch

```c
 //To know the role of the device rsi_bt_get_local_device_role((int8_t \*)str_conn_bd_addr, &device_state);
 //To set the device role to either Master or Slave.(set_role = 0 --\>Master,  set_role = 1 --\>Slave) rsi_bt_set_local_device_role((int8_t \*)str_conn_bd_addr, set_role, &device_state); 
 //To know the status of the Switch Role role_change (uint16_t resp_status, rsi_bt_event_role_change_t \*role_change_status1); 
```

The status of the role_change function should return success for successful role switch, otherwise fail.

**4.2** Open `rsi_spp_master_slave.c` file and update/modify following macros,

**4.2.1** User must update the below parameters

**SPP_MODE** refers to type of module mode, whether it's master/slave.

```c
#define SPP_MODE                       "SPP_SLAVE"
#if (SPP_MODE == SPP_MASTER)
#define RSI_BT_LOCAL_NAME             "SPP_MASTER"
#else
#define RSI_BT_LOCAL_NAME             "SPP_SLAVE"
#endif 
```

**PIN_CODE** refers four bytes string required for pairing process.

```c
#define PIN_CODE                                     "4321"
```

**4.2.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.
Following are the **non-configurable** macros in the application.

**BT_GLOBAL_BUFF_LEN** refers the number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                           15000
```

**4.3** Open `rsi_bt_config.h` file and update/modify following macros:

```c
#define CONCURRENT_MODE                              RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                          FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                            RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                   TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                   FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP               RAM_LEVEL_NWP_ALL_MCU_ZERO
#define RSI_BAND                                     RSI_BAND_2P4GHZ
```

**Role Switch Configuration**

Following 3 API's used to get the role, to set the role and to know the status of the role switch

```c
 //To know the role of the device rsi_bt_get_local_device_role((int8_t \*)str_conn_bd_addr, &device_state);
 //To set the device role to either Master or Slave.(set_role = 0 --\>Master,  set_role = 1 --\>Slave) rsi_bt_set_local_device_role((int8_t \*)str_conn_bd_addr, set_role, &device_state);
 //To know the status of the Switch Role role_change (uint16_t resp_status, rsi_bt_event_role_change_t \*role_change_status1); |
```

The status of the role_change function should return success for successful role switch, otherwise fail.

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects/bt_spp_dual_role_with_secure_pairing-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the project from `<SDK>/examples/snippets/bt/bt_spp_dual_role_with_secure_pairing/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

**Executing the Application for Master Mode**

1. Power on Bluetooth in smart phone and put it in visible mode to all Bluetooth devices(Can be done through "Bluetooth SPP Manager" app. As shown in the below image.

![Bluetooth Power On - Visible Mode](/wifibt-wc-snippet-examples/2.14.0/images/image16a.png)

1. Tap the "Set Device Discoverable" option in the App. By again tapping the "Allow/Yes" in the pop-up, the module will be discoverable for 60Seconds.

![Tap the "Set Device Discoverable" option in the App](/wifibt-wc-snippet-examples/2.14.0/images/image17a.png)

1. After the program gets executed, Silicon Labs module initiates basic connection with the remote device (Smart phone). User has to provide **PIN_CODE** at remote device for successful connectivity. Find below images for connection at remote device.

![Silicon Labs module initiates basic connection with the remote device](/wifibt-wc-snippet-examples/2.14.0/images/image17b.png)

1. After a successful physical level connection, in smartphone, "connection established" notification message will be displayed which means profile level connection is completed.
2. After successful SPP Connection in mobile side, go to BT_MESSENGER tab which is next to DEVICES tab. Write some data (Ex: "Silicon Labs") and call "Send Message" option in that app. we can see that the same message has been exchanged between two modules which is kind of loopback test.

![Write some data in BT_MESSENGER tab](/wifibt-wc-snippet-examples/2.14.0/images/image17c.png)

**Executing the Application for Slave Mode**

1. After the program gets executed, the Silicon Labs module initializes the SPP profile and waits for the incoming connection.
2. Open the Bluetooth setting present in the mobile. Now scan for available devices in the settings menu until the Silicon Labs module (Ex: "SPP_SLAVE") gets listed in that scan list.

![Scan for available devices in the settings menu](/wifibt-wc-snippet-examples/2.14.0/images/image18a.png)

1. After the successful scan, select the device and initiate pairing to Silicon Labs module.
2. After initiating pairing, the Pairing request will pop-up at the smartphone side and issue a secret key which is given at the Silicon Labs module (PIN_CODE ) side. Then the module successfully establishes the physical level connection.

![Pairing request will pop-up at the smartphone side](/wifibt-wc-snippet-examples/2.14.0/images/image18b.png)

1. Open the "SPP Manager app", Tap on the "search devices" option visible in the app you will get scan results as shown below

![Tap on the "search devices" option visible in the app](/wifibt-wc-snippet-examples/2.14.0/images/image18c.png)

1. After tapping on the SPP_SLAVE in that scan list, it will initiate profile level connection as it already paired through physical level process.
2. After successful SPP Connection in mobile side, go to BT_MESSENGER tab which is next to DEVICES tab. Write some data (Ex: "Silicon Labs") and call "Send Message" option in that app. we can see that the same message has been exchanged  between two modules which is kind of loopback test.

![Write some data in BT_MESSENGER tab](/wifibt-wc-snippet-examples/2.14.0/images/image18d.png)

##### 6. Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Multiconnection GATT Test

##### 1. Purpose / Scope

The Application demonstrates how to configure RS9116W EVK in central/peripheral modes and then connect with multiple peripherals/centrals.

It provides user to configure secure connection with central and peripheral remote devices and support data transfers.

This also displays all the remote GATT profiles and service characteristics logs of connected remote device.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Smart phone/tablet with BLE Application
- BLE peripheral device
- BLE central device

![Setup Diagram of Dual Role Example](/wifibt-wc-snippet-examples/2.14.0/images/image79.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_multiconnection_gatt_test/projects/ble_multiconnection_gatt_test-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_multiconnection_gatt_test/projects/ble_multiconnection_gatt_test-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_multiconnection_gatt_test/projects/ble_multiconnection_gatt_test-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image79b.png)

###### 3.4 RTOS Support

This application supports only RTOS configuration. By default, the application project files (Keil and Simplicity studio) are provided with OS environment in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** open `rsi_ble_config.h` file provided in the SDK at `examples/snippets/ble/ble_multiconnection_gatt_test` update/modify following macros.

**4.1.1** User must update the below parameters

To select number of BLE connections, configure below macros.

Set below macro to required peripheral connections.

```c
#define RSI_BLE_MAX_NBR_SLAVES   1
```

Set below macro to required master connections.

```c
#define RSI_BLE_MAX_NBR_MASTERS   1
```

` Note: Maximum no. of  RSI_BLE_MAX_NBR_MASTERS and RSI_BLE_MAX_NBR_SLAVES can be configured to max '3'.`

If CONNECT_OPTION is set to CONN_BY_NAME, configure below macros.

```c
#define CONNECT_OPTION CONN_BY_NAME //CONN_BY_NAME or CONN_BY_ADDR
```

To identify remote device with BD Address/device name.

Add the remote BLE device name to connect

```c
#define RSI_REMOTE_DEVICE_NAME1                       "SILABS_DEV"
#define RSI_REMOTE_DEVICE_NAME2                       "slave22"
#define RSI_REMOTE_DEVICE_NAME3                       "slave3"
```

If CONNECT_OPTION is set to CONN_BY_ADDR, configure the below macros.

Configure the address type of remote device as either Public Address or Random Address

```c
#define RSI_BLE_DEV_ADDR_TYPE LE_PUBLIC_ADDRESS //!LE_PUBLIC_ADDRESS or LE_RANDOM_ADDRESS
```

Add the BD Address of remote BLE device to connect

```c
#define RSI_BLE_DEV_1_ADDR "00:1A:7D:DA:71:16"
#define RSI_BLE_DEV_2_ADDR "00:1A:7D:DA:71:74"
#define RSI_BLE_DEV_3_ADDR "00:1A:7D:DA:73:13"
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Configure below macros to select each connection configurations,

**Master1 configurations: (where XX=M1)**

Set below macro to enable secure connection between Silicon Labs device(peripheral) and remote ble device(central)

```c
#define SMP_ENABLE_XX         0
```

//By default this macro is set to '0'

Set below macro to add remote device to whitelist

```c
#define ADD_TO_WHITELIST_XX     0
```

//By default this macro is set to '0'

Set below macro to discover remote profiles.

```c
#define PROFILE_QUERY_XX     1
```

//By default this macro is set to '1'

Set below macro to enable data transfer between devices

```c
#define DATA_TRANSFER_XX     1
```

//By default this macro is set to '1'

To select the type of data transfer configure below macros

Set below macro to receive 'gatt notifications' from remote device.

```c
#define RX_NOTIFICATIONS_FROM_XX     0
```

//By default this macro is set to '1'

Note: Make sure to set below macros to 0 #define  RX_INDICATIONS_FROM_XX  0 //Set this to 0 |

Set below macro to receive 'gatt indications' from remote device.

```c
#define RX_INDICATIONS_FROM_XX     0
```

//By default this macro is set to '0'

Set below macro to Transmit 'gatt notifications' to remote device.

```c
#define TX_NOTIFICATIONS_TO_XX     1
```

//By default this macro is set to '1'

**Note:**
Make sure to set below macros to 0

```c
#define  TX_WRITES_TO_XX        0 //Set this to 0
#define  TX_WRITES_NO_RESP_TO_XX    0 //Set this to 0
#define  TX_INDICATIONS_TO_XX    0 //Set this to 0 
```

Set below macro to Transmit 'gatt write with response' to remote device.

```c
#define TX_WRITES_TO_XX     0
```

//By default this macro is set to '0'

Set below macro to Transmit 'gatt write without response' to remote device.

```c
#define TX_WRITES_NO_RESP_TO_XX     0
```

//By default this macro is set to '0'

Set below macro to Transmit 'gatt indications to remote device.

```c
#define TX_INDICATIONS_TO_XX       0
```

//By default this macro is set to '0'

To select data length extension for each connection configure below macro

Set below macro to enable data length extension

```c
#define DLE_ON_XX             0
```

//By default this macro is set to '0'

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_multiconnection_gatt_test/projects/ble_multiconnection_gatt_test-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/ble/ble_multiconnection_gatt_test/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote ble devices in peripheral and put it in advertising mode and/or in central and put in scanning mode.
2. Silicon Labs device is in scanning and advertising mode.
3. After the program gets executed, Silicon Labs device tries to connect with the remote device name specified in  
   the macro **RSI_REMOTE_DEVICE_NAME1**or **RSI_BLE_DEV_1_ADDR**.
4. Observe that the connection is established between the desired device and RS9116W EVK.
5. Observe the listed remote device GATT profiles and characteristics logs displayed on the teraterm.
6. If user configures SMP pairing in the specified macro **SMP_ENABLE_XX** , after successful connection between module and remote device flow of commands are as below:  
   a. Central device will initiate SMP pairing  
   b. Peripheral device gives SMP response.  
   For SMP success give ok for pairing request and enter the passkey displayed on host logs.
7. If SMP succeed, host receives SMP encrypt enabled event. If not success, Device sends SMP failure event to host.
8. After successful program execution, if the Silcon Labs device connects to remote BLE peripheral device, prints in teraterm looks as shown below.

![Prints in Teraterm for Central Configuration-1](/wifibt-wc-snippet-examples/2.14.0/images/multi-gatt-master1.png)

![Prints in Teraterm for Central Configuration-2](/wifibt-wc-snippet-examples/2.14.0/images/multi-gatt-master2.png)

1. After successful program execution, if the Silcon Labs device connects to remote BLE central device, prints in teraterm looks as shown below.

![Prints in Teraterm for Peripheral Configuration-1](/wifibt-wc-snippet-examples/2.14.0/images/multi-gatt-slave1.png)

1. To check data transfer, enable Gatt notifications of Module on service characteristic having UUID 0x1AA1
2. If enabled, module continuously transmits notifications which can be seen on remote device

![Prints in Teraterm for Peripheral Configuration-2](/wifibt-wc-snippet-examples/2.14.0/images/multi-gatt-slave2.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Central

##### 1. Purpose / Scope

This application demonstrates how to connect RS9116W EVK with remote BLE device in central mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device

![figureSetup Diagram for Simple Central Example](/wifibt-wc-snippet-examples/2.14.0/images/images23.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_central/projects/ble_central-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_central/projects/ble_central-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_central/projects/ble_central-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image23a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_central/projects/ble_central-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_central.c` file

**4.1.1** User must update the below parameters

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                          LE_PUBLIC_ADDRESS 
```

Based on address type of remote device, valid configurations are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                               "00:1E:7C:25:E9:4D"  
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect.

```c
#define RSI_REMOTE_DEVICE_NAME                         "SILABS_DEV" 
```

**Note:** user can configure either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the event numbers for advertising, connection and disconnection events

```c
#define RSI_APP_EVENT_ADV_REPORT                       0
#define RSI_APP_EVENT_CONNECTED                        1
#define RSI_APP_EVENT_DISCONNECTED                     2
```

Following are the non-configurable macros in the application.

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       BLE_DISABLE_DUTY_CYCLING
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

**Note:** `rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippetsble/ble/ble_central/projects/ble_central-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_central/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote BLE device in peripheral mode and put it in advertising mode.For remote mobile ensure that the device is named same as the value mentioned in RSI_REMOTE_DEVICE_NAME macro also see to it that Complete local name record is added to advertising data and Scan response data and connectable is ticked in options.
2. After the program gets executed, Silicon Labs device tries to connect with the remote device specified in `RSI_BLE_DEV_ADDR` or `RSI_REMOTE_DEVICE_NAME` macro.
3. Observe that the connection is established between the desired device and RS9116W EVK.  
   **Note:** Examples for BLE peripherals: Bluetooth Dongle, mobile application, TA sensor tag.
4. After successful program execution the prints in teraterm looks as shown below.

![Prints in Teraterm window](/wifibt-wc-snippet-examples/2.14.0/images/images23-log.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Secure Connection

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK device in peripheral role and how to connect it to a remote device. By default, our module has enable the SMP secure connection is enabled in the module.

In this application, module connects with remote device and initiates SMP pairing process.  After successful SMP pairing, SMP encryption will be enabled in both Central and Peripheral device.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device which supports privacy feature(Generally phones with the BLE Connect application)
- BLE peripheral device which supports SMP pairing(This Application uses TI sensor tag for a remote device)

![Setup Diagram For LE Secure Connections Example](/wifibt-wc-snippet-examples/2.14.0/images/image-1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_secureconnection/projects/ble_secureconnection-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_secureconnection/projects/ble_secureconnection-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_secureconnection/projects/ble_secureconnection-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-1a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_secureconnection/projects/ble_secureconnection-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_sc.c` file and update/modify following macros,

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

`RSI_BLE_DEVICE_NAME` refers the name of the WiSeConnect device to appear during scanning by remote devices.

```c
#define RSI_BLE_DEVICE_NAME                              "BLE_SMP_SC"
```

RSI_BLE_SMP_IO_CAPABILITY refers IO capability.

```c
#define RSI_BLE_SMP_IO_CAPABILITY                        0x00
```

RSI_BLE_SMP_PASSKEY refers SMP Passkey

```c
#define RSI_BLE_SMP_PASSKEY                              0
```

Following are the non-configurable macros in the application.

```c
#define RSI_BLE_CONN_EVENT                               0x01
#define RSI_BLE_DISCONN_EVENT                            0x02
#define RSI_BLE_SMP_REQ_EVENT                            0x03
#define RSI_BLE_SMP_RESP_EVENT                           0x04
#define RSI_BLE_SMP_PASSKEY_EVENT                        0x05
#define RSI_BLE_SMP_FAILED_EVENT                         0x06
#define RSI_BLE_ENCRYPT_STARTED_EVENT                    0x07
#define RSI_BLE_SMP_PASSKEY_DISPLAY_EVENT                0x08
#define RSI_BLE_SC_PASSKEY_EVENT                         0X09
#define RSI_BLE_LTK_REQ_EVENT                            0x0A
```

BT_GLOBAL_BUFF_LEN refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                               15000
```

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.2**  Open `rsi_ble_config.h` file and update/modify following macros,

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                  0
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_secureconnection/projects/ble_secureconnection-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_secureconnection/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. After the program gets executed, WiseConnect device will be in advertising state.
2. Open a LEApp in the Smartphone and do the scan.Ensure that the device is not bonded prior . Open the bonded tab and if the application name appears  
   then click on the three dots beside the name and select delete bond information.
3. In the App, RS9116W EVK  will appear with the name configured in the macro "BLE_SMP_SC" or sometimes observed as Silicon Labs device as internal name "SimpleBLEPeripheral".
4. Initiate connection from the App.
5. Observe that the connection is established between the desired device and Silicon Labs device.When application sends a smp request accept it on remote side by clicking ok(pair) and after smp passkey display event .Enter the passkey displayed on the console (host logs) on the remote mobile side
6. After successful connection, application will initiate SMP paring and wait for SMP response event and SMP passkey request event. After receiving SMP response and SMP SC passkey events, application sends SMP response and stores passkey in numeric value and sets SMP Sc Passkey responses event. If SMP is successful, Device sends SMP encrypt started event to host. If not success, Device sends SMP failure event to host.
7. After successful program execution, the prints in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/image-1b.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

##### BLE Testmodes

**Setup**

![Figure btm1: Setup Diagram for TestModes Example](/wifibt-wc-snippet-examples/2.14.0/images/images-btm1.png)

**Configuration and Steps for Execution**

**Configuring the Application for Tx:**

1. Open **rsi_ble_testmodes.c** file and update/modify following macros:  
   #define RSI_CONFIG_TEST_MODE                          RSI_BLE_TESTMODE_TRANSMIT  
   #define RSI_BLE_TX_PAYLOAD_LEN                        0x20  
   #define RSI_BLE_TX_PAYLOAD_TYPE                       PRBS9_SEQ  
   **RSI_SEL_ANTENNA** refers to the antenna which is to be used by Silicon Labs module.  
   If the user using internal antenna then set,  
   #define RSI_SEL_ANTENNA                               RSI_SEL_INTERNAL_ANTENNA  
   If the user using an external antenna (U.FL connector) then set, **RSI_SEL_EXTERNAL_ANTENNA**
2. Open rsi_bt_config.h file,  
   Following are the **non-configurable** macros in the file.  
   **BT_GLOBAL_BUFF_LEN** refers Number of bytes required by the application and the driver  
   #define BT_GLOBAL_BUFF_LEN                            15000
3. Open rsi_wlan_config.h file and update/modify following macros,  
   #define CONCURRENT_MODE                               RSI_DISABLE  
   #define RSI_FEATURE_BIT_MAP                           FEAT_SECURITY_OPEN  
   #define RSI_TCP_IP_BYPASS                             RSI_DISABLE  
   #define RSI_TCP_IP_FEATURE_BIT_MAP                    TCP_IP_FEAT_DHCPV4_CLIENT  
   #define RSI_CUSTOM_FEATURE_BIT_MAP                    FEAT_CUSTOM_FEAT_EXTENTION_VALID  
   #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                RAM_LEVEL_NWP_ALL_MCU_ZERO  
   #define RSI_BAND                                      RSI_BAND_2P4GHZ
4. Open rsi_ble_config.h file and update/modify following macros,  
   #define RSI_BLE_PWR_INX                               30  
   #define RSI_BLE_PWR_SAVE_OPTIONS                      0  
   ```c  
   Note:  
   rsi_bt_config.h, rsi_wlan_config.h and rsi_ble_config.h files are already set with the desired configuration in respective example folders user need not change for each example.  
   ```

**Executing the Application**

1. After the program gets executed, Silicon Labs module will Transmit the packets with desired length.
2. Run the below command using Third party dongle to verify whether the packets are transmitted or not from the Silicon Labs module.
3. hcitool -i hcix cmd 0x08 0x001D 0x10 → (hcix – Interface of third party dongle, 0x10 – Received  channel)
4. Received channel of third party dongle should be same as transmit channel of Silicon Labs module.
5. Run the below command using Third party dongle to stop receiving.
6. hcitool -i hcix cmd 0x08 0x001F (hcix – Interface of third party dongle)
7. Verify the status parameters whether the packets are received or not after receiving stop command.

**Configuring the Application for Rx:**

1. Open rsi_ble_testmodes.c file and update/modify following macros:  
   #define RSI_CONFIG_TEST_MODE                      RSI_BLE_TESTMODE_RECEIVE  
   **RSI_SEL_ANTENNA** refers to the antenna which is to be used by Silicon Labs module.  
   If the user using internal antenna then set,  
   #define RSI_SEL_ANTENNA                         RSI_SEL_INTERNAL_ANTENNA  
   If the user using an external antenna (U.FL connector) then set, RSI_SEL_EXTERNAL_ANTENNA

**Executing the Application**

1. After the program gets executed, Silicon Labs module will Receive the packets.
2. Run the below command using Third party dongle to transmit the packets to Silicon Labs module.
3. hcitool -i hcix cmd 0x08 0x001E 0x10 0x20 0x01 → (hcix – Interface of third party dongle, 0x10 – Received  channel , 0x20 – Payload length, 0x01 – Payload Type)
4. Received channel of Silicon Labs module should be same as transmit channel of Third party dongle.

#### BLE Data Length Extensions

##### 1. Purpose / Scope

This application demonstrates how to configure the RS9116W EVK in central role and can be used to set data length extension with the connected remote device.
Packet length extension refers to the increasing Packet Data Unit (PDU) size from 27 to 251 bytes during the data transfer during the connection events.
Both the central and peripheral can initiate this procedure at any time after entering the Connection.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device which supports data length extension feature.

![Setup diagram for BLE Data Length Extensions](/wifibt-wc-snippet-examples/2.14.0/images/images-bdl1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_datalength/projects/ble_datalength-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_datalength/projects/ble_datalength-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_datalength/projects/ble_datalength-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/imagebdl-radio.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_datalength/projects/ble_datalength-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_datalength.c` file

**4.1.1** User must update the below parameters

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                           LE_PUBLIC_ADDRESS
```

Based on the address of the advertising device, Valid configurations are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

**Note**
Depends on the remote device, address type will be changed.

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                                "00:23:A7:80:70:B9"
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect

```c
#define RSI_REMOTE_DEVICE_NAME                         "SILABS_DEV"
```

---

**Note!**
Silicon Labs module can connect to remote device by referring either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

---

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the non-configurable macros in the file.
`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                              15000 
```

Following are the event numbers for advertising, connection and Disconnection events,

```c
#define RSI_APP_EVENT_ADV_REPORT                         0
#define RSI_APP_EVENT_CONNECTED                          1
#define RSI_APP_EVENT_DISCONNECTED                       2 
#define RSI_APP_EVENT_DATA_LENGTH_CHANGE                 3
#define RSI_BLE_MTU_EVENT                                4
```

Following are the macros for setting data length(TX length and TX time)

```c
#define TX_LEN                                          0x001e
#define TX_TIME                                         0x01f4
```

**4.2** Open `rsi_ble_config.h` file. User can also modify the below parameters as per their needs and requirements.

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       BLE_DISABLE_DUTY_CYCLING
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                             FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                               RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                      TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                      FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                  RAM_LEVEL_NWP_ALL_MCU_ZERO
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_datalength/projects/ble_datalength-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_datalength/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote device in peripheral mode and put it in advertising mode.
2. After the program gets executed, Silicon Labs device tries to connect with the remote device specified in **RSI_BLE_DEV_ADDR** or **RSI_REMOTE_DEVICE_NAME** macro.
3. Observe that the connection is established between the desired device and Silicon Labs device.
4. After connection Silicon Labs device will set data length of the remote device.
5. Observe data length change event after setting data length.
6. After successful program execution the print in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/images-bdl-log.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Extended Advertising Unified CoEx App

##### 1. Purpose / Scope

This application demonstrates how to configure  RS9116W EVK as both Extended Advertiser(Peripheral) and Extended Scanner(Central) . It also has support for multiple connections(1 central + 1 peripheral) along with SMP feature and data transfer.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device with AE support
- BLE central device with AE support

![Setup Diagram of Unified AE CoEx Example](/wifibt-wc-snippet-examples/2.14.0/images/ae-unified-setup.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/unified_ae_coex_app/projects/unified_ae_coex_app-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/unified_ae_coex_app/projects/unified_ae_coex_app-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/unified_ae_coex_app/projects/unified_ae_coex_app-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image79b.png)

###### 3.4 RTOS Support

This application supports only RTOS configuration. By default, the application project files (Keil and Simplicity studio) are provided with OS environment in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `ble_config.h` file and update/modify following macros,

**4.1.1** User must update the below parameters

Configure the below macros to enable extended advertsing and scanning by default respectively

```c
       #define ADV_ENABLED_DEFAULT    1
       #define SCAN_ENABLED_DEFAULT   1
```

Set the below macro to enable second advertising set

```c
       #define ADV_SET2    1
```

Configure the below macros to set the number of peripheral and central connections that can be made

```c
       #define RSI_BLE_MAX_NBR_SLAVES    1
       #define RSI_BLE_MAX_NBR_MASTERS   1
```

Fill the name of the peripheral to be connected to in the following macro

```c
       #define RSI_REMOTE_DEVICE_NAME1   AEdevice1
```

configure below macro to enable secure connection for central and peripheral respectively :

```c
       #define SMP_ENABLE_M1    1
       #define SMP_ENABLE_S1    1
```

set below macro to receive 'gatt notifications' from remote device

```c
       #define RX_NOTIFICATIONS_FROM_M1    1
       #define RX_NOTIFICATIONS_FROM_S1    1
```

**Note:**
Max limit for number of peripheral connections is 1 and central connections is 1

**Power save configuration**

- By default, The Application is configured with power save.  
  #define ENABLE_POWER_SAVE 0
- If user wants to run the application in power save, modify the below configuration.  
  #define ENABLE_POWER_SAVE 1

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements

The length of the advertising data needs to be filled in the following macro

```c
       #define BLE_AE_ADV_DATA_LEN    0x19
```

Below mentioned macro needs to be populated with data

```c
       #define BLE_AE_ADV_DATA    "AE_PERIPHERAL_DATA_1"
```

The Extended advertising handle for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_HNDL_SET_1          0x00
#define BLE_AE_ADV_HNDL_SET_2          0x01
```

The minimum advertising interval for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_INT_MIN_SET_1       0x20
#define BLE_AE_ADV_INT_MIN_SET_2       0x30
```

The maximum advertising interval for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_INT_MAX_SET_1       0x20
#define BLE_AE_ADV_INT_MAX_SET_2       0x30
```

The Extended advertising channel map for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_CHANNEL_MAP_SET_1   0x07
#define BLE_AE_ADV_CHANNEL_MAP_SET_2   0x07
```

The Extended advertising filter policy for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_FILTER_POLICY_SET_1 0x00
#define BLE_AE_ADV_FILTER_POLICY_SET_2 0x00
```

The Extended advertising TX Power for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_TX_PWR_SET_1        0x7f
#define BLE_AE_ADV_TX_PWR_SET_2        0x7f
```

The primary advertising phy for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_PRIMARY_ADV_PHY_SET_1   0x01
#define BLE_AE_PRIMARY_ADV_PHY_SET_2   0x01
```

The Extended advertising max skip for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_SEC_ADV_MAX_SKIP_SET_1  0x00
#define BLE_AE_SEC_ADV_MAX_SKIP_SET_2  0x00
```

The secondary advertising phy for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_SECONDARY_ADV_PHY_SET_1 0x01
#define BLE_AE_SECONDARY_ADV_PHY_SET_2 0x01
```

The Extended advertising SID for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_SID_SET_1           0x00
#define BLE_AE_ADV_SID_SET_2           0x01
```

The Extended advertising scan request notification enable for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_SCAN_REQ_NOTIF_EN_SET_1 0x01
#define BLE_AE_SCAN_REQ_NOTIF_EN_SET_2 0x01
```

The Extended advertising event properties for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_EVNT_PROP_SET_1     (BLE_CONNECTABLE_ADV)
#define BLE_AE_ADV_EVNT_PROP_SET_2     0x00
```

The Extended advertising duration for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_DUR_SET_1           0x00
#define BLE_AE_ADV_DUR_SET_2           0x00
```

The maximum extended advertising events for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_MAX_AE_EVENTS_SET_1 0x00
#define BLE_AE_ADV_MAX_AE_EVENTS_SET_2 0x00
```

Extended scanning filter type can be set with the below macro

```c
#define BLE_AE_SCAN_FILTER_TYPE       SCAN_FILTER_TYPE_ALL
```

The scan type for primary phy can be set using below macro

```c
#define PRI_PHY_BLE_AE_SCAN_TYPE      SCAN_TYPE_ACTIVE
```

The scan type for secondary phy can be set using below macro

```c
#define SEC_PHY_BLE_AE_SCAN_TYPE      SCAN_TYPE_ACTIVE
```

The primary phy extended scan interval can be set using below macro

```c
#define PRI_PHY_LE_AE_SCAN_INTERVAL   0x100
```

The primary phy extended scan window can be set using below macro

```c
#define PRI_PHY_LE_AE_SCAN_WINDOW     0x50
```

The secondary phy extended scan interval can be set using below macro

```c
#define SEC_PHY_LE_AE_SCAN_INTERVAL   0x100
```

The secondary phy extended scan window can be set using below macro

```c
#define SEC_PHY_LE_AE_SCAN_WINDOW     0x50
```

Extended scanning filter duplicates can be set using below macro

```c
#define BLE_AE_SCAN_ENABLE_FILTER_DUP 0x00
```

Extended scan duration can be set using below macro

```c
#define BLE_AE_SCAN_DUR               0x00
```

Extended scan period can be set using below macro

```c
#define BLE_AE_SCAN_PERIOD            0x00
```

Following are the **non-configurable** macros in the application.

The event properties bits:

```c
#define BLE_CONNECTABLE_ADV        (1 << 0)
#define BLE_SCANNABLE_ADV          (1 << 1)
#define BLE_LOW_DUTY_DIR_CONN_ADV  (1 << 2)
#define BLE_HIGH_DUTY_DIR_CONN_ADV (1 << 3)
#define BLE_LEGACY_ADV             (1 << 4)
#define BLE_ANONYMOUS_ADV          (1 << 5)
#define BLE_TX_WR_ADV              (1 << 6)
```

Global buffer length:
#define BT_GLOBAL_BUFF_LEN                             15000

Phy rate bits:

```c
#define PHY_1M       BIT(0)
#define PHY_2M       BIT(1)
#define PHY_LE_CODED BIT(2)
```

```c
	 #define RSI_BLE_PWR_INX          30
	 #define RSI_BLE_PWR_SAVE_OPTIONS 0    
	 #define BLE_DISABLE_DUTY_CYCLING 0
     #define BLE_DUTY_CYCLING         1
     #define BLR_DUTY_CYCLING         2
     #define BLE_4X_PWR_SAVE_MODE     4
```

**Opermode command parameters**

```c
	 #define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
	 #define RSI_TCP_IP_BYPASS                              RSI_DISABLE
	 #define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
	 #define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
	 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

**Note:**
ble_config.h file is already set with desired configuration in respective example folder , user need not change for each example.

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/unified_ae_coex_app/projects/unified_ae_coex_app-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/ble/unified_ae_coex_app/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Successful build output will show as below.

##### 6. Program the device

- Once the build was successfull, right click on project and click on Debug As->Silicon Labs ARM Program as shown in below image.

![Unified Ae Coex App Build](/wifibt-wc-snippet-examples/2.14.0/images/unified-ae-coex-app-build.png)
**Note:** Simillarly, Choose the **Run As** option fo one shot execution.

##### 6.1 Running the RS9116W Application

###### 6.1.1 Steps to be followed to verify BLE AE Unified CoEx App

1. Set all the configurations necessary refering to section 4.
2. If extended advertsing is enabled by default RS9116W would be visible on air
3. If extended scanning is enabled it will scan in the given interval and window
4. To make remote central connection scan from any BLE scanner search for the device(if no random address is set it will advertise with the public address)click on connect , if SMP is enabled for this connection the process is started and after successful bonding if data transfer is enabled it is started .**Note:** To see the services on client end need to issue discover services after bonding from remote
5. To make a remote peripheral connection advertise the remote with the particuler name specified in RSI_REMOTE_DEVICE_NAME1 macro,if SMP is enabled for this connection the process is started and after successful bonding if data transfer is enabled it is started .

##### 7. Observing the output prints on serial terminal

- Prints can see as below in any Console terminal  
  ![Unified Ae Coex App Prints](/wifibt-wc-snippet-examples/2.14.0/images/unified-ae-coex-app-prints.png)

#### BLE Throughput App

##### 1 Introduction

This application demonstrates how to exchange continuous data to the remote device to measure the On-Air Throughput using a BLE Sniffer.

- In this Application, the GATT server configures with Custom service with write, read, and notification characteristic UUIDs.
- When connected remote device enables the notification on UUID, Silicon Labs device sends the continuous notifications to the connected device.
- This is data can be captured with Sniffer to measure the throughputs.

###### Sequence of Events

This Application explains to the user how to:

- Create a Simple chat service
- Make the device advertise / scannable
- Connect from remote BLE device/ Connect to remote BLE device
- Initiate the Security
- Excite the Data length and Phy rate features
- Sends the notification messages to the connected peer/Smartphone when the notification is enabled

##### 2 Prerequisites

For the application, you will need the following:

###### **2.1 Hardware Requirements**

- A Windows PC
- BLE peripheral device(Bluetooth version 4.0 and above version).

###### 2.1.1 SoC (heading level 7)

- Silicon Labs SiWx917 PK6030A SoC Kit which includes  
  - BRD4001A/BRD4002A Wireless Starter Kit Mainboard  
  - BRD4325A Radio Board
- USB TO UART converter / TTL cable

###### 2.1.2 NCP (heading level 7)

- Silicon Labs BRD8036A Si917 QMS SB Expansion Board
- [Silicon Labs SLWSTK6006A EFR32xG21 Wireless Starter Kit](https://www.silabs.com/development-tools/wireless/efr32xg21-wireless-starter-kit) which includes  
  - BRD4001A/BRD4002A Wireless Starter Kit Mainboard  
  - BRD4180A/BRD4180B Radio Board

###### 2.2 Software Requirements

- Simplicity Studio IDE  
  - To download and install the Simplicity Studio IDE, refer to the "Simplicity Studio IDE Set up" section in _**Getting started with SiWx91x**_ guides.
- SiWx917_WiSeConnect_SDK.X.X
- [EFR connect Mobile APP](https://www.silabs.com/developers/efr-connect-mobile-app)
- Tera Term software or any other serial terminal software - for viewing application prints

##### 3 Setup diagram

###### 3.1 SoC

![Blethroughputsoc](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputsoc.png)

###### 3.2 NCP

![Blethroughputncp](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputncp.png)

**NOTE**: The Host MCU platform (EFR32xG21) and the SiWx91x interact with each other through the SPI interface.

##### 4 Setup

###### 4.1 SoC/NCP

- Follow the**Hardware connections and Simplicity Studio IDE Set up**  section in the respective _**Getting Started with SiWx91x**_ guides to make the hardware connections and add the SiWx91x COMBO SDKs to Simplicity Studio IDE.

###### 4.2 Loading the SiWx91x Firmware

- Load the latest firmware into SiWx91x module, which is located in the `<SDK>/connectivity_firmware/` path as described in the **SiWx91x Firmware Update** section in the respective _**Getting started with SiWx91x**_ guides.

##### 5 Project Creation

To create the BLE Heartrate example project in the Simplicity Studio IDE, follow the **Project Creation** section in the respective _**Getting started with SiWx91x**_ guides.

- For SoC, choose the **Bluetooth - SoC BLE Thoughput App** example.
- For NCP, choose the **Bluetooth - NCP BLE Thoughput App** example.

##### 6. Application Configuration

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes if needed.

1. In the Project explorer pane of the IDE, expand the **ble_throughput_app_soc** folder and open the **rsi_ble_throughput.c** file.  
   ![Blethroughputapplicationconfigurations](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputapplicationconfigurations.png)  
   - **BLE_THROUGHPUT** refers the name of the Silicon Labs device to appear during scanning by remote devices.    
     ```c    
     #define RSI_BLE_DEVICE_NAME                                  "BLE_THROUGHPUT"    
     ```
2. Open `rsi_ble_common_config.h` file and update the below parameters.  
   ![Blethroughputconfigurations2](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputconfigurations2.png)  
   - **BLE characteristic service and attribute uuid**    
     ```c    
     //RSI_BLE_NEW_SERVICE_UUID refers to the 16-bit of 128-bit attribute value of the newly created service.     
     //128-bit UUID service: 0000AABB-0000-1000-8000-0026BB765291    
     #define RSI_BLE_NEW_SERVICE_UUID                                0xAABB    
         
     //RSI_BLE_ATTRIBUTE_1_UUID refers to the attribute type of the first attribute under this service (RSI_BLE_NEW_SERVICE_UUID).    
     #define RSI_BLE_ATTRIBUTE_1_UUID                                0x1AA1    
         
     //RSI_BLE_ATTRIBUTE_2_UUID refers to the attribute type of the second attribute under this service (RSI_BLE_NEW_SERVICE_UUID).    
     #define RSI_BLE_ATTRIBUTE_2_UUID                                0x1BB1    
     ```  
   - **Note:**   Following are the **Non-configurable** macros in the application.    
     ```c    
     //RSI_BLE_CHAR_SERV_UUID refers to the attribute type of the characteristics to be added in a service.    
     #define RSI_BLE_CHAR_SERV_UUID                                    0x2803    
         
     //RSI_BLE_CLIENT_CHAR_UUID refers to the attribute type of the client characteristics descriptor to be added in a service.    
     #define RSI_BLE_CLIENT_CHAR_UUID                                  0x2902    
     ```  
   - **Note:**  Following are the properties:    
     ```c    
     //RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.    
     #define RSI_BLE_ATT_PROPERTY_READ                                 0x02    
         
     //RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.    
         
     #define RSI_BLE_ATT_PROPERTY_WRITE                                0x08    
         
     //RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.    
     #define RSI_BLE_ATT_PROPERTY_NOTIFY                               0x10    
     ```
3. Open **rsi_ble_config.h** file and configure the Opermode command parameters.  
   ![Blethroughputconfigurations1](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputconfigurations1.png)  
   - **BLE Throughput Configurations**    
     ```c    
     #define RSI_BLE_PWR_INX                                             30    
     #define RSI_BLE_PWR_SAVE_OPTIONS                                    0    
         
     #define RSI_BLE_REMOTE_DEV_ADDR                                     "00:12:45:AB:1D:32"    
     #define RSI_REMOTE_DEVICE_NAME                                      "Note10"    
         
     #define CONN_BY_ADDR                                                1    
     #define CONN_BY_NAME                                                2    
         
     #define CONNECT_OPTION                                              CONN_BY_NAME    
         
     #define CENTERAL_ROLE                                               1    
     #define PERIPHERAL_ROLE                                             2    
     #define CONNECTION_ROLE                                             PERIPHERAL_ROLE    
         
     #define CONN_INTERVAL_MIN                                           45    
     #define CONN_INTERVAL_MAX                                           45    
     #define CONN_LATENCY                                                0    
     #define SUPERVISION_TIMEOUT                                         800    
         
     #define SMP_ENABLE                                                  1    
         
     #define TX_LEN                                                      0xFB    
     #define TX_TIME                                                     0x0148    
         
     #define TX_PHY_RATE                                                 0x02    
     #define RX_PHY_RATE                                                 0x02    
     #define CODDED_PHY_RATE                                             0x00    
         
     #define NOTIFY_DISABLE                                              0x00    
     #define NOTIFY_ENABLE                                               0x01    
         
     #define DLE_ON                                                      1    
         
     #define DLE_BUFFER_MODE                                             1    
     #define DLE_BUFFER_COUNT                                            25    
     #define RSI_BLE_MAX_DATA_LEN                                        232    
     ```  
   - **Opermode command parameters**    
     ```c    
     #define RSI_FEATURE_BIT_MAP     (FEAT_ULP_GPIO_BASED_HANDSHAKE | FEAT_DEV_TO_HOST_ULP_GPIO_1)     
         
     #define RSI_TCP_IP_BYPASS         RSI_DISABLE           
         
     #define RSI_TCP_IP_FEATURE_BIT_MAP     (TCP_IP_FEAT_DHCPV4_CLIENT)     
         
     #define RSI_EXT_TCPIP_FEATURE_BITMAP 0    
         
     #define RSI_CUSTOM_FEATURE_BIT_MAP    FEAT_CUSTOM_FEAT_EXTENTION_VALID      
         
     #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE | EXT_FEAT_512K_M4SS_192K)    
         
     #define RSI_BT_FEATURE_BITMAP (BT_RF_TYPE | ENABLE_BLE_PROTOCOL)    
     ```  
   **Note:** `rsi_ble_config.h` files are already set with desired configuration in respective example folders you need not change for each example.

##### 7 Setup for Serial Prints

To Setup the serial prints, follow the **Setup for Serial Prints** section in the respective _**Getting started with SiWx91x**_ guides

##### 8 Build, Flash, and Run the Application

After making any custom configuration changes required, to build, flash, and run the application project, follow the **Build and Flash the Project** section in the respective _**Getting started with SiWx91x**_ guides.

##### 9 Application Execution Flow*

1. After the program gets executed, the Silicon Labs module will be in an Advertising state by default.
2. Connect any serial console for prints.
3. Open a EFR Connect App on the Smartphone and do the scan.
4. In the App, the Silicon Labs module device will appear with the name configured in the macro **RSI_BLE_DEVICE_NAME (Ex: "BLE_THROUGHPUT")**  
   ![Blethroughputadvertiser](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputadvertiser.png)
5. Initiate a connection from the App.
6. After successful connection, EFR connect APP displays the supported services of Silicon Labs module.  
   ![Blethroughputdeviceconnected](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputdeviceconnected.png)
7. Select the attribute service which is added **RSI_BLE_NEW_SERVICE_UUID**  
   **(Ex: 0xAABB)**
8. After Enable notifications for the read attribute **RSI_BLE_ATTRIBUTE_2_UUID**  
   **(Example: 0x1BB1) So that the GATT server notifies when value updated in that particular attribute.**  
   ![Blethroughputnotificationsenabled](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputnotificationsenabled.png)
9. Please refer to the given below images for continuous notification received on the mobile.  
   ![Blethroughputdatatf](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputdatatf.png)
10. Prints can see as below in any Console terminal  
    - **SoC**    
      ![output SoC](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputprintsncp.png)  
    - **NCP**    
      ![output NCP](/wifibt-wc-snippet-examples/2.14.0/images/blethroughputprintsncp.png)

##### **Appendix**

- By default, the application runs over FreeRTOS. To run the application with Bare metal configurations, follow the **Bare Metal configuration** section in the _**Getting Started with SiWx91x**_ guides.

**Note:** According to Bluetooth Core Specification-5.3, We are replacing the words "master/slave" with "central/peripheral" in our corporate lexicon.

#### BLE Powersave

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK in power save profile with Advertising mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Agilent power analyzer

![Setup Diagram for Simple Peripheral Power Save Example](/wifibt-wc-snippet-examples/2.14.0/images/image31.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the Android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms:

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_power_save/projects/ble_power_save-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_power_save/projects/ble_power_save-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_power_save/projects/ble_power_save-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below        
        ![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image31a.png)  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.      
      - Project path:`<SDK>/examples/snippets/ble/ble_power_save/projects/ble_power_save-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_config.h` file and update/modify following macros

**4.1.1** User must update the below parameters

`RSI_BLE_LOCAL_NAME` refers the name of the WiSeConnect device to appear during scanning by remote devices.

```c
#define RSI_BLE_LOCAL_NAME      "SILABS_DEVICE"
```

Address of the device to connect

```c
#define RSI_BLE_DEV_ADDR "11:11:11:11:11:11"
```

Remote Device Name to connect

```c
#define RSI_REMOTE_DEVICE_NAME "SLAVE"
#define SLAVE_MODE  0
#define MASTER_MODE 1
#define DUAL_MODE   2
```

Configure the required mode using the above three macros

```c
#define BLE_ROLE    SLAVE_MODE
```

**To Enable Power Save**

**PSP_MODE** refers power save profile mode. The WiseConnect device supports following power modes in BTLE,

**RSI_ACTIVE (0):** In this mode, the module is active and power save is disabled.

**RSI_SLEEP_MODE_2 (1):** This mode is applicable when the module is in Advertising state as well as in connected state. In this sleep mode, SoC will go to sleep based on GPIO handshake or Message exchange, therefore handshake is required before sending data to the module.

**RSI_SLEEP_MODE_8 (8):** In this power mode, the module goes to power save when it is in the unassociated state with the remote device. In this sleep mode, SoC will go to sleep based on GPIO handshake or Message exchange, therefore handshake is required before sending the command to the module.

```c
#define PSP_MODE          RSI_SLEEP_MODE_2
```

---

**Note!**
For `RSI_SLEEP_MODE_2` and `RSI_SLEEP_MODE_8` modes, GPIO or Message based handshake can be selected using `RSI_HAND_SHAKE_TYPE` macro which is defined in `rsi_wlan_config.h`

In this example,user can verify `RSI_SLEEP_MODE_2` with Message based handshake. If the user wants to verify other power modes,
the user has to change the application as well as GPIO handshake signals                                                            **PSP_TYPE** refers power save profile type. The WiseConnect device supports following power save profile types in BTLE mode, **RSI_MAX_PSP (0):** In this mode, the WiSeConnect device will be in Maximum power save mode. i.e Device will wake up for every DTIM beacon and do data Tx and Rx.

---

```c
#define PSP_TYPE                                      RSI_MAX_PSP                    `
```

**Following are the non-configurable macros in the application.**

Following are the event numbers for advertising, connection and Disconnection events:

```c
#define RSI_APP_EVENT_ADV_REPORT                  0
#define RSI_APP_EVENT_CONNECTED                       1
#define RSI_APP_EVENT_DISCONNECTED                    2
```

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                            15000 `
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                           FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                             RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                    TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                    FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                (RAM_LEVEL_NWP_ALL_MCU_ZERO|EXT_FEAT_XTAL_CLK_ENABLE |           EXT_FEAT_LOW_POWER_MODE)
```

`RSI_HAND_SHAKE_TYPE` is used to select GPIO or Message based handshake in RSI_SLEEP_MODE_2 and RSI_SLEEP_MODE_8 modes.

```c
#define RSI_HAND_SHAKE_TYPE                           GPIO_BASED
```

`RSI_SELECT_LP_OR_ULP_MODE` is used to select low power mode or ultra low power mode. Valid configurations are, RSI_LP_MODE or RSI_ULP_WITH_RAM_RET or RSI_ULP_WITHOUT_RAM_RET

`RSI_LP_MODE`

In this, the module will be in Low power mode.

`RSI_ULP_WITH_RAM_RET`

In this, the module will be in Ultra low power mode and it will remember the previous state after issuing power save mode command.

`RSI_ULP_WITHOUT_RAM_RET`

In this, the module will be in Ultra low power mode and it will not remember the previous state after issuing power save mode command. After wakeup, the module will give CARD READY indication and the user has to issue commands from wireless initialization.

```c
#define RSI_SELECT_LP_OR_ULP_MODE                     RSI_ULP_WITH_RAM_RET
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_power_save/projects/ble_power_save-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_power_save/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. After the program gets executed, the WiSeConnect module would be in Advertising state with configured power save the profile.
2. The WiseConnect device will go to sleep and wakes up for every advertising interval and goes back to sleep after advertising. Refer the given below image for power save cycle in advertising mode.  
   ![Power Save Cycle in Advertising mode](/wifibt-wc-snippet-examples/2.14.0/images/image32.png)
3. Open an LE App in the Smartphone and do Scan
4. In the App, WiSeConnect module device will appear with the name configured in the macro **RSI_BLE_LOCAL_NAME (Ex: "WLAN_BLE_SIMPLE")** or sometimes observed as the WiSeConnect device as the internal name **"SILABS_DEVICE".**  
   ![WiSeConenct device in App](/wifibt-wc-snippet-examples/2.14.0/images/image33.png)
5. Initiate connection from the mobile App.
6. After successful connection, user can see the connected state in BLE scanner app and also check the supported services by the WiSeConnect device.  
   ![Connected State in BLE Scanner app](/wifibt-wc-snippet-examples/2.14.0/images/image34.png)
7. After successful connection, module goes to sleep and wakes up for every connection interval. Check the below image for power save cycle after connection.  
   ![Power save cycle after connection](/wifibt-wc-snippet-examples/2.14.0/images/image35.png)
8. After successful program execution, if the Silicon Labs device is configured in SLAVE_MODE , the prints in teraterm looks as shown below.  
   ![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/image-pw-log.png)

Default configuration of connection interval of Central device (smartphone) is 18 ms. So, the WiSeConnect device will wake up for every 18ms sec and goes back to sleep after advertise.

Above power save profile image capture when it is in the idle state after successful connection.

So, the user may not get the same profile as shown in the above image. It will vary based on the traffic.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### HID on GATT

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK as GATT server in BLE peripheral mode and as GATT client in BLE central mode, and provides details of how to do read, notify and indicate operations with GATT server from connected remote device using GATT client and details of getting GATT information from remote GATT server in case of our module as client.

HID (Human Interface Device) Service GATT server configures with HID service with notification characteristic UUID. When connected remote device writes data to writable characteristic UUID, module receives the data which is received on writable characteristic UUID and writes the same data to readable characteristic UUID and sends notifications to the connected device (or) remote device can read the same data using read characteristic UUID if notification enabled on client side.

HID Service GATT client will get HID service (primary service) , Report Map (characteristic service), and descriptors(client characteristic configuration and report reference) information from the remote GATT server. If remote device supports notify, our module will enable notify property and will be notified by the remote GATT server when value changed.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BTLE supported Smart phone with GATT client in case of our module as GATT server
- BTLE supported Smart phone with GATT Human Interface Device server  in case of our module as GATT client

![Setup Diagram For BLE HID on GATT Example](/wifibt-wc-snippet-examples/2.14.0/images/image63.png)

**Note:** Use default Bluetooth application in smart phones which has BLE support.

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/hid_on_gatt/projects/hid_on_gatt-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/hid_on_gatt/projects/hid_on_gatt-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/hid_on_gatt/projects/hid_on_gatt-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image77a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/hid_on_gatt/projects/hid_on_gatt-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_hid.c` file and update/modify following macros.

**4.1.1** User must update the below parameters

**GATT_ROLE** refers the role of the Silicon Labs module to be selected.

If user configure **SERVER**, Silicon Labs module will act as GATT SERVER, means will add Human Interface Device service profile.

If user configure **CLIENT**, Silicon Labs module will act as GATT CLIENT, means will connect to remote GATT server and get services.

```c
#define GATT_ROLE                                        SERVER 
```

Valid configurations are SERVER and CLIENT.

If user configure **CLIENT** role following macros should be configured.

`RSI_BLE_REMOTE_BD_ADDRESS_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_REMOTE_BD_ADDRESS_TYPE                   RANDOM_ADDRESS 
```

Valid configurations are RANDOM_ADDRESS and PUBLIC_ADDRESS.

`RSI_BLE_REMOTE_BD_ADDRESS` refers address of the remote device to connect. Replace this with valid BD address.

```c
#define RSI_BLE_REMOTE_BD_ADDRESS                        "F5:64:91:A2:F6:6F"
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect

```c
#define RSI_REMOTE_DEVICE_NAME                           "Designer Keyboard"
```

**Note:** User can configure either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

`RSI_BLE_HID_SERVICE_UUID` refers to the attribute value of the newly created service.

```c
#define RSI_BLE_HID_SERVICE_UUID                         0x1812 
```

`RSI_BLE_HID_PROTOCOL_MODE_UUID` refers to the attribute type of the first attribute under this above primary service.

`RSI_BLE_HID_REPORT_UUID` refers to the attribute type of the second attribute under this above primary service.

`RSI_BLE_HID_REPORT_MAP_UUID` refers to the attribute type of the third attribute under this above primary service.

`RSI_BLE_HID_INFO_UUID` refers to the attribute type of the fourth attribute under this above primary service.

`RSI_BLE_HID_CONTROL_POINT_UUID` refers to the attribute type of the fifth attribute under this above primary service.

```c
#define RSI_BLE_HID_PROTOCOL_MODE_UUID                   0x2A4E
#define RSI_BLE_HID_REPORT_UUID                          0x2A4D
#define RSI_BLE_HID_REPORT_MAP_UUID                      0x2A4B
#define RSI_BLE_HID_INFO_UUID                            0x2A4A
#define RSI_BLE_HID_CONTROL_POINT_UUID                   0x2A4C 
```

`RSI_BLE_APP_HIDS` refers name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_APP_HIDS                                 "HID_OVER_GATT" 
```

Following are the non configurable macros related to attribute properties.

```c
#define RSI_BLE_ATT_PROP_RD                              0x02
#define RSI_BLE_ATT_PROP_WR_NO_RESP                      0x04
#define RSI_BLE_ATT_PROP_WR                              0x08
#define RSI_BLE_ATT_PROP_NOTIFY                          0x10
#define RSI_BLE_ATT_PROP_INDICATE                        0x20 
```

Following are the **non-configurable** macros in the application.

`RSI_BLE_CHAR_SERV_UUID` refers to the attribute type of the characteristics to be added in a service.

`RSI_BLE_CLIENT_CHAR_UUID` refers to the attribute type of the client characteristics descriptor to be added in a service.

`RSI_BLE_REPORT_REFERENCE_UUID` refers to the attribute type of the report reference descriptor to be added in a service.

```c
#define RSI_BLE_CHAR_SERV_UUID                           0x2803
#define RSI_BLE_CLIENT_CHAR_UUID                         0x2902
#define RSI_BLE_REPORT_REFERENCE_UUID                    0x2908 
```

**GLOBAL_BUFF_LEN** refers Number of bytes required by the application and the driver

```c
#define GLOBAL_BUFF_LEN                               15000 
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros, #define RSI_BLE_PWR_INX 8

```c
#define RSI_BLE_PWR_INX                                  30
#define RSI_BLE_PWR_SAVE_OPTIONS                         BLE_DISABLE_DUTY_CYCLING 
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                              FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                                RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                       TCP_IP_FEAT_DHCPV4_CLIENT 
#define RSI_CUSTOM_FEATURE_BIT_MAP                       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                   RAM_LEVEL_NWP_ALL_MCU_ZERO
```

---

**Note!** rsi_ble_config.h files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/hid_on_gatt/projects/hid_on_gatt-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/hid_on_gatt/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps (heading level 7)

**Server role**

1. After the program gets executed, Silicon Labs module will be in Advertising state.
2. Open a default Bluetooth App and do the scan.
3. In the App, Silicon Labs module will appear with the name configured in the macro **RSI_BLE_APP_HIDS (Ex: "HIDS")** or sometimes observed as Silicon Labs device as internal name "**SimpleBLEPeripheral**".
4. Initiate connection from the bt App and complete the paining process.
5. After successful connection, open note pad or any text editor in phone, you can see some text printing.
6. By default, application is sending some text (i.e. "hog ") in regular interval, which will come as a notification to smart phone.
7. While connection, smart phone will do service discovery and it will find the HID service with UUID **RSI_BLE_HID_SERVICE_UUID.** After that it will read report map and enables the notification.
8. Following are the screen shots of smart phone to test HID over GATT application.

![Scanning for HID_OVER_GATT Device](/wifibt-wc-snippet-examples/2.14.0/images/image73.png)

![Connect to HID_OVER_GATT Device](/wifibt-wc-snippet-examples/2.14.0/images/image74.png)

![Pair with HID_OVER_GATT Device](/wifibt-wc-snippet-examples/2.14.0/images/image75.png)

![HID_OVER_GATT Device Connected](/wifibt-wc-snippet-examples/2.14.0/images/image76.png)

![Receiving data from HID_OVER_GATT Device](/wifibt-wc-snippet-examples/2.14.0/images/image77.png)

1. After successful program execution, the prints in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/image77b.png)

**Client role**

1. Advertise a LE device which supports Human Interface Device Service.
2. After the program gets executed, Silicon Labs module will connect to that remote device based on given BD address.
3. After successful connection Silicon Labs module will read the services from the remote GATT server.
4. If remote device support notify property Silicon Labs module will enable notify, and ready to receive notifications from remote device.
5. Whenever GATT server changes value and notifies that Silicon Labs module will receive that value.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Longrange 2Mbps

##### 1. Purpose / Scope

This application demonstrates how to configure/connects RS9116W EVK as a Central and can be used to update the PHY rates. The PHY update Procedure is used to change the Transmit or receive PHYs, or both.

The procedure can be initiated either on a request by the host or autonomously by the Link Layer. Either the central or the peripheral may initiate this procedure at any time after entering the Connection State.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device which supports BLE long range and 2Mbps feature.

![Setup Diagram for Long Range and 2Mbps Example](/wifibt-wc-snippet-examples/2.14.0/images/image49.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects/ble_longrange_2mbps-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects/ble_longrange_2mbps-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects/ble_longrange_2mbps-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image49a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects/ble_longrange_2mbps-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_lr_2mbps.c` file and update/modify following macros,

**4.1.1** User must update the below parameters

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                LE_PUBLIC_ADDRESS |
```

Valid configurations are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

**Note:** Depends on the remote device, address type will be changed.

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                                    "00:23:A7:80:70:B9"
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect

```c
#define RSI_REMOTE_DEVICE_NAME                              "SILABS_DEV"
```

**Note:**
Silicon Labs module can connect to remote device by referring either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device. |

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements

Following are the event numbers for advertising, connection and Disconnection events,

```c
#define RSI_APP_EVENT_ADV_REPORT                            0
#define RSI_APP_EVENT_CONNECTED                             1
#define RSI_APP_EVENT_DISCONNECTED                          2
#define RSI_APP_EVENT_PHY_UPDATE_COMPLETE                   3
```

Following are the non-configurable macros in the application.

`GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define GLOBAL_BUFF_LEN                                  15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                                   30
#define RSI_BLE_PWR_SAVE_OPTIONS                          0 
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                                 FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                                   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                          TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                          FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                      RAM_LEVEL_NWP_ALL_MCU_ZERO
```

**Note:**
`rsi_ble_config.h` files are already set with desired configuration in
respective example folders user need not change for each example.

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects/ble_longrange_2mbps-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_longrange_2mbps/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

##### 5.3 Common Steps

1. Configure the remote BLE device in advertising mode.For remote mobile if connecting using name ensure that the device is named same as the value mentioned in RSI_REMOTE_DEVICE_NAME macro also see to it that Complete local name record is added to advertising data and Scan response data and connectable is ticked in options.
2. After the program gets executed, Silicon Labs device tries to connect with the remote device specified in **RSI_BLE_DEV_ADDR** **or RSI_REMOTE_DEVICE_NAME** macro.
3. Observe that the connection is established between the desired device and Silicon Labs device.
4. After connection, Silicon Labs device will read PHY rate of the remote device and set PHY rate of the remote device.
5. Observe PHY update complete event after setting PHY rate.
6. After successful program execution, the prints in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/images-log.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

##### GATT Long Read

**Overview**

This application demonstrates how a GATT client device accesses a GATT server device for long read, means when user wants to read more than MTU(minimum of local and remote devices MTU's) size of data.Silicon Labs module acts as a GATT client/server(based on user configuration) and explains reads/writes .Client role is initialized with Battery Service. Server role is initialized with a custom service.

**Sequence of Events**

This Application explains user how to:

- Advertising in SLAVE role
- Connects with remote device in MASTER role.
- Loop back the data came from the remote device
- Read request to the remote device

**Example Setup**

The WiSeConnect parts require that the host processor is connected to the WiSeConnect using either SPI, UART or USB host interface. The host processor firmware needs to properly initialize the selected host interface. The Silicon Labs Wireless SAPI framework provides necessary HAL APIs to enable variety of host processors.

**WiSeConnect  based Setup Requirements**

- Windows / Linux PC with Host interface(UART/ USB-CDC/ SPI/ USB) in case of WiSeConnect
- Silicon Labs module
- BTLE peripheral device in case of Silicon Labs module as master
- BTLE central device in case of Silicon Labs module as slave

![Figure glr: Setup diagram for BLE Long Read Example](/wifibt-wc-snippet-examples/2.14.0/images/image-glr.png)

**Configuration and Steps for Execution**

**Configuring the Application**

1. Open **rsi_ble_long_read.c** file and configure the below macros.  
   **RSI_BLE_DEV_ADDR_TYPE** refers address type of the remote device to connect.  
   #define RSI_BLE_DEV_ADDR_TYPE                         LE_PUBLIC_ADDRESS  
   Valid configurations are  
   LE_RANDOM_ADDRESS  
   LE_PUBLIC_ADDRESS  
   Note:  
   Depends on the remote device, address type will be changed.  
   **RSI_BLE_DEV_ADDR** refers address of the remote device to connect.  
   #define RSI_BLE_DEV_ADDR                              "00:1A:7D:DA:71:13"  
   **RSI_REMOTE_DEVICE_NAME** refers the name of remote device to which Silicon Labs device has to connect  
   #define RSI_REMOTE_DEVICE_NAME                        "SILABS_DEV"  
   ```c  
   Note:  
   Silicon Labs module can connect to remote device by referring either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.  
   ```  
   **GATT_ROLE** refers the GATT role of the Silicon Labs device  
   #define SERVER                                        0  
   #define CLIENT                                        1  
   #define GATT_ROLE                                     SERVER  
   valid configurations of GATT_ROLE are:  
   SERVER  
   CLIENT  
   **BT_GLOBAL_BUFF_LEN**  refers the Number of bytes required for the Application and the Driver.  
   #define BT_GLOBAL_BUFF_LEN                            15000  
   **RSI_BLE_CHAR_SERV_UUID** refers standard attribute type of characteristic service  
   **RSI_BLE_CLIENT_CHAR_UUID**  refers standard attribute type of client characteristic configuration descriptor.  
   #define RSI_BLE_CHAR_SERV_UUID                       0x2803  
   #define RSI_BLE_CLIENT_CHAR_UUID                     0x2902  
   **RSI_BLE_NEW_SERVICE_UUID** refers service uuid when module acts as server  
   **RSI_BLE_ATTRIBUTE_1_UUID** refers characteristic uuid when module acts as server  
   #define RSI_BLE_NEW_SERVICE_UUID                      0xAABB  
   #define RSI_BLE_ATTRIBUTE_1_UUID                      0x1AA1  
   **RSI_BLE_NEW_CLIENT_SERVICE_UUID** refers service present in GATT server LE device.  
   **RSI_BLE_CLIENT_ATTRIBUTE_1_UUID** refers characteristic present under above service in GATT server LE device.  
   #define RSI_BLE_NEW_CLIENT_SERVICE_UUID               0x180F  
   #define RSI_BLE_CLIENT_ATTRIBUTE_1_UUID               0x2A19  
   **RSI_BLE_MAX_DATA_LEN** refers the maximum attribute value length.  
   #define RSI_BLE_MAX_DATA_LEN                          20  
   Following are event numbers for specific events  
   #define RSI_BLE_CONNN_EVENT                           1  
   #define RSI_BLE_DISCONN_EVENT                         2  
   #define RSI_BLE_GATT_WRITE_EVENT                      3  
   #define RSI_BLE_READ_REQ_EVENT                        4  
   #define RSI_BLE_MTU_EVENT                             5  
   #define RSI_BLE_GATT_PROFILE_RESP_EVENT               6  
   #define RSI_BLE_GATT_CHAR_SERVICES_RESP_EVENT         7  
   Following are the non-configurable macros in the application.  
   #define RSI_BLE_ATT_PROPERTY_READ                     0x02  
   #define RSI_BLE_ATT_PROPERTY_WRITE                    0x08  
   #define RSI_BLE_ATT_PROPERTY_NOTIFY                   0x10
2. Open rsi_wlan_config.h file and update/modify following macros,  
   #define CONCURRENT_MODE                               RSI_DISABLE  
   #define RSI_FEATURE_BIT_MAP                           FEAT_SECURITY_OPEN  
   #define RSI_TCP_IP_BYPASS                             RSI_DISABLE  
   #define RSI_TCP_IP_FEATURE_BIT_MAP                    TCP_IP_FEAT_DHCPV4_CLIENT  
   #define RSI_CUSTOM_FEATURE_BIT_MAP                    FEAT_CUSTOM_FEAT_EXTENTION_VALID  
   #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                RAM_LEVEL_NWP_ALL_MCU_ZERO  
   #define RSI_BAND                                      RSI_BAND_2P4GHZ
3. Open rsi_ble_config.h file and update/modify following macros,  
   #define RSI_BLE_PWR_INX                               30  
   #define RSI_BLE_PWR_SAVE_OPTIONS                      0

**Executing the Application**

1. After the program gets executed,
2. In Client mode,  
   Silicon Labs module will trying to connect with remote device as specified by RSI_BLE_REMOTE_BD_ADDRESS or RSI_REMOTE_DEVICE_NAME.
3. After connecting, mtu size will be updated. As per mtu(maximum transmit unit) size, read requests will be happen from Silicon Labs device
4. In Server mode,  
   Silicon Labs module will advertise,
5. Initiate connection from master.
6. After connecting, mtu size will be updated. As per mtu size, write will be happen from Silicon Labs device
7. In either role: If mtu size is of 100 bytes, module can read upto 98 bytes, write upto 97 bytes
8. For the data more than 20 bytes, application has to store value and send using gatt_read_response function whenever remote device reads some handle's data.  
   For read request event to be raised auth_read flag in rsi_ble_add_char_val_att function need to be set.  
   Based on GATT_ROLE configurable macro, this application will be act as a GATT server or GATT client device.

#### BLE Privacy

##### 1. Purpose / Scope

Bluetooth LE supports a feature that reduces the ability to track an LE device over a period of time by changing the Bluetooth device address on a frequent basis, called Privacy of that particular device.

The device address of the remote device referred to as the private address will be resolved by local device in order to connect to that device. The private address is generated by using Identity Resolving Key (IRK) exchange in between devices during SMP bonding procedure. Our local device will add the remote devices in one Resolving list(to maintain remote device identity addresses) along with that IRK's and enable the Resolution, sets privacy mode and connect to the remote device with remote identity address.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BTLE peripheral device which supports privacy feature(Generally phones with the nRF Connect application)

![Setup Diagram for Privacy Example](/wifibt-wc-snippet-examples/2.14.0/images/image40.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing the BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_privacy/projects/ble_privacy-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_privacy/projects/ble_privacy-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_privacy/projects/ble_privacy-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image40b.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_privacy/projects/ble_privacy-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_privacy.c` file and update/modify following macros:

**4.1.1** User must update the below parameters

`RSI_BLE_DEVICE_NAME` refers the name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_DEVICE_NAME                              "SIMPLE_PRIVACY"
```

RSI_DEVICE_ROLE refers the role of the Silicon Labs device.

```c
#define RSI_DEVICE_ROLE                                  RSI_SLAVE
```

`Note: RSI_DEVICE_ROLE should be RSI_MASTER`

RSI_BLE_DEV_ADDR_TYPE` refers the address type of the remote device.

```c
#define RSI_BLE_REMOTE_ADDR_TYPE                         LE_PUBLIC_ADDRESS
```

`RSI_BLE_DEV_ADDR_1` refers remote device address which has to connect.

```c
#define RSI_BLE_REMOTE_ADDR                              "00:23:A7:56:77:77"
```

`RSI_REMOTE_DEVICE_NAME` refers the name of the Remote device to which Silicon Labs module initiate connection.

```c
#define RSI_REMOTE_DEVICE_NAME                           "BLE_SIMPLE_PRIVACY"
```

RSI_BLE_SMP_IO_CAPABILITY refers the IO capability of Silicon Labs device for SMP, RSI_BLE_SMP_PASSKEY is smp passkey key from Silicon Labs device

```c
#define RSI_BLE_SMP_IO_CAPABILITY                        0x00
#define RSI_BLE_SMP_PASSKEY                              0
```

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the **non-configurable** macros in the application.

Following are the event numbers for connection, Disconnection, and enhanced connection events.

```c
#define RSI_APP_EVENT_ADV_REPORT                         0x00
#define  RSI_BLE_CONN_EVENT                              0x01
#define  RSI_BLE_DISCONN_EVENT                           0x02
#define  RSI_BLE_SMP_REQ_EVENT                           0x03
#define  RSI_BLE_SMP_RESP_EVENT                          0x04
#define  RSI_BLE_SMP_PASSKEY_EVENT                       0x05
#define  RSI_BLE_SMP_FAILED_EVENT                        0x06
#define  RSI_BLE_ENCRYPT_STARTED_EVENT                   0x07
#define  RSI_BLE_SMP_PASSKEY_DISPLAY_EVENT               0x08
#define  RSI_BLE_SC_PASSKEY_EVENT                        0x09
#define  RSI_BLE_LTK_REQ_EVENT                           0x0A
#define  RSI_BLE_SECURITY_KEYS_EVENT                     0x0B
#define  RSI_BLE_ENHANCE_CONNECTED_EVENT                 0x0C
```

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver.

```c
#define BT_GLOBAL_BUFF_LEN                               15000
```

`RSI_BLE_SET_RESOLVABLE_PRIV_ADDR_TOUT` refers resolution timeout , that is the length of time the Controller uses a Resolvable Private Address before a new resolvable private address is generated and starts being used.

```c
#define RSI_BLE_SET_RESOLVABLE_PRIV_ADDR_TOUT           120
```

Process type refers the operation to be performed on the resolving list. valid configurations for the process type are

```c
#define RSI_BLE_ADD_TO_RESOLVE_LIST                      1
#define RSI_BLE_REMOVE_FROM_RESOLVE_LIST                 2
#define RSI_BLE_CLEAR_RESOLVE_LIST                       3
```

`RSI_BLE_PRIVACY_MODE` refers the privacy mode of local device

```c
#define RSI_BLE_PRIVACY_MODE                             RSI_BLE_DEVICE_PRIVACY_MODE
```

`RSI_BLE_RESOLVING_LIST_SIZE` refers the resolving list size of Silicon Labs device.

```c
#define RSI_BLE_RESOLVING_LIST_SIZE                      5
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros

`RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE` refers address resolution is enable or not. It should be 1 to enable privacy feature.

```c
#define RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE               1
```

`RSI_BLE_ADV_DIR_ADDR_TYPE` refers the address type of remote device which use while advertising.

```c
#define RSI_BLE_ADV_DIR_ADDR_TYPE                        LE_PUBLIC_ADDRESS
```

`RSI_BLE_ADV_DIR_ADDR` refers to which device the local device will advertise with private address, it should be one of the device in resolve list.

```c
#define RSI_BLE_ADV_DIR_ADDR                             "00:15:83:6A:64:17"
#define RSI_BLE_PWR_INX                                  30
#define RSI_BLE_PWR_SAVE_OPTIONS                         BLE_DISABLE_DUTY_CYCLING 
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                              FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                                RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                       TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                   0
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_privacy/projects/ble_privacy-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_privacy/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. After the program gets executed, Silicon Labs module will be in Scanning state.
2. Advertise remote device,
3. If Silicon Labs module get device with name configured RSI_BLE_LOCAL_NAME or bd address with address configured in RSI_BLE_REMOTE_ADDR  in results ,local device will try to connect with remote device.
4. After connection Silicon Labs device which is in central mode will initiate SMP request
5. Give response from Remote device and passkey
6. After successful SMP connection security keys will exchanged between Remote device and Silicon Labs device.
7. Silicon Labs device will add remote device's IRK's and local IRK's in to resolve list and enable resolution
8. Give disconnect from remote device and keep in advertise mode.
9. Now Silicon Labs module will try to connect to remote device with identity address.
10. After successful connection, Silicon Labs module will give start encryption instead of SMP repairing.
11. Encryption will be enabled on both sides.
12. After successful program execution, if Silcon Labs device connects to the remote BLE central device the prints in teraterm looks as shown below.

![Prints in Teraterm-1](/wifibt-wc-snippet-examples/2.14.0/images/image-slave1.png)

![Prints in Teraterm-2](/wifibt-wc-snippet-examples/2.14.0/images/image-slave2.png)

Find following screen shots for reference.

1. Advertise remote device

![Advertise remote device in App](/wifibt-wc-snippet-examples/2.14.0/images/image41.png)

1. Connection in between Silicon Labs module and remote device

![Connection Establishment](/wifibt-wc-snippet-examples/2.14.0/images/image42.png)

1. Pairing confirmation

![Pairing confirmation](/wifibt-wc-snippet-examples/2.14.0/images/image43.png)

1. Passkey confirmation

![Passkey confirmation](/wifibt-wc-snippet-examples/2.14.0/images/image44.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Heart Rate Profile

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK Heart rate as GATT server in BLE peripheral mode and explains how to do indicate operation with GATT server from connected remote device using GATT client.

Also configure module as GATT client in BLE central mode and enables indicate operation of Heart rate service of connected remote GATT server from GATT client. In this Application, Heart rate GATT server configures with heart rate service with indicate characteristic UUID.

When connected remote device writes data to writable characteristic UUID, WiseConnect device receives the data which is received on writable characteristic UUID and writes the same data to readable characteristic UUID and sends indications to the connected device (or) remote device can read the same data using read characteristic UUID if indication enabled on client side.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE Smart Phone with GATT client

![Setup Diagram for Heart Rate Example](/wifibt-wc-snippet-examples/2.14.0/images/image19.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing the BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - EFR32MG21 platform    
    - The Simplicity Studio project is used to evaluate the application on EFR32MG21.    
    - Project path:      
      - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-brd4180a-mg21.slsproj`      
      - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image19a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_heart_rate.c` file and update/modify following macros,

**4.1.1** User must update the below parameters

**GATT_ROLE** refers the role of the Silicon Labs module to be selected.

If user configures, **SERVER**, Silicon Labs module will act as GATT SERVER, means will add heart rate profile.

If user configures, **CLIENT**, Silicon Labs module will act as GATT CLIENT, means will connect to remote GATT server and get services and enable notify.

```c
#define GATT_ROLE                                     SERVER
```

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                         LE_PUBLIC_ADDRESS
```

Valid configurations based on address type of the remote device are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

**Note:** Depends on the remote device, address type will be changed.

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                              "00:23:A7:80:70:B9"
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect.

```c
#define RSI_REMOTE_DEVICE_NAME                        "SILABS_DEV"
```

**Note:**
Silicon Labs module can connect to remote device by referring either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements

`RSI_BLE_HEART_RATE_UUID` refers to the attribute value of the newly created service.

```c
#define RSI_BLE_HEART_RATE_SERVICE_UUID                0x180D
```

`RSI_BLE_HEART_RATE_MEASUREMENT_UUID` refers to the attribute type of the first attribute under this service (RSI_BLE_HEART_RATE_SERVICE_UUID`).

```c
#define RSI_BLE_HEART_RATE_MEASUREMENT_UUID            0x2A37
```

`RSI_BLE_SENSOR_LOCATION_UUID` refers to the attribute type of the second attribute under this service (RSI_BLE_HEART_RATE_SERVICE_UUID`).

```c
#define RSI_BLE_SENSOR_LOCATION_UUID                   0x2A38
```

`RSI_BLE_HEART_RATE_CONTROL_POINT_UUID` refers to the attribute type of the second attribute under this service (`RSI_BLE_HEART_RATE_SERVICE_UUID`).

```c
#define RSI_BLE_HEART_RATE_CONTROL_POINT_UUID          0x2A39
```

`RSI_BLE_MAX_DATA_LEN` refers to the Maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                           20
```

`BLE_HEART_RATE_PROFILE` refers name of the Repine device to appear during scanning by remote devices.

```c
#define RSI_BLE_HEART_RATE_PROFILE                     "BLE_HEART_RATE_PROFILE"
```

Following are the **non-configurable** macros in the application.

`RSI_BLE_CHAR_SERV_UUID` refers to the attribute type of the characteristics to be added in a service.

```c
#define RSI_BLE_CHAR_SERV_UUID                         0x2803
```

`RSI_BLE_CLIENT_CHAR_UUID` refers to the attribute type of the client characteristics descriptor to be added in a service.

```c
#define RSI_BLE_CLIENT_CHAR_UUID                       0x2902
```

`RSI_BLE_ATT_PROPERTY_READ` is used to set the read property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_READ                      0x02
```

`RSI_BLE_ATT_PROPERTY_WRITE` is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                     0x08
```

`RSI_BLE_ATT_PROPERTY_NOTIFY` is used to set the NOTIFY property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_NOTIFY                    0x10
```

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver.

```c
#define BT_GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                               30
#define RSI_BLE_PWR_SAVE_OPTIONS                      0 
```

Zero indicate to below macro.

```c
#define BLE_DISABLE_DUTY_CYCLING 0
#define BLE_DUTY_CYCLING         1
define BLR_DUTY_CYCLING          2
#define BLE_4X_PWR_SAVE_MODE     4
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects/ble_heart_rate_profile-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_heart_rate_profile/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. After the program gets executed, If Silicon Labs device is configured as **SERVER** specified in the macro **GATT_ROLE**, Silicon Labs will be in Advertising state.
2. Open a LE App in the Smartphone and do the scan.
3. In the App, Silicon Labs module device will appear with the name configured in the macro `RSI_BLE_HEART_RATE_PROFILE (Ex: "BLE_HEART_RATE_PROFILE")` or sometimes observed as Silicon Labs device as internal name "**SimpleBLEPeripheral**".

![Device in the App](/wifibt-wc-snippet-examples/2.14.0/images/image20.png)

1. Initiate connection from the App.
2. After successful connection, LE scanner displays the supported services of Silicon Labs module.
3. Select the attribute service which is added `RSI_BLE_HEART_RATE_SERVICE_UUID`
4. Enable notify for the characteristic `RSI_BLE_HEART_RATE_MEASUREMENT_UUID`  
   So that GATT server indicates when value updated in that particular attribute.
5. Whenever the value is updated at server it will be notified to the client which can be read at Heart_Rate_Measurement attribute.
6. Refer the below images for notify operation from remote device GATT client.

![Notify Operation from App-1](/wifibt-wc-snippet-examples/2.14.0/images/image21.png)

![Notify Operation from App-2](/wifibt-wc-snippet-examples/2.14.0/images/image22.png)

1. When Silicon Labs device is configured as **CLIENT** specified in the macro **GATT_ROLE**, scans for remote device and tries to connect with the remote device specified in `RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME` macro.
2. Get all GATT profiles of remote device and Search for profile specified in the macro `RSI_BLE_HEART_RATE_SERVICE_UUID`. And get all characteristics of the heartrate service and verify the characteristic `RSI_BLE_HEART_RATE_MEASUREMENT_UUID` which has notify property.
3. Observe notify property is enabled in the GATT server and indicates to the GATT client whenever the value is updated at server .
4. Also observe the updated heart rate measurement value on the teraterm.
5. After successful program execution, if the module configured as SERVER the print in teraterm looks as shown below.

![Prints in Teraterm for Server Configuration](/wifibt-wc-snippet-examples/2.14.0/images/images-server.png)

1. After successful program execution, if the module configured as CLIENT the print in teraterm looks as shown below.

![Prints in Teraterm for Client Configuration](/wifibt-wc-snippet-examples/2.14.0/images/image22a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Extended Advertising Peripheral

##### 1. Purpose / Scope

This application demonstrates how to connect RS9116W EVK with remote BLE device in Extended Advertising peripheral mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device

![figureSetup Diagram for AE Peripheral Example using RS9116 EVK](/wifibt-wc-snippet-examples/2.14.0/images/ae-peripheral.png)
![figureSetup Diagram for AE Peripheral Example using RS9116 ACX Expansion board](/wifibt-wc-snippet-examples/2.14.0/images/ac1-ae-peripheral.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_peripheral/projects/ble_ae_peripheral-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_peipheral/projects/ble_ae_peripheral-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_peripheral/projects/ble_ae_peripheral-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/radio-board.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>examples/_internal/Wireless_Examples/ble/ble_ae_peripheral/ble_ae_peripheral-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal Support

This application supports bare metal . By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `ae_peripheral.c` file

**4.1.1** User must update the below parameters

Set below macro to enable second set of advertising

```c
#define ADV_SET2            1
```

The length of the advertising data needs to be filled in the following macro

```c
#define BLE_AE_ADV_DATA_LEN    0x19
```

Below mentioned macro needs to be populated with data

```c
#define BLE_AE_ADV_DATA    "AE_PERIPHERAL_DATA_1"
```

Mention the address type of the device which needs to be whitelisted

```c
#define RSI_BLE_WHITELIST_DEV_ADDR1_TYPE LE_RANDOM_ADDRESS
```

Fill the address of the device to be whitelisted in the below mentioned variable

```c
ble_whitelist_addr1[6] = { 0xDA, 0x81, 0xE0, 0xB8, 0xB9, 0x42 };
```

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the event numbers for advertising, connection and disconnection events

```c
#define RSI_APP_EVENT_ADV_REPORT                       0
#define RSI_APP_EVENT_CONNECTED                        1
#define RSI_APP_EVENT_DISCONNECTED                     2
```

Following are the non-configurable macros in the application.

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

The minimum avertising interval:

```c
#define RSI_BLE_ADV_INT_MIN     0x020
```

The maximum advertising interval:

```c
#define RSI_BLE_ADV_INT_MAX     0x020 
```

Channel map selection:

```c
#define RSI_BLE_ADV_CHANNEL_MAP 0x07
```

Maximum extended advertisingevents:

```c
#define BLE_MAX_AE_EVNTS 0
```

Extended advertising filter policy

```c
#define BLE_AE_ADV_FILTER_POLICY  0x00
```

Extended advertising TX Power

```c
#define BLE_AE_ADV_TX_PWR         0x7f
```

Secondary advertising max skip count:

```c
#define BLE_AE_SEC_ADV_MAX_SKIP   0x00
```

Advertising SID

```c
#define BLE_AE_ADV_SID            0x00
```

Event properties can be set by enabling the respective bits in the following macros

```c
#define BLE_CONNECTABLE_ADV        (1 << 0)
#define BLE_SCANNABLE_ADV          (0 << 1)
#define BLE_LOW_DUTY_DIR_CONN_ADV  (0 << 2)
#define BLE_HIGH_DUTY_DIR_CONN_ADV (0 << 3)
#define BLE_LEGACY_ADV             (0 << 4)
#define BLE_ANONYMOUS_ADV          (0 << 5)
#define BLE_TX_WR_ADV              (0 << 6)
```

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       BLE_DISABLE_DUTY_CYCLING
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

**Note:** `rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>examples/_internal/Wireless_Examples/ble/ble_ae_central//projects/ble_ae_central-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_central//projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote BLE device in Central mode and scan for the DUT's address and give a connect.
2. Observe that the connection is established between the desired device and RS9116W EVK.
3. After successful program execution the prints in docklight looks as shown below.

![Prints in docklight window](/wifibt-wc-snippet-examples/2.14.0/images/ae-logs.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Acceptlist

##### 1. Purpose / Scope

This application is used to add a particular BD-Address to the Accept List. The device to connect is saved on the accept list located in the LL block of the controller.

This enumerates the remote devices that are allowed to communicate with the local device. The Accept List can restrict which device are allowed to connect to other device.

If it is not, it wont connect. Once the address was saved, the connection with that device is going to be an auto connection establishment procedure.

This means that the Controller autonomously establishes a connection with the device address that matches the address stored in the While List.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device

![Setup Diagram For BLE Acceptlist Example ](/wifibt-wc-snippet-examples/2.14.0/images/image78.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/ble/ble_accept_list/projects/ble_accept_list-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_accept_list/projects/ble_accept_list-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_accept_list/projects/ble_accept_list-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image78a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_accept_list/projects/ble_accept_list-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal//RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_acceptlist.c` file and update/modify following macros,

**4.1.1** User must update the below parameters

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                          LE_PUBLIC_ADDRESS
```

Based on address type of remote device, valid configurations are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                      "00:1A:7D:DA:71:48"
```

`RSI_BLE_ACCEPTLIST_DEV_ADDR1_TYPE`,`RSI_BLE_ACCEPTLIST_DEV_ADDR1_TYPE` refers address of the remote devices to be acceptlisted

```c
#define RSI_BLE_ACCEPTLIST_DEV_ADDR1_TYPE              LE_PUBLIC_ADDRESS
#define RSI_BLE_ACCEPTLIST_DEV_ADDR2_TYPE              LE_PUBLIC_ADDRESS 
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect

```c
#define RSI_REMOTE_DEVICE_NAME                    "SILABS_DEV"
```

**Note:**
user can configure either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

**Power save configuration**

By default, the Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the event numbers for advertising, connection and Disconnection events,

```c
#define RSI_APP_EVENT_ADV_REPORT                       0
#define RSI_APP_EVENT_CONNECTED                        1
#define RSI_APP_EVENT_DISCONNECTED                     2 
```

Following are the non-configurable macros in the application.

**GLOBAL_BUFF_LEN** refers Number of bytes required by the application and the driver

```c
#define GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       0
#define RSI_BLE_SCAN_FILTER_TYPE                       SCAN_FILTER_TYPE_ONLY_ACCEPT_LIST
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 RAM_LEVEL_NWP_ALL_MCU_ZERO
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example. |

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_accept_list/projects/ble_accept_list-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_accept_list/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote ble device in peripheral mode and put it in advertising mode.
2. After the program gets executed, it adds the configured remote device addresses to the acceptlist, and Silicon Labs device tries to connect only with the acceptlisted remote device specified in **RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME** macro and ble_acceptlist_addr1 array
3. Observe that the connection is established between the desired device and Silicon Labs device.
4. After successful program execution the print in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/image78b.png)

```c
 **Note:** Examples for ble peripherals: Blue tooth Dongle, mobile application, TA sensor tag
```

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Dual Role

##### 1. Purpose / Scope

This application demonstrates how to configure/connect RS9116W EVK with multiple peripherals in central mode and also configure/connect with multiple centrals in peripheral mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE central devices.

![Setup Diagram of Dual Role Example](/wifibt-wc-snippet-examples/2.14.0/images/images79.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path:  `<SDK>/examples/snippets/ble/ble_dual_role/projects/ble_dual_role-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_dual_role/projects/ble_dual_role-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_dual_role/projects/ble_dual_role-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image79a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_dual_role/projects/ble_dual_role-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameterss

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_dualrole.c` file and update/modify following macros,

**4.1.1** User must update the below parameters

`RSI_BLE_LOCAL_NAME` refers the name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_LOCAL_NAME                            "BLE_PERIPHERAL"       
```

`RSI_BLE_DEV_ADDR_TYPE` refers address type of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR_TYPE                          LE_PUBLIC_ADDRESS
```

Based on address type of remote device, valid configurations are

LE_RANDOM_ADDRESS

LE_PUBLIC_ADDRESS

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_1_ADDR "00:1A:7D:DA:71:22"
#define RSI_BLE_DEV_2_ADDR "00:1A:7D:DA:71:73"
#define RSI_BLE_DEV_3_ADDR "00:1A:7D:DA:71:63"
#define RSI_BLE_DEV_4_ADDR "00:1A:7D:34:54:66"
#define RSI_BLE_DEV_5_ADDR "00:1A:7D:DA:71:48"
#define RSI_BLE_DEV_6_ADDR "00:1A:7D:DA:71:22"
#define RSI_BLE_DEV_7_ADDR "00:1A:7D:DB:71:21"
#define RSI_BLE_DEV_8_ADDR "00:1A:7D:DA:71:0C"
```

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

`RSI_BLE_LOCAL_NAME` refers the name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_LOCAL_NAME                            "BLE_PERIPHERAL"   
```

Following are the event numbers for advertising,connection, Disconnection events and scan restart events.

```c
#define RSI_APP_EVENT_ADV_REPORT                       0x01
#define RSI_APP_EVENT_CONNECTED                        0x02
#define RSI_APP_EVENT_DISCONNECTED                     0x03
#define RSI_BLE_SCAN_RESTART_EVENT                     0x04
```

Following are the non-configurable macros in the application.

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       BLE_DISABLE_DUTY_CYCLING
```

To configure the Nbr of master and No of slaves to be connected

```c
#define RSI_BLE_MAX_NBR_SLAVES                         8
#define RSI_BLE_MAX_NBR_MASTERS                        2
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/ble/ble_dual_role/projects/ble_dual_role-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_dual_role/projects/`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote ble device in peripheral mode and put it in advertising mode.
2. After the program gets executed, Silicon Labs device tries to connect with the remote device address specified in the Macros  
   **example: RSI_BLE_DEV_1_ADDR**
3. Silicon Labs device also in advertising mode,open an LE app scan and connect from another remote BLE Central device.
4. Observe that the connection is established between the desired device and Silicon Labs device.
5. After successful program execution, if Silcon Labs device connects to the remote BLE Central device the prints in teraterm looks as shown below.

![Prints in Teraterm](/wifibt-wc-snippet-examples/2.14.0/images/image79b.png)

**Note:** Maximum we can connect with 2 Remote BLE Centrals.

**Note:** Examples for ble peripherals: Blue tooth Dongle, mobile application, TA sensor tag

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### iBeacon

##### 1. Purpose / Scope

This application demonstrates how to set the iBeacon data format in advertising parameters in  BLE peripheral mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)  
  - Host MCU Eval Kit. This example has been tested with:    
    - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)    
    - [STM32F411 Nucleo](https://st.com/)
- Smart phone with ibeacon detector application

![Setup Diagram for iBeacon Example](/wifibt-wc-snippet-examples/2.14.0/images/image-ib1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the [iBeaconDetector](https://play.google.com/stor/apps/details?id=youten.redo.ble.ibeacondetector) app in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

**iBeacon Advertise Data Format**

iBeacon prefix   UUID        Major Number   Minor Number    TX Power
9Bytes           16bytes     2Bytes         2 Bytes         1bytes

Adv Flags        Adv Header  Company ID   iBeacon Type    iBeacon Length
3 Bytes          2 Bytes     2 Bytes      1Byte           1Bytes

**iBeacon Prefix:**
Vendor specific fixed value.
Default iBeacon prefix values setting by application is,
Prefix = {0x02, 0x01, 0x02, 0x1A, 0xFF, 0x4C, 0x00, 0x02, 0x15}

**UUID:**
User generated proximity UUID.
Remote devices recognize which beacon they approach on the basis of UUID, major and minor numbers.
Default UUID, Major and Minor values setting by application is,
UUID = {0xFB , 0x0B , 0x57 , 0xA2 , 0x82 , 0x28 , 0x44 , 0xCD , 0x91 ,
0x3A , 0x94 , 0xA1 , 0x22 , 0xBA , 0x12 , 0x06}
major_num = {0x11, 0x22}
minor_num = {0x33, 0x44}

**TX Power** is used to calculate distance from iBeacon.
Default TX power value setting by application is,
TX Power = 0x33

Note:
If the user wants to change the prefix, UUID, Major number, Minor number and TX Power values, change the following values in rsi_ble_ibeacon.c_ file.

For Prefix:
`<span style="color: #005032">uint8_t</span> adv[31] = {0x02, 0x01, 0x02, 0x1A, 0xFF, 0x4C, 0x00, 0x02, 0x15}; //prefix(9bytes)`

**For UUID:**

uint8_t uuid[16] = {0xFB , 0x0B , 0x57 , 0xA2 , 0x82 , 0x28 , 0x44 , 0xCD , 0x91 , 0x3A , 0x94 , 0xA1 , 0x22 , 0xBA , 0x12 , 0x06};
For Major Number:
uint8_t major_num[2] = {0x11, 0x22};
For Major Number:
uint8_t minor_num[2] = {0x33, 0x44};
For TX Power:
uint8_t tx_power = 0x33;

![rsi_ble_ibeacon function](/wifibt-wc-snippet-examples/2.14.0/images/image-ib2.png)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project

- The Keil project is used to evaluate the application on STM32.
- Project path: `<SDK>/examples/snippets/ble/ble_ibeacon/projects/ibeacon-nucleo-f411re.uvprojx`

- Simplicity Studio

- The Simplicity Studio project is used to evaluate the application on EFR32MG21.
- Project path:  
  - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/ble_ibeacon/projects/ibeacon-brd4180a-mg21.slsproj`  
  - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/ble_ibeacon/projects/ibeacon-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image23a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/ble_ibeacon/projects/ble_ibeacon-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_ibeacon.c` file and update/modify following macros:

`RSI_BLE_LOCAL_NAME` refers name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_LOCAL_NAME                     "ibeacon"
```

Following are the event numbers for connection and Disconnection events,

```c
#define RSI_APP_EVENT_CONNECTED                1
#define RSI_APP_EVENT_DISCONNECTED             2
```

Following are the **non-configurable** macros in the application.
BT_GLOBAL_BUFF_LEN refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                     15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

```c
#define RSI_BLE_PWR_INX                        30
#define RSI_BLE_PWR_SAVE_OPTIONS               0
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                    FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                      RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP             TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP             FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP         RAM_LEVEL_NWP_ALL_MCU_ZERO
```

---

**Note!**
`rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

---

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippetsble/ble/ble_ibeacon/projects/ibeacon-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/ble/ble_ibeacon/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. After the program gets executed, Silicon Labs module would be in Advertising state.
2. Open iBeaconDetector app in the Smartphone and do Scan.
3. In the App, Silicon Labs module device would appear with the name configured in the macro **RSI_BLE_LOCAL_NAME** (Ex: "ibeacon") or sometimes observed as "SimpleBLEPeripheral".
4. After successful scan, user can see the Silicon Labs device advertised data i.e UUID, Maximum Number, Minimum Number and TX Power in iBeaconDetector application.

![Advertised data in iBeaconDetector application](/wifibt-wc-snippet-examples/2.14.0/images/image-ib3.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BLE Extended Adv Central

##### 1. Purpose / Scope

This application demonstrates how to connect RS9116W EVK with remote BLE device in Extended advertsing central mode.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- BLE peripheral device

![Setup Diagram for Simple Central Example using RS9116 EVK](/wifibt-wc-snippet-examples/2.14.0/images/ae-central.png)
![Setup Diagram for Simple Central Example using RS9116 ACX Expansion board](/wifibt-wc-snippet-examples/2.14.0/images/ac1-ae-central.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_central/projects/ble_ae_central-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_central/projects/ble_ae_central-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_central/projects/ble_ae_central-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/radio-board.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>examples/_internal/Wireless_Examples/ble/ble_ae_central/ble_ae_central-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal Support

This application supports bare metal. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ble_central.c` file

**4.1.1** User must update the below parameters

`RSI_BLE_DEV_ADDR` refers address of the remote device to connect.

```c
#define RSI_BLE_DEV_ADDR                               "00:1E:7C:25:E9:4D"  
```

`RSI_REMOTE_DEVICE_NAME` refers the name of remote device to which Silicon Labs device has to connect.

```c
#define RSI_REMOTE_DEVICE_NAME                         "SILABS_AE" 
```

**Note:** user can configure either RSI_BLE_DEV_ADDR or RSI_REMOTE_DEVICE_NAME of the remote device.

**Power save configuration**

By default, The Application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

If user wants to run the application in power save, modify the below configuration.

```c
#define ENABLE_POWER_SAVE 1 
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

Following are the event numbers for advertising, connection and disconnection events

```c
#define RSI_APP_EVENT_ADV_REPORT                       0
#define RSI_APP_EVENT_CONNECTED                        1
#define RSI_APP_EVENT_DISCONNECTED                     2
```

Following are the non-configurable macros in the application.

`BT_GLOBAL_BUFF_LEN` refers Number of bytes required by the application and the driver

```c
#define BT_GLOBAL_BUFF_LEN                             15000
```

**4.2** Open `rsi_ble_config.h` file and update/modify following macros,

Initiating phys:

```c
#define INITIATING_PHYS (PHY_1M | PHY_2M | PHY_LE_CODED)
```

Primary phy scan interval:

```c
#define PRI_PHY_LE_SCAN_INTERVAL 0x100
```

Primary phy scan window:

```c
#define PRI_PHY_LE_SCAN_WINDOW   0x50
```

Secondary phy scan interval:

```c
#define SEC_PHY_LE_SCAN_INTERVAL 0x100
```

Secondary phy scan window:

```c
#define SEC_PHY_LE_SCAN_WINDOW   0x50
```

Primary scan type :

```c
#define PRI_PHY_BLE_SCAN_TYPE    SCAN_TYPE_ACTIVE
```

Secondary scan type:

```c
#define SEC_PHY_BLE_SCAN_TYPE    SCAN_TYPE_ACTIVE
```

Scan filter type:

```c
#define RSI_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL
```

Scan filter duplicates:

```c
#define BLE_SCAN_ENABLE_FILTER_DUP 0x00
```

Scan duration:

```c
    #define BLE_SCAN_DUR               0x00
```

Scan period:

```c
    #define BLE_SCAN_PERIOD            0x00
```

```c
#define RSI_BLE_PWR_INX                                30
#define RSI_BLE_PWR_SAVE_OPTIONS                       BLE_DISABLE_DUTY_CYCLING
```

**Opermode command parameters**

```c
#define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                              RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 0
```

**Note:** `rsi_ble_config.h` files are already set with desired configuration in respective example folders user need not change for each example.

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>examples/_internal/Wireless_Examples/ble/ble_ae_central//projects/ble_ae_central-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/_internal/Wireless_Examples/ble/ble_ae_central//projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the remote BLE device in peripheral mode and put it in advertising mode.For remote mobile ensure that the device is named same as the value mentioned in RSI_REMOTE_DEVICE_NAME macro also see to it that Complete local name record is added to advertising data and Scan response data and connectable is ticked in options.
2. After the program gets executed, Silicon Labs device tries to connect with the remote device specified in `RSI_BLE_DEV_ADDR` or `RSI_REMOTE_DEVICE_NAME` macro.
3. Observe that the connection is established between the desired device and RS9116W EVK.  
   **Note:** Examples for BLE peripherals: Bluetooth Dongle, mobile application, TA sensor tag.
4. After successful program execution the prints in docklight looks as shown below.

![Prints in docklight window](/wifibt-wc-snippet-examples/2.14.0/images/ae-central-logs.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN BLE Power Save

##### 1. Purpose / Scope

The example demonstrates how to configure the device in WiSeConnect coex mode with WLAN standby mode and BLE-connected power save running in the RS9116W EVK module.
In this coex application, a Silicon Labs BLE device connects with a remote BLE device (for example, a smartphone with an spp pro application) and issues a connected power save command to module.

The application uses both BLE and WLAN tasks to enable communication between a smartphone and a remote PC. Messages from the smartphone are received via BLE and forwarded through WLAN to the PC via an Access Point. Similarly, messages from the PC are sent via WLAN to BLE, enabling seamless bidirectional data transfer.

###### 1.1 WLAN Task

This application explains how to:

- Create a Silicon Labs device as a station.
- Connect a Silicon Labs station to remote access point and get an IP.
- Enable the appropriate power save mode and then wait in a scheduler for some time.
- Receive TCP data sent by the connected station and forward it to the BLE task.
- Send data received by the BLE task to the connected station using TCP over SSL client protocol.

###### 1.2 BLE Task

This application explains how to:

- Configure the device in advertise mode.
- Connect from a smartphone/dongle.
- Configure a device in power save profile mode 2.
- Receive data from the WLAN task and send it to the connected remote BLE device via GATT.
- Send data received from the remote BLE device via GATT to the WLAN task.

##### 2. Prerequisites / Setup Requirements

The WiSeConnect parts require that the host processor is connected to the WiSeConnect using an SPI, UART, or USB host interface. The host processor firmware needs to properly initialize the selected host interface. The Silicon Labs Wireless SAPI framework provides necessary HAL APIs to enable a variety of host processors.

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows / Linux PC with Host interface (UART/ USB-CDC/ SPI/ USB) in case of WiSeConnect.
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point.
- Windows PC2 with SSL server application (openssl).
- BLE supported smart phone with GATT client application.

![Setup diagram for WLAN BLE Power save](/wifibt-wc-snippet-examples/2.14.0/images/image1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install OpenSSL from this link [OpenSSL](http://ufpr.dl.sourceforge.net/project/gnuwin32/openssl/0.9.8h-1/openssl-0.9.8h-1-bin.zip) to download openssl in remote PC.
- Download and install the Silicon Labs [Simplicity Connect Mobile App](https://www.silabs.com/software-and-tools/simplicity-connect-mobile-app) in the Android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

###### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan_ble/wlan_ble_power_save/projects/wlan_ble_power_save-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_ble_power_save/projects/wlan_ble_power_save-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_ble_power_save/projects/wlan_ble_power_save-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image263a.png)

###### Bare Metal Support

This application supports only bare metal environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Configuring the WLAN task

**4.1.1** Open the `rsi_wlan_app.c` file and modify the following macros:

SSID refers to the name of the Access point.

```c
#define SSID                                          "REDPINE_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0, device will scan all channels.

```c
#define CHANNEL_NO                                     0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, and WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                                 RSI_OPEN
```

PSK refers to the secret key if the access point is configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                           "<psk>"
```

To Load certificate:

```c
#define LOAD_CERTIFICATE                              1
```

If **LOAD_CERTIFICATE** is set to 1, application will load certificate which is included using rsi_wlan_set_certificate API.

By default, the application loads "cacert.pem" certificate if **LOAD_CERTIFICATE** is enable. In order to load different certificate, user has to follow the following steps:

rsi_wlan_set_certificate API expects the certificate in the form of linear array. So, convert the pem certificate into linear array form using python script provided in the release package "certificate_script.py".

Example: If the certificate is `wifi-user.pem`, give the command in the following way:

```sh
python certificate_to_array.py <input_file> <output_file>
Example: python certificate_to_array.py wifi-user.pem wifiuser.pem
```

The script will generate `wifiuser.pem` in which one linear array named `wifiuser[]` contains the certificate.

After converting the certificate, update the `rsi_wlan_app.c` source file by including the certificate file and by providing the required parameters to the `rsi_wlan_set_certificate` API.

> Note:
> Once the certificate loads into the device, it will write into the device flash. So, the user does not need the load certificate for every boot up unless the certificate changes.

Define LOAD_CERTIFICATE as 0 if the certificate is already present in the Device.

> Note:
> All the certificates are given in the release package `<SDK>/resources/certificates`

DEVICE_PORT port refers to SSL client port number.

```c
#define DEVICE_PORT                                  5001
```

SERVER_PORT port refers to remote the SSL server port number.

```c
#define SERVER_PORT                                  5001
```

SERVER_IP_ADDRESS refers to the remote peer IP address to connect with SSL server socket.

```c
#define SERVER_IP_ADDRESS                           "192.168.10.100"
```

To configure IP address

Enable / Disable: DHCP mode 1-Enables DHCP mode (gets the IP from DHCP server), 0-Disables DHCP mode

```c
#define DHCP_MODE                             1
```

If user wants to configure module IP address through STATIC IP, then configure the DEVICE_IP, GATEWAY and NETMASK macros as below.

```c
#define   DEVICE_IP                           "192.168.10.101"
#define   GATEWAY                             "192.168.10.1"
#define   NETMASK                             "255.255.255.0" 
```

**4.1.2** In the **rsi_ble_app.c** file, default power save mode configuration is set to low power mode 2 (RSI_SLEEP_MODE_2) with maximum power save (RSI_MAX_PSP) with a message-based hand shake.

```c
#define PSP_MODE  RSI_SLEEP_MODE_2
#define PSP_TYPE  RSI_MAX_PSP
```

**4.1.3** Open the `rsi_wlan_config.h` file and modify following macros:

```c
#define CONCURRENT_MODE                              RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                          (FEAT_SECURITY_OPEN | FEAT_AGGREGATION | FEAT_ULP_GPIO_BASED_HANDSHAKE | FEAT_DEV_TO_HOST_ULP_GPIO_1)
#define RSI_TCP_IP_BYPASS                            RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                   (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP                   (FEAT_CUSTOM_FEAT_EXTENTION_VALID | CUSTOM_FEAT_SOC_CLK_CONFIG_120MHZ)
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP               (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE | EXT_FEAT_384K_MODE)
#define RSI_EXT_TCPIP_FEATURE_BITMAP                 EXT_TCP_IP_WINDOW_DIV
#define RSI_BAND                                     RSI_BAND_2P4GHZ
```

Default configuration of low power save mode 2:

```c
#define RSI_HAND_SHAKE_TYPE GPIO_BASED
#define RSI_SELECT_LP_OR_ULP_MODE RSI_ULP_WITH_RAM_RET
#define RSI_DTIM_ALIGNED_TYPE 0
#define RSI_MONITOR_INTERVAL 50
#define RSI_WMM_PS_ENABLE RSI_DISABLE
#define RSI_WMM_PS_TYPE 0 
#define RSI_WMM_PS_WAKE_INTERVAL 20
#define RSI_WMM_PS_UAPSD_BITMAP 15
```

##### 4.2 Configuring the BLE task

**4.2.1** Open the `rsi_ble_app.c` file and modify following macros:

RSI_BLE_NEW_SERVICE_UUID refers to the newly created custom service.

```c
#define RSI_BLE_NEW_SERVICE_UUID                     0xAABB
```

RSI_BLE_ATTRIBUTE_1_UUID refers to the first characteristic under this custom service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_1_UUID                      0x1AA1
```

RSI_BLE_ATTRIBUTE_2_UUID refers to the second characteristic under this custom service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_2_UUID                      0x1BB1
```

RSI_BLE_MAX_DATA_LEN refers to the maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                         20
```

RSI_BLE_APP_DEVICE_NAME refers to the name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define RSI_BLE_APP_DEVICE_NAME                       "WLAN_BLE_SIMPLE_CHAT"
```

Following are the **non-configurable** macros in the application:

RSI_BLE_CHAR_SERV_UUID refers to the client characteristic declaration.

```c
#define RSI_BLE_CHAR_SERV_UUID                         0x2803
```

RSI_BLE_CLIENT_CHAR_UUID refers to the client characteristic configuration descriptor.

```c
#define RSI_BLE_CLIENT_CHAR_UUID                       0x2902
```

RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_READ                       0x02
```

RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                    0x08
```

RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_NOTIFY                   0x10
```

**4.2.2** Open `rsi_ble_config.h` file. User can also modify the below parameters as per their needs and requirements.

```c
#define RSI_BLE_PWR_INX                               30
#define RSI_BLE_PWR_SAVE_OPTIONS                      0
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_ble/wlan_ble_power_save/projects/wlan_ble_power_save-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/wlan_ble/wlan_ble_power_save/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. On Windows PC2, which is connected to the AP through LAN. Download the Openssl package from above mentioned link and run SSL server by giving following command:

```sh
Openssl.exe s_server -accept <SERVER_PORT> –cert <server_certificate_file_path> -key <server_key_file_path> -tls<tls_version>
Example: openssl.exe s_server –accept 5001 –cert server-cert.pem -key server-key.pem –tls1
```

![OpenSSL server Window](/wifibt-wc-snippet-examples/2.14.0/images/image2.png)

1. After the program gets executed, Silicon Labs BLE is in Advertising state and WLAN connects to the Access Point and establishes SSL connectivity with SSL server opened on Windows PC2. The following image illustrates the connection establishment at Windows PC2.

![OpenSSL server log Window](/wifibt-wc-snippet-examples/2.14.0/images/image3.png)

1. Open Simplicity Connect app in the smartphone and perform the Scan.
2. In the App, the Silicon Labs module device will appear with the name configured in the macro **RSI_BLE_APP_DEVICE_NAME (Ex: "WLAN_BLE_APP")** or sometimes observed as a RS9116W EVK as internal name "**SimpleBLEPeripheral**".

![WLAN_BLE_APP Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image4.png)

1. Initiate the BLE connection from the app.

![BLE connection Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image5.png)

1. Once the connection is established, the SiConnect app displays all services supported by the Silicon Labs module.
2. After the BLE connection is set up, the device enters the configured coex power-save mode.
3. Select the custom service which is added **RSI_BLE_NEW_SERVICE_UUID** (for example, `0xAABB`) and enable Notification for attribute UUID **RSI_BLE_ATTRIBUTE_2_UUID** (for example, `0x1BB1`) to receive data sent by Wi-Fi STA.

![Enable Read Notification Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image6.png)

1. From SSL server (Windows PC2), send a message (for example, **Hello from WiFi STA**) to the Silicon Labs device. The Silicon Labs device forwards the received message from SSL server to remote BLE device which is connected to Silicon Labs BLE device over BLE protocol. User can observe the message notification on attribute UUID **RSI_BLE_ATTRIBUTE_2_UUID** (for example, **0x1BB1**) in the SiConnect app.

![Message Notification Window](/wifibt-wc-snippet-examples/2.14.0/images/image7.png)

![Attribute UUID Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image8.png)

> Note:
> The `rsi_wlan_app_send_to_ble()` function defined in `rsi_ble_app.c` sends a message from the WLAN task to BLE task.

1. Now send a message (for example, **Hello from BLE**) from GATT client (from the smartphone SiConnect app) using attribute **RSI_BLE_ATTRIBUTE_1_UUID** (for example, `0x1AA1`) to Silicon Labs device. Silicon Labs device forwards the received message from BLE remote device to SSL server over Wi-Fi protocol. The user can observe the message on SSL socket application.

![Enable Write Notification Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image9.png)

![Send Message Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image10.png)

![Message on SSL socket Window](/wifibt-wc-snippet-examples/2.14.0/images/image11.png)

> Note:
> `rsi_bt_app_send_to_wlan()` function is defined in `rsi_wlan_app.c` to send message from BLE task to WLAN task.

1. Note down the power measurement by connecting Module to Agilent Power meter setup.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Socket Select in coex mode

##### 1. Purpose / Scope

This application demonstrates how to create the multiple sockets in RS9116W EVK and monitor multiple sockets for a certain activity to occur. If there is some data to be read on one of the sockets, the Select provides the response about the socket whether the data is to be read on the socket or not.
This also can be used in Coex mode(BLE & Wlan mode).

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- TCP client application running in Windows PC2 (This uses iperf application to open TCP client socket in remote PC)

![Setup Diagram for WLAN station BLE Provisioning Select Example](/wifibt-wc-snippet-examples/2.14.0/images/provisioning-select.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in the remote PC.  
  User can install any of the below apps to verify WLAN Station BLE Provisioning.

1. Install Android based Silicon labs Connect APK:

- Access the apk provided in the path:  `<SDK>/utilities/Silicon_lab_connectApp.apk`

1. Install windows Silicon labs connect application in laptop.

- Refer the application provided in the path: `<SDK>/utilities/windows_ble_provisioning_app`
- Follow the instructions provided in the path: `<SDK>/utilities/windows_ble_provisioning_app/Installation_steps_to_run_silabs_connect_windows_application.docx`

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select/projects/wlan_station_ble_provisioning_select-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select/projects/wlan_station_ble_provisioning_select-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select/projects/wlan_station_ble_provisioning_select-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/radio-boards.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select/projects/wlan_station_ble_provisioning_select-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.
**Steps to configure project settings in Keil IDE**
- Open project in Keil IDE and click on 'Options for Target'
- Go to 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
- Click on 'OK' button to save the settings

![project settings in Keil IDE](/wifibt-wc-snippet-examples/2.14.0/images/image279a.png)

**Steps to configure project settings in Simplicity Studio**
- Open project in Simplicity Studio
- Right click on the project and choose 'Properties'
- GO to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
- Click on 'Apply' and 'OK' to save the settings

![project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image279b.png)

![project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image279c.png)

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open `main.c` file

Memory length for driver

```c
#define GLOBAL_BUFF_LEN                            15000
```

The following parameters are configured if OS is used.

Task Priotrities should be given as below. Application task priority should be given as low priority and Driver task priority should be given as highest priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                 1
#define RSI_BLE_TASK_PRIORITY                         2
#define RSI_DRIVER_TASK_PRIORITY                      3
```

Application Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE             1000
```

BLE Task stack size is configured by this macro

```c
#define RSI_BLW_TASK_STACK_SIZE                     1000
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE                  2000
```

###### 4.2 Open rsi_wlan_app.c file

###### 4.2.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                               1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                               0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                 0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                 0x00FFFFFF
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                         15000
```

User can connect to access point through PMK

To Enable keep 1 else 0

```c
#define CONNECT_WITH_PMK                         0
```

> Note:
> If CONNECT_WITH_PMK is enabled, SECURITY_TYPE is set to RSI_WPA2_PMK.

###### 4.3 Open `rsi_wlan_config.h` file

```c
#define CONCURRENT_MODE                          RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                      (FEAT_SECURITY_OPEN | FEAT_AGGREGATION)
#define RSI_TCP_IP_BYPASS                        RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP               (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_TOTAL_SOCKETS_1 | TCP_IP_FEAT_EXTENSION_VALID) 
#define RSI_CUSTOM_FEATURE_BIT_MAP               FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP           0   
#define RSI_EXT_TCPIP_FEATURE_BIT_MAP            (EXT_DYNAMIC_COEX_MEMORY | EXT_TCP_IP_TOTAL_SELECTS_1)
#define RSI_BAND                                 RSI_BAND_2P4GHZ
#define RSI_BT_FEATURE_BITMAP                    (BT_RF_TYPE | ENABLE_BLE_PROTOCOL)
```

> Note:
> RSI_EXT_TCPIP_FEATURE_BIT_MAP-- has been added with EXT_TCP_IP_TOTAL_SELECTS_1
> rsi_wlan_config.h, rsi_bt_config.h and rsi_ble_config.h files are already set with the above desired configuration for this example.

###### 4.4 Open `rsi_ble_app.c` file and update/modify following macros

RSI_BLE_CHAR_SERV_UUID refers to the attribute type of the characteristics to be added in a service.

```c
#define  RSI_BLE_CHAR_SERV_UUID                         0x2803
```

RSI_BLE_CLIENT_CHAR_UUID refers to the attribute type of the client characteristics descriptor to be added in a service.

```c
#define RSI_BLE_CLIENT_CHAR_UUID                        0x2902
```

RSI_BLE_NEW_SERVICE_UUID refers to the attribute value of the newly created service.

```c
#define  RSI_BLE_NEW_SERVICE_UUID                       0xAABB
```

RSI_BLE_ATTRIBUTE_1_UUID refers to the attribute type of the first attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define  RSI_BLE_ATTRIBUTE_1_UUID                        0x1AA1
```

RSI_BLE_ATTRIBUTE_2_UUID refers to the attribute type of the second attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_2_UUID                         0x1BB1
```

RSI_BLE_ATTRIBUTE_3_UUID refers to the attribute type of the third attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_3_UUID                         0x1CC1
```

RSI_BLE_MAX_DATA_LEN refers to the Maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                             66
```

RSI_BLE_APP_DEVICE_NAME refers to the name of the RS9116W EVK to appear during scanning by remote devices.

```c
#define  RSI_BLE_APP_DEVICE_NAME                         "BLE_CONFIGURATOR"
```

The following are the **non-configurable** macros in the application.

RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_READ                       0x02
```

RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                       0x08
```

RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_NOTIFY                     0x10
```

BT_GLOBAL_BUFF_LEN refers to the number of bytes required by the application and the driver.

```c
#define  BT_GLOBAL_BUFF_LEN                              15000
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_select/projects/wlan_station_ble_provisioning_select-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project.
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan_ble\wlan_station_ble_provisioning_select\projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd4180b-mg21.slsproj  for EFR32mg21 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

###### 5.3.1 Steps to verify the WLAN Station BLE Provisioning Example (heading level 7)

Steps to be followed to verify WLAN Station BLE Provisioning with Android Silicon Labs Connect App

1. Configure the Access point with internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect the RS9116W EVK in STA mode.
2. Connect any serial console for prints.
3. When RS9116W EVK enters BLE advertising mode, launch the EFR Connect App.

![EFR Connect App](/wifibt-wc-snippet-examples/2.14.0/images/efr-app.png)

1. Enable the Location services

![Location Enable](/wifibt-wc-snippet-examples/2.14.0/images/location-enable.png)

1. Click on Start Scanning

![BLE Scan](/wifibt-wc-snippet-examples/2.14.0/images/start-scan.png)

1. Once you scan you will find the module displayed

![BLE Connected](/wifibt-wc-snippet-examples/2.14.0/images/ble-configurator-connect.png)

1. Connect to an module

![Module displayed](/wifibt-wc-snippet-examples/2.14.0/images/connected.png)

1. Pass the appropriate commands and pass the ssid psk

![Send Commands](/wifibt-wc-snippet-examples/2.14.0/images/send-command.png)

1. Refer the below figure for console prints

![Docklight Console logs](/wifibt-wc-snippet-examples/2.14.0/images/docklight-console-logs.png)

###### 5.3.2 Steps to be followed to verify WLAN Station BLE Provisioning with windows based Silicon Labs Connect App (heading level 7)

1. Configure the Access point with internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect the RS9116W EVK in STA mode.
2. Connect any serial console for prints.  
   **Note:** Turn on BT in the PC.
3. Go to folder  `<SDK>/utilities/windows_ble_provisioning_app` and Run **Silabs_Connect.py** in the command prompt.
4. Executing the application in the command prompt as stated in the above point will open the GUI (with the â€œBLE SCAN ONâ€� button).

![Silicon labs connect GUI](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-1.png)

1. When click on the **BLE SCAN ON** button, all the RS9116 BLE Devices that are available nearby are displayed in the window.

![BLE scan mode](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-3.png)

**Note:** - RS9116 BLE device will advertise with different names based on the application configuration.

1. Once RS9116 BLE device displayed on the scanning list, initiate the connection by clicking a button on the available RS9116 BLE device.

![BLE device displayed ](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-4.png)

1. Once the BLE get connected, **Firmware version** and list of available Access Points get displayed on the screen.

![BLE get connected](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-5.png)

1. By clicking on one of the scanned APâ€™s, RS9116 will connect to that particular AP. If Access Point is secured it will ask the password as input but if that Access point as not secured, then directly connect to that Access Point.

![Password pop-up for PSK](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-7.png)

1. After successful connection, â€œIP & Mac addressâ€� of connected Access point get displayed.

![Connected Access point IP and MAC](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-8.png)

1. To disconnect from Access Point, click on connected AP.
2. After successful disconnection of WLAN, pop-up comes like **WLAN GOT DISCONNECTED**. Click on the â€œokâ€�.

![Connected Access point POCO C3](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-9.png)

![wlan disconnected](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-10.png)

**Note:**   For more information refer **Silabs_Connect_Windows_Application_User_Guide.pdf** in the path
`<SDK>/utilities/windows_ble_provisioning_app/`

###### 5.3.3 Steps to follow to create socket connection and run iperf on client

1. After the program gets executed, RS9116W EVK is configured as client and connects to AP and gets IP.
2. After successful connection with the access point, the socket select is issued for the desired socket.
3. Open TCP client from WindowsPC2 and connect to TCP server opened on the device on port number DEVICE_PORT. The Iperf command to start the TCP client is:

> `C:\> iperf.exe -c <Module_IP> -p <DEVICE_PORT> -i 1 -t <time interval in sec>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 192.168.0.100 -p 5001 -i 1 -t 30`

1. Select provides the response about the socket whether the data is to be read on the socket or not.
2. If data is to be received on the socket, then the receive function is called on the socket.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN - BLE Extended Advertising CoEx App

##### 1. Purpose / Scope

This application demonstrates how to configure  RS9116W EVK as both Extended Advertiser(Peripheral) with two advertising sets supported and Extended Scanner(Central). It supports multiple connections (one central + one peripheral), WLAN Station Connection along with SMP feature and data transfer.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user needs the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- BLE peripheral device with AE support
- BLE central device with AE support
- Wi-Fi Access point with a connection to the internet
- Windows PC2 (Remote PC) if TCP data needs to be transffered on Wi-Fi

![Setup Diagram of WLAN BLE AE CoEx Example](/wifibt-wc-snippet-examples/2.14.0/images/wlan-ble-ae-coex.png)

![Setup Diagram of WLAN BLE AE CoEx Example using ACX board](/wifibt-wc-snippet-examples/2.14.0/images/wlan-ble-ae-coex-acx.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs Simplicity Connect App(formerly EFR Connect App) or other BLE Central/Peripheral app in the Android/iOS smart phones for testing BLE applications. User can also use their choice of BLE apps available in Android/iOS smart phones (which support AE).

##### 3. Application Build Environment

The Application is built and executed on following Host platforms
[WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.1 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

Refer to "Connect the RS9116W EVK to the host MCU development board" section in the following link for SPI connections
Refer [Connect the RS9116W EVK to the host MCU development board](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/getting-started-with-rs9116w-with-efr32#connect-the-rs9116w-evk-to-the-host-mcu-development-board)

###### 3.2 Project Configuration

The Application is provided with the project folder containing Simplicity Studio project files.

- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/ble/wlan_ble_ae_coex_app/projects/wlan_ble_ae_coex_app-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/ble/wlan_ble_ae_coex_app/projects/wlan_ble_ae_coex_app-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image79b.png)

###### 3.3 RTOS Support

This application supports only RTOS configuration. By default, the application project files (Simplicity studio) are provided with OS environment in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `ble_config.h` file and update/modify following macros,

**4.1.1** User must update the below parameters

Configure the below macros to enable extended advertsing and scanning by default respectively

```c
       #define ADV_ENABLED_DEFAULT    1
       #define SCAN_ENABLED_DEFAULT   1
```

Set the below macro to enable second advertising set

```c
       #define ADV_SET2    1
```

Configure the below macros to set the number of peripheral and central connections that can be made

```c
       #define RSI_BLE_MAX_NBR_PERIPHERALS    1
       #define RSI_BLE_MAX_NBR_CENTRALS       1
```

RSI_REMOTE_DEVICE_NAME1 refers address of the remote device(AE peripheral) to connect

```c
       #define RSI_REMOTE_DEVICE_NAME1   AEdevice1
```

configure following macros to enable secure connection for central and peripheral respectively:

```c
       #define SMP_ENABLE_C1    1
       #define SMP_ENABLE_P1    1
```

Enable the following macros to receive the "GATT Notifications" from the remote devices

```c
       #define RX_NOTIFICATIONS_FROM_C1    1
       #define RX_NOTIFICATIONS_FROM_P1    1
```

**Note:**
The maximum number of peripheral connections support, and the maximum number of central connections support is one for both.

**Power save configuration**

- By default, the application is configured with power save enable feature:  
  #define ENABLE_POWER_SAVE 1
- To disable power save, modify the following configuration:  
  #define ENABLE_POWER_SAVE 0  
  **For Powersave functionality with NCP expansion (ACX) board**

> **Note:**For using powersave functionality with NCP expansion (ACX) board, the `EXP_BOARD=1` preprocessor symbol should be added to the list of defined symbols in the preprocessor menu of project settings."

```c
> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Preprocessor' and add the macro `EXP_BOARD=1`
> - Select 'Apply' and 'OK' to save the settings

To add the macro
1.Click Add to Pre-processor defines symbol
2.Add macro EXP_BOARD and assign it to 1
3.Click OK
4.Click "Apply and Close" 
```

![Exp Board](/wifibt-wc-snippet-examples/2.14.0/images/exp-board.png)

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements

**4.1.2.1** Extended Advertising parameters

The length of the advertising data needs to be filled in the following macro

```c
       #define BLE_AE_ADV_DATA_LEN    0x19
```

Below mentioned macro needs to be populated with data

```c
       #define BLE_AE_ADV_DATA    "AE_PERIPHERAL_DATA_1"
```

The Extended advertising handle for set 1 and 2 can be set with the following macros respectively

```c
#define BLE_AE_ADV_HNDL_SET_1          0x00
#define BLE_AE_ADV_HNDL_SET_2          0x01
```

The minimum advertising interval for set1 and set2 can be configured using the following macros

```c
#define BLE_AE_ADV_INT_MIN_SET_1       0x664
#define BLE_AE_ADV_INT_MIN_SET_2       0x664
```

The maximum advertising interval for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_INT_MAX_SET_1       0x664
#define BLE_AE_ADV_INT_MAX_SET_2       0x664
```

The Extended advertising channel map for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_CHANNEL_MAP_SET_1   0x07
#define BLE_AE_ADV_CHANNEL_MAP_SET_2   0x07
```

The Extended advertising filter policy for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_FILTER_POLICY_SET_1 0x00
#define BLE_AE_ADV_FILTER_POLICY_SET_2 0x00
```

The Extended advertising TX Power for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_TX_PWR_SET_1        0x00
#define BLE_AE_ADV_TX_PWR_SET_2        0x06
```

The primary advertising phy for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_PRIMARY_ADV_PHY_SET_1   0x01
#define BLE_AE_PRIMARY_ADV_PHY_SET_2   0x03
```

The Extended advertising max skip for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_SEC_ADV_MAX_SKIP_SET_1  0x00
#define BLE_AE_SEC_ADV_MAX_SKIP_SET_2  0x00
```

The secondary advertising phy for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_SECONDARY_ADV_PHY_SET_1 0x01
#define BLE_AE_SECONDARY_ADV_PHY_SET_2 0x03
```

The Extended advertising SID for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_SID_SET_1           0x00
#define BLE_AE_ADV_SID_SET_2           0x01
```

The Extended advertising scan request notification enable for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_SCAN_REQ_NOTIF_EN_SET_1 0x01
#define BLE_AE_SCAN_REQ_NOTIF_EN_SET_2 0x01
```

The Extended advertising event properties for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_EVNT_PROP_SET_1     (BLE_CONNECTABLE_ADV)
#define BLE_AE_ADV_EVNT_PROP_SET_2     0x00
```

The Extended advertising duration for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_DUR_SET_1           0x00
#define BLE_AE_ADV_DUR_SET_2           0x00
```

The maximum extended advertising events for set1 and set2 can be configured with the following macros respectively

```c
#define BLE_AE_ADV_MAX_AE_EVENTS_SET_1 0x00
#define BLE_AE_ADV_MAX_AE_EVENTS_SET_2 0x00
```

**4.1.2.2** Extended scan parameters

Extended scanning filter type can be set with the below macro

```c
#define BLE_AE_SCAN_FILTER_TYPE       SCAN_FILTER_TYPE_ALL
```

The scan type for primary phy can be set using below macro

```c
#define PRI_PHY_BLE_AE_SCAN_TYPE      SCAN_TYPE_ACTIVE
```

The scan type for secondary phy can be set using below macro

```c
#define SEC_PHY_BLE_AE_SCAN_TYPE      SCAN_TYPE_ACTIVE
```

The primary phy extended scan interval can be set using below macro

```c
#define PRI_PHY_LE_AE_SCAN_INTERVAL   0x14A0
```

The primary phy extended scan window can be set using below macro

```c
#define PRI_PHY_LE_AE_SCAN_WINDOW     0x14A0
```

The secondary phy extended scan interval can be set using below macro

```c
#define SEC_PHY_LE_AE_SCAN_INTERVAL   0x14A0
```

The secondary phy extended scan window can be set using below macro

```c
#define SEC_PHY_LE_AE_SCAN_WINDOW     0x14A0
```

Extended scanning filter duplicates can be set using below macro

```c
#define BLE_AE_SCAN_ENABLE_FILTER_DUP 0x00
```

Extended scan duration can be set using below macro

```c
#define BLE_AE_SCAN_DUR               0x00
```

Extended scan period can be set using below macro

```c
#define BLE_AE_SCAN_PERIOD            0x00
```

Following are the **non-configurable** macros in the application.

The event properties bits:

```c
#define BLE_CONNECTABLE_ADV        (1 << 0)
#define BLE_SCANNABLE_ADV          (1 << 1)
#define BLE_LOW_DUTY_DIR_CONN_ADV  (1 << 2)
#define BLE_HIGH_DUTY_DIR_CONN_ADV (1 << 3)
#define BLE_LEGACY_ADV             (1 << 4)
#define BLE_ANONYMOUS_ADV          (1 << 5)
#define BLE_TX_WR_ADV              (1 << 6)
```

Global buffer length:

```c
 #define GLOBAL_BUFF_LEN                             15000
```

Phy rate bits:

```c
#define PHY_1M       BIT(0)
#define PHY_2M       BIT(1)
#define PHY_LE_CODED BIT(2)
```

```c
	 #define RSI_BLE_PWR_INX          30
	 #define RSI_BLE_PWR_SAVE_OPTIONS 0    
	 #define BLE_DISABLE_DUTY_CYCLING 0
     #define BLE_DUTY_CYCLING         1
     #define BLR_DUTY_CYCLING         2
     #define BLE_4X_PWR_SAVE_MODE     4
```

**Opermode command parameters**

```c
	 #define RSI_FEATURE_BIT_MAP                            FEAT_SECURITY_OPEN
	 #define RSI_TCP_IP_BYPASS                              RSI_DISABLE
	 #define RSI_TCP_IP_FEATURE_BIT_MAP                     TCP_IP_FEAT_DHCPV4_CLIENT
	 #define RSI_CUSTOM_FEATURE_BIT_MAP                     FEAT_CUSTOM_FEAT_EXTENTION_VALID
	 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                 (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE)
	 #define RSI_EXT_TCPIP_FEATURE_BITMAP 			(EXT_TCP_IP_WINDOW_DIV | EXT_TCP_IP_WAIT_FOR_SOCKET_CLOSE)
```

**Note:**
ble_config.h file is already set with desired configuration in respective example folder, user need not change for each example.

**4.2** Open `rsi_wlan_tcp_server_app.c` file and update/modify following macros,

SSID refers to the name of the Access point.

```c
 #define SSID "YOUR_AP_SSID"
```

PSK refers to the Password of the Access point.

```c
 #define PSK "YOUR_AP_PASSWORD"
```

SECURITY_TYPE refers to the security type of the Access Point either OPEN/WPA_2

```c
 #define SECURITY_TYPE RSI_WPA2
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/ble/wlan_ble_ae_coex_app/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Successful build output will show as below.

##### 6. Program the device

- Once the build was successful, right click on project and click on Debug As->Silicon Labs ARM Program as shown in below image.

![Wlan Ble Ae Coex Build](/wifibt-wc-snippet-examples/2.14.0/images/wlan-ble-ae-coex-build.png)
**Note:** Simillarly, Choose the **Run As** option fo one shot execution.

##### 6.1 Running the RS9116W Application

###### 6.1.1 Steps to be followed to verify BLE AE Unified CoEx App

1. Set all the configurations necessary refering to section 4.
2. The RS9116W device, with its default configuration parameters, is set up for 2 extended advertising sets and extended scanning. Its advertising functionality will be validated with any remote device supporting the AE feature. The image below illustrates the RS9116W device's extended advertising sets in the Si Connect app

![Remote Scanner](/wifibt-wc-snippet-examples/2.14.0/images/remote-scanner.png)

1. To make remote central connection , scan from any BLE scanner search for the device(if no random address is set it will advertise with the public address).
2. As shown in step 2, to establish the connection, click on the "CONNECT" option of the device for the required advertising set.
3. Once the physical level connection is established, and if SMP is enabled, the application will initiate the SMP process, as shown in the image below.
4. The pairing procedure using the app is as follows: Select the "Pair and Connect" option.

click on the "Pair and connect" option

![Pairing Prompt On Conn](/wifibt-wc-snippet-examples/2.14.0/images/pairing-prompt-on-conn.png)<br />![Pairing Prompt](/wifibt-wc-snippet-examples/2.14.0/images/pairing-prompt.png)

Enter the passkey displayed in the serial terminal, as shown in the following images.

![Passkey Entry](/wifibt-wc-snippet-examples/2.14.0/images/passkey-entry.png)

Once the SMP pairing process is successful, the connection status is displayed as follows :

![Active Connection](/wifibt-wc-snippet-examples/2.14.0/images/active-connection.png)

1. If extended scanning is enabled, the RS9116W device will scan for the advertising devices using the configured scan parameters
2. To make a remote peripheral connection, advertise the remote device with the specific name defined in the RSI_REMOTE_DEVICE_NAME1 macro. If SMP is enabled for this connection, the bonding process is initiated. Here in the example heartrate service and advertise the device clicking on create new button and configuring required parameters in the advertiser.

**Note:**  Refer to " Create a New Advertisement Set " for creating the advertising set in the Simplicity Connect mobile App(formerly EFR Connect App).

Refer [Create a New Advertisement Set](https://docs.silabs.com/mobile-apps/latest/mobile-apps-explore/03-ble-configure-view) .
Add required services say for example heartrate service and advertise the device clicking on create new button and configuring required parameters in the advertiser.

![Add Heartrate Gatt Service](/wifibt-wc-snippet-examples/2.14.0/images/add-heartrate-gatt-service.png)

1. Select the "Notify" property to enable notifications for continuous data transfer from the RS9116W device.

```c
Following image shows how to enable TX notifications from DUT after connection
```

![Notification Enable](/wifibt-wc-snippet-examples/2.14.0/images/notification-enable.png)

1. To enable Wi-Fi TCP data transfer, user needs to set the macro TCP_DATA_TEST_CODE = 1 in rsi_wlan_tcp_server_app.c
2. Run TCP client on another PC (preferably linux) and issue the following command using command prompt in iperf application :

```c
  TCP client command.
  iperf -c <IPAddr> -p <portnumber> -i <interval between reports (seconds)> -t <time (in sec)>
  TCP server command.
  iperf -s -p <portnumber> -i <interval between reports (seconds)>
  for example :
    1. To run TCP_RX on our module for 10 mins with the remote client having IP_ADDR = 192.168.10.100 - Run the following command on the remote client.
       iperf -c 192.168.10.100 -p 5003 -i 1 -t 600
    2. To run TCP_TX on our module with the remote client having IP_ADDR = 192.168.10.100 - Run the below command on the remote client.
       iperf -s -p 5003 -i 1
```

##### 7. Observing the output prints on serial terminal

- Prints can see as below in any Console terminal

![Wlan Ble Ae Coex Host Logs](/wifibt-wc-snippet-examples/2.14.0/images/wlan-ble-ae-coex-host-logs.png)

![Wlan Ble Ae Host Logs Smp](/wifibt-wc-snippet-examples/2.14.0/images/wlan-ble-ae-host-logs-smp.png)

**Note:**
Wi-Fi TCP data transfer can be enabled using the macro(TCP_DATA_TEST_CODE) in this application.
Data stalls may occur during TCP data transfer when the module is in power-saving mode.

#### WLAN Station BLE Provisioning

##### 1. Purpose / Scope

This example demonstrates how to configure/connects RS9116W EVK to get the WLAN connection functionality using BLE provisioning

RS9116W EVK starts advertising in BLE mode and Access Point details are fetched using BLE Provisioning.

RS9116W EVK is configured as a WiFi station and connects to an Access Point.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI).
- Silicon labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Android Mobile Phone with Silicon labs Connect App.  
  (or)
- Windows PC with windows Silicon labs connect application.

![Setup Diagram for WLAN Station BLE Provisioning Application ](/wifibt-wc-snippet-examples/2.14.0/images/image279.png)

![Setup Diagram for WLAN Station BLE Provisioning Application ](/wifibt-wc-snippet-examples/2.14.0/images/ble-provisioning-windows.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- User can install any of the below apps to verify WLAN Station BLE Provisioning.

1. Install Android based Silicon labs Connect APK:

- Access the apk provided in the path:  `<SDK>/utilities/Silicon_lab_connectApp.apk`

1. Install windows Silicon labs connect application in laptop.

- Refer the application provided in the path: `<SDK>/utilities/windows_ble_provisioning_app`
- Follow the instructions provided in the path: `<SDK>/utilities/windows_ble_provisioning_app/Installation_steps_to_run_silabs_connect_windows_application.docx`

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project:  
  - The Keil project can be executed on STM32 platform.  
  - Project path: `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning/projects/wlan_station_ble_provisioning-nucleo-f411re.uvprojx`
- Simplicity Studio:  
  - The Simplicity Studio project can be executed on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning/projects/wlan_station_ble_provisioning/projects-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning/projects/wlan_station_ble_provisioning/projects-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image279d.png)

###### Bare Metal/RTOS Support

The Application supports both FreeRTOS and bare metal configurations.

- By default, the application project files (Keil and Simplicity Studio) are provided with RTOS enabled in the SDK, so the application can be tested/validated under OS environment.
- Follow the below steps for changing the project configuration in Keil and Simplicity Studio  to test the application in the bare metal environment.  
  - **Steps to configure project settings in Keil IDE**  
  - Open project in Keil IDE and click on 'Options for Target'  
  - Go to 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols  
  - Click on 'OK' button to save the settings

![project settings in Keil IDE](/wifibt-wc-snippet-examples/2.14.0/images/image279a.png)

- **Steps to configure project settings in Simplicity Studio**

```c
- Open project in Simplicity Studio
- Right click on the project and choose 'Properties'
- GO to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
- Click on 'Apply' and 'OK' to save the settings
```

![project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image279b.png)

![project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image279c.png)

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `main.c` file

Memory length for driver

```c
#define GLOBAL_BUFF_LEN                            15000
```

The following parameters are configured if OS is used.

Task Priotrities should be given as below. Application task priority should be given as low priority and Driver task priority should be given as highest priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                 1
#define RSI_BLE_TASK_PRIORITY                         2
#define RSI_DRIVER_TASK_PRIORITY                      3
```

Application Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE             1000
```

BLE Task stack size is configured by this macro

```c
#define RSI_BLW_TASK_STACK_SIZE                     1000
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE                  2000
```

**4.2** Open `rsi_wlan_app.c` file and update/modify following macro

Memory length for the send buffer

```c
#define BUF_SIZE                                    1600
```

**4.3** Open `rsi_wlan_config.h` file

```c
#define CONCURRENT_MODE                          RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                      (FEAT_SECURITY_OPEN | FEAT_AGGREGATION)
#define RSI_TCP_IP_BYPASS                        RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP               (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_TOTAL_SOCKETS_1 | TCP_IP_FEAT_EXTENSION_VALID) 
#define RSI_CUSTOM_FEATURE_BIT_MAP               FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP           0   
#define RSI_EXT_TCPIP_FEATURE_BIT_MAP            EXT_DYNAMIC_COEX_MEMORY
#define RSI_BAND                                 RSI_BAND_2P4GHZ
#define RSI_BT_FEATURE_BITMAP                    (BT_RF_TYPE | ENABLE_BLE_PROTOCOL)
```

> Note:
> rsi_wlan_config.h, rsi_bt_config.h and rsi_ble_config.h files are already set with the above desired configuration for this example.

**4.4** Open `rsi_ble_app.c` file and update/modify following macros

RSI_BLE_CHAR_SERV_UUID refers to the attribute type of the characteristics to be added in a service.

```c
#define  RSI_BLE_CHAR_SERV_UUID                         0x2803
```

RSI_BLE_CLIENT_CHAR_UUID refers to the attribute type of the client characteristics descriptor to be added in a service.

```c
#define RSI_BLE_CLIENT_CHAR_UUID                        0x2902
```

RSI_BLE_NEW_SERVICE_UUID refers to the attribute value of the newly created service.

```c
#define  RSI_BLE_NEW_SERVICE_UUID                       0xAABB
```

RSI_BLE_ATTRIBUTE_1_UUID refers to the attribute type of the first attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define  RSI_BLE_ATTRIBUTE_1_UUID                        0x1AA1
```

RSI_BLE_ATTRIBUTE_2_UUID refers to the attribute type of the second attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_2_UUID                         0x1BB1
```

RSI_BLE_ATTRIBUTE_3_UUID refers to the attribute type of the third attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_3_UUID                         0x1CC1
```

RSI_BLE_MAX_DATA_LEN refers to the Maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                             66
```

RSI_BLE_APP_DEVICE_NAME refers to the name of the RS9116W EVK to appear during scanning by remote devices.

```c
#define  RSI_BLE_APP_DEVICE_NAME                         "BLE_CONFIGURATOR"
```

The following are the **non-configurable** macros in the application.

RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_READ                       0x02
```

RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                       0x08
```

RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_NOTIFY                     0x10
```

BT_GLOBAL_BUFF_LEN refers to the number of bytes required by the application and the driver.

```c
#define  BT_GLOBAL_BUFF_LEN                              15000
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning/projects/wlan_station_ble_provisioning-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Steps to verify the WLAN Station BLE Provisioning Example

###### 5.3.1 Steps to be followed to verify WLAN Station BLE Provisioning with Android Silicon Labs Connect App (heading level 7)

1. Configure the Access point with internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect the RS9116W EVK in STA mode.
2. Connect any serial console for prints.
3. When RS9116W EVK enters BLE advertising mode, launch the Silicon Labs Connect App.

![BLE advertising mode](/wifibt-wc-snippet-examples/2.14.0/images/image280.jpg)

1. Click on BLE Provisioning.

![BLE Provisioning](/wifibt-wc-snippet-examples/2.14.0/images/image281.jpg)

1. Click on BLE_CONFIGURATOR.

![BLE Configurator](/wifibt-wc-snippet-examples/2.14.0/images/image282.png)

1. Once the BLE got the connected, list of available Access Points get displayed on the screen

![BLE Connected](/wifibt-wc-snippet-examples/2.14.0/images/image283.jpg)

1. Connect to an Access Point, once the RS9116W EVK gets connected to AP, IP address of RS9116W EVK get displyed on the screen

![Module displayed](/wifibt-wc-snippet-examples/2.14.0/images/image284.jpg)

1. To disconnect from Access Point, click on connected AP and click on YES

![Disconnect from Access Point](/wifibt-wc-snippet-examples/2.14.0/images/image285.jpg)

1. Refer the below figure for console prints

![Docklight Console logs](/wifibt-wc-snippet-examples/2.14.0/images/image286.png)

###### 5.3.2 Steps to be followed to verify WLAN Station BLE Provisioning with windows based Silicon Labs Connect App (heading level 7)

1. Configure the Access point with internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect the RS9116W EVK in STA mode.
2. Connect any serial console for prints.  
   **Note:** Turn on BT in the PC.
3. Go to folder  `<SDK>/utilities/windows_ble_provisioning_app` and Run **Silabs_Connect.py** in the command prompt.
4. Executing the application in the command prompt as stated in the above point will open the GUI (with the â€œBLE SCAN ONâ€� button.

![Silicon labs connect GUI](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-1.png)

1. When click on the **BLE SCAN ON** button, all the RS9116 BLE Devices that are available nearby are displayed in the window.

![BLE scan mode](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-3.png)

**Note:** - RS9116 BLE device will advertise with different names based on the application configuration.

1. Once RS9116 BLE device displayed on the scanning list, initiate the connection by clicking a button on the available RS9116 BLE device.

![BLE device displayed ](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-4.png)

1. Once the BLE get connected, **Firmware version** and list of available Access Points get displayed on the screen.

![BLE get connected](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-5.png)

1. By clicking on one of the scanned APâ€™s, RS9116 will connect to that particular AP. If Access Point is secured it will ask the password as input but if that Access point as not secured, then directly connect to that Access Point.

![Password pop-up for PSK](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-7.png)

1. After successful connection, â€œIP & Mac addressâ€� of connected Access point get displayed.

![Connected Access point IP and MAC](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-8.png)

1. To disconnect from Access Point, click on connected AP.
2. After successful disconnection of WLAN, pop-up comes like **WLAN GOT DISCONNECTED**. Click on the â€œokâ€�.

![Connected Access point POCO C3](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-9.png)

![wlan disconnected](/wifibt-wc-snippet-examples/2.14.0/images/image-ble-10.png)

**Note:**   For more information refer **Silabs_Connect_Windows_Application_User_Guide.pdf** in the path
`<SDK>/utilities/windows_ble_provisioning_app/`

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN Station BLE Bridge

##### 1. Purpose / Scope

This example demonstrates how information can be exchanged seamlessly using coexwireless protocols (WLAN and BLE) running in the RS9116W EVK module.
In this coex application, The module connects with remote BTLE device (Smart Phone) and WiFi Access Point in station mode and do the data transfer on both interfaces.

The Application has WLAN and BLE tasks where as smart phone interacts with BLE task and remote PC interacts with WLAN task. When Smartphone connects and sends message to RS9116W EVK, BLE task accepts and sends to WLAN task, which in turn sends to remote PC which is connected to Access Point.
Similarly, when remote PC sends message to RS9116W EVK, the message will be sent to Smartphone via BLE task.Thus messages can be seamlessly transferred between PC and Smartphone.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Windows PC2 (Remote PC) with SSL server application (Openssl)
- BTLE supported Smart phone with GATT client application.

![Setup Diagram for WLAN Station BLE Bridge Example](/wifibt-wc-snippet-examples/2.14.0/images/image263.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install OpenSSL from this link [OpenSSL](http://ufpr.dl.sourceforge.net/project/gnuwin32/openssl/0.9.8h-1/openssl-0.9.8h-1-bin.zip) to download openssl in remote PC.
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the Android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.

###### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_bridge/projects/wlan_station_ble_bridge-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_bridge/projects/wlan_station_ble_bridge-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_bridge/projects/wlan_station_ble_bridge-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image263a.png)

###### Bare Metal Support

This application supports only bare metal environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_wlan_app.c` file

**4.1.1** User must update the below parameters

SSID refers to the name of the Access point.

```c
#define SSID                                         "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0, device will scan all channels.

```c
#define CHANNEL_NO                                   0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                                RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                          "1234567890"
```

DEVICE_PORT port refers SSL client port number

```c
#define DEVICE_PORT                                  5001
```

SERVER_PORT port refers remote SSL server port number

```c
#define SERVER_PORT                                  5001
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with SSL server socket.

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.10.100" as IP address, update the macro SERVER_IP_ADDRESS as 0x640AA8C0.

```c
#define SERVER_IP_ADDRESS                            0x640AA8C0
```

**4.1.2** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

To Load certificate:

```c
#define LOAD_CERTIFICATE                             1
```

If **LOAD_CERTIFICATE** set to 1, application will load certificate which is included using rsi_wlan_set_certificate API.

By default, application loading "cacert.pem" certificate if **LOAD_CERTIFICATE** enable. In order to load different certificate, user has to follow the following steps:

rsi_wlan_set_certificate API expects the certificate in the form of linear array. So, convert the pem certificate into linear array form using python script provided in the SDK "certificate_to_array.py"

Ex: If the certificate is wifi-user.pem. Give the command in the following way
python certificate_to_array.py ca-cert.pem
Script will generate wifiuser.pem in which one linear array named cacert contains the certificate.

After conversion of certificate, update `rsi_ssl_client.c` source file by including the certificate file and by providing the required parameters to rsi_wlan_set_certificate API.

> Note:
> Once certificate loads into the device, it will write into the device flash. So, user need not load certificate for every boot up unless certificate change.

So, define LOAD_CERTIFICATE as 0, if certificate is already present in the Device.

> Note:
> All the certificates are given in the path `<SDK>/certificates`

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                                    1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                                    0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                      0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                      0x00FFFFFF
```

**4.2** Open `rsi_ble_app.c` file and update/modify following macros

RSI_BLE\NEW_SERVICE_UUID refers to the attribute value of the newly created service.

```c
#define RSI_BLE_NEW_SERVICE_UUID                     0xAABB
```

RSI_BLE_ATTRIBUTE_1_UUID refers to the attribute type of the first attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_1_UUID                      0x1AA1
```

RSI_BLE_ATTRIBUTE_2_UUID refers to the attribute type of the second attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_2_UUID                      0x1BB1
```

RSI_BLE_MAX_DATA_LEN refers to the Maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                          20
```

RSI_BLE_APP_DEVICE_NAME refers name of the RS9116W EVK to appear during scanning by remote devices.

```c
#define RSI_BLE_APP_DEVICE_NAME                       "WLAN_BLE_APP"
```

Following are the **non-configurable** macros in the application.

RSI_BLE_CHAR_SERV_UUID refers to the attribute type of the characteristics to be added in a service.

```c
#define RSI_BLE_CHAR_SERV_UUID                        0x2803
```

RSI_BLE_CLIENT_CHAR_UUID refers to the attribute type of the client characteristics descriptor to be added in a service.

```c
#define RSI_BLE_CLIENT_CHAR _UUID                     0x2902
```

RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_READ                     0x02
```

RSI_BLE_ATT_PROPERTY_WRITE is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                    0x08
```

RSI_BLE_ATT_PROPERTY_NOTIFY is used to set the NOTIFY property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_NOTIFY                   0x10
```

BT_GLOBAL_BUFF_LEN refers Number of bytes required by the application and the driver.

```c
#define BT_GLOBAL_BUFF_LEN                            15000
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_BLE_TASK_STACK_SIZE           1000
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         3000
```

**4.3** Open `rsi_wlan_config.h` file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                              RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                          FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                            RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                   (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_TOTAL_SOCKETS_1 | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP                   FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP               0
#define RSI_EXT_TCPIP_FEATURE_BIT_MAP                EXT_DYNAMIC_COEX_MEMORY
#define RSI_BT_FEATURE_BITMAP             (BT_RF_TYPE | ENABLE_BLE_PROTOCOL)
#define RSI_BAND                                     RSI_BAND_2P4GHZ 
```

**4.4** Open `main.c` file. The following parameters are configured if OS is used.

WLAN_BLE task should be of low priority

```c
#define RSI_WLAN_BLE_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 4
```

###### NOTE: (heading level 7)

- If the user wants to run the application with power_save, then **ENABLE_POWER_SAVE** macro should be enabled in rsi_ble_config.h file and continue with building and executing the application.

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_bridge/projects/wlan_station_ble_bridge-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_bridge/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. In Windows PC2 which is connected to AP through LAN, Download the Openssl package from above mentioned link and run SSL server by giving following command:

```sh
Openssl.exe s_server -accept<SERVER_PORT> –cert <server_certificate_file_path> -key <server_key_file_path> -tls<tls_version>
Example: openssl.exe s_server –accept 5001 –cert server-cert.pem -key server-key.pem –tls1
```

![OpenSSL server Window](/wifibt-wc-snippet-examples/2.14.0/images/image254.png)

1. After the program gets executed, Silicon Labs BLE is in Advertising state and WLAN connects to Access Point and establishes SSL connectivity with SSL server opened on Windows PC1. Refer the given below image for connection establishment at windows PC1,

![OpenSSL server log Window](/wifibt-wc-snippet-examples/2.14.0/images/image255.png)

1. Open a BLE scanner App in the Smartphone and do the Scan.
2. In the App, Silicon Labs module device will appear with the name configured in the macro **RSI_BLE_APP_SIMPLE_CHAT (Ex: "WLAN_BLE_SIMPLE_CHAT")** or sometimes observed as RS9116W EVK as internal name "**SimpleBLEPeripheral**".

![SimpleBLEPeripheral Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image256.png)

1. Initiate BLE connection from the App.
2. After successful connection, LE scanner displays the supported services of Silicon Labs module.
3. Select the attribute service which is added **RSI_BLE_NEW_SERVICE_UUID**

(Ex: 0xAABB) and enable Notification for attribute UUID **RSI_BLE_ATTRIBUTE_2_UUID** **(Ex: 0x1BB1)** to receive data sent by Wi-Fi STA.

![Enable Notification Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image257.png)

1. Now from SSL server opened in Windows PC2 (Remote PC), send a message (Ex: "Hello from WiFi STA") to RS9116W EVK. RS9116W EVK forwards the received message from SSL server to remote BTLE device which is connected to Silicon Labs BTLE device over BTLE protocol. User can observe the message notification on attribute UUID **RSI_BLE_ATTRIBUTE_2_UUID** (Ex: 0x1BB1) in BTLE scanner app.

![Message Notification Window](/wifibt-wc-snippet-examples/2.14.0/images/image258.png)

![Attribute UUID Mobile screenshot](/wifibt-wc-snippet-examples/2.14.0/images/image259.png)

> Note:
> rsi_wlan_app_send_to_btle() function is defined in rsi_ble_app.c to send message from WLAN task to BTLE task.

1. Now send a message (Ex: "Hello from BT peripheral") from GATT client (from smart phone BLE scanner app) using attribute **RSI_BLE_ATTRIBUTE_1_UUID**  
   (Ex: 0x1AA1) to RS9116W EVK. RS9116W EVK forwards the received message from BTLE remote device to SSL server over WiFi protocol. User can observe the message on UDP socket application.

![Smart phone BLE scanner app](/wifibt-wc-snippet-examples/2.14.0/images/image260.png)

![BTLE remote device](/wifibt-wc-snippet-examples/2.14.0/images/image261.png)

![Message on UDP socket Window](/wifibt-wc-snippet-examples/2.14.0/images/image262.png)

> Note:
> rsi_bt_app_send_to_wlan() function is defined in rsi_wlan_app.c to send message from BTLE task to WLAN task.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN Station BLE Provisioning with AWS cloud

##### 1. Purpose / Scope

This example demonstrates how to configure/connects RS9116W EVK to get the WLAN connection functionality using BLE provisioning. In this application, the Module starts advertising and with BLE Provisioning the Access Point details are fetched

The RS9116W EVK module is configured  as a station, which associates to an access point and then communicates with an AWS server using MQTT. Data will be continuously published until the device is disconnected from the access point.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI).
- Silicon labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Android Mobile Phone with Silicon labs Connect App.  
  (or)
- Windows PC with windows Silicon labs connect application.

![Setup diagram of WLAN Station BLE Provisioning with AWS cloud ](/wifibt-wc-snippet-examples/2.14.0/images/image-aws1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- User can install any of the below apps to verify WLAN Station BLE Provisioning.  
  1. Install Android based Silicon labs Connect APK:  
  - Access the apk provided in the path: `<SDK>/utilities/Silicon_lab_connectApp.apk`  
  1. Install windows Silicon labs connect application in laptop.  
  - Refer the application provided in the path: `<SDK>/utilities/windows_ble_provisioning_app`  
  - Follow the instructions provided in the document: `<SDK>/utilities/windows_ble_provisioning_app/Installation_steps_to_run_silabs_connect_windows_application.docx`

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project:  
  - The Keil project can be executed on STM32 platform.  
  - Project path: `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_AWS/projects/wlan_station_ble_provisioning_AWS-nucleo-f411re.uvprojx`
- Simplicity Studio:  
  - The Simplicity Studio project can be executed on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_AWS/projects/wlan_station_ble_provisioning_AWS/projects-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_AWS/projects/wlan_station_ble_provisioning_AWS/projects-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image279d.png)

###### 3.4 Bare Metal Support

This application supports only bare metal configuration. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal environment in the SDK.

###### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_wlan_app.c` file and update/modify following macros

Modify the MQTT topics and give different names for both topics RS9116 is subscribed to MQTT_TOPIC1 and publishing to MQTT_TOPIC2.
MQTT web application is subscribed to `MQTT_TOPIC2` and publishing on `MQTT_TOPIC1`.

```c
#define MQTT_TOPIC1           "$aws/things/SmartLockWebApp-v01/shadow/update/device_status"
#define MQTT_TOPIC2           "$aws/things/SmartLockWebAppv01/shadow/update/delta/temperature_reading"
```

**NOTE:** If you would like to change the topic names, then you can modify only the last keyword of the topic, which are `device_status` and `temperature_reading`.

**To configure the IP address**

Memory length for driver

```c
#define GLOBAL_BUFF_LEN                          15000
```

Memory length for the send buffer

```c
#define BUF_SIZE                                 1400
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 4
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE                 500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE               500
```

**4.1.1** Open `rsi_wlan_config.h` file and update/modify the following macros

```c
#define CONCURRENT_MODE                          RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                      (FEAT_SECURITY_OPEN  | FEAT_AGGREGATION | FEAT_ULP_GPIO_BASED_HANDSHAKE)
#define RSI_TCP_IP_BYPASS                        RSI_DISABLE 
#define RSI_TCP_IP_FEATURE_BIT_MAP               (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT | TCP_IP_TOTAL_SOCKETS_1 | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP               FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP           (RAM_LEVEL_NWP_ALL_MCU_ZERO | EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_RSA_KEY_WITH_4096_SUPPORT | EXT_FEAT_SSL_CERT_WITH_4096_KEY_SUPPORT)  
define RSI_EXT_TCPIP_FEATURE_BIT_MAP             ( EXT_DYNAMIC_COEX_MEMORY | EXT_TCP_IP_FEAT_SSL_MEMORY_CLOUD | CONFIG_FEAT_EXTENTION_VALID)    
define RSI_CONFIG_FEATURE_BITMAP                 RSI_FEAT_SLEEP_GPIO_SEL_BITMAP 
define RSI_BT_FEATURE_BITMAP                     (BT_RF_TYPE | ENABLE_BLE_PROTOCOL)
define RSI_BAND                                  RSI_BAND_2P4GHZ 
```

**Note:**
`rsi_wlan_config.h` file is already set with the desired configuration in respective example folders, user need not change for each example.

**4.2** Open `rsi_ble_app.c` file and update/modify following macros

**Configuring the BLE Application**

`RSI_BLE_CHAR_SERV_UUID` refers to the attribute type of the characteristics to be added in a service.

```c
#define  RSI_BLE_CHAR_SERV_UUID                         0x2803
```

`RSI_BLE_CLIENT_CHAR_UUID` refers to the attribute type of the client characteristics descriptor to be added in a service.

```c
#define RSI_BLE_CLIENT_CHAR_UUID                        0x2902
```

`RSI_BLE_NEW_SERVICE_UUID` refers to the attribute value of the newly created service.

```c
#define  RSI_BLE_NEW_SERVICE_UUID                       0xAABB
```

`RSI_BLE_ATTRIBUTE_1_UUID` refers to the attribute type of the first attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define  RSI_BLE_ATTRIBUTE_1_UUID                        0x1AA1
```

`RSI_BLE_ATTRIBUTE_2_UUID` refers to the attribute type of the second attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_2_UUID                         0x1BB1
```

`RSI_BLE_ATTRIBUTE_3_UUID` refers to the attribute type of the third attribute under this service (RSI_BLE_NEW_SERVICE_UUID).

```c
#define RSI_BLE_ATTRIBUTE_3_UUID                         0x1CC1
```

`RSI_BLE_MAX_DATA_LEN` refers to the Maximum length of the attribute data.

```c
#define RSI_BLE_MAX_DATA_LEN                               20
```

`RSI_BLE_APP_DEVICE_NAME` refers to the name of the Silicon Labs device to appear during scanning by remote devices.

```c
#define  RSI_BLE_APP_DEVICE_NAME               "BLE_CONFIGURATOR"
```

The following are the **non-configurable** macros in the application.

RSI_BLE_ATT_PROPERTY_READ is used to set the READ property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_READ                    0x02
```

`RSI_BLE_ATT_PROPERTY_WRITE` is used to set the WRITE property to an attribute value.

```c
#define RSI_BLE_ATT_PROPERTY_WRITE                       0x08
```

`RSI_BLE_ATT_PROPERTY_NOTIFY` is used to set the NOTIFY property to an attribute value.

```c
#define  RSI_BLE_ATT_PROPERTY_NOTIFY                      0x10
```

`BT_GLOBAL_BUFF_LEN` refers to the number of bytes required by the application and the driver.

```c
#define  BT_GLOBAL_BUFF_LEN                              15000
```

**4.3** Open `main.c` file and enable the macro `BLE_ENABLE` to activate BLE functionality.

**4.4** Open `aws_iot_config.h` file and change the AWS_IOT_MQTT_CLIENT_ID to your choice (Make sure this is unique, if more than one user use has same client id it might get conflict at server side).

```c
  //AWS Host name 
  #define AWS_IOT_MQTT_HOST          "a25jwtlmds8eip-ats.iot.us-east-2.amazonaws.com"  

  //default port for MQTT
  #define AWS_IOT_MQTT_PORT          "8883"
  
  #define AWS_IOT_MQTT_CLIENT_ID     "Redp"
  
  // Thing Name of the Shadow this device is associated with 
  #define AWS_IOT_MY_THING_NAME      "AWS-IoT-C-SDK"    
```

**4.5 To Load Certificate**

**rsi_wlan_set_certificate()** API expects the certificate in the form of linear array. Convert the pem certificate into linear array form using python script provided in the SDK `<SDK>/resources/certificates/certificate_script.py`.

> For example : If the certificate is ca-certificate.pem, enter the command in the following way:
> python certificate_script.py ca-certificate.pem
> The script will generate ca-certificate.pem.h in which one linear array named ca-certificate contains the certificate.
> Root CA certificate, Device private key and Device client certificate needs to be converted as mentioned above

After the conversion, place the converted files in `<SDK>/resources/certificates/` path and include the certificate files in rsi_wlan_app.c

```c
Replace the default Device certificate and Private key certificate include in the application with the converted pem file name.

// Certificate includes
#include "aws_client_certificate.pem.crt.h"
#include "aws_client_private_key.pem.key.h"

Replace the default Device certificate and Private key certificate given in `rsi_wlan_set_certificate()` API in the application with the converted pem array.

// Load Security Certificates
status = rsi_wlan_set_certificate(RSI_SSL_CLIENT, aws_client_certificate, (sizeof(aws_client_certificate) - 1));

status =
rsi_wlan_set_certificate(RSI_SSL_CLIENT_PRIVATE_KEY, aws_client_private_key, (sizeof(aws_client_private_key) - 1));
```

> NOTE :
> For AWS connectivity, StarField Root CA Class 2 certificate has the highest authority being at the top of the signing hierarchy.
> 
> The StarField Root CA Class 2 certificate is an expected/required certificate which usually comes pre-installed in the operating systems and it plays a key part in certificate chain verification when a device is performing TLS authentication with the IoT endpoint.
> 
> On RS9116 device, we do not maintain root CA trust repository due to memory constraints, so it is mandatory to load StarField Root CA Class 2 certificate for successful mutual authentication to AWS server.
> 
> The certificate chain sent by AWS server is as below:
> id-at-commonName=Amazon,id-at-organizationalUnitName=Server CA 1B,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Amazon Root CA 1,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Starfield Services Root Certificate Authority ,id-at-organizationName=Starfield Technologies, Inc.,id-at-localityName=Scottsdale,id-at-  stateOrProvinceName=Arizona,id-at-countryName=US)
> 
> On RS9116 to authenticate the AWS server, firstly Root CA is validated (validate the Root CA received with the Root CA loaded on the device). Once the Root CA is validation is successful , other certificates sent from the AWS server are validated.
> RS9116 don't authenticate to AWS server if intermediate CA certificates are loaded instead of StarField Root CA Class 2 certificate and would result in Handshake error.
> StarField Root CA Class 2 certificate is at [https://certs.secureserver.net/repository/sf-class2-root.crt](https://certs.secureserver.net/repository/sf-class2-root.crt)
> 
> Reference links :
> [https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/](https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/)

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_AWS/projects/wlan_station_ble_provisioning_AWS-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/wlan_ble/wlan_station_ble_provisioning_AWS/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Execution of AWS IoT with BLE Provisioning

###### 5.3.1  BLE Provisioning with Windows Application (heading level 7)

1. Configure the Access point with internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect the RS9116W EVK in STA mode.
2. Connect any serial console for prints.  
   **Note** Turn on **BT** in the PC.
3. Go to folder  `<SDK>/utilities/windows_ble_provisioning_app` and Run **Silabs_Connect.py** in the command prompt.
4. Executing the application in the command prompt as stated in the above point will open the GUI (with the â€œBLE SCAN ONâ€� button.

![Silicon labs connect GUI](/wifibt-wc-snippet-examples/2.14.0/images/image-aws15.png)

1. Check for the configured name in the BLE scanned list and connect to the â€˜SILABS_BLE_CONFIGURATORâ€™, by clicking on it.

![Silicon labs BLE Configurator ](/wifibt-wc-snippet-examples/2.14.0/images/image-aws16.png)

1. Once the BLE connection is successful, Wi-Fi access points scan list will be populated. Click on the Access Point (AP) SSID and enter the password of the AP, to which you would  like to connect.

![ Silicon labs Wi-Fi access points](/wifibt-wc-snippet-examples/2.14.0/images/image-aws17.png)

**Note** Now go to section **5.3.3** MQTT connection for AWS connection

###### 5.3.2 BLE Provisioning with Android Application

1. Silicon Labs Connect app is available in the `<SDK>/utilities/` folder. Currently, this app will be available for Android devices only.
2. Once the application gets executed, launch the Android application which you have already installed on Android mobile.
3. Click on BLE Provisioning.

![BLE Provisioning BLE connect app](/wifibt-wc-snippet-examples/2.14.0/images/image-aws18.png)

1. It will scan for the RS9116 module, and it appears in the list. For example, â€œSILABS_BLE_Configuratorâ€� on the UI, select this.

![Module appears in the list](/wifibt-wc-snippet-examples/2.14.0/images/image-aws19.png)

1. Now, RS9116 module will start as a station and scan for the access points (AP) nearby.
2. Once the list of AP scan results is displayed on the screen, you can select the SSID of the AP to which you want to connect.

![Module SSID](/wifibt-wc-snippet-examples/2.14.0/images/image-aws20.png)

1. Click on the SSID of the AP, enter â€œpasswordâ€� if the AP is in security mode. Click on â€œConnectâ€� to associate with the access point.
2. Once Silicon labs RS9116 module is connected to the access point, you can notice on the GUI as below.

![Module Access](/wifibt-wc-snippet-examples/2.14.0/images/image-aws21.png)

1. This completes the BLE provisioning using Android application, next step is the MQTT communication.

###### 5.3.3 MQTT Connection

1. Once MQTT connection completed , device subscribed to specific Topic and waits for data from the Cloud.  
   if any data received through AWS cloud from subscribed clients, then module publishes temperature sensor reading to MQTT client in case of EFR32.  
   While in case of  STM32 random temperature readings ranges from 25-40 is published to MQTT client through AWS cloud.
2. You can use any MQTT client and connect to the AWS cloud, for subscribe and publishing messages.

![Module connected log ](/wifibt-wc-snippet-examples/2.14.0/images/image-aws23.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### SSL Client with Multiple TLS Versions

##### 1. Purpose / Scope

This application demonstrates how to open a TCP client socket on RS9116W EVK and use this TCP client socket with secure connection using SSL and send the data on socket.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- TCP server over SSL running in Windows PC2 (This application uses OpenSSL to create TCP server over SSL)

![Setup Diagram for TCP Client Socket over SSL Application with Multiple TLS Versions](/wifibt-wc-snippet-examples/2.14.0/images/image199.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [OpenSSL Application](https://sourceforge.net/projects/openssl/files/openssl-1.0.2j-fips-x86_64/openssl-1.0.2j-fips-x86_64.zip/download) in Windows PC (Remote PC).

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/tls_client/projects/tls_client-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/tls_client/projects/tls_client-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/tls_client/projects/tls_client-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![Figure: EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image199a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/tls_client/projects/tls_client-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_ssl_client_tls_versions.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                           "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                                  RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK /WPA2-PSK security modes.

```c
#define PSK                                            "1234567890"
```

DEVICE_PORT1 port refers TCP client port number

```c
#define DEVICE_PORT1                                   <local port>
```

SERVER_PORT1 port refers remote TCP server port number which is opened in Windows PC2.

```c
#define SERVER_PORT1                                   <remote port>
```

DEVICE_PORT2 refers another TCP client port number

```c
#define DEVICE_PORT2                                   <local port>
```

SERVER_PORT2 refers another remote TCP server port number which is opened in Windows PC2.

```c
#define SERVER_PORT2                                   <remote port>
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with TCP server socket.

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.10.100" as IP address, update the macro DEVICE_IP as 0x640AA8C0.

```c
#define SERVER_IP_ADDRESS                              0x640AA8C0
```

NUMEBR_OF_PACKETS refers how many packets to receive from TCP client

```c
#define NUMBER_OF_PACKETS                              <no of packets>
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                                15000
```

LOAD_CERTIFICATE refers to load certificates into flash

0 - Already certificates are there in flash so no need to laod.

1 - Certicates will load into flash.

```c
#define LOAD_CERTIFICATE                               0 
```

> Note:
> If certificates are not there in flash then ssl handshake will fail.

DHCP_MODE refers whether IP address is configured through DHCP or STATIC

```c
#define DHCP_MODE                                      1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                                     0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order.

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                                       0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                                       0x00FFFFFF
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                               RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                           FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                             RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                    (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL)
#define RSI_CUSTOM_FEATURE_BIT_MAP                    FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP                EXT_FEAT_SSL_VERSIONS_SUPPORT
#define RSI_BAND                                      RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE               0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE               1
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/tls_client/projects/tls_client-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/tls_client/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Copy the certificates server-cert and server-key into Openssl/bin folder in the Windows PC2 (Remote PC).

> Note:
> All the certificates are given in the SDK. Path: `<SDK>/resources/certificates`

1. In Windows PC2 (Remote PC) which is connected to AP, run the Openssl and run two SSL servers by giving the following command

> `Openssl.exe s_server -accept<SERVER_PORT> -cert <server_certificate_file_path> -key <server_key_file_path> -tls<tls_version>`
> Example: openssl.exe s_server -accept 5001 -cert server-cert.pem -key server-key.pem -tls1
> Example: openssl.exe s_server -accept 5002 -cert server-cert.pem -key server-key.pem -tls1_2
> Note: openssl.exe s_server -accept 5002 -cert server-cert.pem -key server-key.pem -tls1_2 is not supporting if the open ssl version 0.9.8h but supporting if the open ssl version is 1.1.1h.

1. After the program gets executed, RS9116W EVK would be connected to access point having the configuration same as that of in the application and get IP.
2. The RS9116W EVK which is configured as SSL client will connect to remote SSL server and sends number of packets configured in **NUMBER_OF_PACKETS**.

![EVK connects to remote SSL server-1](/wifibt-wc-snippet-examples/2.14.0/images/image357.png)

![EVK connects to remote SSL server-1](/wifibt-wc-snippet-examples/2.14.0/images/image358.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### HTTP Client (IPv6)

##### 1. Purpose / Scope

This application demonstrates how to create Silicon Labs device as HTTP/HTTPs client and do HTTP PUT, GET and POST operations with the HTTP server opened on remote peer.
In this application, the device configures as Wi-Fi station and connects to Access point and do HTTP/HTTPs PUT, GET and post operation with HTTP server opened on remote peer.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Windows PC (Remote PC) with iperf application

![Setup Diagram for HTTP Client Example](/wifibt-wc-snippet-examples/2.14.0/images/httpclientv6setupncp.png)

- UART INTERFACE setup![Setup Diagram for HTTP Client Example with UART interface](/wifibt-wc-snippet-examples/2.14.0/images/uart-interface-setup.png)
- Here is the Pin connections between EFR32MG21 and RS9116W:

![Pin connections between EFR32MG21 and RS9116W for HTTP Client Example with UART interface](/wifibt-wc-snippet-examples/2.14.0/images/pin-connections.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/).
- Embedded Development Environment.  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).
- Windows PC with openssl support and python installed.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application can be configured to use the UART interface with EFR32MG21.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image83a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>examples/snippets/wlan/http_client_v6/projects/http_client_v6-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1  Open rsi_http_client_app.c file

###### 4.1.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

SSID refers to the name of the Access point to be created.

```c
#define SSID "SILABS_AP"
```

CHANNEL_NO refers to the channel in which AP would be started

```c
#define CHANNEL_NO 11
```

SECURITY_TYPE refers type of security. Access point supports Open, WPA, WPA2 securities.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE RSI_WPA2
```

ENCRYPTION_TYPE refers to the type of Encryption method. Access point supports OPEN, TKIP, CCMP encryption methods.

Valid configurations are:

- RSI_CCMP - For CCMP encryption
- RSI_TKIP - For TKIP encryption
- RSI_NONE - For open encryption

PSK refers to the secret key if the Access point to be configured in WPA/WPA2 security modes.

```c
#define PSK "1234567890"            
```

To Load certificate

```c
#define LOAD_CERTIFICATE 1
```

To configure IP address
DHCP_MODE refers whether IP address configured through DHCP or STATIC.

```c
#define DHCP_MODE 1
```

**Note!**

> If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.

---

IPv6 address to be configured to the device

Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below

```c
#define DEVICE_IP6 "2001:db8:0:1::121"
```

IP address of the gateway.

Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below

```c
#define GATEWAY6 "2001:db8:0:1::121"
```

HTTP_SERVER_IP_ADDRESS refers IP address of the HTTP/HTTPS server

```c
#define HTTP_SERVER_IP_ADDRESS "2001:0db8:0000:0001:0000:0000:0000:0121"
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE     RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                                                                    \
  (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_EXTENSION_VALID \
   | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6 | TCP_IP_FEAT_HTTP_CLIENT)
#define RSI_BAND RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/http_client_v6/projects/http_client_v6-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116 , then user need to press the RESET button on RS9116W EVK before free run.
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/http_client_v6/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to Rs9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
- For the Host MCU to communicate with RS9116W through UART Interface, replace the **RSI_SPI_INTERFACE** and **RSI_SPI_HIGH_SPEED_ENABLE** macros in the pre-processor Symbols present at path: **C/C++ General → Paths and Symbols → Symbols → GNU C** with **RSI_UART_INTERFACE** , **EFX_UART_HAL** and **RSI_UART_FLOW_CTRL_ENABLE**.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. In Windows PC, install python and run HTTP server.
2. In release package python scripts are provided to open HTTP server in the path: utilities/script
3. Run simple_http_server_v6.py by port number 80 as argument to open HTTP server.
4. After the program gets executed, the device connects to AP and get IP.
5. After successful connection with Access Point, the Silicon Labs device request for HTTP PUT to PUT/Create the file on to the server, which is given in index.txt file and wait until put file complete.
6. Remote web server accepts a PUT request and writes the received data to a file. User can find the created new file "index.html" on Windows PC in the following path, utilities/scripts
7. After successful creation of file using HTTP PUT, Silicon Labs device request for the file "index.html" using HTTP GET method and wait until complete response receive from Server.
8. After receiving complete response for the given HTTP GET, the device post the given data in HTTP_DATA macro to HTTP server using HTTP POST method.
9. User can see the log messages at HTTP server.

###### Console Output with a UART Interface (heading level 7)

**Using Run as:**

- From the menu, select Tools
- In the Tools dialog, select Simplicity Commander and click OK.
- In the Simplicity Commander window, click Select Kit and choose your radio board.
- In the navigation pane, go to the Console section.
- Click Connect.
- Console output will start getting displayed in the SWO window as shown below.

![Console logs](/wifibt-wc-snippet-examples/2.14.0/images/uart-interface-http-client-host-logs-run-as.png)

**Using Debug as:**

- Run the Project by clicking on relevant icons on the IDE. Observe the LOG PRINTS of the application in the console window as shown below.

![Console logs](/wifibt-wc-snippet-examples/2.14.0/images/uart-interface-http-client-host-logs-debug-as.png)

**Note!**

> You must click Disconnect to close the SWO connection (if already connected) before initiating the debugging of an application.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Access Point (IPv6)

##### 1. Purpose / Scope

This application demonstrates how to configure the RS9116W EVK as a soft Access point and allows stations to connect to it and enables TCP data transmission from the connected Wi-Fi station to Silicon Labs Access Point.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Windows PC (Remote PC) with iperf application

![Setup Diagram for Access Point Start Example](/wifibt-wc-snippet-examples/2.14.0/images/apv6setup.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/).
- Embedded Development Environment.  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in Windows PC(Remote PC)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/access_point_v6/projects/access_point_v6-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/access_point_v6/projects/access_point_v6-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>examples/snippets/wlan/access_point_v6/projects/access_point_v6-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image83a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>examples/snippets/wlan/access_point_v6/projects/access_point_v6-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1  Open rsi_ap_start.c file

###### 4.1.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

SSID refers to the name of the Access point to be created.

```c
#define SSID "SILABS_AP"
```

CHANNEL_NO refers to the channel in which AP would be started

```c
#define CHANNEL_NO 11
```

SECURITY_TYPE refers type of security. Access point supports Open, WPA, WPA2 securities.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE RSI_WPA2
```

ENCRYPTION_TYPE refers to the type of Encryption method. Access point supports OPEN, TKIP, CCMP encryption methods.

Valid configurations are:

- RSI_CCMP - For CCMP encryption
- RSI_TKIP - For TKIP encryption
- RSI_NONE - For open encryption

```c
#define ENCRYPTION_TYPE RSI_CCMP
```

PSK refers to the secret key if the Access point to be configured in WPA/WPA2 security modes.

```c
#define PSK "1234567890"            
```

BEACON_INTERVAL refers to the time delay between two consecutive beacons in milliseconds. Allowed values are integers from 100 to 1000 which are multiples of 100.

```c
#define BEACON_INTERVAL 100
```

DTIM_INTERVAL refers DTIM interval of the Access Point. Allowed values are from 1 to 255.

```c
#define DTIM_INTERVAL 4
```

DEVICE_PORT port refers TCP server port number

```c
#define DEVICE_PORT 5001
```

NUMEBR_OF_PACKETS refers how many packets to receive from remote TCP client.

```c
#define NUMBER_OF_PACKETS 1000
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN 15000
```

RECV_BUFFER_SIZE refers receive data length

```c
#define RECV_BUFFER_SIZE 1000
```

**Note!**

> If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.

---

IPv6 address to be configured to the device

Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below

```c
#define DEVICE_IP6 "2001:db8:0:1::121"
```

IP address of the gateway.

Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below

```c
#define GATEWAY6 "2001:db8:0:1::121"
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE     RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP \
  (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6 | TCP_IP_FEAT_DHCPV6_SERVER)
#define RSI_BAND RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/access_point_v6/projects/access_point_v6-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116 , then user need to press the RESET button on RS9116W EVK before free run.
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/access_point_v6/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to Rs9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. After program gets executed, RS9116W EVK will be created as an access point with configured **SSID** (Ex: "**SILABS_AP"**) and opens TCP server socket on **DEVICE_PORT** and waits for TCP connection request from TCP client. Now scan and connect to device access point (Ex: "SILABS_AP" is the AP name) from laptop.
2. After successful connection, open iperf application from remote PC command Prompt.
3. Connect to TCP Server running on RS9116W EVK using below command  
   `iperf.exe -c <DEVICE_IP> -p <DEVICE_PORT> -V -i 1 -t 100`
4. The RS9116W EVK accepts connection request and receives data on the TCP server port and exit after receiving configured NUMBER_OF_PACKETS

![Receiving data on the TCP server port](/wifibt-wc-snippet-examples/2.14.0/images/image107.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Socket Select

##### 1. Purpose / Scope

This application demonstrates how to create the multiple sockets in RS9116W EVK and monitor multiple sockets for a certain activity to occur. If there is some data to be read on one of the sockets, the Select provides the response about the socket whether the data is to be read on the socket or not.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- TCP client application running in Windows PC2 (This uses iperf application to open TCP client socket in remote PC)

![Setup Diagram for socket select Example](/wifibt-wc-snippet-examples/2.14.0/images/image198.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in the remote PC.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image198a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_socket_select.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                    "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0 device will scan all channels.

```c
#define CHANNEL_NO                              0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                           RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                  "1234567890"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                               1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                               0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                 0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                 0x00FFFFFF
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                         15000
```

User can connect to access point through PMK

To Enable keep 1 else 0

```c
#define CONNECT_WITH_PMK                         0
```

> Note:
> If CONNECT_WITH_PMK is enabled, SECURITY_TYPE is set to RSI_WPA2_PMK.

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                      RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                  FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                    RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP           (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_EXT_TCPIP_FEATURE_BITMAP         (RSI_NUMBER_OF_SELECTS << 12)
#define RSI_CUSTOM_FEATURE_BIT_MAP           0
#define RSI_BAND                             RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE          0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE          1
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project.
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/socket_select_app/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. After the program gets executed, RS9116W EVK is configured as client and connects to AP and gets IP.
3. After successful connection with the access point, the socket select is issued for the desired socket.
4. Open UDP client from WindowsPC2 and connect to UDP server opened on the device on port number DEVICE_PORT. The Iperf command to start the UDP client is:

> `C:\> iperf.exe -u -c <Module_IP> -p <DEVICE_PORT> -i 1 -t <time interval in sec>`
> 
> For example ...
> 
> `C:\> iperf.exe -u -c 192.168.0.100 -p 5001 -i 1 -t 30`

1. Select provides the response about the socket whether the data is to be read on the socket or not.
2. If data is to be received on the socket, then the receive function is called on the socket.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### SNTP Client (IPv6)

##### 1. Purpose / Scope

This application demonstrates how Silicon Labs device gets info from SNTP server. In this application, Silicon Labs device connects to Access Point in client mode and connects to SNTP server. After successful connection with SNTP server, application gets time and date info from SNTP server.

##### 2. Prerequisites / Setup Requirements

Before running the application, set up the following:

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point

![Setup Diagram](/wifibt-wc-snippet-examples/2.14.0/images/sntpclientncp.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<Release_Package>/examples/snippets/wlan/sntp_client_v6/projects/sntp_client_v6-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<Release_Package>/examples/snippets/wlan/sntp_client_v6/projects/sntp_client_v6-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<Release_Package>/examples/snippets/wlan/sntp_client_v6/projects/sntp_client_v6-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-2a.png)

###### 3.4 Bare Metal Support

This application supports only bare metal environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the release package.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_sntp_client_app.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0, device will scan all channels

```c
#define CHANNEL_NO 0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK /WPA2-PSK security modes.

```c
#define PSK "1234567890"
```

SERVER_IP_ADDRESS refers remote SNTP Server IPv6 address to connect.

```c
#define SERVER_IP "2610:20:6f96:96::4"
```

Configure the SNTP method to use the server

```c
#define SNTP_METHOD RSI_SNTP_UNICAST_MODE
```

SNTP time out value to use

```c
#define SNTP_TIMEOUT 50
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN 15000
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

To configure IP address
DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE 1
```

**Note!**

> If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.

---

IPv6 address to be configured to the device.

Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below

```c
#define DEVICE_IP6 "2001:db8:0:1::121"
```

IP address of the gateway.

Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below

```c
#define GATEWAY6 "2001:db8:0:1::121"
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE     RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP \
  (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SNTP_CLIENT | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6)
#define RSI_CUSTOM_FEATURE_BIT_MAP  FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_BAND                    RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK.

The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/sntp_client_v6/projects/sntp_client_v6-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/sntp_client/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point (internet AP) in OPEN / WPA-PSK / WPA2-PSK mode in order to connect Silicon Labs device in STA mode.
2. Connect to SNTP server and request server for information.
3. After the program gets executed, Silicon Labs device would be connected to access point and gets IP.
4. After successful connection with access point, device starts connection with the SNTP server.
5. After successful connection, module will send request to the server for time,date and Server details.
6. Application gets all the information requested.
7. Analyze the sniffer capture for NTP server response which contains date and time.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Index Based SSL Client Sockets

##### 1. Purpose / Scope

This application demonstrates how RS9116W EVK will connect to three different SSL servers with four different set of SSL certificates and loading certificates into the FLASH using the Index.

- Both index 0 and index 1 have a common root CA certificate and different client certificates and private key certificates required for HTTPS and MQTT connections.
- Index 2 is used for firmware listing, a connection is made to the firmware listing server with a different root CA certificate using HTTPS connection.
- Index 3 is fetching the required certificate for SSL connection, from the Index 2 server.
- Index 3 location is kept idle while the certificate for index 3 is being fetched from the server, which we are connecting to index 2.
- Index 3 is used for firmware download, by initiating from the firmware download server using HTTPS connection.

##### 2. Prerequisites / Setup Requirements

Before running the application, set up the following:

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI / SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- [Python tool](https://www.python.org/downloads/)
- Windows PC1 with with MQTT broker installed in it.
- Wireless Access Point

![Setup Diagram](/wifibt-wc-snippet-examples/2.14.0/images/image-1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Python tool](https://www.python.org/downloads/)  
  - [MQTT Broker](https://mosquitto.org/files/binary/win64/mosquitto-1.6.12-install-windows-x64.exe) in Windows PC1.

> **Note:** This example has been tested with Mosquitto _v1.5.3_, _v1.6.9_, and _v1.6.12_.

- Install and configure Wamp-Apache HTTP server, refer to Appendix section 6.3 **Configuring and uploading firmware on Apache HTTP**.
- Install and configure Wamp-Apache HTTPs server, refer to Appendix section 6.4 **Configuring and uploading firmware on Apache HTTPs**.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-2.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_index_based_ssl_client_sockets.h file

###### 4.1.1 User must update the below common parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                         "SILABS_AP"
```

CHANNEL_NO refers to the channel in which AP would be started

```c
#define CHANNEL_NO                  0
```

SECURITY_TYPE refers to the type of security. Generally Access point supports Open, WPA, WPA2 securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                RSI_WPA2
```

PSK refers to the secret key of the Access point(applies when AP is configured in WPA/WPA2 security modes)

```c
#define PSK                          "1234567890"
```

MQTT_CLIENT_PORT port refers to device MQTT client port number

```c
#define MQTT_CLIENT_PORT                           1883
```

MQTT_SERVER_PORT port refers remote MQTT broker/server port number

```c
#define MQTT_SERVER_PORT			   8883
```

SERVER_IP_ADDRESS refers remote peer IP address (Windows PC1) to connect with MQTT broker/server socket.

```c
#define SERVER_IP_ADDRESS                          192.168.10.1
```

MQTT client keep alive period

```c
#define RSI_KEEP_ALIVE_PERIOD                      100
```

Memory to initialize MQTT client Info structure

```c
#define MQTT_CLIENT_INIT_BUFF_LEN                  3500
```

QOS indicates the level of assurance for delivery of an Application Message.

QoS levels are:

0 - At most once delivery

1 - At least once delivery

2 - Exactly once delivery

```c
#define QOS                                        0
```

RSI_MQTT_TOPIC refers to which topic WiSeConnect MQTT client is supposed to subscribe.

```c
#define RSI_MQTT_TOPIC                             "MQTT_DEMO"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

DHCP_MODE refers the way of configuring IP address to Silicon Labs module

1-Enables DHCP mode (gets the IP from DHCP server)

0-Disables DHCP mode

Desired configuration :

```c
#define DHCP_MODE                    1
```

If DHCP Mode is disabled configure a static IP address using the following macros. These values are in long format and in little endian order. For example an address of "192.168.10.1" is represented by a value of 0x010AA8C0.

```c
#define DEVICE_IP                    0X010AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                      0x00FFFFFF
```

> Note:
> In AP mode, configure same IP address for both DEVICE_IP and GATEWAY macros.

###### 4.1.3 User must update the below server configuration parameters (heading level 7)

Based on the type of server (Apache) from which firmware files needs to be downloaded, the below mentioned parameters needs to be configured.
Configure FLAGS to choose the version and security type to be enabled

Valid configurations are :

Enable IPv6 set this bit in FLAGS, Default is IPv4

```c
#define HTTPV6           BIT(0)
```

Set HTTPS_SUPPORT to use HTTPS feature

```c
 #define HTTPS_SUPPORT    BIT(1)
```

Set HTTP_V_1_1 to use HTTP version 1.1

```c
 #define HTTP_V_1_1       BIT(6)
```

Both AWS and Azure macro is disabled in application, HTTP/s Apache server can be used to download the firmware and certificates required.

- HTTP_SERVER_PORT refers to HTTP Server port number
- SERVER_IP_ADDRESS refers to HTTP/MQTT Server IP address
- HTTP_SERVER_URL refers to HTTP resource name to list the firmware and certificates on the server.
- HTTP_FW_UPDATE_URL refers to the HTTP Firmware update URL
- HTTP_SERVER_URL1 refers to the HTTP local server for index_0
- HTTP_CERTS_DOWNLOAD_URL refers to the URL of HTTPS server to download the certificate
- HTTP_HOSTNAME refers to HTTP server hostname
- HTTP_EXTENDED_HEADER refers to HTTP extended header. If NULL default extented header is filled
- USERNAME refers to the username to be used to access the HTTP resource
- PASSWORD refers to the password to be used to access the HTTP resource1

**For local HTTPS Server for index_0**

- Include Root certificate pem file for SSL connection
- Provide the PC IP where HTTPS server is running in SERVER_IP_ADDRESS

```c
//Sample configurations for Index_0
#include "cacert.pem"
#define HTTP_INDEX0_FLAGS       HTTPS_SUPPORT
#define HTTP_SERVER_PORT1       5443
#define SERVER_IP_ADDRESS  	   "192.168.xxx.xxx"
#define HTTP_SERVER_URL1        "/index.html" //Index_0 HTTPS connection
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

**For Apache HTTPS Server for index_2 and Index_3**

- Include Root certificate pem file for SSL connection
- Provide the PC IP where Apache server is running in SERVER_IP_ADDRESS
- Provide the firmware listing path to upload the firmwares on Apache server in HTTP_SERVER_URL
- Provide the certifcate path uploaded in Apache server in HTTP_CERTS_DOWNLOAD_URL
- Provide the firmware package name uploaded in Apache server in HTTP_FW_UPDATE_URL

```c
//Sample configurations for Index_2
#include "cacert.pem"
#define HTTP_INDEX2_FLAGS       (HTTPS_SUPPORT | HTTPS_CERT_INDEX_2)
#define HTTP_SERVER_PORT        443
#define SERVER_IP_ADDRESS       "192.168.xxx.xxx"
#define HTTP_SERVER_URL         "silabs/index.html" //For FW listing on the apache server
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

```c
//Sample configurations for Index_3 to download certificates
#include "cacert.pem"
#define HTTP_INDEX2_FLAGS       (HTTPS_SUPPORT | HTTPS_CERT_INDEX_2)
#define HTTP_SERVER_PORT        443
#define SERVER_IP_ADDRESS       "192.168.xxx.xxx"
#define HTTP_CERTS_DOWNLOAD_URL certs/cacert.pem
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

```c
//Sample configurations for Index_3 to downalod and update the firmware
#include "cacert.pem"
#define FLAGS                   (HTTPS_SUPPORT | HTTPS_CERT_INDEX_3)
#define HTTP_SERVER_PORT        443
#define SERVER_IP_ADDRESS       "192.168.xxx.xxx"
#define HTTP_FW_UPDATE_URL      "firmware/RS9116W.2.11.4.0.1.rps"
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

###### 4.2 Open rsi_mqtt_client.c file. User can also modify the below parameters as per their needs and requirements.

```c
uint8_t publish_message[] ="THIS IS MQTT CLIENT DEMO FROM APPLICATION"
```

> Note :
> As the publish message will be appended to MQTT header it is recommended to substract (topic length + 7 bytes of MQTT control fields) from maximum buf size limit for the protocol(TCP/SSL) to decide payload size.
> Example, if topic is "MQTT_DEMO", for TCP payload size should be of size 1444 bytes( = 1460 - 9 - 7), for SSL it sums up to 1354 bytes( = 1370 - 9 - 7).

MQTT Client ID with which MQTT client connects to MQTT broker/server

```c
uint8_t clientID[] = "MQTTCLIENT"
```

User name for login credentials

```c
int8_t username[] = "username"
```

Password for login credentials

```c
int8_t password[] = "password"
```

###### 4.3 Open  rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE			RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                  FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                    RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP 		(TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_HTTP_CLIENT | TCP_IP_FEAT_EXTENSION_VALID | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT)
#define RSI_EXT_TCPIP_FEATURE_BITMAP 	(EXT_FEAT_HTTP_OTAF_SUPPORT | EXT_TCP_IP_FEAT_SSL_THREE_SOCKETS | EXT_TCP_IP_SSL_16K_RECORD | EXT_TCP_IP_CERTIFICATE_INDEX_3)
#define RSI_CUSTOM_FEATURE_BIT_MAP           EXT_FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP 	(RAM_LEVEL_NWP_ALL_MCU_ZERO | EXT_FEAT_UART_SEL_FOR_DEBUG_PRINTS)
#define RSI_BAND                             RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/http_otaf/projects/http_otaf-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the project from `<SDK>/examples/snippets/wlan/http_otaf/projects`
- Select the appropriate .slsproj as per the Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Follow step 5.3.1 for HTTPS Server-1 configuration.
3. Follow step 5.3.2 for MQTT Server-2 configuration.
4. Follow step 5.3.3 for Steps for Apache HTTPS Server-2 configuration for Firmware Listing and Firmware updating.
5. After the program gets executed, RS9116W EVK would be connected to Access point having the configuration same that of in the application and get IP.

![Device_successful_connection](/wifibt-wc-snippet-examples/2.14.0/images/image-8.png)

1. The Device which is configured as SSL client will connect to three different remote SSL servers.
2. Device will connect to HTTPS server on index_0. GET the HTTPS data from the server.

![Device_connected_to_HTTPS_Server](/wifibt-wc-snippet-examples/2.14.0/images/image-9.png)

1. Device will connect to the MQTT server on index_1. Subscribes to the topic, publishes the topic. Closes the socket.

![Device_connected_to_MQTT_Broker](/wifibt-wc-snippet-examples/2.14.0/images/image-10.png)

1. Device will connect to HTTPS server on index_2 and lists the firmware's on the server.

![Device_connects_HTTPS_Index2](/wifibt-wc-snippet-examples/2.14.0/images/image-11.png)

1. Device will connect to the HTTPS server and gets the required certificates from the server-2 and loads the certificate into index_3.
2. Device will connect to the HTTPS server using index_3 and updates the firmware on the module.

![Device_connects_HTTPS_FWUP](/wifibt-wc-snippet-examples/2.14.0/images/image-12.png)

###### 5.3.1 Steps for HTTPS configuration. (heading level 7)

1. In Windows PC, install python and run HTTPS server.
2. Copy the certificates cacert, server-cert and server-key into local folder where simple_https_server.py file is present in the Windows PC (Remote PC).

> Note:
> All the certificates are given in the SDK. Path: `<SDK>/resources/certificates`

1. In release package python scripts are provided to open HTTPS server in the path: utilities/script
2. Run simple_https_server.py by port number 5443 as argument to open HTTPS server

```sh
python simple_https_server.py 5443
```

![Run HTTPS_Server in Windows PC](/wifibt-wc-snippet-examples/2.14.0/images/image-3.png)

###### 5.3.2 Steps for MQTTS configuration. (heading level 7)

1. Install MQTT broker in Windows PC which is connected to Access Point through LAN.
2. User needs to update the mosquitto.conf file with the proper file paths, in which the certificates are available in the mosquitto.conf file.
3. Also, add "certs" folder to the mosquitto broker folder.
4. Execute the following command in MQTT server installed folder. (Ex:  C:\Program Files\mosquitto>mosquitto.exe -c mosquitto.conf -v) (Port can be 1883/8883)

```sh
mosquitto.exe -c mosquitto.conf -v`  
```

![For opening MQTT server](/wifibt-wc-snippet-examples/2.14.0/images/image-4.png)

###### 5.3.3 Steps for Apache HTTPS Server configuration for Firmware Listing and Firmware updating. (heading level 7)

1. In Windows PC, install Apache and run HTTP/s server.
2. Install and configure Apache. To configure apache server follow step-6.4
3. Write the HTML script for firmwares to be listed on the server in index.html file.
4. Configuring and Uploading Firmwares on Apache HTTPs:

![For listing fw_on_server](/wifibt-wc-snippet-examples/2.14.0/images/image-5.png)

1. HTTPs Sever configuration for Apache requires Wamp server, if you have not installed it, follow the **"Step 1: Download and Install Wamp-Apache Server"** step and continue with the HTTPS steps in this document.

- **Download and Install OPENSSL for windows**  
  - OpenSSL for windows from here ([https://slproweb.com/products/Win32OpenSSL.html](https://slproweb.com/products/Win32OpenSSL.html)).  
  - Do default install for OpenSSL.  
  - We can only run OpenSSL using command prompt, for that we need to first find the openssl.exe file.  
  - Normally it will be in "C:\Program Files\OpenSSL-Win64\bin\openssl.exe"
- **Generate required certs**  
  > **Note:** If you already have the reqired certs to run the server then, skip the **Generate required certs** step, copy your certs to `C:\wamp64\bin\apache\apache2.4.46\conf` directory and update the `httpd-ssl.conf` file with these certificate paths shown in **HTTPD Configuration** step.  
  - Open Command Prompt in Administrator privilege's.  
  - Change directory to your openssl.exe file "cd C:\Program Files\OpenSSL-Win64\bin"  
  - Execute the below command to generate a private.key file with AES 256 encryption.

```sh
   openssl.exe genrsa -aes256 -out private.key 2048
   openssl.exe rsa -in private.key -out private.key
   openssl.exe req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config <your-wamp-apache-openssl.conf-file-path>
   openssl.exe req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp64\bin\apache\apache2.4.46\conf\openssl.conf
```

- Now there will be two files created [Private.key and certificate.crt] in "C:\Program Files\OpenSSL-Win64\bin" directory, copy them to "C:\wamp64\bin\apache\apache2.4.46\conf"
- **HTTPD Configuration**  
  - Open "httpd.conf" file in "C:\wamp64\bin\apache\apache2.4.46\conf"  
  - Uncomment the below shown lines in that file. Save and Exit.  
  ```sh  
  LoadModule ssl_module modules/mod_ssl.so  
  Include conf/extra/httpd-ssl.conf  
  LoadModule socache_shmcb_module modules/mod_socache_shmcb.so  
  ```  
  - Open "php.ini" file in "C:\wamp64\bin\php\php5.6.40" and uncomment the below line in the file    
    `extension=php_openssl.dll`  
  - Open "httpd-ssl.conf" file in "C:\wamp64\bin\apache\apache2.4.46\conf\extra" and update the below paths with proper information (i.e provide system relative paths)  
  ```sh  
  <VirtualHost default:443>  
  General setup for the virtual host  
  DocumentRoot "C:/wamp64/www"  
  ServerName 192.168.43.85:443  
  ServerAdmin admin@example.com  
  ErrorLog "C:/wamp64/bin/apache/apache2.4.46/logs/error.log"  
  TransferLog "C:/wamp64/bin/apache/apache2.4.46/logs/access.log"  
    
  SSLCertificateFile "C:/wamp64/bin/apache/apache2.4.46/conf/certificate.crt"  
  SSLCertificateKeyFile "C:/wamp64/bin/apache/apache2.4.46/conf/private.key"   
  ```  
  - Run below command to check if the configurations given above are proper or not. If the configurations are proper, it will return "Syntax OK"    
    `httpd.exe -t`
- **Configure HTTPS Wamp-Apache Server to Download firmware**  
  - Goto the Wamp Root directory "C:\wamp64" and navigate to "www"  
  - Create a new folder in that directory "Firmware". [Folder Structure: C:\wamp64\www\Firmware]  
  - In the "Firmware" folder create an "index.html" file and write below contents to the file.

```html
    <!DOCTYPE html>
    <html>
        <body>
            <h2>Using a Relative File Path</h2>
            <a href="firmware.rps" download>Download_Version_6</a><br><br>
            <a href="firmware1.rps" download>Download_Version_4</a>
        </body>
    </html>
```

- This code will link your resources to Apache server, so that those files can be downloaded.
- Make sure to copy all the firmware files into the present directory, C:\wamp64\www\Firmware
- you can edit href values in the index.html to your firmware file names.

```html
    <a href="<your-firmware-file>-1.rps" download>Download_Version_6</a><br><br>
    <a href="<your-firmware-file>-2.rps" download>Download_Version_4</a>
```

- Save the file and Exit.
- **Restart Server**  
  - Open RUN, "WIN+R" → "services.msc" → ENTER  
  - Restart the Apache service.  
  - Open browser and give your Apache server URL

![Give your Apache server URL](/wifibt-wc-snippet-examples/2.14.0/images/image-6.png)

> - Here click on "Advanced Settings" and click on "Proceed to 192.168.43.85 (unsafe)"
> - You will be able to access the page and resources in HTTPS.

![Access the page and resources in HTTPS](/wifibt-wc-snippet-examples/2.14.0/images/image-7.png)

> **Note:** Make sure to check your HTTPS server from other local machines present in the same network. It should be accessible.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### FTP CLIENT

##### 1. Purpose / Scope

This application demonstrates how to connect to a FTP server opened on remote peer using FTP client, read a file from FTP server and write the file on to the FTP server.
In this application, the Silicon Labs device connects to Access Point and establishes FTP client connection with FTP server opened on remote peer. After successful connection, the application writes the data to a file created on the FTP server. Then demonstrates renaming of the file and then reads the contents of the renamed file.

File Transfer Protocol (FTP) is a protocol through which internet users can upload files from their computers to a website or download files from a website to their PCs.
FTP is a client-server protocol that relies on two TCP communications channels between client and server and a command channel for controlling the conversation (command port) and a data channel for transmitting file content(data port).

##### 2. Prerequisites / Setup Requirements

Before running the application, set up the following.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Windows PC2 with FTP server installed in it![Setup Diagram for FTP CLIENT Example](/wifibt-wc-snippet-examples/2.14.0/images/image384.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Install and configure FTP Server demo application.
- FTP Server demo application can be downloaded from [Filezilla](https://filezilla-project.org/download.php?type=server)  
  - **Note:** FTP client functionality verified with FileZilla server version 0.9.51.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/ftp_client/projects/ftp_client-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/ftp_client/projects/ftp_client-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/ftp_client/projects/ftp_client-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image384g.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/ftp_client/projects/ftp_client-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal environment. The application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_ftp_client.c file

###### 4.1.1 User must update the below common parameters (heading level 7)

**SSID** refers to the name of the Access point.

```c
	 #define SSID                                 "<SILABS_AP>"
```

**SECURITY_TYPE** refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.
Valid configuration is:
**RSI_OPEN** - For OPEN security mode
**RSI_WPA** - For WPA security mode
**RSI_WPA2** - For WPA2 security mode

```c
#define SECURITY_TYPE                         RSI_OPEN
```

**PSK** refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                  "<psk>"
```

**FTP_SERVER_PORT** port refers remote FTP server port number.
By default FileZilla Server runs on port number 21.

```c
#define FTP_SERVER_PORT                      21
```

**SERVER_IP_ADDRESS** refers remote peer IP address to connect with TCP server socket.
IP address should be in long format and in little endian byte order.
Example: To configure "192.168.0.100" as remote IP address, update the macro **SERVER_IP_ADDRESS** as **0x6400A8C0**.

```c
#define SERVER_IP_ADDRESS                    0x6400A8C0
```

FTP Server login username

```c
#define FTP_SERVER_LOGIN_USERNAME            "username"
```

FTP Server login password

```c
#define FTP_SERVER_LOGIN_PASSWORD            "password"
```

File to read which is on FTP server
Create a file on FTP server with the file name along with the path with data given below

```c
#define FTP_FILE_TO_READ                     "read.txt"
	 (or)
#define FTP_FILE_TO_READ                     "D:\FTP Test\read.txt"
```

**FILE_CONTENT_LENGTH** refers content length of the read file from FTP server (Ex: configure **FILE_CONTENT_LENGTH** >= Sizeof ("read.txt"))

```c
#define FILE_CONTENT_LENGTH                   10000
```

File name to create on FTP server and write the same content which is read from "read.txt"

```c
#define FTP_FILE_TO_WRITE                   "write.txt"
	 (or)
#define FTP_FILE_TO_WRITE                   "D:\FTP Test\write.txt"
```

To rename a file on FTP server

```c
#define FTP_FILE_TO_RENAME                  "read.txt"
```

To set the directory on FTP server

```c
#define FTP_DIRECTORY_SET                   "../FTP"
```

To create directory on FTP server

```c
#define FTP_DIRECTORY_CREATE                "FTP"
```

To list the directories on FTP server

```c
#define FTP_DIRECTORY_LIST                  "/"
```

**To configure IP address**

**DHCP_MODE** refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                            1
```

---

**Note!**
If user wants to configure STA IP address through DHCP then set DHCP_MODE to 1 and skip configuring the following DEVICE_IP,GATEWAY and NETMASK macros.
(Or)
If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.
IP address to be configured to the device in STA mode, it should be in long format and in little endian byte order.
Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

---

```c
#define DEVICE_IP                           0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order
Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                             0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order
Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                             0x00FFFFFF
```

The following parameters need to be configure if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY             1
```

Driver task should be of highest priority

```c
#define RSI_DRIVER_TASK_PRIORITY           2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

###### 4.1.2 User must update the below server configuration parameters (heading level 7)

Open **rsi_wlan_config.h** file and update/modify following macros

```c
#define CONCURRENT_MODE                   RSI_DISABLE
#define RSI_FEATURE_BIT_MAP               FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                 RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP        (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_FTP_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP        FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP       RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_BAND                          RSI_BAND_2P4GHZ
```

---

**Note!**
`rsi_wlan_config.h` file is already set with desired configuration in respective example folders user need not change for each example.

---

**Installation of FTP server**

1. Download the FileZilla FTP server from below link - [https://filezilla-project.org/download.php?type=server](https://filezilla-project.org/download.php?type=server)
2. Install downloaded FileZilla FTP server in Windows PC2 which is connected to AP through LAN.
3. Configure and run FTP server. Please refer the below images for configuring and running FileZilla FTP server.
4. After installation, open FileZilla Server interface.

![Filezilla Windows Home](/wifibt-wc-snippet-examples/2.14.0/images/image-1.png)

1. After opening FileZilla server interface, connect to server admin interface.

![Filezilla Connect to Server](/wifibt-wc-snippet-examples/2.14.0/images/image-2.png)

1. After connection with server, configure the user settings.

![Configure User Settings](/wifibt-wc-snippet-examples/2.14.0/images/image-3.png)
![Configure User Settings](/wifibt-wc-snippet-examples/2.14.0/images/image-4.png)
![Configure User Settings](/wifibt-wc-snippet-examples/2.14.0/images/image-5.png)
![Configure User Settings](/wifibt-wc-snippet-examples/2.14.0/images/image-6.png)

1. Place "read.txt" file in FTP directory (Ex: "D:\FTP Test\read.txt")

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/ftp_client/projects/ftp_client-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the project from `<SDK>/examples/snippets/wlan/ftp_client/projects`
- Select the appropriate .slsproj as per the Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point in **OPEN/WPA-PSK/WPA2-PSK** mode to connect the Silicon Labs device in STA mode.
2. Run FTP server on Windows PC2 and place "read.txt" file in the FTP directory.
3. After the program gets executed, the Silicon Labs device will be connected to same access point having the configuration same as that of in the application and get IP.
4. After successful connection with the Access Point, the device connects to FTP server and reads the file content of given file ("read.txt") and creates a file name "write.txt" in FTP directory and writes the same content which is read from "read.txt" by replacing first few bytes with "FTP CLIENT DEMO". After successful file write WiSeConnect device disconnects from FTP server.
5. Refer below images for message exchanges with FTP server and for read and write files,

![Output on Filezilla Interface](/wifibt-wc-snippet-examples/2.14.0/images/image-7.png)

![Read Write Files in Explorer](/wifibt-wc-snippet-examples/2.14.0/images/image-8.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Station Ping

##### 1. Purpose / Scope

Ping is used diagnostically to ensure that a host computer the user is trying to reach is actually operating. Ping works by sending an Internet Control Message Protocol (ICMP) Echo Request to a specified interface on the network and waiting for a reply. Ping can be used for troubleshooting to test connectivity and determine response time.
The application demonstrates how to configure Silicon Labs device in client mode to send ping request to target IP address .

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Silicon Labs module
- A TCP server application running on the Windows PC2 (This example uses iperf for windows )

![Setup Diagram for Station ping Example](/wifibt-wc-snippet-examples/2.14.0/images/image176.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - A TCP server application running on the Windows PC2 (This example uses iperf for windows )

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-2a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

User has to configure the below parameters for executing the application.

##### 4.1 Open rsi_station_ping.c file and update/modify following macros,

SSID refers to the name of the Access point.

```c
#define SSID                                    "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0,device will scan all channels.

```c
#define CHANNEL_NO                              0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                           RSI_WPA2
```

AP_BSSID  refer  to BSSID of AP, join based up on BSSID (Example : If two Access points had same SSID then at the time based on this BSSID,module will join to particular AP). This feature is valid only if  RSI_JOIN_FEAT_BIT_MAP set to RSI_JOIN_FEAT_BSSID_BASED in the rsi_wlan_config.h file.

```c
#define AP_BSSID                                    { }
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK "1234567890"
```

**To configure IP address**

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                               1`
```

> Note
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to 1 and skip configuring the following DEVICE_IP,GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro **DEVICE_IP** as **0x0A0AA8C0**.

```c
#define DEVICE_IP                               0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro **GATEWAY** as **0x010AA8C0**

```c
#define GATEWAY                                 0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro **NETMASK** as **0x00FFFFFF**

```c
#define NETMASK                                 0x00FFFFFF
```

Configure following macro stoping initiate ping with the remote peer

IP address of the remote peer (AP IP address).

Example: To configure "192.168.10.1" as REMOTE_IP, update the macro **REMOTE_IP** as **0x0A0AA8C0**.

```c
#define REMOTE_IP                               0x010AA8C0
```

PING_SIZE refers the size of ping packet.

```c
#define PING_SIZE                               100
```

NUMBER_OF_PACKETS refers how many number of pings to send from device.

```c
#define NUMBER_OF_PACKETS                       1000
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                         15000
```

User can connect to access point through PMK

To Enable keep 1 else 0

```c
#define CONNECT_WITH_PMK                         0`
```

> **Note:** If `CONNECT_WITH_PMK` is enable ,`SECURITY_TYPE` is set to `RSI_WPA2_PMK`

##### 4.2 Open _**rsi_wlan_config.h**_ file and update/modify following macros,

```c
#define CONCURRENT_MODE                         RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                     FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                       RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP             (TCP_IP_FEAT_DHCPV4_CLIENT| TCP_IP_FEAT_ICMP)
#define RSI_CUSTOM_FEATURE_BIT_MAP              FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP             RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_BAND                                RSI_BAND_2P4GHZ

/* ping response timeout in seconds */
    
#define RSI_PING_REQ_TIMEOUT      `              1
    
/* If want to join with BSSID of AP,then enable this feature and add BSSID of AP in the rsi_station_ping.c file*/
   
#define  RSI_JOIN_FEAT_BIT_MAP                  RSI_JOIN_FEAT_BSSID_BASED
```

> Note: `rsi_wlan_config.h` file is already set with desired configuration in respective example folders user need not change for each example.

##### 5. Steps for Executing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Steps for Compiling and Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-nucleo-f411re.uvprojx` in Keil IDE.
- Build the project
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/station_ping/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. After the program gets executed, Silicon Labs module configured as client and connects to AP and gets IP.
3. After successful connection with the Access Point, the device starts sending ping requests to the given **REMOTE_IP** with configured **PING_SIZE** to check availability of target Device.
4. Device sends the number of ping packets configured in **NUMBER_OF_PACKETS**.
5. In rsi_station_ping.c file, **rsi_wlan_ping_async** API returns success status, which means that the ping request packet is successfully sent in to the medium. When actual ping response  
   comes from the remote node, it is known from the status parameter of the callback function (**rsi_ping_response_handler**) registered in the Ping API.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Station Ping (IPv6)

##### 1. Purpose / Scope

Ping is used diagnostically to ensure that a host computer the user is trying to reach is actually operating. Ping works by sending an Internet Control Message Protocol (ICMP) Echo Request to a specified interface on the network and waiting for a reply. Ping can be used for troubleshooting to test connectivity and determine response time.
The application demonstrates how to configure Silicon Labs device in client mode to send ping request to target IP address .

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Silicon Labs module
- A TCP server application running on the Windows PC2 (This example uses iperf for windows)

![Setup Diagram for Station ping Example](/wifibt-wc-snippet-examples/2.14.0/images/stationpingv6setupncp.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - A TCP server application running on the Windows PC2 (This example uses iperf for windows)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/station_ping_v6/projects/station_ping_v6-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/station_ping_v6/projects/station_ping_v6-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/station_ping_v6/projects/station_ping_v6-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image83a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/station_ping_v6/projects/station_ping_v6-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

User has to configure the below parameters for executing the application.

##### 4.1 Open rsi_station_ping.c file and update/modify following macros,

SSID refers to the name of the Access point.

```c
#define SSID "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0,device will scan all channels.

```c
#define CHANNEL_NO 0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE RSI_WPA2
```

AP_BSSID  refer  to BSSID of AP, join based up on BSSID (Example : If two Access points had same SSID then at the time based on this BSSID,module will join to particular AP). This feature is valid only if  RSI_JOIN_FEAT_BIT_MAP set to RSI_JOIN_FEAT_BSSID_BASED in the rsi_wlan_config.h file.

```c
#define AP_BSSID \
  {              \
  }
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK "1234567890"
```

**To configure IP address**

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE 1`
```

**Note!**

> If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.

---

IPv6 address to be configured to the device.

Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below

```c
#define DEVICE_IP6 "2001:db8:0:1::121"
```

IP address of the gateway .

Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below

```c
#define GATEWAY6 "2001:db8:0:1::121"
```

Configure following macro stoping initiate ping with the remote peer

IP address of the remote peer (AP IP address).

Example: To configure "2001:db8:0:1::121" as REMOTE_IP, update the macro **REMOTE_IP** as below.

```c
#define REMOTE_IP "2001:db8:0:1::121"
```

PING_SIZE refers the size of ping packet.

```c
#define PING_SIZE 100
```

NUMBER_OF_PACKETS refers how many number of pings to send from device.

```c
#define NUMBER_OF_PACKETS 1000
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN 15000
```

User can connect to access point through PMK

To Enable keep 1 else 0

```c
#define CONNECT_WITH_PMK 0`
```

> **Note:** If `CONNECT_WITH_PMK` is enable ,`SECURITY_TYPE` is set to `RSI_WPA2_PMK`

##### 4.2 Open _**rsi_wlan_config.h**_ file and update/modify following macros,

```c
#define CONCURRENT_MODE     RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP \
  (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6 | TCP_IP_FEAT_ICMP)
#define RSI_CUSTOM_FEATURE_BIT_MAP  FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_BAND                    RSI_BAND_2P4GHZ

/* ping response timeout in seconds */

#define RSI_PING_REQ_TIMEOUT      ` 1

/* If want to join with BSSID of AP,then enable this feature and add BSSID of AP in the rsi_station_ping.c file*/

#define RSI_JOIN_FEAT_BIT_MAP RSI_JOIN_FEAT_BSSID_BASED
```

> Note: `rsi_wlan_config.h` file is already set with desired configuration in respective example folders user need not change for each example.

##### 5. Steps for Executing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Steps for Compiling and Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/station_ping_v6/projects/station_ping_v6-nucleo-f411re.uvprojx` in Keil IDE.
- Build the project
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/station_ping_v6/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. After the program gets executed, Silicon Labs module configured as client and connects to AP and gets IP.
3. After successful connection with the Access Point, the device starts sending ping requests to the given **REMOTE_IP** with configured **PING_SIZE** to check availability of target device.
4. Device sends the number of ping packets configured in **NUMBER_OF_PACKETS**.
5. In rsi_station_ping.c file, **rsi_wlan_ping_async** API returns success status, which means that the ping request packet is successfully sent in to the medium. When actual ping response comes from the remote node, it is known from the status parameter of the callback function (**rsi_ping_response_handler**) registered in the Ping API.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Access Point

##### 1. Purpose / Scope

This application demonstrates how to configure the RS9116W EVK as a soft Access point and allows stations to connect to it and enables TCP data transmission from the connected Wi-Fi station to Silicon Labs Access Point.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Windows PC (Remote PC) with iperf application

![Setup Diagram for Access Point Start Example](/wifibt-wc-snippet-examples/2.14.0/images/setup-diagram-for-ap-example.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/).
- Embedded Development Environment.  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in Windows PC(Remote PC)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/access_point/projects/access_point-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/access_point/projects/access_point-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/access_point/projects/access_point-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/efr-radio-boards.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/access_point/projects/access_point-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1  Open rsi_ap_start.c file

###### 4.1.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

SSID refers to the name of the Access point to be created.

```c
#define SSID                                 "SILABS_AP"
```

CHANNEL_NO refers to the channel in which AP would be started

```c
#define CHANNEL_NO                           11
```

SECURITY_TYPE refers type of security. Access point supports Open, WPA, WPA2 securities.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                        RSI_WPA2
```

ENCRYPTION_TYPE refers to the type of Encryption method. Access point supports OPEN, TKIP, CCMP encryption methods.

Valid configurations are:

- RSI_CCMP - For CCMP encryption
- RSI_TKIP - For TKIP encryption
- RSI_NONE - For open encryption

```c
#define ENCRYPTION_TYPE                      RSI_CCMP
```

PSK refers to the secret key if the Access point to be configured in WPA/WPA2 security modes.

```c
#define PSK                      "1234567890"            
```

BEACON_INTERVAL refers to the time delay between two consecutive beacons in milliseconds. Allowed values are integers from 100 to 1000 which are multiples of 100.

```c
#define BEACON_INTERVAL                      100
```

DTIM_INTERVAL refers DTIM interval of the Access Point. Allowed values are from 1 to 255.

```c
#define DTIM_INTERVAL                        4
```

DEVICE_PORT port refers TCP server port number

```c
#define DEVICE_PORT                          5001
```

NUMEBR_OF_PACKETS refers how many packets to receive from remote TCP client.

```c
#define NUMBER_OF_PACKETS                    1000
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

RECV_BUFFER_SIZE refers receive data length

```c
#define RECV_BUFFER_SIZE                      1000
```

IP address to be configured to the device should be in long format and in little endian byte order.

Example: To configure "192.168.10.1" as IP address, update the macro DEVICE_IP as 0x010AA8C0.

```c
#define DEVICE_IP                            0X010AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                              0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                              0x00FFFFFF
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                      RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                  FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS                    RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP           TCP_IP_FEAT_DHCPV4_SERVER
#define RSI_BAND                             RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/access_point/projects/access_point-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116 , then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/access_point/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to Rs9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. After program gets executed, RS9116W EVK will be created as an Access Point with configured **SSID** ( Ex: "**SILABS_AP"**) and opens TCP server socket on **DEVICE_PORT** and waits for TCP connection request from TCP client. Now scan and connect to Device Access Point (Ex: "SILABS_AP" is the AP name) from Laptop.
2. After successful connection, open iperf application from remote PC command Prompt.
3. Connect to TCP Server running on RS9116W EVK using below command  
   `iperf.exe -c <DEVICE_IP> -p <DEVICE_PORT> -i 1 -t 100`
4. The RS9116W EVK accepts connection request and receives data on the TCP server port and exit after receiving configured NUMBER_OF_PACKETS

![Receiving data on the TCP server port](/wifibt-wc-snippet-examples/2.14.0/images/iperf-client-cmd.png)

1. If rsi_wlan_ap_stop() API is used to turn off the module's soft Access Point, then its Wi-Fi network closes the connection with all connected clients and it stops beaconing its Wi-Fi network of specified SSID.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Throughput Dual IP (IPv4 and IPv6) Application

##### Introduction

This application demonstrates the procedure to measure WLAN UDP/TCP throughput in both ipv4 and ipv6 simultaneously by configuring the RS9116W.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- A computer running Iperf (may be the same PC or Mac used to program the Host MCU)
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wi-Fi Access Point

![Figure: Setup Diagram for WLAN Throughput Example](/wifibt-wc-snippet-examples/2.14.0/images/throughputdualipv4v6setupncp.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)
- Installation of Build tools for Linux including the gcc compiler (or equivalent on PC or Mac)  
  - For Ubuntu, use the following command for installation: `user@ubuntu:~$ sudo apt install build-essential`
- If you don't have Linux, [Cygwin for Windows](https://www.cygwin.com/) may be used instead
- A working installation of [iPerf version 2.0.9](https://iperf.fr/iperf-download.php#windows).  **Note:** iPerf version 2.0.9 is the only version that has been verified to work with this example.

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi Configuration

Configure the following parameters in [rsi_dual_ip.c] to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID          "SILABS_AP"  // Wi-Fi Network Name
#define PSK           "1234567890" // Wi-Fi Password
#define SECURITY_TYPE RSI_WPA2     // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
#define CHANNEL_NO    0            // Wi-Fi channel if the softAP is used (0 = auto select)
```

###### Client/Server IP Settings

```c
#define PORT_NUM            <local_port>        // Local port to use
#define SERVER_PORT         <remote_port>       // Remote server port
#define SERVER_IP_ADDRESS   "192.168.0.111"     // Remote server IPv4 address .
#define SERVER_IP_ADDRESS_6 "2001:db8:0:1::121" // Remote server IPv6 address .
                                          
```

##### Throughput Measurement Types

The application is configured to measure throughput using UDP, TCP in ipv4 and ipv6 respectively.

```c
#define THROUGHPUT_TYPE_4 UDP_TX_4
#define THROUGHPUT_TYPE_6 TCP_TX_6
```

#Testing Throughput
There are two 'ends' involved when measuring throughput, data is sent between the client end and the server end. By default, the Iperf protocol sends data from the Client to the Server to measure throughput. Depending on the configuration selected, the RS9116W may be the client or the server. In general, it is advisable to start the server before the client since the client will immediately begin to try to connect to the server to send data.

The following sections describe how to run the RS9116W throughput application together with examples for various Iperf configurations that run on the PC.

##### Running the RS9116 Application

After making any custom configuration changes required, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/).

##### UDP Tx v4 Throughput

To measure UDP Tx throughput, configure the RS9116W as a UDP client and start a UDP server on the remote PC.
The Iperf command to start the UDP server on the PC is:

> `C:\> iperf.exe -s -u -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -u -p 5001 -i 1`

##### TCP Tx v6 Throuhgput

To measure TCP Tx throughput, configure the RS9116W as a TCP client and start a TCP server on the remote PC.
The Iperf command to start the TCP server is:

> `C:\> iperf.exe -s -V -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -V -p 5001 -i 1`

#Selecting Bare Metal
The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

##### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

##### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Socket Select

##### 1. Purpose / Scope

This application demonstrates how to create the multiple sockets in RS9116W EVK and monitor multiple sockets for a certain activity to occur. If there is some data to be read on one of the sockets, the Select provides the response about the socket whether the data is to be read on the socket or not.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- TCP client application running in Windows PC2 (This uses iperf application to open TCP client socket in remote PC)

![Setup Diagram for socket select Example](/wifibt-wc-snippet-examples/2.14.0/images/image198.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in the remote PC.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image198a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_socket_select.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                    "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0 device will scan all channels.

```c
#define CHANNEL_NO                              0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                           RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                  "1234567890"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                               1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                               0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                 0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                 0x00FFFFFF
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                         15000
```

User can connect to access point through PMK

To Enable keep 1 else 0

```c
#define CONNECT_WITH_PMK                         0
```

> Note:
> If CONNECT_WITH_PMK is enabled, SECURITY_TYPE is set to RSI_WPA2_PMK.

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                      RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                  FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                    RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP           (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_EXT_TCPIP_FEATURE_BITMAP         (RSI_NUMBER_OF_SELECTS << 12)
#define RSI_CUSTOM_FEATURE_BIT_MAP           0
#define RSI_BAND                             RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE          0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE          1
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/socket_select_app/projects/socket_select_app-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project.
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/socket_select_app/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. After the program gets executed, RS9116W EVK is configured as client and connects to AP and gets IP.
3. After successful connection with the access point, the socket select is issued for the desired socket.
4. Open TCP client from WindowsPC2 and connect to TCP server opened on the device on port number DEVICE_PORT. The Iperf command to start the TCP client is:

> `C:\> iperf.exe -c <Module_IP> -p <DEVICE_PORT> -i 1 -t <time interval in sec>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 192.168.0.100 -p 5001 -i 1 -t 30`

1. Select provides the response about the socket whether the data is to be read on the socket or not.
2. If data is to be received on the socket, then the receive function is called on the socket.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Calibration

##### 1. Purpose / Scope

This application demonstrates the procedure to calibrate the carrier frequency offset, EVM offset, Tx gain offset and few more parameters and update them to the Flash/Efuse. Customers need to calibrate these two parameters on their platforms after chip integration.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Spectrum Analyzer
- RF Cable connects between EVK and Spectrum Analyzer.

![Setup Diagram for Calibration Example](/wifibt-wc-snippet-examples/2.14.0/images/image-c1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment.  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).
- Python 3 installation

###### 2.3 Flowchart for Calibration Process

![Flowchart for Calibration Process](/wifibt-wc-snippet-examples/2.14.0/images/image-c2.png)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/calibration_app/projects/calibration_app-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/calibration_app/projects/calibration_app-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/calibration_app/projects/calibration_app-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-c10.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/calibration_app/projects/calibration_app-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_calib_app.c file. The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

To set TX power in dBm. The valid values are from 2dbm to 18dbm for WiSeConnectTM module.

```c
#define RSI_TX_TEST_POWER                         18
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_1
```

To configure length of the TX packet. Valid values are in the range of 24 to 1500 bytes in the burst mode and range of 24 to 260 bytes in the continuous mode.

```c
#define RSI_TX_TEST_LENGTH                        1000 
```

To configure Burst mode or Continuous mode

```c
#define RSI_TX_TEST_MODE                           RSI_BURST_MODE
```

To configure the channel number in 2.4 GHz or 5GHz. Here mention the channel number. For example user wants to given channel 1 in 2.4 GHz

```c
#define RSI_TX_TEST_CHANNEL                       1
```

To select internal antenna or UFL connector

```c
#define RSI_ANTENNA                               0
```

> **Note:** RSI_ANTENNA value should be set to 0 for Single Band module and 1 for Dual Band module

To select antenna gain in db for 2.4GHz band. Valid values are from 0 to 10.

```c
#define RSI_ANTENNA_GAIN_2G                       0
```

To select antenna gain in db for 5GHz band. Valid values are from 0 to 10.

```c
#define RSI_ANTENNA_GAIN_5G                       0
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                           RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                       FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                         RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                0
#define RSI_BAND                                  RSI_BAND_2P4GHZ
```

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/calibration_app/projects/calibration_app-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import theEFR32/EFM32 project from `<SDK>/examples/snippets/wlan/calibration_app/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Make connections as per setup diagram (above) and set the appropriate settings on the Spectrum Analyzer by using the steps mentioned in below **Spectrum Analyzer Settings**.
2. After the program gets executed, the RS9116W device will start the transmit test with the given configuration.
3. Refer the below image which shows when RS9116W device transmits packets in Burst mode with different Tx power and different transmission rates in channel 1 with length 1000bytes.  
   ```sh  
   RSI_TX_TEST_POWER    - 18dBm  
   RSI_TX_TEST_RATE     - 1Mbps  
   RSI_TX_TEST_LENGTH   - 1000  
   RSI_TX_TEST_MODE     - BURST mode  
   RSI_TX_TEST_CHANNEL  - 1   
   ```
4. Observe the Avg Freq Error (highlighted) on the screen and now try to adjust the frequency offset by using CLI commands with serial terminal (Docklight or Teraterm)

![Avg Freq Error (highlighted) on the screen](/wifibt-wc-snippet-examples/2.14.0/images/image-c7.png)

###### Frequency Offset Correction

Frequency offset correction will be done by using the rsi_freq_offset command. This command is used during the RF calibration process and requires PER mode transmissions to be initiated prior. This command sends freq_offset (deviation) as observed on the signal analyzer against the expected channel frequency.

Prototype :

> `rsi_freq_offset = freq_offset_in_khz <CR><LF>`
> 
> Here freq_offset_in_khz means Frequency deviation in KHz or ppm

Examples :

> `rsi_freq_offset=10<CR><LF>`
> 
> `rsi_freq_offset=-10<CR><LF>`

![CLI commands](/wifibt-wc-snippet-examples/2.14.0/images/image-c8.png)

> **Note:** User can use the above command for any number of times till it gets tuned to desired frequency offset.

Open the serial terminal (Docklight/TeraTerm tool) and enter the following commands. User can provide input to correct frequency offset by sending the commands on console. This should lead towards a correction in the frequency offset as observed earlier and repeat till the error is within the tolerance limits (+/- 2 KHz tolerance limits).

See the below picture after frequency offset correction.

![After frequency offset correction](/wifibt-wc-snippet-examples/2.14.0/images/image-c9.png)

> **Note:** freq_offset_in_khz can be either +ve or -ve. When user enters the freq offset as observed on signal analyzer (+ve/-ve), a small freq offset correction is done. User needs to iterate this till the freq offset is within tolerance limits.

###### Gain Offset Correction:

###### Update XO Ctune and Gain Offset (heading level 7)

Using rsi_calib_write command the calibrated XO Ctune and calculated gain offset can be updated to target memory (Flash/Efuse).

```sh
Prototype :
rsi_calib_write=<target>,<flags>,<gain_offset_low>,<gain_offset_mid>,<gain_offset_high>,<xo_ctune>
```

**Parameters**

|Parameter|Description| | |
|---|---|---|---|
|target|Value|Macro|Description|
| |0|BURN_INTO_EFUSE|Burns calibration data to EFuse|
| |1|BURN_INTO_FLASH|Burns calibration data to Flash|
|flags|BIT|Macro|Description|
| |0| |Reserved for future use|
| |1|BURN_FREQ_OFFSET|1 - Update XO Ctune to calibration data|
| | |0 - Skip XO Ctune update|
| |2|SW_XO_CTUNE_VALID|1 - Use XO Ctune provided as argument to update calibration data|
| | |0 - Use XO Ctune value as read from hardware register|
| |3|BURN_XO_FAST_DISABLE|Used to apply patch for cold temperature issue (host interface detection) observed on CC0/CC1 modules. \ref appendix|
| |4|BURN_GAIN_OFFSET_LOW|1 - Update gain offset for low sub-band (2 GHz)|
| | |0 - Skip low sub-band gain-offset update|
| |5|BURN_GAIN_OFFSET_MID|1 - Update gain offset for mid sub-band (2 GHz)|
| | |0 - Skip mid sub-band gain-offset update|
| |6|BURN_GAIN_OFFSET_HIGH|1 - Update gain offset for high sub-band (2 GHz)|
| | |0 - Skip high sub-band gain-offset update|
| |7|SELECT_GAIN_OFFSETS_1P8V|1 - Update gain offsets for 1.8 V|
| | |0 - Update gain offsets for 3.3 V|
| |31-8| |Reserved for future use|
|gain_offset_low|gain_offset as observed in dBm in channel-1| |
|gain_offset_mid|gain_offset as observed in dBm in channel-6| |
|gain_offset_high|gain_offset as observed in dBm in channel-11| |
|xo_ctune|This field allows user to directly update xo_ctune value to calibration data bypassing the freq offset loop, valid only when BURN_FREQ_OFFSET & SW_XO_CTUNE_VALID of flags is set.| |The range of xo_ctune is [0, 255], and the typical value is 80|
| |

> **Note:** For RS9116 Rev 1.5, the user needs to calibrate gain-offset for low sub-band (channel-1), mid sub-band (channel-6), and high sub-band (channel-11) and input the three gain-offsets to this API and set the corresponding flags to validate it. However, for RS9116 Rev 1.4, the user needs to calibrate gain-offset for low sub-band (channel-1) only and input the three gain-offsets to this API with dummy values for mid and high gain offsets and set the flag for low gain offset only to validate it. \n

> **Precondition:**rsi_freq_offset command needs to be called before this command when xo ctune value from hardware register is to be used.

Gain offset can be calculated using the following equation :

gain_offset = observed_power_level + cable_loss - configured_power_level

Example :

gain_offset = 14.3 + 1.7 (assuming) - 18 = -2 dBm

For 2 GHz band, the gain offset has to calibrated for three channels, viz. channel-1, channel-6, channel-11. After the three gain offsets are calculated these can be written to Flash using the `rsi_calib_write` command. the command to update gain offsets as -2, 2, 1 dBm for channel-1, channel-6, channel-11, and XO Ctune value as it reads from hardware is:

`rsi_calib_write=1,114,-2,2,1<CR><LF>`

> NOTE :
> The gain_offset can be negative but not a floating value.
> Once the frequency offset is corrected after multiple tries, rsi_calib_write commands has to be given once for all to write the values to flash.

The application reads the updated calibration values for verification by using `rsi_calib_read` command and displays.

![calib data](/wifibt-wc-snippet-examples/2.14.0/images/image-c11.png)

###### EVM Offset Correction

EVM offset correction will be done by using the rsi_evm_offset command. This command is used during the RF calibration process and requires PER mode transmissions to be initiated prior. This command sends evm_offset (deviation) as observed on the signal analyzer.

**Note:**
After this command is send, application is required to restart the transmission for the EVM offset correction to reflect.

###### EVM offset setting procedure

1. Configure the RF parameters in the SAPI code, like frequency, data rate and set power index to 127.
2. Change the #define RSI_TX_TEST_POWER 18 to #define RSI_TX_TEST_POWER 127 in rsi_calib_app.c for EVM offset calibration.
3. Load the SAPI code onto your host microcontroller.  
   Load the firmware file onto the WMS chip.
4. Select the port on which the host is connected to communicate with the WMS chip and send commands.
5. Tune the EVM offset using rsi_evm_offset command. Refer to the section below for setting the parameters.
6. Write the EVM offsets into the flash using rsi_evm_write command. Refer to the section below for setting the parameters.
7. Reset the WMS module to verify the changes.

###### Below Section about setting parameters in rsi_evm_offset and rsi_evm_write

Prototype :

> `rsi_evm_offset =<index>, <evm_offset> <CR><LF>`
> 
> Here index is used to update the evm_offset_cust[index] range from 0 to 4

```c
 0 - customer_evm_offset_11B
 1 - customer_evm_offset_11G_6M_24M
 2 - customer_evm_offset_11G_36M_54M_11N_MCS4_MCS6
 3 - customer_evm_offset_11N_MCS0_MCS3
 4 - customer_evm_offset_11N_MCS7
```

> Here evm_offset means EVM offset value

Examples :

> `rsi_evm_offset=0,10<CR><LF>`
> 
> `rsi_evm_offset=0,-10<CR><LF>`

![CLI commands](/wifibt-wc-snippet-examples/2.14.0/images/image-c14.png)

> **Note:** evm_offset can be either +ve or -ve. When user enters the evm offset as observed on signal analyzer (+ve/-ve), a small EVM offset correction is done. User needs to iterate this till the EVM offset is within the limits

###### Update EVM Offset (heading level 7)

Using rsi_evm_write command the calibrated calculated EVM offset can be updated to target memory (Flash).

```sh
Prototype :
rsi_evm_write=<target>,<flags>,<evm_offset_0>,<evm_offset_1>,<evm_offset_2>,<evm_offset_3>,<evm_offset_4>
```

> Here Target means based on value need to write into on Flash/Efuse

> 0 - Efuse

> 1 - Flash

Note:Efuse not supported .

> Here flag means based on flag value will update corresponding index

**Parameters**

|Bit|MACRO|Description|
|---|---|---|
|0|EVM_OFFSET_CUST_0|1 - Update customer_evm_offset_11B rate calibration data \n	0 - Skip evm_offset update|
|1|EVM_OFFSET_CUST_1|1 - Update customer_evm_offset_11G_6M_24M rate calibration data \n 0 - Skip evm_offset update|
|2|EVM_OFFSET_CUST_2|1 - Update customer_evm_offset_11G_36M_54M_11N_MCS4_MCS6 rate calibration data \n0 - Skip evm_offset update|
|3|EVM_OFFSET_CUST_3|1 - Update customer_evm_offset_11N_MCS0_MCS3 rate calibration data \n	0 - Skip evm_offset update|
|4|EVM_OFFSET_CUST_4|1 - Update customer_evm_offset_11N_MCS7 rate calibration data \n	0 - Skip evm_offset update|
|31-5| |Reserved|

Example for rsi_evm_write :

To update EVM offset into flash use the command below.

> `rsi_evm_write=1,31,-20,-10,10,20,-7 <CR><LF>`

> NOTE :
> In the above example,
> 
> The flag value is 31 (In binary : 11111) - it should update all EVM offset values to flash.

> If flag value is 3 (In binary : 0011) - it should update EVM offset value of -20 and -10.

> If flag value is 4 (binary : 0100) - it should update EVM offset value of 10 etc.

![CLI commands](/wifibt-wc-snippet-examples/2.14.0/images/image-c15.png)

> NOTE :
> The evm_offset can be negative but not a floating value.
> Once the EVM offset is corrected after multiple tries, rsi_evm_write  commands has to be given once for all to write the values to flash.

###### Examples with Pics.

###### Customer_evm_offset_11B:

Change the below macros in rsi_calib_app.c for EVM offset calibration.

```c
#define RSI_TX_TEST_POWER                         127
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_1
```

**Before EVM offset correction**

For 1Mbps, the RMS EVM average is 10.78% and the average burst power is 16.3dB.
For the same case the spectral emission mask limit is failing as shown below.

![Before EVM offset correction](/wifibt-wc-snippet-examples/2.14.0/images/image-c16.png)
![Before EVM offset correction](/wifibt-wc-snippet-examples/2.14.0/images/image-c17.png)

**Commands**

The following are the commands used for this case.

![CLI commands](/wifibt-wc-snippet-examples/2.14.0/images/image-c18.png)

**After EVM offset correction**

After setting the EVM offset the RMS EVM average value changes to 6.14% and average burst power reduces to 11.4dB.
The spectral emission mask is now passing as shown below.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c19.png)
![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c20.png)

###### Customer_evm_offset_11G_6M_24M:

Change the below macros in rsi_calib_app.c for EVM offset calibration.

```c
#define RSI_TX_TEST_POWER                         127
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_6
```

**Before EVM offset correction**

For 6Mbps, the RMS EVM average is -9.8dB and the average burst power is 16.7dB.
For the same case the spectral emission mask limit is failing as shown below.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c21.png)
![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c22.png)

**Commands**

The following are the commands used for this case.

![CLI commands](/wifibt-wc-snippet-examples/2.14.0/images/image-c23.png)

**After EVM offset correction**

After setting the EVM offset the RMS EVM average value changes to -13.5dB  and average burst power reduces to 12.4dB.
The spectral emission mask is now passing as shown below

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c24.png)
![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c25.png)

###### Customer_evm_offset_11G_36M_54M_11N_MCS4_MCS6:

Change the below macros in rsi_calib_app.c for EVM offset calibration.

```c
#define RSI_TX_TEST_POWER                         127
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_54
```

**Before EVM offset correction**

For 54Mbps, the RMS EVM average is -18.9dB which below the limit, and the average burst power is 12.8dB. For this case spectral emission mask will generally pass and hence is not shown.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c26.png)

**Commands**

The following are the commands used for this case.

![CLI commands:](/wifibt-wc-snippet-examples/2.14.0/images/image-c27.png)

**After EVM offset correction**

After setting the EVM offset the RMS EVM average value changes to -26.6dB and average burst power reduces to 8.3dB.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c28.png)

###### Customer_evm_offset_11N_MCS0_MCS3:

Change the below macros in rsi_calib_app.c for EVM offset calibration.

```c
#define RSI_TX_TEST_POWER                         127
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_MCS0
```

**Before EVM offset correction**

For MCS0, the RMS EVM average is -18.9dB, and the average burst power is 11.7dB.
For the same case the spectral emission mask limit is failing as shown below.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c29.png)
![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c30.png)

**Commands**

The following are the commands used for this case.

![CLI commands:](/wifibt-wc-snippet-examples/2.14.0/images/image-c31.png)

**After EVM offset correction**

After setting the EVM offset the RMS EVM average value changes to -15dB and average burst power reduces to 4.6dB.
The spectral emission mask is now passing as shown below.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c32.png)

###### Customer_evm_offset_11N_MCS7:

Change the below macros in rsi_calib_app.c for EVM offset calibration.

```c
#define RSI_TX_TEST_POWER                         127
```

To set transmit data rate.

```c
#define RSI_TX_TEST_RATE                          RSI_RATE_MCS7
```

**Before EVM offset correction**

For MCS7, the RMS EVM average is -16.3dB which below the limit, and the average burst power is 12dB. For this case spectral emission mask will generally pass and hence is not shown.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c33.png)

**Commands**

The following are the commands used for this case.

![CLI commands :](/wifibt-wc-snippet-examples/2.14.0/images/image-c34.png)

**After EVM offset correction**

After setting the EVM offset the RMS EVM average value changes to -28dB and average burst power reduces to 6.7dB.

![Figure :](/wifibt-wc-snippet-examples/2.14.0/images/image-c35.png)

###### Spectrum Analyzer Settings

**Below are the necessary settings to see Polar Graph Spectrum Analyzer settings**

1. Frequency channel → center frequency→ 2412MHz for channel1.
2. SpanX scale → span→ 50MHz
3. Mode → WLAN → Mode setup → Radio Std → 802.11a/b/g → 802.11 b/g
4. Trigger → RF Burst

The frequency error section shows the error that needs to be adjusted. Using `rsi_freq_offset` and `rsi_calib_write` command user should be able to adjust the frequency error.

###### Acronyms and Abbreviations

|Acronym|Description|
|---|---|
|TX|Transmit|
|RX|Receive|
|RF|Radio Frequency|
|WLAN|Wireless Local Area Network|
|XO|Crystal Oscillator|
|Ctune|Captune|
|Q7|Single band RS9116 EVK|
|A7|Dual band RS9116 EVK|

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### MQTT Client (IPv6)

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK as MQTT client and how to establish connection with MQTT broker and how to subscribe, publish and receive the MQTT messages from MQTT broker. In this application, RS9116W EVK is configured as WiFi station and connects to Access Point. After successful WiFi connection, application connects to MQTT broker and subscribes to the topic _**"MQTT_DEMO"**_ and publishes a message _**"THIS IS MQTT CLIENT DEMO FROM APPLICATION"**_ on that subscribed topic. The application waits to receive the data published on subscribed topic by other clients.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Windows PC1 with with MQTT broker installed in it
- Windows PC2 with with MQTT client utility installed in it

![Setup Diagram for MQTT Client Example](/wifibt-wc-snippet-examples/2.14.0/images/mqttclientv6setupncp.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [MQTT Broker](https://mosquitto.org/files/binary/win64/mosquitto-1.6.12-install-windows-x64.exe) in Windows PC1.

> **Note:** This example has been tested with Mosquitto _v1.5.3_, _v1.6.9_, and _v1.6.12_.

- [MQTT Utility (MQTT Explorer)](http://mqtt-explorer.com/) in Windows PC2.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/mqtt_client_v6/projects/mqtt_client_v6-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client_v6/projects/mqtt_client_v6-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client_v6/projects/mqtt_client_v6-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-2a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/mqtt_client_v6/projects/mqtt_client_v6-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

> Note :
> If the user wants to use MQTT library(in Host), then user can opt for this mqtt application.

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_mqtt.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application, STA supports Open, WPA-PSK, WPA2-PSK securities.

The valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA    - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE RSI_OPEN
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK "<psk>"
```

CLIENT_PORT port refers to device MQTT client port number

```c
#define CLIENT_PORT 5001
```

SERVER_PORT port refers remote MQTT broker/server port number

```c
#define SERVER_PORT 1883
```

SERVER_IP_ADDRESS refers remote peer IPv6 address (Windows PC2) to connect with MQTT broker/server socket.

```c
#define SERVER_IP_ADDRESS "2001:db8:0:1::121"
```

MQTT client keep alive period

```c
#define RSI_KEEP_ALIVE_PERIOD 100
```

Memory to initialize MQTT client Info structure

```c
#define MQTT_CLIENT_INIT_BUFF_LEN 3500
```

Global buffer or memory which is used for MQTT client initialization. This buffer is used for the MQTT client information storage.

```c
uint8_t mqqt_client_buffer[MQTT_CLIENT_INIT_BUFF_LEN]
```

QOS indicates the level of assurance for delivery of an Application Message.

QoS levels are:

0 - At most once delivery

1 - At least once delivery

2 - Exactly once delivery

```c
#define QOS 0
```

RSI_MQTT_TOPIC refers to which topic WiSeConnect MQTT client is supposed to subscribe.

```c
#define RSI_MQTT_TOPIC "MQTT_DEMO"
```

MQTT Message to publish on the topic subscribed

```c
uint8_t publish_message[] ="THIS IS MQTT CLIENT DEMO FROM APPLICATION"
```

MQTT Client ID with which MQTT client connects to MQTT broker/server

```c
uint8_t clientID[] = "MQTTCLIENT"
```

User name for login credentials

```c
int8_t username[] = "username"
```

Password for login credentials

```c
int8_t password[] = "password"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN 15000
```

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE 1
```

**Note!**

> If the user wants to configure the STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP6, and GATEWAY6 macros Otherwise set the DHCP_MODE macro to "0" and configure the following DEVICE_IP6 and GATEWAY6 macros.

---

IPv6 address to be configured to the device.

Example: To configure "2001:db8:0:1::121" as IP address, update the macro DEVICE_IP6 as below

```c
#define DEVICE_IP6 "2001:db8:0:1::121"
```

IP address of the gateway.

Example: To configure "2001:db8:0:1::121" as Gateway, update the macro GATEWAY6 as below

```c
#define GATEWAY6 "2001:db8:0:1::121"
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE            RSI_DISABLE
#define RSI_FEATURE_BIT_MAP        FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS          RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_IPV6)
#define RSI_CUSTOM_FEATURE_BIT_MAP 0
#define RSI_BAND                   RSI_BAND_2P4GHZ
```

For running **MQTT** with **SSL**, please enable **TCP_IP_FEAT_SSL** in **rsi_wlan_config.h** file, as shown below. Also load the related **SSL Certificates** in the module using rsi_wlan_set_certificate() API and Need to enable **SSL** flag **RSI_SSL_ENABLE** in rsi_mqtt_connect() API.

```c
#define CONCURRENT_MODE     RSI_DISABLE
#define RSI_FEATURE_BIT_MAP FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS   RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP \
  (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP     EXT_FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_EXT_TCPIP_FEATURE_BITMAP   CONFIG_FEAT_EXTENTION_VALID
#define RSI_BAND                       RSI_BAND_2P4GHZ
```

> Note:
> In rsi_mqtt_client.h change 'MQTT_VERSION' macro to either 3 or 4 based on the MQTT broker support version (Supported versions are 3 and 4).

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/mqtt_client_v6/projects/mqtt_client_v6-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings (Project -> Options for Target -> C/C++ -> Preprosessor Symbols)
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/mqtt_client_v6/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Add the macro RSI_CONFIGURE_IPV6=1 in the preprocessor settings to enable IPv6 (Project -> Properties -> C/C++ Build -> Settings ->GNU ARM C Compiler ->Preprosessor)
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps (heading level 7)

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. To run MQTT broker in Windows PC1, open command prompt and go to MQTT installed folder (Ex: C:\Program Files\mosquitto) and run the following command:

```sh
mosquitto.exe –p 1883 –v
```

![Run MQTT broker in Windows PC1](/wifibt-wc-snippet-examples/2.14.0/images/image-3.png)

1. Open MQTT Explorer in Windows PC2 and delete the existing connections if any and click on "Advanced" as shown in the below image.

![Delete the existing connections](/wifibt-wc-snippet-examples/2.14.0/images/image-4.png)

1. Delete the existing topic names if any. Enter the desired "TOPIC_NAME" in topic field and click on "ADD". Then the desired topic name can be observed in the topic list and click on "BACK" as shown in below image.

![Add "TOPIC_NAME" in topic field](/wifibt-wc-snippet-examples/2.14.0/images/image-5.png)

1. Connect to MQTT broker by giving IP address and port number of Windows PC1 in HOST and PORT fields in MQTT Explorer respectively and click on "CONNECT" to connect to the MQTT broker. If you are running your MQTT broker on the same PC then the following configuration is made as shown in the below image.

![MQTT broker Configuration](/wifibt-wc-snippet-examples/2.14.0/images/image-6.png)

1. After the program gets executed, the RS9116W EVK will be connected to the same access point having the configuration same as that of in the application and get IP.
2. Once the RS9116W EVK gets connected to the MQTT broker, it will subscribe to the topic **RSI_MQTT_TOPIC (Ex: "MQTT_DEMO")**. The user can see the client connected and subscription success information in the MQTT broker.

![User can see the client connected and subscription success information](/wifibt-wc-snippet-examples/2.14.0/images/mosquittoconnectsubscribemqttdemov6.png)

1. After successful subscription to the topic **RSI_MQTT_TOPIC (Ex: "MQTT_DEMO")**, the RS9116W EVK publishes a message which is given in **publish_message** array  
   (Ex: "THIS IS MQTT CLIENT DEMO FROM APPLICATION") on the subscribed topic.
2. MQTT Explorer which is running on Windows PC2 will receive the message published by the RS9116W EVK as it subscribed to the same topic.

![MQTT Explorer receives the message published by the RS9116W EVK](/wifibt-wc-snippet-examples/2.14.0/images/image-8.png)

1. In the MQTT broker, user can observe the published message as the MQTT client is subscribed topic to that topic.

![In MQTT broker, user can observe the published message](/wifibt-wc-snippet-examples/2.14.0/images/mosquittopublishfrommodulemqttdemov6.png)

1. Now to publish a message using MQTT Explorer, enter the topic name under "Publish" tab, select "raw" data format, type the data that user wishes to send and then click on "publish". This message will be received by the RS9116W EVK.

![To publish a message using MQTT Explorer](/wifibt-wc-snippet-examples/2.14.0/images/image-10.png)

###### 5.4 Procedure For exexcuting the Application when enabled with SSL

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. Install MQTT broker in Windows PC2 which is connected to access point through LAN.
3. User needs to update the mosquitto.conf file with the proper file paths, in which the certificates are available in the mosquitto.conf file.
4. Also, add "certs" folder to the mosquitto broker folder.
5. Execute the following command in MQTT server installed folder. (Ex:  C:\Program Files\mosquitto>mosquitto.exe -c mosquitto.conf -v) (Port can be 1883/8883)  
   `mosquitto.exe -c mosquitto.conf -v`

![For opening MQTT server ](/wifibt-wc-snippet-examples/2.14.0/images/image-11.png)

1. If you see any error - Unsupported tls_version "tlsv1", just comment the "tls_version tlsv1" in mosquitto.conf file
2. From here, repeat the steps from step 4 to step 9 of **5.3** to complete the execution.

> Note:
> Multiple MQTT client instances can be created.
> If mosquitto isn't allowing external connections to broker, add the below lines in mosquitto.conf file:
> listener 1883
> allow_anonymous true

> For using a different config file for mosquitto broker, use command:
> "mosquitto -v -p 1883 -c config/mosquitto.conf"
> where config is the sub folder and mosquitto.conf is the different config file than default.

> Limitations:
> MQTT client application keeps on polling for the data to receive on the subscribed topic irrespective of receive timeout mentioned in the rsi_mqtt_poll_for_recv_data API.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Concurrent Mode

##### 1. Purpose / Scope

This application demonstrates how to configure the RS9116W EVK in both Wi-Fi Station mode and Access Point mode and how to transfer data in both modes.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point.
- Windows PC2 (Remote PC) with iperf application.
- Windows PC with Wifi Station.

![Setup Diagram for Concurrent Mode Example](/wifibt-wc-snippet-examples/2.14.0/images/image105.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [Iperf Application](https://iperf.fr/iperf-download.php) in Windows PC (Remote PC)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below      
      ![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image105a.png)  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.      
      - Project path:`<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_concurrent_mode.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                          "SILABS_AP"
```

STA_SECURITY_TYPE refers to the type of security. In concurrent mode STA supports Open, WPA and WPA2 securities.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define STA_SECURITY_TYPE             RSI_WPA2
```

STA_PSK refers to the STA secret key to connect with the secured Access Point.

```c
#define STA_PSK                       "1234567890"
```

DEVICE_PORT port refers internal TCP client port number

```c
#define DEVICE_PORT                        5001
```

REMOTE_PORT port refers remote TCP server port number which is opened in Windows PC2.

```c
#define REMOTE_PORT                        5001
```

SERVER_IP_ADDRESS refers remote peer (Windows PC2) IP address to connect with TCP server socket.

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.0.100" as remote IP address, update the macro **SERVER_IP_ADDRESS** as **0x6400A8C0**.

```c
#define SERVER_IP_ADDRESS                  0x6400A8C0
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements (heading level 7)

AP_SSID refers to the name of the WiSeConnect Access point would be created.

```c
#define AP_SSID                       "SILABS_AP"
```

AP_CHANNEL_NO refers to the channel in which AP would be started

```c
#define AP_CHANNEL_NO                 11
```

> Note:
> 
> 1. Valid values for CHANNEL_NO are 1 to 11 in 2.4GHz band and 36 to 48 & 149 to 165 in 5GHz. In this example default configured band is 2.4GHz. If user wants to use 5GHz band then user has to set RSI_BAND macro to 5GHz band in rsi_wlan_config.h file.
> 2. In concurrent mode, STA and AP should be configured in same channel. Configure the AP_CHANNEL_NO to same channel in which Wireless Access point (to which WiSeConnect STA connects) exist.

AP_SECURITY_TYPE refers to the security type of the WiSeConnect Access Point. Access point supports OPEN, WPA-PSK, WPA2-PSK security modes.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                   RSI_WPA2
```

AP_ENCRYPTION_TYPE refers to the type of Encryption method .Access point supports OPEN, TKIP and CCMP methods.

Valid configurations are:

- RSI_CCMP - For CCMP encryption
- RSI_TKIP - For TKIP encryption
- RSI_NONE - For open encryption

```c
#define AP_ENCRYPTION_TYPE                RSI_CCMP
```

AP_PSK refers to the secret key if the Access point to be configured in WPA/WPA2-PSK security modes.

```c
#define AP_PSK                           “1234567890”
```

BEACON_INTERVAL refers to the time delay between two consecutive beacons in milliseconds in AP mode. Allowed values are integers from 100 to 1000 which are multiples of 100.

```c
#define BEACON_INTERVAL                    100
```

DTIM_INTERVAL refers DTIM interval of the Access Point. Allowed values are from 1 to 255.

```c
#define DTIM_INTERVAL                       4
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

NUMEBR_OF_PACKETS refers how many packets to send from TCP client to TCP server

```c
#define NUMBER_OF_PACKETS                 1000
```

DHCP_MODE refers whether IP address configured through DHCP or STATIC in STA mode

```c
#define DHCP_MODE                         1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to 1 and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.0.10" as IP address, update the macro DEVICE_IP as 0x010AA8C0.

```c
#define DEVICE_IP                       0X0A00A8C0
```

IP address of the gateway should also be in long format and in little endian byte order.

Example: To configure "192.168.0.1" as Gateway, update the macro GATEWAY as 0x0100A8C0

```c
#define GATEWAY                         0x0100A8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                         0x00FFFFFF
```

> Note:
> 
> 1. This application is not providing the facility to configure the Access Point’s IP Parameters. Default IP address of the Silicon Labs Access point is “192.168.100.76”
> 2. In concurrent mode, IP networks of Silicon Labs STA and Silicon Labs Access  Point both should be different. Configure Wireless Access Point IP network(Ex: 192.168.0.1) other than Silicon Labs Access point IP network.

###### 4.2 Open rsi_wlan_config.h file.User can also modify the below parameters as per their needs and requirements

```c
#define CONCURRENT_MODE                 RSI_ENABLE
#define RSI_FEATURE_BIT_MAP             FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS               RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP      (TCP_IP_FEAT_DHCPV4_SERVER | TCP_IP_FEAT_DHCPV4_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP      0
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP     0
#define RSI_BAND                        RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.  
  ```c  
  #define ENABLE_POWER_SAVE 0  
  ```
- If user wants to run the application in power save, modify the below macro.  
  ```c  
  #define ENABLE_POWER_SAVE 1  
  ```

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/).

- Open the project `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms.

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/concurrent_mode/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the access point in OPEN/WPA-PSK/WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Open iperf application in Windows PC2(Remote PC) command prompt which is connected to the access point
3. Open TCP server using the below command in command prompt.  
   `iperf.exe –s -p <SERVER_PORT> -i 1`
4. After the program gets executed, RS9116W EVK connects to the access point.
5. On other side, RS9116W EVK acts as an access point with provided configurations in **Section 4.1.2**
6. After successful connection in STA mode, RS9116W EVK connects to TCP server socket opened on Windows PC2 (Remote PC) using TCP client socket and sends configured NUMBER_OF_PACKETS to remote TCP server. Refer the below image for reception of TCP data on TCP server.  
   ![Reception of TCP data on TCP server.](/wifibt-wc-snippet-examples/2.14.0/images/image107.png)
7. Connect Windows PC with Wifi station to RS9116W EVK access point
8. After successful connection, open command prompt inWindows PC with WiFi station and initiate ping by using below command  
   `ping <RS9116W EVK ip address> -t`
9. The RS9116W EVK access point gives Ping reply for the received Ping Request. The below image depicts the ping success.  
   ![Ping Success](/wifibt-wc-snippet-examples/2.14.0/images/image108.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide).

#### MQTT Client

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK as MQTT client and how to establish connection with MQTT broker and how to subscribe, publish and receive the MQTT messages from MQTT broker. In this application, RS9116W EVK is configured as WiFi station and connects to Access Point. After successful WiFi connection, application connects to MQTT broker and subscribes to the topic _**"MQTT_DEMO"**_ and publishes a message _**"THIS IS MQTT CLIENT DEMO FROM APPLICATION"**_ on that subscribed topic. The application waits to receive the data published on subscribed topic by other clients.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Windows PC1 with with MQTT broker installed in it
- Windows PC2 with with MQTT client utility installed in it

![Setup Diagram for MQTT Client Example](/wifibt-wc-snippet-examples/2.14.0/images/image-2.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [MQTT Broker](https://mosquitto.org/files/binary/win64/mosquitto-1.6.12-install-windows-x64.exe) in Windows PC1.

> **Note:** This example has been tested with Mosquitto _v1.5.3_, _v1.6.9_, and _v1.6.12_.

- [MQTT Utility (MQTT Explorer)](http://mqtt-explorer.com/) in Windows PC2.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-2a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

> Note :
> If the user wants to use MQTT library(in Host), then user can opt for this mqtt application.

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_mqtt.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                       "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application, STA supports Open, WPA-PSK, WPA2-PSK securities.

The valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA    - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                              RSI_OPEN
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                        "<psk>"
```

CLIENT_PORT port refers to device MQTT client port number

```c
#define CLIENT_PORT                                5001
```

SERVER_PORT port refers remote MQTT broker/server port number

```c
#define SERVER_PORT                                1883
```

SERVER_IP_ADDRESS refers remote peer IP address (Windows PC2) to connect with MQTT broker/server socket.

```c
#define SERVER_IP_ADDRESS                          192.168.10.1
```

MQTT client keep alive period

```c
#define RSI_KEEP_ALIVE_PERIOD                      100
```

Memory to initialize MQTT client Info structure

```c
#define MQTT_CLIENT_INIT_BUFF_LEN                  3500
```

Global buffer or memory which is used for MQTT client initialization. This buffer is used for the MQTT client information storage.

```c
uint8_t mqqt_client_buffer[MQTT_CLIENT_INIT_BUFF_LEN]
```

QOS indicates the level of assurance for delivery of an Application Message.

QoS levels are:

0 - At most once delivery

1 - At least once delivery

2 - Exactly once delivery

```c
#define QOS                                        0
```

RSI_MQTT_TOPIC refers to which topic WiSeConnect MQTT client is supposed to subscribe.

```c
#define RSI_MQTT_TOPIC                             "MQTT_DEMO"
```

MQTT Message to publish on the topic subscribed

```c
uint8_t publish_message[] ="THIS IS MQTT CLIENT DEMO FROM APPLICATION"
```

> Note :
> As the publish message will be appended to MQTT header it is recommended to substract (topic length + 7 bytes of MQTT control fields) from maximum buf size limit for the protocol(TCP/SSL) to decide payload size.
> Example, if topic is "MQTT_DEMO", for TCP payload size should be of size 1444 bytes( = 1460 - 9 - 7), for SSL it sums up to 1354 bytes( = 1370 - 9 - 7).

MQTT Client ID with which MQTT client connects to MQTT broker/server

```c
uint8_t clientID[] = "MQTTCLIENT"
```

User name for login credentials

```c
int8_t username[] = "username"
```

Password for login credentials

```c
int8_t password[] = "password"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                            15000
```

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                                  1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                                  0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                    0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                    0x00FFFFFF
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                            RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                        FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                          RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                 TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP                 0
#define RSI_BAND                                   RSI_BAND_2P4GHZ
```

For running **MQTT** with **SSL**, please enable **TCP_IP_FEAT_SSL** in **rsi_wlan_config.h** file, as shown below. Also load the related **SSL Certificates** in the module using rsi_wlan_set_certificate() API and Need to enable **SSL** flag **RSI_SSL_ENABLE** in rsi_mqtt_connect() API.

```c
#define CONCURRENT_MODE                            RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                        FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                          RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                 (TCP_IP_FEAT_DHCPV4_CLIENT |  TCP_IP_FEAT_SSL  |  TCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP                 EXT_FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP             RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_EXT_TCPIP_FEATURE_BITMAP               CONFIG_FEAT_EXTENTION_VALID
#define RSI_BAND                                   RSI_BAND_2P4GHZ
```

> Note:
> In rsi_mqtt_client.h change 'MQTT_VERSION' macro to either 3 or 4 based on the MQTT broker support version (Supported versions are 3 and 4).

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/mqtt_client/projects/mqtt_client-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/mqtt_client/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps (heading level 7)

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. To run MQTT broker in Windows PC1, open command prompt and go to MQTT installed folder (Ex: C:\Program Files\mosquitto) and run the following command:

```sh
mosquitto.exe –p 1883 –v
```

![Run MQTT broker in Windows PC1](/wifibt-wc-snippet-examples/2.14.0/images/image-3.png)

1. Open MQTT Explorer in Windows PC2 and delete the existing connections if any and click on "Advanced" as shown in the below image.

![Delete the existing connections](/wifibt-wc-snippet-examples/2.14.0/images/image-4.png)

1. Delete the existing topic names if any. Enter the desired "TOPIC_NAME" in topic field and click on "ADD". Then the desired topic name can be observed in the topic list and click on "BACK" as shown in below image.

![Add "TOPIC_NAME" in topic field](/wifibt-wc-snippet-examples/2.14.0/images/image-5.png)

1. Connect to MQTT broker by giving IP address and port number of Windows PC1 in HOST and PORT fields in MQTT Explorer respectively and click on "CONNECT" to connect to the MQTT broker. If you are running your MQTT broker on the same PC then the following configuration is made as shown in the below image.

![MQTT broker Configuration](/wifibt-wc-snippet-examples/2.14.0/images/image-6.png)

1. After the program gets executed, the RS9116W EVK will be connected to the same access point having the configuration same as that of in the application and get IP.
2. Once the RS9116W EVK gets connected to the MQTT broker, it will subscribe to the topic **RSI_MQTT_TOPIC (Ex: "MQTT_DEMO")**. The user can see the client connected and subscription success information in the MQTT broker.

![User can see the client connected and subscription success information](/wifibt-wc-snippet-examples/2.14.0/images/image-7.png)

1. After successful subscription to the topic **RSI_MQTT_TOPIC (Ex: "MQTT_DEMO")**, the RS9116W EVK publishes a message which is given in **publish_message** array  
   (Ex: "THIS IS MQTT CLIENT DEMO FROM APPLICATION") on the subscribed topic.
2. MQTT Explorer which is running on Windows PC2 will receive the message published by the RS9116W EVK as it subscribed to the same topic.

![MQTT Explorer receives the message published by the RS9116W EVK](/wifibt-wc-snippet-examples/2.14.0/images/image-8.png)

1. In the MQTT broker, user can observe the published message as the MQTT client is subscribed topic to that topic.

![In MQTT broker, user can observe the published message](/wifibt-wc-snippet-examples/2.14.0/images/image-9.png)

1. Now to publish a message using MQTT Explorer, enter the topic name under "Publish" tab, select "raw" data format, type the data that user wishes to send and then click on "publish". This message will be received by the RS9116W EVK.

![To publish a message using MQTT Explorer](/wifibt-wc-snippet-examples/2.14.0/images/image-10.png)

###### 5.4 Procedure For exexcuting the Application when enabled with SSL

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. Install MQTT broker in Windows PC2 which is connected to Access Point through LAN.
3. User needs to update the mosquitto.conf file with the proper file paths, in which the certificates are available in the mosquitto.conf file.
4. Also, add "certs" folder to the mosquitto broker folder.
5. Execute the following command in MQTT server installed folder. (Ex:  C:\Program Files\mosquitto>mosquitto.exe -c mosquitto.conf -v) (Port can be 1883/8883)  
   `mosquitto.exe -c mosquitto.conf -v`

![For opening MQTT server ](/wifibt-wc-snippet-examples/2.14.0/images/image-11.png)

1. If you see any error - Unsupported tls_version "tlsv1", just comment the "tls_version tlsv1" in mosquitto.conf file
2. From here, repeat the steps from step 4 to step 9 of **5.3** to complete the execution.

> Note:
> Multiple MQTT client instances can be created.
> If mosquitto isn't allowing external connections to broker, add the below lines in mosquitto.conf file:
> listener 1883
> allow_anonymous true

> For using a different config file for mosquitto broker, use command:
> "mosquitto -v -p 1883 -c config/mosquitto.conf"
> where config is the sub folder and mosquitto.conf is the different config file than default.

> Limitations:
> MQTT client application keeps on polling for the data to receive on the subscribed topic irrespective of receive timeout mentioned in the rsi_mqtt_poll_for_recv_data API.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### TCP Logging Stats

##### 1. Purpose / Scope

This application demonstrates how to open and use a standard TCP client socket in RS9116W EVK and sends data to TCP server socket when power save mode is enabled.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI)
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Windows PC (Remote PC) with iperf application.

![Setup Diagram for TCP Logging Stats Example](/wifibt-wc-snippet-examples/2.14.0/images/image205.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in the remote PC.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/tcp_logging_stats/projects/tcp_logging_stats-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/tcp_logging_stats/projects/tcp_logging_stats-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/tcp_logging_stats/projects/tcp_logging_stats-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image205a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.  
  - Project path:`<SDK>/examples/snippets/wlan/tcp_logging_stats/projects/tcp_logging_stats-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_wlan_tcp_logging_stats.c file.

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                    "SILABS_AP"
```

CHANNEL_NO refers to the channel in which device should scan. If it is 0, device will scan all channels.

```c
#define CHANNEL_NO                              0
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.
Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                           RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                    "1234567890"
```

DEVICE_PORT port refers TCP client port number

```c
#define DEVICE_PORT                            5001
```

SERVER_PORT port refers remote TCP server port number which is opened in windows PC2.

```c
#define SERVER_PORT                            5001
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with TCP server socket.

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.10.100" as IP address, update the macro DEVICE_IP as 0x640AA8C0.

```c
#define SERVER_IP_ADDRESS                      0x640AA8C0
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

NUMEBR_OF_PACKETS refers how many packets to send from device to TCP server

```c
#define NUMBER_OF_PACKETS                      1000
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                        15000
```

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                              1
```

> Note:
> To configure, STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> To configure, STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                              0X0A0AA8C0 
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                                0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                                0x00FFFFFF
```

TCP Max retries

```c
#define RSI_MAX_TCP_RETRIES                     10
```

Packet send inetrval time

```c
#define PKT_SEND_INTERVAL                        55000
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements

```c
#define CONCURRENT_MODE                       RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                   (FEAT_SECURITY_OPEN | FEAT_AGGREGATION | FEAT_ULP_GPIO_BASED_HANDSHAKE)
#define RSI_TCP_IP_BYPASS                     RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP            (TCP_IP_FEAT_EXTENSION_VALID | TCP_IP_FEAT_DHCPV4_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP            (CUSTOM_FEAT_ASYNC_CONNECTION_STATUS | FEAT_CUSTOM_FEAT_EXTENTION_VALID)
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP           (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE)
#define RSI_EXT_TCPIP_FEATURE_BITMAP          CONFIG_FEAT_EXTENTION_VALID
#define RSI_CONFIG_FEATURE_BITMAP             (RSI_FEAT_SLEEP_GPIO_SEL_BITMAP | ENABLE_ENHANCED_MAX_PSP)
#define RSI_BAND                              RSI_BAND_2P4GHZ
#define RSI_LISTEN_INTERVAL                   1000
#define RSI_SOCKET_KEEPALIVE_TIMEOUT          300
#define RSI_TIMEOUT_SUPPORT                   RSI_DISABLE
#define RSI_TIMEOUT_VALUE                     1500
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Configure STM32 CN10 header pin-30(PB13) should connect to UULP_GPIO_0 and STM32 pin-2 should connect to UULP_GPIO_0.
- Open the project `<SDK>/examples/snippets/wlan/tcp_logging_stats/projects/tcp_logging_stats-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Configure EFX32 pin-9(PD03/PB01 GPIO) should connect to UULP_GPIO_0 and EVFX32 pin-7(PD02/PB00 GPIO) should connect to UULP_GPIO_2.
- Open Simplicity Studio and import the project from `<SDK>/examples/snippets/wlan/tcp_logging_stats/projects`
- Select the appropriate .slsproj as per the Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Open iperf application in Windows PC2(Remote PC) which is connected to the access point
3. Open TCP server using the below command in command prompt.

`iperf.exe –s -p <SERVER_PORT> -i 1 -t <Time_interval>`

![Open TCP server in command prompt](/wifibt-wc-snippet-examples/2.14.0/images/image206.png)

1. After program gets executed, RS9116W EVK would scan and connect to Access point and get IP.
2. After successful connection, device STA connects to TCP server socket opened on Windows PC2 using TCP client socket and TCP socket will connect and disconnect continuously.
3. After successful connection, user can check below powersave statistics of Wakeup and Sleep times in communication port.  
   - W indicates Wakeup time  
   - S indicates sleep time

![Powersave statistics of Wakeup and Sleep times](/wifibt-wc-snippet-examples/2.14.0/images/image208.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Embedded MQTT

##### 1. Purpose / Scope

This application demonstrates how to configure the RS9116W EVK as MQTT client and establish connection with MQTT broker and how to subscribe, publish and receive the MQTT messages from MQTT broker.

In this application, RS9116W EVK configured as WiFi station and connects to the Access Point. After successful WiFi connection, RS9116W EVK connects to MQTT broker and subscribes to the topic "SILABS_TEST" and publishes a message "THIS IS MQTT CLIENT DEMO FROM SILABS" on that subscribed topic. After publishing the message on the subscribed topic, the MQTT client un-subscribes and disconnects with the MQTT broker.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Windows PC1 with MQTT broker installed in it
- Windows PC2 with MQTT client utility installed in it

![Demonstration of MQTT protocol](/wifibt-wc-snippet-examples/2.14.0/images/image147.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [MQTT Broker](https://mosquitto.org/files/binary/win64/mosquitto-1.6.12-install-windows-x64.exe) in Windows PC1

> **Note:** This example has been tested with Mosquitto _v1.5.3_, _v1.6.9_, and _v1.6.12_.

- [MQTT Utility](https://www.eclipse.org/downloads/download.php?file=/paho/1.0/org.eclipse.paho.mqtt.utility-1.0.0.jar) in Windows PC2

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/embedded_mqtt/projects/embedded_mqtt-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/embedded_mqtt/projects/embedded_mqtt-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/embedded_mqtt/projects/embedded_mqtt-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image147a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/embedded_mqtt/projects/embedded_mqtt-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS configuration. By default, the application project files (Keil and Simplicity studio) are provided with bare metal environment in the SDK.

##### 4. Application Configuration Parameters

> Note :
> If the user wants to use embedded (in firmware) MQTT library, then user can opt for this emb_mqtt application.

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_emb_mqtt.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                       "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application, STA supports Open, WPA-PSK, WPA2-PSK securities.

The valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                              RSI_OPEN
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                        "<psk>"
```

CLIENT_PORT port refers to device MQTT client port number

```c
#define CLIENT_PORT                                5001
```

SERVER_PORT port refers remote MQTT broker/server port number

```c
#define SERVER_PORT                                1883
```

SERVER_IP_ADDRESS refers remote peer IP address (Windows PC2) to connect with MQTT broker/server socket.

```c
#define SERVER_IP_ADDRESS                          192.168.10.1
```

MQTT client keep alive period

```c
#define RSI_KEEP_ALIVE_PERIOD                      0
```

QOS indicates the level of assurance for delivery of an Application Message.

QoS levels are:

0 - At most once delivery

1 - At least once delivery

2 - Exactly once delivery

```c
#define QOS                                        0
```

RSI_MQTT_TOPIC refers to which topic WiSeConnect MQTT client is supposed to subscribe.

```c
#define RSI_MQTT_TOPIC                             "SILABS"
```

MQTT Message to publish on the topic subscribed

```c
uint8_t publish_message[] ="THIS IS MQTT CLIENT DEMO FROM SILABS"
```

MQTT Client ID with which MQTT client connects to MQTT broker/server

```c
uint8_t clientID[] = "MQTTCLIENT"
```

User name for login credentials

```c
int8_t username[] = "username"
```

Password for login credentials

```c
int8_t password[] = "password"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                            15000
```

To configure IP address
DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                                  1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                                  0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
#define GATEWAY                                    0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
#define NETMASK                                    0x00FFFFFF
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                            RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                        FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                          RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                 (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP                 0
#define RSI_EXT_TCPIP_FEATURE_BITMAP               EXT_EMB_MQTT_ENABLE
#define RSI_BAND                                   RSI_BAND_2P4GHZ
```

For running **EMB_MQTT** with **SSL**, please enable **TCP_IP_FEAT_SSL** in **rsi_wlan_config.h** file, as shown below. Also load the related **SSL Certificates** in the module using rsi_wlan_set_certificate() API and and Need to enable **SSL** flag **RSI_EMB_MQTT_SSL_ENABLE** in rsi_emb_mqtt_client_init() API.

```c
#define CONCURRENT_MODE                            RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                        FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                          RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                 (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSLTCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_CUSTOM_FEATURE_BIT_MAP                 EXT_FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP             RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM
#define RSI_EXT_TCPIP_FEATURE_BITMAP               EXT_EMB_MQTT_ENABLE
#define RSI_BAND                                   RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE 1
```

> Note:
> In rsi_mqtt_client.h change 'MQTT_VERSION' macro to either 3 or 4 based on the MQTT broker support version (Supported versions are 3 and 4).

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK.

The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/embedded_mqtt/projects/embedded_mqtt-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/embedded_mqtt/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect RS9116W device in STA mode.
2. Install MQTT broker in Windows PC1 which is connected to Access Point.
3. Run MQTT broker in Windows PC1 using following command. Open Command prompt and go to MQTT installed folder (Ex: C:\Program Files\mosquitto) and run the following command:

`mosquito.exe -p 1883 -v`

![Run MQTT broker in Windows PC1](/wifibt-wc-snippet-examples/2.14.0/images/image148.png)

1. Open MQTT client utility in Windows PC2 and connect to MQTT broker by giving Windows PC1 IP address and MQTT broker port number in Broker TCP/IP address field.

![MQTT client utility in Windows PC2](/wifibt-wc-snippet-examples/2.14.0/images/image149.png)

1. After successful connection, subscribe to the topic from MQTT client utility.

![Subscribe to the topic from MQTT client utility](/wifibt-wc-snippet-examples/2.14.0/images/image150.png)

1. After the program gets executed, RS9116W EVK will get connected to the same access point having the configuration same as that of in the application and get IP.
2. Once the RS9116W EVK gets connected to the MQTT broker, it will subscribe to the topic RSI_MQTT_TOPIC (Ex: "SILABS_TEST"). The user can see the client connected and subscribe information in the MQTT broker.

![Client Connected and Subscribe Information in the MQTT broker](/wifibt-wc-snippet-examples/2.14.0/images/image151.png)

1. After successful subscription to the topic RSI_MQTT_TOPIC (Ex: "SILABS"), the device publishes a message which is given in publish_message array (Ex: "THIS IS MQTT CLIENT DEMO FROM SILABS") on the subscribed topic.
2. MQTT client utility which is running on Windows PC3 will receive the message published by the device as it subscribes to the same topic.  
   - Refer to the below image for MQTT client utility and message history.

![MQTT client utility and message history](/wifibt-wc-snippet-examples/2.14.0/images/image152.png)

1. Now publish a message using MQTT Utility on the same topic. Now this message is the message received by the device.

![Publish a message using MQTT Utility](/wifibt-wc-snippet-examples/2.14.0/images/image153.png)

**Note:**
Multiple MQTT client instances can be created

###### 5.4 Procedure For exexcuting the Application when enabled with SSL

1. Configure the Access point in OPEN/WPA-PSK/WPA2-PSK mode to connect Silicon Labs device in STA mode.
2. Install MQTT broker in Windows PC2 which is connected to Access Point through LAN.
3. User needs to update the mosquitto.conf file with the proper file paths, in which the certificates are available in the mosquitto.conf file.
4. Also, add "certs" folder to the mosquitto broker folder.
5. Execute the following command in MQTT server installed folder. (Ex:  C:\Program Files\mosquitto>mosquitto.exe -c mosquitto.conf -v) (Port can be 1883/8883)  
   `mosquitto.exe -c mosquitto.conf -v`

![For opening MQTT server ](/wifibt-wc-snippet-examples/2.14.0/images/image154.png)

1. If you see any error - Unsupported tls_version "tlsv1", just comment the "tls_version tlsv1" in mosquitto.conf file.
2. From here, repeat the steps from step 4 to step 9 of **5.3** to complete the execution.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Enterprise client

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116W EVK in Enterprise client and connects with Enterprise secured Access point and data traffic in Enterprise security mode.

In this application, RS9116W EVK connects to Enterprise secured AP using EAP-TLS/TTLS/PEAP/FAST method. After successful connection, application opens TCP client socket and connects with TCP server opened on remote peer and sends TCP data on opened socket.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Windows PC with AAA Radius Server or Free Radius server
- Wifi router connected to Windows PC.

![Setup Diagram for Enterprise Client Example](/wifibt-wc-snippet-examples/2.14.0/images/image143.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [Iperf Application](https://iperf.fr/iperf-download.php)
- [Free Radius Server](https://freeradius.org/) in Windows PC1(Remote PC)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/featured/enterprise_client/projects/enterprise_client-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/featured/enterprise_client/projects/enterprise_client-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/featured/enterprise_client/projects/enterprise_client-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image143a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/enterprise_client/projects/enterprise_client-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_eap_connectivity.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                                                  "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In In this application STA supports WPA-EAP, WPA2-EAP securities.

Valid configuration is:

- RSI_WPA_EAP - For WPA-EAP security mode
- RSI_WPA2_EAP - For WPA2-EAP security mode

```c
#define SECURITY_TYPE                                         RSI_WPA2_EAP
```

LOAD_CERTIFICATE refers whether certificate to load into module or not.

```c
#define LOAD_CERTIFICATE                                      1
```

If LOAD_CERTIFICATE set to 1, application will load certificate which is included using rsi_wlan_set_certificate API.

By default, application is loading "wifiuser.pem" certificate when LOAD_CERTIFICATE enabled. In order to load different certificate, user has to do the following steps:

rsi_wlan_set_certificate API expects the certificate in the form of linear array. So convert the pem certificate into linear array form using python script provided in the SDK "resources/certificates/certificate_to_array.py"

Example: If the certificate is wifi-user.pem, give the command like the following way:

`python certificate_to_array.py wifi-user.pem`

The script will generate `wifiuser.pem` in which one linear array named wifiuser contains the certificate.

After conversion of certificate, update rsi_eap_connectivity.c source file by including the certificate file and by providing the required parameters to rsi_wlan_set_certificate API.

Once the certificate loads into the device, it will write into the device flash. So, user need not load certificate for every boot up unless certificate change.

So define LOAD_CERTIFICATE as 0, if certificate is already present in the device.

USER_IDENTITY refers to user ID which is configured in the user configuration file of the radius server. In this example, user identity is "user1".

```c
#define USER_IDENTITY                                         "\"user1\""
```

PASSWORD refers to the password which is configured in the user configuration file of the Radius Server for that User Identity.

In this example, password is "test123"

```c
#define PASSWORD                                              "\"test123\""
```

DEVICE_PORT port refers TCP client port number

```c
#define DEVICE_PORT                                           5001
```

SERVER_PORT port refers remote TCP server port number which is opened in Windows PC2.

```c
#define SERVER_PORT                                           5001
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with TCP server socket.

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.0.100" as remote IP address, update the macro SERVER_IP_ADDRESS as 0x6400A8C0.

```c
#define SERVER_IP_ADDRESS                                     0x640AA8C0
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN memory length which is required by the driver

```c
#define GLOBAL_BUFF_LEN                            15000
```

NUMEBR_OF_PACKETS refers how many packets to receive from TCP client

```c
#define NUMBER_OF_PACKETS                                     1000
```

DHCP_MODE refers whether IP address configured through DHCP or STATIC in STA mode

```c
#define DHCP_MODE                                             1
```

> Note:
> If the user wants to configure STA IP address through DHCP then skip configuring the DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If the user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.0.10" as IP address, update the macro DEVICE_IP as 0x010AA8C0.

```c
#define DEVICE_IP                                             0X0A00A8C0
```

IP address of the gateway should also be in long format and in little endian byte order.
Example: To configure "192.168.0.1" as Gateway, update the macro GATEWAY as 0x0100A8C0

```c
#define GATEWAY                                               0x0100A8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as **0x00FFFFFF**

```c
#define NETMASK                                               0x00FFFFFF
```

Configure the following macro to initiate ping with the remote peer IP address (AP IP address).

Example: To configure "192.168.10.1" as remote IP, update the macro REMOTE_IP as 0x6B01A8C0

```c
#define REMOTE_IP                                             0x010AA8C0
```

PING_SIZE refers to the size of the ping packet

```c
#define PING_SIZE                                             100
```

###### 4.2 Open rsi_wlan_config.h file

```c
#define CONCURRENT_MODE                                       RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                                   FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS                                     RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP                            (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_ICMP)
#define RSI_CUSTOM_FEATURE_BIT_MAP                            0
#define RSI_BAND                                              RSI_BAND_2P4GHZ
```

> Note:
> For TLS version selection, use `rsi_wlan_common_config.h` at `<SDK>\sapis\include` instead of `rsi_wlan_config.h` and enable respective bits as shown below.
> To select TLS 1.0 version, enable `RSI_FEAT_EAP_TLS_V1P0` (BIT(14)) in `RSI_CONFIG_FEATURE_BITMAP`
> To select TLS 1.2 version, enable `RSI_FEAT_EAP_TLS_V1P2` (BIT(15)) in `RSI_CONFIG_FEATURE_BITMAP`

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Access Point Setup

When working with the EAP-Ping example, LAN cable is connected between the Access point modem and CPU.

- After the connection, using the command prompt give "ipconfig" command to know the IP and gateway1. address of the Radius server. The below image is for reference purpose.

![Give "ipconfig" command in command prompt](/wifibt-wc-snippet-examples/2.14.0/images/image136.png)

- Connect the Access Point to PC over Ethernet and open the Access Point page in browser by typing the IP address of the AP's Default Gateway address and configure it.
- Navigate to the Wireless Security section and enable the "WPA/WPA2 - Enterprise" option, as shown in the figure below. The image below is for a TP-Link Access Point.

![Enable the "WPA/WPA2 - Enterprise" option](/wifibt-wc-snippet-examples/2.14.0/images/image137.png)

- Enter the IP address of the Radius Server in the field labeled, "Radius Server IP". In the above figure, it is 192.168.50.100.
- Enter the Radius Password as "12345678". This is the same as that entered in the 'clients.conf' file of the Radius Server.

###### 5.3 Radius Server Setup

**Description :**

The figure below shows the setup for Wi-Fi Client in Enterprise Security Mode.

![Setup for Wi-Fi Client in Enterprise Security Mode](/wifibt-wc-snippet-examples/2.14.0/images/image138.png)

**Radius server Set-up guide :**

The WiSeConnect module supports four Enterprise Security modes:

1. EAP-TLS
2. EAP-TTLS
3. EAP-PEAP
4. EAP-FAST

**Radius Server Configuration**

The configuration explained below is for Windows OS, similar process may be followed for other OS.

- Free Radius Server installation link:  
  [https://freeradius.org/](https://freeradius.org/)  
  [http://xperiencetech.com/download/radius-free-download.asp](http://xperiencetech.com/download/radius-free-download.asp)  
  **Note**  
  Application was tested in FreeRADIUS-server-2.2.3-x86.
- Once installed, go to the C:\FreeRADIUS\etc\raddb folder and make the following modifications.
- Open the 'clients.conf' file and add the following lines at the end of the file.

```sh
   client 192.168.50.1/24 {
   secret = 12345678
   shortname = private-network-1
   }
```

- The IP address in the above lines (192.168.50.1) is the IP address of the Access Point in this example setup. The "12345678" input is the key to be entered in the Access Point's radius server configuration page to authenticate it with the Radius Server.
- Open the 'eap.conf' file and make the following changes:  
  - Change the input for the "default_eap_type" field under the "eap" section to  "tls", as shown in the figure below.

![Change the input for the "default_eap_type" field ](/wifibt-wc-snippet-examples/2.14.0/images/image139.png)

- Change the inputs for "private_key_file", "certificate_file" and "CA_file" fields under the "tls" section to "${certdir}/wifi-user.pem", as shown in the figure below.

![Change the inputs](/wifibt-wc-snippet-examples/2.14.0/images/image140.png)

- Uncomment the "fragment_size" and "include_length" lines under the "tls" section, as shown in the figure below.

![Uncomment the "fragment_size" and "include_length" lines](/wifibt-wc-snippet-examples/2.14.0/images/image141.png)

- Open the users file and add the lines shown in the figure below starting with "user1". This adds a user with username "user1" and password "test123".

![Open the users file and add the lines](/wifibt-wc-snippet-examples/2.14.0/images/image142.png)

- Copy the 'wifi-user.pem; file from `<SDK>\resources\certificates` folder to **C:\FreeRADIUS\etc\raddb\certs** folder.
- Click on the windows key and just search for Start RADIUS Server and click on it.
- Then Radius server has started successfully you will see a print at the end which says, "Ready to process requests".

> Note:
> 
> The radius server has to run before the application is executed. You will observe some transactions when the module is trying to connect to the radius server. Restart the Radius server when you execute the application every time.

###### 5.4 Building the Application on Host Platform

###### 5.4.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/enterprise_client/projects/enterprise_client-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.5**

###### 5.4.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/enterprise_client/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.5**

###### 5.5 Common Steps

1. Connect the RS9116W EVK (Silicon Labs module) to the Windows PC running Keil IDE.
2. Configure the Access point in WPA-EAP/WPA2-EAP mode to connect the RS9116W EVK (Silicon Labs module) in ent erprise secured mode.
3. Run Radius server in Windows PC2 which is connected to AP by providing required certificate and credentials.

![Run Radius server in Windows PC2](/wifibt-wc-snippet-examples/2.14.0/images/image144.png)

1. After the program gets executed, RS9116W EVK (Silicon Labs module) will get connected to access point which is in enterprise security having the configuration provide in **Section 4** and gets IP.
2. After a successful connection with the Access Point, the starts sending ping requests to the given REMOTE_IP with configured PING_SIZE to check the availability of the target device.
3. The RS9116W EVK sends the number of ping packets configured in NUMBER_OF_PACKETS.
4. In the rsi_eap_connectivity.c file, rsi_wlan_ping_async API returns success status, which means that the ping request packet is successfully sent into the medium. When the actual ping response comes from the remote node, it is known from the status parameter of the callback function (rsi_ping_response_handler) registered in the Ping API.
5. The following figures shows the Packet_count is continuously incremented, which means the ping request packet is successfully sent into the medium. Place a breakpoint at rsi_delay_ms(1000) and add the packet_count variable to watch the window and monitor the packet count.

![The Packet_count is continuously incremented-1](/wifibt-wc-snippet-examples/2.14.0/images/image145.png)

![The Packet_count is continuously incremented-2](/wifibt-wc-snippet-examples/2.14.0/images/image146.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### HTTP/HTTPS OTA

##### 1. Purpose / Scope

This application demonstrates how to update new firmware to RS9116W EVK using remote HTTP/s server or cloud storage server.

In this application, RS9116W EVK connects to Access Point as HTTP/HTTPS client and establishes connection with HTTP/s server (Apache server) or the cloud storage server (i.e., AWS S3 bucket/Azure Blob storage). After successful HTTP/s connection, RS9116W EVK sends firmware file request (HTTP GET Request) to remote server and server responds with Firmware file.

The server transferred firmware file gets loaded/updated in the RS9116 module flash memory. After successful firmware update, HTTP/s OTA API returns success response.

##### 2. Prerequisites / Setup Requirements

Before running the application, set up the following.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point

![Setup Diagram for HTTP/HTTPS OTA Example](/wifibt-wc-snippet-examples/2.14.0/images/image384.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Install and configure Wamp-Apache HTTP server, refer to Appendix section 6.3 **Configuring and uploading firmware on Apache HTTP**.
- Install and configure Wamp-Apache HTTPs server, refer to Appendix section 6.4 **Configuring and uploading firmware on Apache HTTPs**.
- Configure AWS S3 bucket, refer to Appendix setion 6.1 **Configuring AWS S3 Bucket**.
- Configure Azure Blob storage, refer to Appendix section 6.2 **Configuring Azure Blob Storage**.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.

---

**Note!**
This application is under development in EFM32 host platform.

---

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/http_otaf/projects/http_otaf-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/http_otaf/projects/http_otaf-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/http_otaf/projects/http_otaf-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image384g.png)

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal environment. The application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_http_otaf_app.c file

###### 4.1.1 User must update the below common parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                         "SILABS_AP"
```

CHANNEL_NO refers to the channel in which AP would be started

```c
#define CHANNEL_NO                  0
```

SECURITY_TYPE refers to the type of security. Generally Access point supports Open, WPA, WPA2 securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                RSI_WPA2
```

PSK refers to the secret key of the Access point(applies when AP is configured in WPA/WPA2 security modes)

```c
#define PSK                          "1234567890"
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

DHCP_MODE refers the way of configuring IP address to Silicon Labs module

1-Enables DHCP mode (gets the IP from DHCP server)

0-Disables DHCP mode

Desired configuration :

```c
#define DHCP_MODE                    1
```

If DHCP Mode is disabled configure a static IP address using the following macros. These values are in long format and in little endian order. For example an address of "192.168.10.1" is represented by a value of 0x010AA8C0.

```c
#define DEVICE_IP                    0X010AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                      0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                      0x00FFFFFF
```

> Note:
> In AP mode, configure same IP address for both DEVICE_IP and GATEWAY macros.

###### 4.1.2 User must update the below server configuration parameters (heading level 7)

Based on the type of server (Apache/AWS S3 bucket/Azure Blob Storage) from which firmware files needs to be downloaded, the below mentioned parameters needs to be configured.
Configure FLAGS to choose the version and security type to be enabled

Valid configurations are :

Enable IPv6 set this bit in FLAGS, Default is IPv4

```c
#define HTTPV6           BIT(0) 
```

Set HTTPS_SUPPORT to use HTTPS feature

```c
 #define HTTPS_SUPPORT    BIT(1) 
```

Set HTTP_V_1_1 to use HTTP version 1.1

```c
 #define HTTP_V_1_1       BIT(6) 
```

In code, **AWS_ENABLE** macro is enabled by default in application.
Depending on the requirement user can enable downloading firmware from Azure Blob storage (Enable Macro **AZURE_ENABLE**).
Else if both AWS and Azure macro is disabled, HTTP/s Apache server can be used to download the firmware.

- HTTP_PORT refers to HTTP Server port number
- HTTP_SERVER_IP_ADDRESS refers to HTTP Server IP address
- HTTP_URL refers to HTTP resource name
- HTTP_HOSTNAME refers to HTTP server hostname
- HTTP_EXTENDED_HEADER refers to HTTP extended header. If NULL default extented header is filled
- USERNAME refers to the username to be used to access the HTTP resource
- PASSWORD refers to the password to be used to access the HTTP resource

**For Apache HTTP Server**

```c
//Sample configurations
#define FLAGS                   0
#define HTTP_PORT               80
#define HTTP_SERVER_IP_ADDRESS  "192.168.xxx.xxx"
#define HTTP_URL                "Firmware/firmware.rps" //firwmare file name to download
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

**For Apache HTTPS Server**

- Include Root certificate pem file for SSL connection
- Provide the PC IP where Apache server is running in HTTP_SERVER_IP_ADDRESS
- Provide the firmware package name uploaded in Apache server in HTTP_URL

```c
//Sample configurations
#include "cacert.pem"
#define FLAGS                   HTTPS_SUPPORT
#define HTTP_PORT               443
#define HTTP_SERVER_IP_ADDRESS  "192.168.xxx.xxx"
#define HTTP_URL                "Firmware/firmware.rps" //firwmare file name to download
#define HTTP_HOSTNAME           "192.168.xxx.xxx"
#define USERNAME                "admin"
#define PASSWORD                "admin"
```

**For AWS S3 Bucket**

- Include Starfield root certificate file for SSL connection

> Note : The certificate authority for Amazon AWS S3 is Starfield, hence we need to include Starfield Root certification for SSL connection to be successful. This certificate is already included in the SDK in linear array format "aws_starfield_ca.pem.h" which can be directly used for SSL connection to AWS S3.

- Extract the hostname from AWS S3 bucket URL `https://<Your-S3-Bucket-name>.s3.<Your-nearest-S3-location>.amazonaws.com/firmware.rps` and provide it in **hostname**

> Example: For S3 bucket URL [https://example.s3.ap-south-1.amazonaws.com/firmware.rps](https://example.s3.ap-south-1.amazonaws.com/firmware.rps)", hostname will be "example.s3.ap-south-1.amazonaws.com"

- Extract the firmware package name from URL `https://<Your-S3-Bucket-name>.s3.<Your-nearest-S3-location>.amazonaws.com/firmware.rps` and provide it in **HTTP_URL**

> Example: For S3 bucket URL "[https://example.s3.ap-south-1.amazonaws.com/firmware.rps](https://example.s3.ap-south-1.amazonaws.com/firmware.rps)", HTTP_URL will be "firmware.rps"

```c
//Sample configurations
#include "aws_starfield_ca.pem.h"         //CA certificate
#define FLAGS                              HTTPS_SUPPORT
#define HTTP_PORT                          443
#define HTTP_URL                           "firmware.rps" //firwmare file name to download
#define USERNAME                           ""
#define PASSWORD                           ""
char *hostname                             ="example.s3.ap-south-1.amazonaws.com";
```

**Note:** The `USERNAME` and `PASSWORD` is provided as empty string "" since the S3 bucket URL created has public access provided. Refer Appendix section 6.1 on how to upload Firmware in AWS S3 Bucket.

- **For Azure Blob storage**  
  - Include Digicert (Baltimore CyberTrust Root) certificate file for SSL connection

> Note : The certificate authority for Azure Blob storage is Digicert, hence we need to include Digicert Root (Baltimore CyberTrust Root) certification for SSL connection to be successful. This certificate is already included in the SDK in linear array format "http_batimore_ca.pem.h" which can be directly used for SSL connection to Azure Blob storage.

- Extract the hostname from Azure Blob storage URL `https://<Your-Blob-Name>.blob.core.windows.net/rps/firmware.rps` and provide it in hostname

> Example: For Azure Blob storage URL "[https://example.blob.core.windows.net/example_directory/firmware.rps](https://example.blob.core.windows.net/example_directory/firmware.rps)", hostname will be "example.blob.core.windows.net"

- Extract the firmware package name from URL `https://<Your-Blob-Name>.blob.core.windows.net/rps/firmware.rps` and provide it in HTTP_URL

> Example: For Azure Blob storage URL "[https://example.blob.core.windows.net/example_directory/firmware.rps](https://example.blob.core.windows.net/example_directory/firmware.rps)", HTTP_URL will be "rps/firmware.rps"

```c
//Sample configurations
#include "http_baltimore_ca.pem.h"        //Baltimore Root CA
#define FLAGS                             HTTPS_SUPPORT
#define HTTP_PORT                         443
#define HTTP_URL                          "rps/firmware.rps" //firwmare file name to download
#define USERNAME                          ""
#define PASSWORD                          ""
char *hostname                            ="example.blob.core.windows.net";
```

**Note:** The USERNAME and PASSWORD is provided as empty string "" since the Azure Blob storage URL created has public access provided. Refer to Appendix section 6.2 on how to upload Firmware in Azure Blob storage

###### 4.2 Open  rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

- For Apache HTTP Server

```c
#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_HTTP_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
#define RSI_EXT_TCPIP_FEATURE_BITMAP EXT_FEAT_HTTP_OTAF_SUPPORT
```

- For Apache HTTPS Server

```c
#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_HTTP_CLIENT| TCP_IP_FEAT_EXTENSION_VALID | TCP_IP_FEAT_SSL)
#define RSI_EXT_TCPIP_FEATURE_BITMAP EXT_FEAT_HTTP_OTAF_SUPPORT
```

- For AWS S3 Bucket/Azure Blob storage

```c
#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_HTTP_CLIENT| TCP_IP_FEAT_EXTENSION_VALID | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT)
#define RSI_EXT_TCPIP_FEATURE_BITMAP (EXT_FEAT_HTTP_OTAF_SUPPORT | EXT_TCP_IP_SSL_16K_RECORD)
```

###### 4.3 To Load Certificate

**rsi_wlan_set_certificate()** API expects the certificate in the form of linear array. Convert the pem certificate into linear array form using python script provided in the SDK `<SDK>/resources/certificates/certificate_script.py`.

For example : If the certificate is ca-certificate.pem, enter the command in the following way:
python certificate_script.py ca-certificate.pem
The script will generate ca-certificate.pem in which one linear array named ca-certificate contains the certificate.

Root CA certificate needs to be converted as mentioned above.

After the conversion, place the converted file in `<SDK>/resources/certificates/` path and include the certificate file in rsi_http_otaf_app.c

For firmware download using HTTPs Apache server, replace the below certificate include in application

```c
 // Certificate includes
 #include "cacert.pem"
 Replace the certificate in `rsi_wlan_set_certificate()` API in the application with the converted pem array.
 
 // Load Security Certificates
 status = rsi_wlan_set_certificate(RSI_SSL_CA_CERTIFICATE, cacert, (sizeof(cacert) - 1));
```

**Note:** For AWS S3 use the certificate "aws_starfield_ca.pem.h" and for Azure Blob storage use the certificate "http_baltimore_ca.pem.h" included in release pacakge for SSL connection. The corresponding rsi_wlan_set_certificate function calls would be as follows:

For AWS

```c
status = rsi_wlan_set_certificate(RSI_SSL_CA_CERTIFICATE, aws_starfield_ca, (sizeof(aws_starfield_ca) - 1));
```

For Azure

```c
status = rsi_wlan_set_certificate(RSI_SSL_CA_CERTIFICATE, http_baltimore_ca, (sizeof(http_baltimore_ca) - 1));
```

**Note:**

> AWS has notified that there would be changes in their root CA chaining. Further details can be found in the reference links.([https://aws.amazon.com/blogs/security/acm-will-no-longer-cross-sign-certificates-with-starfield-class-2-starting-august-2024/](https://aws.amazon.com/blogs/security/acm-will-no-longer-cross-sign-certificates-with-starfield-class-2-starting-august-2024/))
> We are providing both root CAs (Starfield class-2 and Starfield G2) in aws_starfield_ca.pem.h, the new files to the WiSeConnect directory `<SDK>/resources/certificates/aws_starfield_ca.pem.h`5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/http_otaf/projects/http_otaf-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the project from `<SDK>/examples/snippets/wlan/http_otaf/projects`
- Select the appropriate .slsproj as per the Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

- On free run, the application starts downloading firmware from AWS S3 Bucket as "AWS_ENABLE" macro is enabled by default in application.
- Depending on the requirement user can enable downloading firmware from Azure Blob storage (Enable Macro "AZURE_ENABLE"),  
  else if both AWS and Azure macro is disabled, HTTP/s Apache server can be used to download the firmware (Refer to section 4.1.2 on how to configure HTTP/s parameters).
- Below are the logs for successful application execution using AWS S3 Bucket.

![Using AWS S3 Bucket](/wifibt-wc-snippet-examples/2.14.0/images/image385.png)

- Below are the logs for successful application execution using AZURE Blob Storage.

![Using AZURE Blob Storage](/wifibt-wc-snippet-examples/2.14.0/images/image386.png)

- Below are the logs for successful application execution using HTTP/s Local Apache Server.

![Using HTTP/s Local Apache Server](/wifibt-wc-snippet-examples/2.14.0/images/image387.png)

##### 6 Appendix

###### 6.1 Configuring AWS S3 Bucket

- Sign into the Amazon S3 console at [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)
- Choose **Create bucket**

![Create bucket](/wifibt-wc-snippet-examples/2.14.0/images/image388.png)

- Enter a **bucket name**

![Bucket name](/wifibt-wc-snippet-examples/2.14.0/images/image389.png)

- Under **Bucket settings for Block Public Access** keep **Block all public access**

![Block all public access](/wifibt-wc-snippet-examples/2.14.0/images/image390.png)

- Under **Bucket Versioning**, select **Enable** to keep all versions in the same bucket

![Select Enable to keep all versions in the same bucket](/wifibt-wc-snippet-examples/2.14.0/images/image391.png)

- Choose **Create bucket**

![Create bucket](/wifibt-wc-snippet-examples/2.14.0/images/image392.png)

- Upload the file in creating bucket

![Upload the file](/wifibt-wc-snippet-examples/2.14.0/images/image393.png)

- Add the file to the bucket

![Add the file to the bucket](/wifibt-wc-snippet-examples/2.14.0/images/image394.png)

- Setting permission to public access

![Setting permission to public access](/wifibt-wc-snippet-examples/2.14.0/images/image395.png)

- Get the S3 bucket URL inside bucket/properties, like below :

[[https://rs9116fmw.s3.ap-south-1.amazonaws.com/firmware.rps](https://rs9116fmw.s3.ap-south-1.amazonaws.com/firmware.rps)]

###### 6.2 Configuring Azure Blob Storage

- Login to your Azure account and go to Storage Account or search for Storage Account

![Search for Storage Account](/wifibt-wc-snippet-examples/2.14.0/images/image396.png)

- Open storage account and create a new storage

![Create a new storage](/wifibt-wc-snippet-examples/2.14.0/images/image397.png)

- While creating a storage account select your common Resource Group you have already created and provide a storage account name.
- Select preferred location, for the account kind select Blob-Storage and Replication select LRS

![Select preferred location](/wifibt-wc-snippet-examples/2.14.0/images/image398.png)

- Review and create your storage account
- Now download the Windows Storage Explorer here
- After installing the storage explorer, open Azure Storage Explorer in your Windows machine and navigate to Account management and add your Azure account.

![Open Azure Storage Explorer](/wifibt-wc-snippet-examples/2.14.0/images/image399.png)

![Add your Azure account](/wifibt-wc-snippet-examples/2.14.0/images/image400.png)

- Click on Open connect dialog, where you need to select a Resource from the list as shown below

![Select a Resource from the list](/wifibt-wc-snippet-examples/2.14.0/images/image401.png)

- Select Storage account or service, then select connection method as Connection String

![Select connection method as Connection String](/wifibt-wc-snippet-examples/2.14.0/images/image402.png)

- In the Azure Portal, navigate to your newly created storage account and select Access Keys, copy the connection string for Key1

![Copy the connection string for Key1](/wifibt-wc-snippet-examples/2.14.0/images/image403.png)

- The connection string has to be given in the local Azure Storage Explorer app
- Up on successfully adding, you should now see the EXPLORER tab on your Azure Storage Explorer display all the storages available in your account

![Display all the storages available in your account](/wifibt-wc-snippet-examples/2.14.0/images/image404.png)

- In the Azure Portal search for Storage Explorer and work the same thing there also. But it is in preview so better to use Windows Azure Storage Explorer
- Create a new blob container as shown below

![Create a new blob container](/wifibt-wc-snippet-examples/2.14.0/images/image405.png)

- The route folder name you give is quite important as all the further connections happen from here. For this I am choosing a file extension
- The name used here is “rps”
- This should create a new folder, which looks like this

![New folder looks like this](/wifibt-wc-snippet-examples/2.14.0/images/image406.png)

- Change the Public Access Level, right click on the new folder and select Set Container Access Level

![Select Set Container Access Level](/wifibt-wc-snippet-examples/2.14.0/images/image407.png)

- We can upload the Device Update File

![Upload the Device Update File](/wifibt-wc-snippet-examples/2.14.0/images/image408.png)

- Once done uploading, we can see the file

![We can see the file](/wifibt-wc-snippet-examples/2.14.0/images/image409.png)

- Right click on the uploaded file, then select properties. You will find a URL path.

![Find a URL path](/wifibt-wc-snippet-examples/2.14.0/images/image410.png)

- Copy it this link is used for accessing our device update files

![This link is used for accessing our device update files](/wifibt-wc-snippet-examples/2.14.0/images/image411.png)

- By accessing this URL, you can download the Device Update files in application

###### 6.3 Configuring and Uploading Firmware on Apache HTTP:

- Download and Install Wamp-Apache Server  
  - Open the below link in your system browser.    
    Wamp Server - ([https://www.wampserver.com/en/](https://www.wampserver.com/en/))  
  - Under Downloads, Download the latest version of WAMP server for 32bit or 64bit machine.  
  - Install Wamp-Apache server with all the default settings.  
  - Make sure the Wamp-Apache server is present in C:\ directory
- Configure a HTTP server  
  - Navigate to C:\wamp64\bin\apache\apache2.4.46\conf  
  - Open httpd.conf file with an editor.  
  - Change the below lines into system IP address

```sh
   Listen {System-IP-Address}:80
   ServerName {System-IP-Address}:80
   Eg: Listen 192.168.1.4:80
       ServerName 192.168.1.4:80
```

- Save the file and Exit.
- Open command prompt and run with Administrator Privilege's.
- Navigate to directory C:\wamp64\bin\apache\apache2.4.46\bin
- Add Apache as a Windows Service:  
  `httpd.exe -k install`
- While the install is in progress, you will be prompted to Windows Network Access page as shown below. Make sure you allow both Private and Public network access.

![Windows Network Access page](/wifibt-wc-snippet-examples/2.14.0/images/image412.png)

- Start Apache Service in Windows  
  - Open RUN in windows using WIN+R button.  
  - Input "services.msc" into RUN  
  - This will open your Windows System Services  
  - In the list of services running you can find Apache2.x present.  
  - Start the service as shown below

![Start the service](/wifibt-wc-snippet-examples/2.14.0/images/image413.png)

- Now that your Apache has started and running, check it by using your browser. Open a Web browser and type the machine IP in the address bar and hit Enter. You should see the below, if server has started successfully.

![If server has started successfully.](/wifibt-wc-snippet-examples/2.14.0/images/image414.png)

- As you can see the connection is "Not Secure" means it is running HTTP server.
- Configure HTTP Wamp-Apache Server to Download firmware  
  - Goto the Wamp Root directory, in my case it is C:\wamp64 and navigate to "www" folder C:\wamp64\[www](http://www).  
  - Create a new folder in that directory, in my case I created a folder named "Firmware". [Folder Structure: C:\wamp64\www\Firmware]  
  - In the "Firmware" folder create an "index.html" file and write below contents to the file.

```html
    <!DOCTYPE html>
    <html>
        <body>
            <h2>Using a Relative File Path</h2>
            <a href="firmware.rps" download>Download_Version_6</a><br><br>
            <a href="firmware1.rps" download>Download_Version_4</a>
        </body>
    </html>
```

- This code will link your resources to Apache server, so that those files can be downloaded.
- you can edit href values in the index.html to your firmware file names.
- Make sure to copy all the firmware files into the present directory, C:\wamp64\www\Firmware. Save the file and Exit.  
  ```html  
  <a href="<your-firmware-file>-1.rps" download>Download_Version_6</a><br><br>  
  <a href="<your-firmware-file>-2.rps" download>Download_Version_4</a>  
  ```
- Configure HTTPD.conf file for Wamp-Apache Server  
  - Open httpd.conf file in C:\wamp64\bin\apache\apache2.4.46\conf\httpd.conf  
  - Search or Find "DocumentRoot" and change it to below configuration. Save the file and Exit  
  ```sh  
   "${INSTALL_DIR}/www/Firmware"  
  ```
- Restart Apache Service  
  - Open Windows services, "WIN+R" → "services.msc" → ENTER  
  - Check for Apache service and Restart the service  
  - In the above configuration, we have created a resource for our server in "Firmware" folder.  
  - Our access resource URL looks as shown below

> `http://<your-ip-address>/<Sub-Resource-Directory>/<Resources>`
> 
> Eg: [http://192.168.1.4/Firmware/firmware.rps](http://192.168.1.4/Firmware/firmware.rps)
> [http://192.168.1.4/Firmware/firmware1.rps](http://192.168.1.4/Firmware/firmware1.rps)

- Giving the `http://<your-ip-address>/<Sub-Resource-Directory>` in browser should load as shown below. Clicking on any link should download the Firmware files.

![Webpage in browser](/wifibt-wc-snippet-examples/2.14.0/images/image415.png)

- Get the resource Information and test with Application  
  - In the RS9116 FOTA application, make below changes and test application this should start downloading firmware.  
  ```c  
  #define HTTP_SERVER_IP_ADDRESS "192.168.1.4"              //Replace this values related to your requirements  
  #define HTTP_URL               "Firmware/RS9116C.2.2.0.0006.rps"          //HTTP GET request resource name  
  #define HTTP_HOSTNAME          "192.168.1.4"//Replace this values related to your requirements  
  ```

> **Warning:** Make sure that you are able to Access the WAMP-Apache Server (with its IP Address) is accessible to other systems in the same network, if not follow the Changing PHP Configurations. Else proceed with next steps

- Changing PHP Configuration  
  - The below steps to be done only when you face an issue of not able to access the WAMP-Server from other machines in the network. Issue shown below :

![Issue of not able to access the WAMP-Server from other machines](/wifibt-wc-snippet-examples/2.14.0/images/image416.png)

- Give permissions to the newly created resource `"<Sub-Resource-Directory>"`
- Open "phpmyadmin.conf" file in "C:\wamp64\alias\phpmyadmin.conf"
- Add the line shown below into the end of file "phpmyadmin.conf" file. Save and exit the file.  
  ```sh  
  <Directory "c:/wamp64/www/<Sub-Resource-Directory>/">  
    
    
  For example,  
  <Directory "c:/wamp64/www/Firmware/">  
  Options +Indexes +FollowSymLinks +MultiViews  
  AllowOverride all  
  Require all granted  
  </Directory>  
  ```
- Restart Apache service and now the resource should be accessible from any systems connected in the same network.

> **Note:**
> Even though if you are not able to access `http://<your-ip-address>/` this page directly, you will be able to access your resources from here `http://<your-ip-address>/<Sub-Resource-Directory>/` as we gave only permissions for this

###### 6.4 Configuring and Uploading Firmware on Apache HTTPs:

HTTPs Sever configuration for Apache requires Wamp server, if you have not installed it, follow the **"Step 1: Download and Install Wamp-Apache Server"** step and continue with the HTTPS steps in this document.

- **Download and Install OPENSSL for windows**  
  - OpenSSL for windows from here ([https://slproweb.com/products/Win32OpenSSL.html](https://slproweb.com/products/Win32OpenSSL.html)).  
  - Do default install for OpenSSL.  
  - We can only run OpenSSL using command prompt, for that we need to first find the openssl.exe file.  
  - Normally it will be in "C:\Program Files\OpenSSL-Win64\bin\openssl.exe"
- **Generate required certs**  
  > **Note:** If you already have the reqired certs to run the server then, skip the **Generate required certs** step, copy your certs to `C:\wamp64\bin\apache\apache2.4.46\conf` directory and update the `httpd-ssl.conf` file with these certificate paths shown in **HTTPD Configuration** step.  
  - Open Command Prompt in Administrator privilege's.  
  - Change directory to your openssl.exe file "cd C:\Program Files\OpenSSL-Win64\bin"  
  - Execute the below command to generate a private.key file with AES 256 encryption.

```sh
   openssl.exe genrsa -aes256 -out private.key 2048
   openssl.exe rsa -in private.key -out private.key
   openssl.exe req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config <your-wamp-apache-openssl.conf-file-path>
   openssl.exe req -new -x509 -nodes -sha1 -key private.key -out certificate.crt -days 36500 -config C:\wamp64\bin\apache\apache2.4.46\conf\openssl.conf
```

- Now there will be two files created [Private.key and certificate.crt] in "C:\Program Files\OpenSSL-Win64\bin" directory, copy them to "C:\wamp64\bin\apache\apache2.4.46\conf"
- **HTTPD Configuration**  
  - Open "httpd.conf" file in "C:\wamp64\bin\apache\apache2.4.46\conf"  
  - Uncomment the below shown lines in that file. Save and Exit.  
  ```sh  
  LoadModule ssl_module modules/mod_ssl.so  
  Include conf/extra/httpd-ssl.conf  
  LoadModule socache_shmcb_module modules/mod_socache_shmcb.so  
  ```  
  - Open "php.ini" file in "C:\wamp64\bin\php\php5.6.40" and uncomment the below line in the file    
    `extension=php_openssl.dll`  
  - Open "httpd-ssl.conf" file in "C:\wamp64\bin\apache\apache2.4.46\conf\extra" and update the below paths with proper information (i.e provide system relative paths)  
  ```sh  
  <VirtualHost default:443>  
  General setup for the virtual host  
  DocumentRoot "C:/wamp64/www"  
  ServerName 192.168.43.85:443  
  ServerAdmin admin@example.com  
  ErrorLog "C:/wamp64/bin/apache/apache2.4.46/logs/error.log"  
  TransferLog "C:/wamp64/bin/apache/apache2.4.46/logs/access.log"  
    
  SSLCertificateFile "C:/wamp64/bin/apache/apache2.4.46/conf/certificate.crt"  
  SSLCertificateKeyFile "C:/wamp64/bin/apache/apache2.4.46/conf/private.key"   
  ```  
  - Run below command to check if the configurations given above are proper or not. If the configurations are proper, it will return "Syntax OK"    
    `httpd.exe -t`
- **Configure HTTPS Wamp-Apache Server to Download firmware**  
  - Goto the Wamp Root directory "C:\wamp64" and navigate to "www"  
  - Create a new folder in that directory "Firmware". [Folder Structure: C:\wamp64\www\Firmware]  
  - In the "Firmware" folder create an "index.html" file and write below contents to the file.

```html
    <!DOCTYPE html>
    <html>
        <body>
            <h2>Using a Relative File Path</h2>
            <a href="firmware.rps" download>Download_Version_6</a><br><br>
            <a href="firmware1.rps" download>Download_Version_4</a>
        </body>
    </html>
```

- This code will link your resources to Apache server, so that those files can be downloaded.
- Make sure to copy all the firmware files into the present directory, C:\wamp64\www\Firmware
- you can edit href values in the index.html to your firmware file names.

```html
    <a href="<your-firmware-file>-1.rps" download>Download_Version_6</a><br><br>
    <a href="<your-firmware-file>-2.rps" download>Download_Version_4</a>
```

- Save the file and Exit.
- **Restart Server**  
  - Open RUN, "WIN+R" → "services.msc" → ENTER  
  - Restart the Apache service.  
  - Open browser and give your Apache server URL

![Give your Apache server URL](/wifibt-wc-snippet-examples/2.14.0/images/image418.png)

> - Here click on "Advanced Settings" and click on "Proceed to 192.168.43.85 (unsafe)"
> - You will be able to access the page and resources in HTTPS.

![Access the page and resources in HTTPS](/wifibt-wc-snippet-examples/2.14.0/images/image419.png)

> **Note:** Make sure to check your HTTPS server from other local machines present in the same network. It should be accessible.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN Throughput (IPv6)

##### Introduction

This application demonstrates the procedure to measure WLAN UDP/TCP/SSL throughput by configuring the RS9116W in client/server role.
In this application, the RS9116W connects to a Wi-Fi access point, obtains an IP address, connects to Iperf server/client running on a remote PC and measures Tx/Rx throughput transmitted/received from remote PC.

##### Setting Up

To use this application, the following hardware, software and project setup is required.

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- A computer running Iperf (may be the same PC or Mac used to program the Host MCU)
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wi-Fi Access Point

![Figure: Setup Diagram for WLAN Throughput Example](/wifibt-wc-snippet-examples/2.14.0/images/wlanthroughputv6setupncp.png)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).  
  - For STM32, use [Keil](https://www.keil.com/demo/eval/arm.htm)
- Installation of Build tools for Linux including the gcc compiler (or equivalent on PC or Mac)  
  - For Ubuntu, use the following command for installation: `user@ubuntu:~$ sudo apt install build-essential`
- If you don't have Linux, [Cygwin for Windows](https://www.cygwin.com/) may be used instead
- A working installation of [iPerf version 2.0.9](https://iperf.fr/iperf-download.php#windows).  **Note:** iPerf version 2.0.9 is the only version that has been verified to work with this example.

###### Project Setup

- **Silicon Labs EFx32 Host**. Follow the the [Getting Started with EFx32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup the example to work with EFx32 and Simplicity Studio.
- **STM32F411 Host**. Follow the the [Getting Started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/) to setup the example to work with STM32 and Keil.

##### Configuring the Application

The application can be configured to suit your requirements and development environment.
Read through the following sections and make any changes needed.

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms (STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms (EFM32GG11) and the RS9116W EVK.

###### Bare Metal/RTOS Support

To select a bare metal configuration, see [Selecting bare metal](#selecting-bare-metal).

###### Wi-Fi Configuration

Configure the following parameters in [rsi_throughput_app.c](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/examples/featured/wlan_throughput/rsi_throughput_app.c) to enable your Silicon Labs Wi-Fi device to connect to your Wi-Fi network.

```c
#define SSID          "SILABS_AP"  // Wi-Fi Network Name
#define PSK           "1234567890" // Wi-Fi Password
#define SECURITY_TYPE RSI_WPA2     // Wi-Fi Security Type: RSI_OPEN / RSI_WPA / RSI_WPA2
#define CHANNEL_NO    0            // Wi-Fi channel if the softAP is used (0 = auto select)
```

###### Client/Server IP Settings

```c
#define PORT_NUM          <local_port>        // Local port to use
#define SERVER_PORT       <remote_port>       // Remote server port
#define SERVER_IP_ADDRESS "2001:db8:0:1::121" // Remote server IP address                                          
```

##### Throughput Measurement Types

The application may be configured to measure throughput using UDP, TCP or SSL/TLS packets. Choose the measurement type using the `THROUGHPUT_TYPE` macro.

```c
#define THROUGHPUT_TYPE TCP_TX // Selects the throughput option; see the following diagrams.
#define TCP_TX          0      // RS9116W transmits packets to remote TCP client
#define TCP_RX          1      // RS9116W receives packets from remote TCP server
#define UDP_TX          2      // RS9116W transmits packets to remote UDP client
#define UDP_RX          3      // RS9116W receives packets from remote UDP server
#define SSL_TX          4      // RS9116W transmits packets to remote SSL client
#define SSL_RX          5      // RS9116W receives packets from remote SSL server
```

**RS9116 is a TCP Client (sends TCP packets to a remote server) ...**
![Figure: RS9116W Configured in TCP Client Mode](/wifibt-wc-snippet-examples/2.14.0/images/image211.png)

**RS9116W is a TCP Server (receives TCP packets from a remote client) ...**
![Figure: RS9116W Configured in TCP Server Mode](/wifibt-wc-snippet-examples/2.14.0/images/image212.png)

**RS9116 is a UDP Client (sends UDP packets to a remote server) ...**
![Figure: RS9116W Configured in UDP Client Mode](/wifibt-wc-snippet-examples/2.14.0/images/image213.png)

**RS9116 is a UDP Server (receives UDP packets from a remote client) ...**
![Figure: RS9116W Configured in UDP Server Mode](/wifibt-wc-snippet-examples/2.14.0/images/image214.png)

**RS9116 is a SSL Client (sends SSL packets to a remote server) ...**
![Figure: RS9116W Configured in SSL Client Mode](/wifibt-wc-snippet-examples/2.14.0/images/image215.png)

**RS9116 is a SSL Server (receives SSL packets from a remote client) ...**
![Figure: RS9116W Configured in SSL Server Mode](/wifibt-wc-snippet-examples/2.14.0/images/image216.png)

##### Throughput Options

Various options are available to customize throughput measurements. Some options only apply for specific throughput types as secribed in the following sections.

###### Discrete Interval Measurements (UDP Rx and SSL Tx)

```c
#define MAX_TX_PKTS 10000
```

The default value of `MAX_TX_PKTS` is 10000. To measure throughput for higher intervals, make the following changes:

- UDP Rx : Increase the value of `MAX_TX_PKTS` and provide a higher interval in the corresponding iperf command
- SSL Tx : Increase the value of `MAX_TX_PKTS` and update the equivalent value in `SSL_Server_throughput_v6.py` located in the  release directory `resources/scripts/`.

###### Discrete Interval Measurements (UDP Tx and TCP Tx)

```c
#define THROUGHPUT_AVG_TIME 30000 // Throughput average time in ms
```

Configure `THROUGHPUT_AVG_TIME` to suit the desired interval.

###### Discrete Interval Measurements (TCP Rx and SSL Rx)

- TCP Rx : Configure the interval desired using the corresponding iperf command
- SSL Rx : Increase the packet count in `SSL_tx_throughput_v6.py` located in the release directory `/resources/scripts/`.

###### Continous Throughput Measurements

```c
#define CONTINUOUS_THROUGHPUT 0
```

**`CONTINUOUS_THROUGHPUT` = `0`** (default value)

- Throughput is calculated only once for interval of :  
  - `THROUGHPUT_AVG_TIME` in case of UDP TX/TCP TX  
  - `MAX_TX_PKTS` in case of UDP RX/SSL TX
- The time interval is provided by the server in case of TCP RX
- Default packet count is provided in server `SSL_tx_throughput.py` in case of `SSL RX`

**`CONTINUOUS_THROUGHPUT` = `1`**.

- The application measures throughput continuously for every interval of `THROUGHPUT_AVG_TIME` regardless of `THROUGHPUT_TYPE`, when provided with the following configuration.  
  - UDP Rx/TCP Rx : Configure high interval greater than `THROUGHPUT_AVG_TIME`  
  - SSL Rx/SSL Tx : Increase packet count to the maximum in the scripts `SSL_tx_throughput_v6.py` and `SSL_Server_throughput_v6.py`

---

**Note!**
If `CONTINUOUS_THROUGHPUT` = `1`, ensure that the RS9116W client/server runs with an interval greater than `THROUGHPUT_AVG_TIME`.

---

#Testing Throughput
There are two 'ends' involved when measuring throughput, data is sent between the client end and the server end. By default, the Iperf protocol sends data from the Client to the Server to measure throughput. Depending on the configuration selected, the RS9116W may be the client or the server. In general, it is advisable to start the server before the client since the client will immediately begin to try to connect to the server to send data.

The following sections describe how to run the RS9116W throughput application together with examples for various Iperf configurations that run on the PC.

##### Running the RS9116 Application

After making any custom configuration changes required, build, download and run the application as described in the [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) or [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/).

##### UDP Tx Throughput

To measure UDP Tx throughput, configure the RS9116W as a UDP client and start a UDP server on the remote PC.
The Iperf command to start the UDP server on the PC is:

> `C:\> iperf.exe -s -u -V -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -u -V -p 5001 -i 1`

##### UDP Rx Throughput

To measure UDP Rx throughput, configure the RS9116W as a UDP server and start a UDP client on the remote PC.
The Iperf command to start the UDP client is:

> `C:\> iperf.exe -c <Module_IP> -u -V -l 1450 -p <Module_Port> -i 1 -b <Bandwidth> -t <time interval in seconds>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 2001:db8:0:1::121 -u -V -l 1450 -p 5001 -i 1 -b 50M -t 30`

##### TCP Tx Throuhgput

To measure TCP Tx throughput, configure the RS9116W as a TCP client and start a TCP server on the remote PC.
The Iperf command to start the TCP server is:

> `C:\> iperf.exe -s -V -p <SERVER_PORT> -i 1`
> 
> For example ...
> 
> `C:\> iperf.exe -s -V -p 5001 -i 1`

##### TCP Rx Throughput

To measure TCP Rx throughput, configure the RS9116W as TCP server and start a TCP client on the remote PC.
The Iperf command to start the TCP client is:

> `C:\> iperf.exe -c <Module_IP> -V -p <module_PORT> -i 1 -t <time interval in sec>`
> 
> For example ...
> 
> `C:\> iperf.exe -c 2001:db8:0:1::121 -V -p 5001 -i 1 -t 30`

##### SSL Tx Throughput

To measure SSL Tx throughput, configure the RS9116W as a SSL client and start a SSL server on the remote PC as described in the following bullets:

- Copy the `SSL_Server_throughput_v6.py` script from the release `/resources/scripts/` directory to the `/resources/certificates/` directory
- Open a command prompt and cd to the folder `/resources/certificates/`, then run the following command:  
  - `C:\> python SSL_Server_throughput_v6.py`

##### SSL Rx Throughput

To measure SSL RX throughput, configure the RS9116W as a SSL server and open a SSL client on the remote PC as described in the following bullets:

- Copy the `SSL_tx_throughput_v6.py` script from the release `/resources/scripts/` directory to the `/resources/certificates/`
- Open a command prompt and cd to the folder `/resources/certificates/`, then run the following command:  
  - `C:\> python SSL_tx_throughput_v6.py`

The RS9116W, which is configured as a UDP/TCP/SSL server/client, connects to the iperf server/client and sends/receives data for configured intervals. While module is transmitting/receiving the data, application prints the throughput numbers in serial console.

---

**Note!**
In this release, due to a low SPI frequency configured for the EFR32, WLAN throughput is lower than the maximum achievable throughput. This will be addressed in the next release.

---

#Selecting Bare Metal
The application has been designed to work with FreeRTOS and Bare Metal configurations. By default, the application project files (Keil and Simplicity studio) are configured with FreeRTOS enabled. The following steps demonstrate how to configure Simplicity Studio and Keil to test the application in a Bare Metal environment.

##### Bare Metal with Simplicity Studio

> - Open the project in Simplicity Studio
> - Right click on the project and choose 'Properties'
> - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Symbols' and remove macro 'RSI_WITH_OS=1'
> - Select 'Apply' and 'OK' to save the settings

![Figure: project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image216b.png)

![Figure: project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image216c.png)

##### Bare Metal with Keil

> - Open the project in Keil and select 'Options for Target'
> - Go to the 'C/C++' tab and remove 'RSI_WITH_OS' macro present under Preprocessor Symbols
> - Select 'OK' to save the settings

![Figure: project settings in Keil IDE](/wifibt-wc-snippet-examples/2.14.0/images/image216a.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Concurrent Mode

##### 1. Purpose / Scope

The RS9116W EVK configuration in both Wi-Fi Station mode and Access Point mode in IPV4 + IPV6 is demonstrated in this application, as well as data transfer in both modes.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point.
- Windows PC2 (Remote PC) with iperf application.
- Windows PC with Wifi Station.

![Setup Diagram for Concurrent Mode Example](/wifibt-wc-snippet-examples/2.14.0/images/image105.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [Iperf Application](https://iperf.fr/iperf-download.php) in Windows PC (Remote PC)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image105a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_concurrent_mode.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                          "SILABS_AP"
```

STA_SECURITY_TYPE refers to the type of security. In concurrent mode STA supports Open, WPA and WPA2 securities.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define AP_SECURITY_TYPE             RSI_WPA2
```

STA_PSK refers to the STA secret key to connect with the secured Access Point.

```c
#define AP_PSK                       "1234567890"
```

DEVICE_PORT_1 port refers internal TCP client port number

```c
#define DEVICE_PORT_1                        5001
```

DEVICE_PORT_2 port refers internal LTCP server port number

```c
#define DEVICE_PORT_2                        5002
```

SERVER_PORT port refers remote SSL server port number which is opened in Windows PC2.

```c
#define SERVER_PORT                        5001
```

SERVER_IP_ADDRESS refers remote peer (Windows PC2) IPV4 address to connect with TCP server socket.

```c
#define SERVER_IP_ADDRESS                  "192.168.10.100"

SERVER_IP6_ADDRESS refers remote peer (Windows PC2) IPV6 address to connect with SSL server socket.

```c
#define SERVER_IP6_ADDRESS                  "2001:db8:0:1::100"
```

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

AP_SSID refers to the name of the WiSeConnect Access point would be created.

```c
#define AP_SSID                       "SILABS_AP"
```

AP_CHANNEL_NO refers to the channel in which AP would be started

```c
#define AP_CHANNEL_NO                 11
```

> Note:
> 
> 1. Valid values for CHANNEL_NO are 1 to 11 in 2.4GHz band and 36 to 48 & 149 to 165 in 5GHz. In this example default configured band is 2.4GHz. If user wants to use 5GHz band then user has to set RSI_BAND macro to 5GHz band in rsi_wlan_config.h file.
> 2. In concurrent mode, STA and AP should be configured in same channel. Configure the AP_CHANNEL_NO to same channel in which Wireless Access point (to which WiSeConnect STA connects) exist.

AP_SECURITY_TYPE refers to the security type of the WiSeConnect Access Point. Access point supports OPEN, WPA-PSK, WPA2-PSK security modes.

Valid configurations are:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define AP_SECURITY_TYPE                   RSI_WPA2
```

AP_ENCRYPTION_TYPE refers to the type of Encryption method .Access point supports OPEN, TKIP and CCMP methods.

Valid configurations are:

- RSI_CCMP - For CCMP encryption
- RSI_TKIP - For TKIP encryption
- RSI_NONE - For open encryption

```c
#define AP_ENCRYPTION_TYPE                RSI_CCMP
```

AP_PSK refers to the secret key if the Access point to be configured in WPA/WPA2-PSK security modes.

```c
#define AP_PSK                           “1234567890”
```

BEACON_INTERVAL refers to the time delay between two consecutive beacons in milliseconds in AP mode. Allowed values are integers from 100 to 1000 which are multiples of 100.

```c
#define BEACON_INTERVAL                    100
```

DTIM_INTERVAL refers DTIM interval of the Access Point. Allowed values are from 1 to 255.

```c
#define DTIM_INTERVAL                       4
```

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

NUMEBR_OF_PACKETS refers how many packets to send from TCP client to TCP server

```c
#define NUMBER_OF_PACKETS                 1000
```

DHCP_MODE refers whether IP address configured through DHCP or STATIC in STA mode

```c
#define DHCP_MODE                         1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to 1 and skip configuring the following STA_DEVICE_IP, STA_GATEWAY and STA_NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following STADEVICE_IP, STA_GATEWAY and STA_NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.0.10" as IP address, update the macro STA_DEVICE_IP as 0x010AA8C0.

```c
#define STA_DEVICE_IP                       0X0A00A8C0
```

IP address of the gateway should also be in long format and in little endian byte order.

Example: To configure "192.168.0.1" as Gateway, update the macro STA_GATEWAY as 0x0100A8C0

```c
#define STA_GATEWAY                         0x0100A8C0
```

IP address of the network mask should also be in long format and in little endian byte order

Example: To configure "255.255.255.0" as network mask, update the macro STA_NETMASK as 0x00FFFFFF

```c
#define STA_NETMASK                         0x00FFFFFF
```

> Note:
> 
> 1. This application is not providing the facility to configure the Access Point’s IP Parameters. Default IP address of the Silicon Labs Access point is “192.168.100.76”
> 2. In concurrent mode, IP networks of Silicon Labs STA and Silicon Labs Access  Point both should be different. Configure Wireless Access Point IP network(Ex: 192.168.0.1) other than Silicon Labs Access point IP network.

###### 4.2 Open rsi_wlan_config.h file.User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                 RSI_ENABLE
#define RSI_FEATURE_BIT_MAP             FEAT_SECURITY_PSK
#define RSI_TCP_IP_BYPASS               RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP      (TCP_IP_FEAT_DHCPV4_SERVER | TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_DHCPV6_SERVER | TCP_IP_FEAT_DHCPV6_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP      0
#define RSI_EXT_CUSTOM_FEAT_BIT_MAP     0
#define RSI_BAND                        RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE 0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE 1
```

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/concurrent_mode/projects/concurrent_mode-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/concurrent_mode/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps

1. Configure the access point in OPEN/WPA-PSK/WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Open iperf application in Windows PC2(Remote PC) command prompt which is connected to the access point
3. Open TCP server using the below command in command prompt.

`iperf.exe –c <STA_IP> -p <SERVER_PORT> -i 1`

1. After the program gets executed, RS9116W EVK connects to the access point.
2. On other side, RS9116W EVK acts as an access point with provided configurations in **Section 4.1.2**
3. After successful connection in STA mode, RS9116W EVK connects to TCP server socket opened on Windows PC2 (Remote PC) using TCP client socket and sends configured NUMBER_OF_PACKETS to remote TCP server. Refer the below image for reception of TCP data on TCP server.

![Reception of TCP data on TCP server.](/wifibt-wc-snippet-examples/2.14.0/images/image107.png)

1. Connect Windows PC with Wifi station to RS9116W EVK access point
2. After successful connection, open command prompt inWindows PC with WiFi station and initiate ping by using below command

`ping <RS9116W EVK ip address> -t`

1. The RS9116W EVK access point gives Ping reply for the received Ping Request. The below image depicts the ping success.

![Ping Success](/wifibt-wc-snippet-examples/2.14.0/images/image108.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Power Save Deep Sleep

##### 1. Purpose / Scope

This application demonstrates how to enable power save deep sleep profile with RS9116W EVK. This application enables power save profile mode 8 and then wait in a scheduler for some time. Once it will come out of delay, it will connect to the configured AP and open udp client socket. It sends some packets to the udp server, disconnects from AP and goes back to deep sleep.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point
- Windows PC2 (Remote PC) with UDP server application (Iperf Application)
- 2 wire connectors for GPIO pins
- Agilent power analyzer

![Setup Diagram for Power save deep sleep Example](/wifibt-wc-snippet-examples/2.14.0/images/image-p1.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [Iperf Application](https://iperf.fr/iperf-download.php) in the remote PC.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects/power_save_deep_sleep-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects/power_save_deep_sleep-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects/power_save_deep_sleep-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image-p1a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects/power_save_deep_sleep-brd2204a-gg11.slsproj`

###### **For Powersave functionality with NCP expansion (ACX) board**

> **Note:**For using powersave functionality with NCP expansion (ACX) board, the following macro has to be enabled:

- While using the NCP expansion (ACX) board, the `EXP_BOARD=1` preprocessor symbol should be added to the   list of defined symbols in the preprocessor menu of project settings.  
  > - Open the project in Simplicity Studio  
  > - Right click on the project and choose 'Properties'  
  > - Go to 'C/C++ Build' | 'Settings' | 'GNU ARM C Compiler' | 'Preprocessor' and add the macro `EXP_BOARD=1`  
  > - Select 'Apply' and 'OK' to save the settings

![Figure: Adding pre-processor symbol required for Expansion board](/wifibt-wc-snippet-examples/2.14.0/images/exp-board.png)

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_wlan_power_save_profile.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                               "SILABS_AP" 
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                      RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                                "1234567890" 
```

SERVER_PORT port refers remote UDP server port number which is opened in Windows PC2.

```c
#define  SERVER_PORT                       5001
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with TCP server socket. IP address should be in long format and in little endian byte order.

Example: To configure “192.168.10.100” as IP address, update the macro DEVICE_IP as 0x640AA8C0.

```c
#define  SERVER_IP_ADDRESS                 0x640AA8C0
```

NUMBER_OF_PACKETS refers how many packets to send from device to remote UDP server.

```c
#define   NUMBER_OF_PACKETS                <no of packets>
```

###### 4.1.2 The desired parameter are provided below. User can also modify the parameters as per their needs and requirements (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver.

```c
#define   GLOBAL_BUFF_LEN                  15000
```

To configure IP address DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define   DHCP_MODE                        1 
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to “0” and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure “192.168.10.10” as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define   DEVICE_IP                        0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure “192.168.10.1” as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define   GATEWAY                          0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure “255.255.255.0” as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define   NETMASK                          0x00FFFFFF
```

In this application, default power save mode configuration is set to low power mode 8 (RSI_SLEEP_MODE_8) with maximum power save (RSI_MAX_PSP) with message based hand shake.

```c
#define   PSP_MODE                         RSI_SLEEP_MODE_8
#define   PSP_TYPE                         RSI_MAX_PSP 
```

###### 4.1.3 If the user wants different power save modes, update/modify the below macros (heading level 7)

PSP_MODE refers to the power save profile mode. RS9116W EVK supports the following power modes:

- RSI_ACTIVE (0)   : In this mode, module is active and power save is disabled.
- RSI_SLEEP_MODE_1 (1): In this power mode, module goes to power save after association with the Access Point. In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module.
- RSI_SLEEP_MODE_2 (2): In this power mode, module goes to power save after association with the Access Point. In this sleep mode, SoC will go to sleep based on GPIO hand shake or Message exchange, therefore handshake is required before sending data to the module.
- RSI_SLEEP_MODE_8 (8): In this power mode, module goes to power save when it is in unassociated state with the Access Point. In this sleep mode, SoC will go to sleep based on GPIO hand shake or Message exchange, therefore handshake is required before sending the command to the module.

```c
#define   PSP_MODE                         RSI_SLEEP_MODE_8
```

WiSeConnect device supports following power save modes:

- RSI_CONNECTED_GPIO_BASED_PS = 2
- RSI_CONNECTED_MSG_BASED_PS = 3
- RSI_GPIO_BASED_DEEP_SLEEP = 8
- RSI_MSG_BASED_DEEP_SLEEP = 9

Among the above mentioned four power save modes, which power save mode must be selected will depend upon the two macros i.e., PSP_MODE and RSI_HAND_SHAKE_TYPE selection.

|RSI_HAND_SHAKE_TYPE|PSP_MODE| |
|---|---|---|
| |RSI_SLEEP_MODE_2 (Connected_SLEEP)|RSI_SLEEP_MODE_8 (Deep_SLEEP)|
|GPIO_BASED|RSI_CONNECTED_GPIO_BASED_PS = 2|RSI_GPIO_BASED_DEEP_SLEEP = 8|
|MSG_BASED|RSI_CONNECTED_MSG_BASED_PS = 3|RSI_MSG_BASED_DEEP_SLEEP = 9|

> Note:
> For RSI_SLEEP_MODE_2 and RSI_SLEEP_MODE_8 modes, GPIO or Message based hand shake can be selected using RSI_HAND_SHAKE_TYPE macro which is define in rsi_wlan_config.h
> In this example user can verify RSI_SLEEP_MODE_2 with Message based hand shake. If user wants to verify other power modes, user has to change the application as well as GPIO hand shake signals.

PSP_TYPE refers power save profile type. WiSeConnect device supports following power save profile types :

- RSI_MAX_PSP (0)  : In this mode, WiSeConnect device will be in Maximum power save mode. i.e Device will wake up for every DTIM beacon and do data Tx and Rx.
- RSI_FAST_PSP (1): In this mode, WiSeConnect device will disable power save for any Tx/Rx packet for monitor interval of time (monitor interval can be set through macro in release/examples/snippets/wlan/power_save_deep_sleep/rsi_wlan_config.h file, default value is 50 ms).If there is no data for monitor interval of time then module will again enable power save.
- RSI_UAPSD (2)  : This PSP_TYPE is used to enable WMM power save.

```c
#define   PSP_TYPE                         RSI_MAX_PSP
```

> Note:
> PSP_TYPE is valid only when PSP_MODE set to RSI_SLEEP_MODE_1 or RSI_SLEEP_MODE_2 mode.
> RSI_UAPSD power profile type in PSP_TYPE is valid only when RSI_WMM_PS_ENABLE is enabled in rsi_wlan_config.h file.

###### 4.2 Open rsi_wlan_config.h file

###### 4.2.1 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements (heading level 7)

```c
#define   CONCURRENT_MODE                  RSI_DISABLE
#define   RSI_FEATURE_BIT_MAP              (FEAT_SECURITY_OPEN | FEAT_ULP_GPIO_BASED_HANDSHAKE)
#define   RSI_TCP_IP_BYPASS                RSI_DISABLE
#define   RSI_TCP_IP_FEATURE_BIT_MAP       TCP_IP_FEAT_DHCPV4_CLIENT
#define   RSI_CUSTOM_FEATURE_BIT_MAP       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define   RSI_EXT_CUSTOM_FEATURE_BIT_MAP   (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE)
#define   RSI_BAND                         RSI_BAND_2P4GHZ
```

Default configuration of low power save mode 2

```c
#define   RSI_HAND_SHAKE_TYPE              GPIO_BASED
#define   RSI_SELECT_LP_OR_ULP_MODE        RSI_LP_MODE
#define   RSI_DTIM_ALIGNED_TYPE            0
#define   RSI_MONITOR_INTERVAL             50
#define   RSI_WMM_PS_ENABLE                RSI_DISABLE
#define   RSI_WMM_PS_TYPE                  0    
#define   RSI_WMM_PS_WAKE_INTERVAL         20
#define   RSI_WMM_PS_UAPSD_BITMAP          15
```

###### 4.2.2 The application is provided with RSI_SLEEP_MODE_8 configurtion. If the user wants to modify different power save modes, update/modify the below macros (heading level 7)

RSI_HAND_SHAKE_TYPE is used to select GPIO or Message based hand shake in RSI_SLEEP_MODE_2 and RSI_SLEEP_MODE_8 modes.

```c
#define   RSI_HAND_SHAKE_TYPE              GPIO_BASED 
```

RSI_SELECT_LP_OR_ULP_MODE is used to select low power mode or ultra low power mode.

Valid configurations are:

- RSI_LP_MODE        : In this module will be in Low power mode.
- RSI_ULP_WITH_RAM_RET : In this module will be in Ultra low power mode and it will remember the previous state after issuing power save mode command.
- RSI_ULP_WITHOUT_RAM_RET : In this module will be in Ultra low power mode and it will not remember the previous state after issuing power save mode command. In order to wake the module up, the user needs to call wake up API (rsi_req_wakeup). Once the module wakes up, it gives CARD READY indication to the host and the user has to issue commands from wireless Initialization API (rsi_wireless_init).

```c
#define   RSI_SELECT_LP_OR_ULP_MODE        RSI_LP_MODE 
```

RSI_DTIM_ALIGNED_TYPE refers whether module has to wake up at normal beacon or DTIM beacon which is just before listen interval.

If RSI_DTIM_ALIGNED_TYPE is set to 0 i.e module will wake up at normal beacon which is just before listen interval

If RSI_DTIM_ALIGNED_TYPE is set to 1 i.e module will wake up at DTIM beacon which is just before listen interval

```c
#define    RSI_DTIM_ALIGNED_TYPE           0 
```

RSI_MONITOR_INTERVAL refers amount of time (in ms) to wait for Tx or Rx before giving power save indication to connected Access Point.

```c
#define     RSI_MONITOR_INTERVAL           50
```

> Note:
> RSI_MONITOR_INTERVAL is applicable only when PSP_TYPE selected as RSI_FAST_PSP

RSI_WMM_PS_ENABLE is used to enable or disable WMM power save.

```c
#define     RSI_WMM_PS_ENABLE              0 
```

RSI_WMM_PS_TYPE is used to set Tx based or Periodic based WMM power save.Update RSI_WMM_PS_TYPE macro with 0 for Tx Based or 1 for periodic based WMM power save.

```c
#define     RSI_WMM_PS_TYPE                0 
```

RSI_WMM_PS_WAKE_INTERVAL refers at periodic time (in ms) module has to wake up module when RSI_WMM_PS_TYPE selected as Periodic.

```c
#define     RSI_WMM_PS_WAKE_INTERVAL       20
```

RSI_WMM_PS_UAPSD_BITMAP refers UAPSD bitmap

```c
#define     RSI_WMM_PS_UAPSD_BITMAP        15 
```

> Note:
> If RSI_WMM_PS_ENABLE is enabled then user has to set PSP_TYPE to RSI_UAPSD in order to work with WMM power save mode.

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Configure STM32 CN10 header pin-4 should connect to UULP_GPIO_0 and CN10 header pin-2 should connect to UULP_GPIO_2.
- Open the project `<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects/power_save_deep_sleep-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project.
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Configure EFX32 J4 pin-9 should connect to UULP_GPIO_0 and EVFX32 J4 pin-7 should connect to UULP_GPIO_2.
- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/power_save_deep_sleep/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU.
- Debug the project.
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before the Free run.
- Free run the project.
- Then continue the common steps from **5.3**

###### 5.3 Common Steps (heading level 7)

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Open UDP server application using iperf application in Windows PC2 (Remote PC) which is connected to access point.  
   `iperf_demo.exe –s -u -p <SERVER_PORT> -i 1`

![Open UDP server application using iperf application](/wifibt-wc-snippet-examples/2.14.0/images/image-p2.png)

1. After program gets executed, RS9116W EVK will go to sleep based on the selected power mode and wakes up after deep sleep timeout (Default deep sleep time is 3sec in RSI_SLEEP_MODE_8 with message based hand shake). Refer the given below image for power save cycle for default deep sleep time.

![Power save cycle for default deep sleep time](/wifibt-wc-snippet-examples/2.14.0/images/image-p3.png)

1. After successful wake up from deep sleep, RS9116W EVK connects to AP and sends configured number of (NUMBER_OF_PACKETS) UDP packets to remote peer which is connected to Access point. Refer the given below image for reception of UDP data on UDP server.

![Reception of UDP data on UDP server](/wifibt-wc-snippet-examples/2.14.0/images/image-p4.png)

1. After sending configured number of packets, RS9116W EVK disconnects from connected AP and again repeat the above steps (It will again go to sleep and wakes up after time out, connects to AP and sends configured number of packets). Find below image for power save profile cycle.

![power save profile cycle](/wifibt-wc-snippet-examples/2.14.0/images/image-p5.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### AWS Device Shadow Logging Stats

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116 as an IoT device and securely connect to AWS IoT Core to subscribe and publish to a topic.

A device’s shadow is a persistent, virtual representation of the device that can be interacted with from AWS IoT Core even if the device is offline.
The device state is captured in its "shadow" is represented as a JSON document.
The device can send commands over MQTT to get, update and delete its latest state as well as receive notifications over MQTT about changes in its state.

Application will subscribe to shadow update topics :
aws/things/thingName/shadow/name/shadowName/update/accepted
aws/things/thingName/shadow/name/shadowName/update/rejected
$aws/things/thingName/shadow/name/shadowName/update/delta

Application publishes data on topic $aws/things/thingname/shadow/update, with new room temperature and the same will be reflected in AWS cloud.

Application calculates the powersave statistics of Wakeup and Sleep times and this data will be displayed in the communication port.

##### Overview of AWS SDK

AWS IoT Core is a cloud platform which connects devices across AWS cloud services. AWS IoT provides a interface which allows the devices to communicate securely and reliably in bi-directional ways to the AWS touch-points, even when the devices are offline.

The AWS IoT Device SDK allow applications to securely connect to the AWS IoT platform.

![Setup Diagram for Device Shadow Example](/wifibt-wc-snippet-examples/2.14.0/images/image431a.png)

##### 2. Prerequisities / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point

![Setup Diagram for Device Shadow Example](/wifibt-wc-snippet-examples/2.14.0/images/image91.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio).
- [Amazon AWS](https://aws.amazon.com/) account
- Python 3 installation

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder consists of Keil and Simplicity studio (ssl) project files.

- Keil project :  
  - The Keil can be executed on STM32 platform.  
  - Project Path : `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\device_shadow_logging_stats\projects\device_shadow_logging_stats-nucleo-f411re.uvprojx`
- Simplicity Studio :  
  - The Simplicity Studio project can be executed on EFR32MG21.  
  - Project Path :  
  - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\device_shadow_logging_stats\projects\device_shadow_logging_stats-brd4180a-mg21.slsproj`  
  - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\device_shadow_logging_stats\projects\device_shadow_logging_stats-brd4180b-mg21.slsproj`  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/cloud_apps\aws_iot\mqtt/projects/aws_iot_mqtt-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open device_shadow_logging_stats.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                           "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                   RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                             "1234567890"
```

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_MQTT_CLIENT_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

MQTT Task stack size is configured by this macro

```c
#define RSI_MQTT_CLIENT_TASK_STACK_SIZE           512 * 4
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         512 * 2
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                        1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

The IP address needs to be configuring to the RS9116W EVk should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                        0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                          0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                          0x00FFFFFF
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                  RSI_DISABLE
#define RSI_FEATURE_BIT_MAP              FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP       (TCP_IP_FEAT_DHCPV4_CLIENT|TCP_IP_FEAT_SSL |TCP_IP_FEAT_DNS_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP   (RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM | BIT(1) | BIT(3) | BIT(27))
#define RSI_BAND                         RSI_BAND_2P4GHZ
```

###### 4.3 Configure Below Parameters in aws_iot_config.h File

```c
//AWS Host name 
#define AWS_IOT_MQTT_HOST          "xxxxxxxxxxxxx-ats.iot.us-east-2.amazonaws.com"  

//default port for MQTT
#define AWS_IOT_MQTT_PORT          "8883"

// MQTT client ID should be unique for every device  
#define AWS_IOT_MQTT_CLIENT_ID     "Test_IoT"

// Thing Name of the Shadow this device is associated with 
#define AWS_IOT_MY_THING_NAME      "Test_IoT"  
```

###### 4.4 Setting up Security Certificates

To authenticate and securely connect with AWS, your Wi-Fi device requires a unique x.509 security certificate and private key, as well as a CA certificate which is used to verify the AWS server. Security credentials need to be converted into a C-array rather than [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) provided by AWS; they also need to be added to your project.

The RS9116 SDK provides a conversion script (written in Python 3) to make the conversion straightforward. The script is provided in the SDK 'resources' directory and is called [certificate_to_array.py](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/).

To convert the device certificate and private key to C arrays, open a system command prompt and use the script as indicated in the following examples.

```sh
$> python3 certificate_to_array.py <input filename> <output arrayname>

For example:
$> python3 certificate_to_array.py d8f3a44d3f.cert.pem    aws_client_certificate
$> python3 certificate_to_array.py d8f3a44d3f.private.key aws_client_private_certificate
```

After running the script on the certificate and private key, two new files are created.

```sh
aws_client_certificate.pem.crt.h
aws_client_private_key.pem.key.h
```

Before proceeding, copy both of the new files to the WiSeConnect directory: `<SDK>/resources/certificates`<br />Go ahead and overwrite any existing files with the same name in that directory, the originals are not needed.

The Root CA certificate used by your Wi-Fi device to verify the AWS server is already included in the RS9116 SDK; no additional setup is required.
For reference, Amazon uses [Starfield Technologies](https://www.starfieldtech.com/) to secure the AWS website, the RS9116 SDK includes the [Starfield CA Certificate](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/aws_starfield_ca.pem.h).

> NOTE :
> For AWS connectivity, StarField Root CA Class 2 certificate has the highest authority being at the top of the signing hierarchy.
> 
> The StarField Root CA Class 2 certificate is an expected/required certificate which usually comes pre-installed in the operating systems and it plays a key part in certificate chain verification when a device is performing TLS authentication with the IoT endpoint.
> 
> On RS9116 device, we do not maintain root CA trust repository due to memory constraints, so it is mandatory to load StarField Root CA Class 2 certificate for successful mutual authentication to AWS server.
> 
> The certificate chain sent by AWS server is as below:
> id-at-commonName=Amazon,id-at-organizationalUnitName=Server CA 1B,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Amazon Root CA 1,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Starfield Services Root Certificate Authority ,id-at-organizationName=Starfield Technologies, Inc.,id-at-localityName=Scottsdale,id-at-  stateOrProvinceName=Arizona,id-at-countryName=US)
> 
> On RS9116 to authenticate the AWS server, firstly Root CA is validated (validate the Root CA received with the Root CA loaded on the device). Once the Root CA is validation is successful , other certificates sent from the AWS server are validated.
> RS9116 don't authenticate to AWS server if intermediate CA certificates are loaded instead of StarField Root CA Class 2 certificate and would result in Handshake error.
> StarField Root CA Class 2 certificate is at [https://certs.secureserver.net/repository/sf-class2-root.crt](https://certs.secureserver.net/repository/sf-class2-root.crt)
> 
> Reference links :
> [https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/](https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/)

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK.

The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Configure STM32 CN10 header pin-30(PB13) should connect to UULP_GPIO_0 and STM32 pin-2 should connect to UULP_GPIO_2.
- Open the project `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\device_shadow_logging_stats\projects\device_shadow_logging_stats-nucleo-f411re.uvprojx`
- Build and debug the project.
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before Free run.
- Free run the project.
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Configure EFX32 pin-9(PD03/PB01 GPIO) should connect to UULP_GPIO_0 and EVFX32 pin-7(PD02/PB00 GPIO) should connect to UULP_GPIO_2.
- Open Simplicity Studio and import the project `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\device_shadow_logging_stats\project`
- Select the appropriate .slsproj as per the Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point with Internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect module in STA mode.
2. Configure the application with the configurations mentioned in **Section 4**. Log in to AWS console and open the THING created in console [ Refer to Appendix on how to create a Thing ]
3. Application will Subscribe to Shadow topics

$aws/things/thingName/shadow/name/shadowName/update/accepted

$aws/things/thingName/shadow/name/shadowName/update/rejected

$aws/things/thingName/shadow/name/shadowName/update/delta

Application is simulated to modify the room temperature in each iteration and Publish the data on topic $aws/things/thingname/shadow/update , the same can be viewed in AWS console

1. After successful execution, updates can be observed in thing shadow present in AWS cloud.

![Shadow Update Activity](/wifibt-wc-snippet-examples/2.14.0/images/image94.png)

1. Following debug prints will be displayed for successful execution :

![Debug Prints](/wifibt-wc-snippet-examples/2.14.0/images/image443.png)

##### Appendix

###### Create an AWS Thing

Create a thing in the AWS IoT registry to represent your IoT Device.

- In the [AWS IoT console](https://console.aws.amazon.com/iot/home), in the navigation pane, choose Manage, and then choose Things.

![AWS console](/wifibt-wc-snippet-examples/2.14.0/images/image444.png)

- If a **You don't have any things yet** dialog box is displayed, choose **Register a thing**. Otherwise, choose **Create**.
- Click on **Create**.

![AWS Thing](/wifibt-wc-snippet-examples/2.14.0/images/image445.png)

- On the **Creating AWS IoT things** page, choose **Create a single thing**.

![AWS thing creation](/wifibt-wc-snippet-examples/2.14.0/images/image446.png)

- On the **Add your device to the device registry** page, enter a name for your IoT thing (for example, **Test_IoT**), and then choose **Next**. You can't change the name of a thing after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.

![Add Device](/wifibt-wc-snippet-examples/2.14.0/images/image447.png)

- On the **Add a certificate for your thing page**, choose **Create certificate**.

![Add Certificate](/wifibt-wc-snippet-examples/2.14.0/images/image448.png)

- Choose the **Download** links to download the certificate, private key, and root CA certificate.  
  > **Warning:** This is the only instance you can download your certificate and private key. Make sure to save them safely.
- Choose **Activate**.
- Choose **Attach a policy**.

![Attach Policy](/wifibt-wc-snippet-examples/2.14.0/images/image449.png)

- Choose the Policy created and then choose **Register Thing**.  
  > **Note :** If you don't have any policy created, follow the steps in **Create Policy** section in the below and then choose the created Policy
- View list of devices as shown

![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image450.png)

###### Create Policy

1. Navigate to **AWS IoT console**
2. Choose **Policies** under **Secure**

![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image451.png)

1. Click on **Create**

![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image452.png)

1. Give the **Name** to your Policy, Fill **Action** and **Resource ARN** as shown in below image, Click on **Allow** under **Effect** and click **Create**

![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image453.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### AWS MQTT Subscribe-Publish Sample

##### 1. Purpose/Scope

This application demonstrates how to configure RS9116 as an IoT device and securely connect to AWS IoT Core to subscribe and publish on a topic.

In this application, RS9116W EVK is configured as Wi-Fi station and connects to an Access Point which has an internet access. After successful Wi-Fi connection, application connects to AWS Core and subscribes to a topic. Publishes a message on subscribed topic and application waits to receive the data published on subscribed topic from the cloud.

##### Overview of AWS SDK

AWS IoT Core is a cloud platform which connects devices across AWS cloud services. AWS IoT provides a interface which allows the devices to communicate securely and reliably in bi-directional ways to the AWS touch-points, even when the devices are offline.

The AWS IoT Device SDK allow applications to securely connect to the AWS IoT platform.

![Setup Diagram for Device Shadow Example](/wifibt-wc-snippet-examples/2.14.0/images/image431a.png)

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access point

![Setup Diagram for Device Shadow Example](/wifibt-wc-snippet-examples/2.14.0/images/image91.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- [Amazon AWS](https://aws.amazon.com/) account
- Python 3 installation

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder consists of Keil and Simplicity studio (ssl) project files.

- Keil project :  
  - The Keil can be executed on STM32 platform.  
  - Project Path : `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\mqtt\projects\aws_iot_mqtt-nucleo-f411re.uvprojx`
- Simplicity Studio :  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\mqtt\projects\aws_iot_mqtt-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\mqtt\projects\aws_iot_mqtt-brd4180b-mg21.slsproj`  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/cloud_apps\aws_iot\mqtt/projects/aws_iot_mqtt-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_subscribe_publish_sample.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                           "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                   RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                             "1234567890"
```

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_MQTT_CLIENT_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

MQTT Task stack size is configured by this macro

```c
#define RSI_MQTT_CLIENT_TASK_STACK_SIZE           512 * 2
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         512 * 2
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                        1
```

To configure MQTT Topic

RSI_MQTT_TOPIC refres to the topic to which the device subscribes and publishes

```c
#define RSI_MQTT_TOPIC          "$aws/things/Test_IoT/shadow/update"
```

> Note:
> To configure, STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> To configure, STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

The IP address needs to be configuring to the RS9116W EVk should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                        0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                          0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                          0x00FFFFFF
```

###### 4.2 Open  rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements

```c
#define CONCURRENT_MODE                  RSI_DISABLE
#define RSI_FEATURE_BIT_MAP              FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP       (TCP_IP_FEAT_DHCPV4_CLIENT|TCP_IP_FEAT_SSL |TCP_IP_FEAT_DNS_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP   (RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM | BIT(1) | BIT(3) | BIT(27))
#define RSI_BAND                         RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.  
  ```c  
  #define ENABLE_POWER_SAVE              0  
  ```
- If user wants to run the application in power save, modify the below macro.  
  ```c  
  #define ENABLE_POWER_SAVE              1  
  ```

###### 4.3 Configure below parameters in aws_iot_config.h file

```C
//AWS Host name 
#define AWS_IOT_MQTT_HOST          "xxxxxxxxxxxxx-ats.iot.us-east-2.amazonaws.com" 

//default port for MQTT
#define AWS_IOT_MQTT_PORT          "8883"

// MQTT client ID should be unique for every device  
#define AWS_IOT_MQTT_CLIENT_ID     "Test_IoT" 
```

###### 4.4 Setting up Security Certificates

To authenticate and securely connect with AWS, your Wi-Fi device requires a unique x.509 security certificate and private key, as well as a CA certificate which is used to verify the AWS server. Security credentials need to be converted into a C-array rather than [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) provided by AWS; they also need to be added to your project.

The RS9116 SDK provides a conversion script (written in Python 3) to make the conversion straightforward. The script is provided in the SDK 'resources' directory and is called [certificate_to_array.py](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/).

To convert the device certificate and private key to C arrays, open a system command prompt and use the script as indicated in the following examples.

```sh
$> python3 certificate_to_array.py <input filename> <output arrayname>

For example:
$> python3 certificate_to_array.py d8f3a44d3f.cert.pem    aws_client_certificate
$> python3 certificate_to_array.py d8f3a44d3f.private.key aws_client_private_certificate
```

After running the script on the certificate and private key, two new files are created.

```sh
aws_client_certificate.pem.crt.h
aws_client_private_key.pem.key.h
```

Before proceeding, copy both of the new files to the WiSeConnect directory: `<SDK>/resources/certificates`<br />Go ahead and overwrite any existing files with the same name in that directory, the originals are not needed.

The Root CA certificate used by your Wi-Fi device to verify the AWS server is already included in the RS9116 SDK; no additional setup is required.
For reference, Amazon uses [Starfield Technologies](https://www.starfieldtech.com/) to secure the AWS website, the RS9116 SDK includes the [Starfield CA Certificate](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/aws_starfield_ca.pem.h).

> NOTE :
> AWS has notified that there would be changes in their root CA chaining. Further details, can be found in the reference link:([https://aws.amazon.com/blogs/security/acm-will-no-longer-cross-sign-certificates-with-starfield-class-2-starting-august-2024/](https://aws.amazon.com/blogs/security/acm-will-no-longer-cross-sign-certificates-with-starfield-class-2-starting-august-2024/))
> We are providing both root CAs (Starfield class-2 and Starfield G2) in aws_starfield_ca.pem.h, the new files to the WiSeConnect directory `<SDK>/resources/certificates/aws_starfield_ca.pem.h`
> For AWS connectivity, StarField Root CA certificate has the highest authority being at the top of the signing hierarchy.
> 
> The StarField Root CA certificate is an expected/required certificate which usually comes pre-installed in the operating systems and it plays a key part in certificate chain verification when a device is performing TLS authentication with the IoT endpoint.
> 
> On RS9116 device, we do not maintain root CA trust repository due to memory constraints, so it is mandatory to load StarField Root CA certificate for successful mutual authentication to AWS server.
> 
> The certificate chain sent by AWS server is as below:
> 
> Starfield Class 2 :
> id-at-commonName=Amazon RSA 2048 M01,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Amazon Root CA 1,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Starfield Services Root Certificate Authority - G2,id-at-organizationName=Starfield Technologies, Inc.,id-at-localityName=Scottsdale,id-at-stateOrProvinceName=Arizona,id-at-countryName=US
> id-at-organizationalUnitName=Starfield Class 2 Certification Authority,id-at-organizationName=Starfield Technologies, Inc.,id-at-countryName=US
> 
> Starfield G2:
> id-at-commonName=Amazon RSA 2048 M01,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Amazon Root CA 1,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Starfield Services Root Certificate Authority - G2,id-at-organizationName=Starfield Technologies, Inc.,id-at-localityName=Scottsdale,id-at-stateOrProvinceName=Arizona,id-at-countryName=US
> On RS9116 to authenticate the AWS server, firstly Root CA is validated (validate the Root CA received with the Root CA loaded on the device). Once the Root CA is validation is successful , other certificates sent from the AWS server are validated.
> RS9116 don't authenticate to AWS server if intermediate CA certificates are loaded instead of StarField Root CA Class 2 certificate and would result in Handshake error.

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\mqtt\projects\aws_iot_mqtt-nucleo-f411re.uvprojx`
- Build and Debug the project.
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before Free run.
- Free run the project.
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32  project `<SDK>\examples\snippets\wlan\cloud_apps\aws_iot\mqtt\projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point with Internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect module in STA mode.
2. Configure the application with the configurations mentioned in **Section 4** for the AWS IoT Thing created.  
   [ Refer to Appendix on how to create a Thing ]
3. Application will Subscribe to the RSI_MQTT_TOPIC and Publishes message "{"state":{"desired":{"toggle":1}}}" to the same topic.  
   It receives the publish message sent, as it has subscribed to the same topic.  
   Upon receiving the Publish message it processes the message "{"state":{"desired":{"toggle":1}}}" and toggles LED.
4. The Terminal Logs appears as shown below  
   ![Console logs](/wifibt-wc-snippet-examples/2.14.0/images/image432.png)
5. You should be able to see the LED toggling on the board

##### Appendix

###### Create an AWS Thing

Create a thing in the AWS IoT registry to represent your IoT Device.

- In the [AWS IoT console](https://console.aws.amazon.com/iot/home), in the navigation pane, choose Manage, and then choose Things.  
  ![AWS console](/wifibt-wc-snippet-examples/2.14.0/images/image433.png)
- If a **You don't have any things yet** dialog box is displayed, choose **Register a thing**. Otherwise, choose **Create**.  
  Click on **Create**.

![AWS Thing](/wifibt-wc-snippet-examples/2.14.0/images/image434.png)

- On the **Creating AWS IoT things** page, choose **Create a single thing**.  
  ![AWS thing creation](/wifibt-wc-snippet-examples/2.14.0/images/image435.png)
- On the **Add your device to the device registry** page, enter a name for your IoT thing (for example, **Test_IoT**), and then choose **Next**. You can't change the name of a thing after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.  
  ![Add Device](/wifibt-wc-snippet-examples/2.14.0/images/image436.png)
- On the **Add a certificate for your thing page**, choose **Create certificate**.  
  ![Add certificate](/wifibt-wc-snippet-examples/2.14.0/images/image437.png)
- Choose the **Download** links to download the certificate, private key, and root CA certificate.  
  > **Warning:** This is the only instance you can download your certificate and private key. Make sure to save them safely.
- Choose **Activate**.
- Choose **Attach a policy**.  
  ![Attach Policy](/wifibt-wc-snippet-examples/2.14.0/images/image438.png)
- Choose the Policy created and then choose **Register Thing**.  
  > **Note :** If you don't have any policy created, follow the steps in **Create Policy** section in the below and then choose the created Policy
- View list of devices as shown  
  ![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image439.png)

###### Create Policy

1. Navigate to **AWS IoT console**.
2. Choose **Policies** under **Secure**.  
   ![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image440.png)
3. Click on **Create**.  
   ![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image441.png)
4. Give the **Name** to your Policy, Fill **Action** and **Resource ARN** as shown in below image, Click on **Allow** under **Effect** and click **Create**.  
   ![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/image442.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Azure Telemetry C2D

##### 1. Purpose / Scope

This application demonstrates how to configure RS9116 as an Azure device endpoint and how to establish connection with Azure IoT Hub and send telemetry messages to Hub from device (D2C) and receive the messages from the IoT Hub (C2D).

##### 2. Prerequisities / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART/ SPI/ SDIO).
- Silabs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silabs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wi-Fi Access point

![Setup Diagram for Azure C2D Example](/wifibt-wc-snippet-examples/2.14.0/images/image359.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silabs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Standard Azure Account.
- Python 3 installation

##### 3. Application Build Environment

###### 3.1 Platforms

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder consists of Keil and Simplicity studio (ssl) project files.

- Keil project :

- The Keil can be executed on STM32 platform.
- Project Path : `<SDK>\examples\snippets\wlan\cloud_apps\azure_iot\projects\azure_iot-nucleo-f411re.uvprojx`

- Simplicity Studio :  
  - The Simplicity Studio project can be executed on EFR32MG21.  
  - Project Path :    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\azure_iot\projects\azure_iot-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>\examples\snippets\wlan\cloud_apps\azure_iot\projects\azure_iot-brd4180b-mg21.slsproj`  
  - EFM32GG11 platform    
    - The Simplicity Studio project is used to evaluate the application on EFM32GG11.      
      - Project path:`<SDK>/examples/snippets/wlan/cloud_apps/azure_iot/projects/azure_iot-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_azure_telemetry_c2d.c file.

###### 4.1.1 User must update the following parameters (heading level 7)

SSID refers to the name of the Access point.

```c
#define SSID                           "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
#define SECURITY_TYPE                   RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK/WPA2-PSK security modes.

```c
#define PSK                             "1234567890"
```

To configure IP address

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
#define DHCP_MODE                        1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

The IP address needs to be configuring to the RS9116W EVk should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
#define DEVICE_IP                        0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0

```c
#define GATEWAY                          0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF

```c
#define NETMASK                          0x00FFFFFF
```

The following parameters are configured if OS is used. Application task should be of low priority

```c
#define RSI_APPLICATION_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

MQTT Task stack size is configured by this macro

```c
#define RSI_APPLICATION_TASK_STACK_SIZE           512 * 4
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         512 * 2
```

GLOBAL_BUFF_LEN refers the memory length for driver

```c
#define GLOBAL_BUFF_LEN                      15000
```

###### 4.2 Open  rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements.

```c
#define CONCURRENT_MODE                  RSI_DISABLE
#define RSI_FEATURE_BIT_MAP              FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP       (TCP_IP_FEAT_DHCPV4_CLIENT|TCP_IP_FEAT_SSL |TCP_IP_FEAT_DNS_CLIENT)
#define RSI_CUSTOM_FEATURE_BIT_MAP       FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP   (RAM_LEVEL_NWP_MEDIUM_MCU_MEDIUM | BIT(1) | BIT(3) | BIT(27))
#define RSI_BAND                         RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
#define ENABLE_POWER_SAVE              0
```

- If user wants to run the application in power save, modify the below macro.

```c
#define ENABLE_POWER_SAVE              1
```

###### 4.3 Configure below parameters in azure_iot_config.h file

```c
#define MAX_NW_RETRY_COUNT  5      ///< Network retry count value
#define MAX_NTP_RETRY_COUNT 5      ///< NTP retry count value
#define RECV_TIMEOUT_VAL    5000   ///< rsi_recv() Time Out in ms
#define TIMEOUT_VAL_NTP_MS  1000   ///< NTP Time Out in ms
#define NTP_SERVER_PORT     123    ///< NTP Port
#define DNS_REQ_COUNT       5      ///< DNS REQUEST retry Count
#define MQTT_KEEPALIVE_VAL  4 * 60 ///< MQTT Keepalive value
#define CONNECTION_STRING \
"HostName=xxxxxxx.azure-devices.net;DeviceId=xxxxx_Device_SelfSign;x509=true" ///< Connection string
#define MESSAGE_COUNT \
5 ///< Number of D2C messages sent to Azure Hub and also minimum number of C2D messages to be received by application
#define CLIENT_PORT 4002 ///< Client port
```

###### 4.4 To Load Certificate

**rsi_wlan_set_certificate()** API expects the certificate in the form of linear array. Convert the pem certificate into linear array form using python script provided in the SDK `<SDK>/resources/certificates/certificate_script.py`.

```sh
For example : If the certificate is ca-certificate.pem, enter the command in the following way:
python certificate_script.py ca-certificate.pem 
The script will generate ca-certificate.pem in which one linear array named ca-certificate contains the certificate.
```

Root CA certificate, Device private key and Device client certificate needs to be converted as mentioned above

After the conversion, place the converted files in `<SDK>/resources/certificates/` path and include the certificate files in rsi_azure_telemetry_c2d.c

Replace the default Device certificate and Private key certificate in the application with the converted pem file name.

```c
// Certificate includes
#include "azure_client_certificate.pem.crt.h"
#include "azure_client_private_key.pem.key.h"
#include "azure_starfield_ca.pem.h"
```

Replace the default Device certificate and Private key certificate given in `rsi_wlan_set_certificate()` API in the application with the converted pem array.

```c
// Load Security Certificates
status = rsi_wlan_set_certificate(RSI_SSL_CLIENT, azure_client_certificate, (sizeof(azure_client_certificate) - 1));

status =
rsi_wlan_set_certificate(RSI_SSL_CLIENT_PRIVATE_KEY, azure_client_private_key, (sizeof(azure_client_private_key) - 1));
```

> NOTE :
> For Azure connectivity, Baltimore Root CA certificate has the highest authority being at the top of the signing hierarchy.
> 
> The Baltimore Root CA certificate is an expected/required certificate which usually comes pre-installed in the operating systems and it plays a key part in certificate chain verification when a device is performing TLS authentication with the IoT endpoint.
> 
> On RS9116 device, we do not maintain root CA trust repository due to memory constraints, so it is mandatory to load Baltimore Root CA certificate for successful mutual authentication to Azure server.
> 
> On RS9116 to authenticate the Azure server, firstly Root CA is validated (validate the Root CA received with the Root CA loaded on the device). Once the Root CA validation is successful , other certificates sent from the Azure server are validated.
> RS9116 don't authenticate to Azure server if intermediate CA certificates are loaded instead of Baltimore Root CA certificate and would result in Handshake error.
> Baltimore Root CA certificate is at [https://www.digicert.com/kb/digicert-root-certificates.htm](https://www.digicert.com/kb/digicert-root-certificates.htm)

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>\examples\snippets\wlan\cloud_apps\azure_iot\projects\azure_iot-nucleo-f411re.uvprojx`
- Build and Debug the project.
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before Free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before Free run.
- Free run the project.
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/cloud_apps/azure_iot/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Run/debug the application
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Configure the Access point with Internet connection in OPEN/WPA-PSK/WPA2-PSK mode to connect RS9116W EVK STA mode.
2. Load the required certificates
3. Login into Azure account. Create IoT Hub in Azure portal. Add IoT Device in the Hub created.
4. Update the connection string in `azure_iot_config.h` with  
   - Primary key of the IoT Device for Symmetric key authentication

> For example : "HostName=example.azure-devices.net;DeviceId=example_Device_SymKey;SharedAccessKey=TAEw6g7gEJh6zB74ykuiUnA8UbUhsSApuqFIgd/YB6Y="

- Connection string for IoT Device with X.509 self signed authentication

> For example : "HostName=example.azure-devices.net;DeviceId=example_Device_SelfSign;x509=true"

> **Note:** Connection string can be generated as specified in Appendix section **Register a New X.509 Authenticated Device with IoT Hub** for X509 and for Symmetric Key follow  **Register IoT Device with symmetric key authentication in IoT Hub** section.

1. By default, application tries to connect to Azure Hub using X.509 self signed authentication mechanism.
2. Connect any serial console for prints.
3. Compile and run the application.  
   8 The example application on execution will send 5 telemetry messages to Azure Hub and waits to receive atleast 5 C2D messages.
4. Following logs will be displayed on the console  
   ![Console logs](/wifibt-wc-snippet-examples/2.14.0/images/image377.png)  
   10. Refer to Appendix section **Steps to check Telemetry message on Azure cloud** to check the application sent messages on cloud.  
   11. Refer to Appendix section **Steps to send c2d message from the cloud** to how to send C2D messages from Azure Hub

**Note the following :**

```c
NOTE-1 :  
If the requirement is to continue the application flow after SDK De-Init i.e Reconnect to the Azure Hub to send and receive messages, following Steps need to be followed :
 - Change the state variable to RSI_WLAN_IOTHUB_LL_INIT_STATE in state RSI_WLAN_IOTHUB_LL_DEINIT_STATE.

 - Add delay of 10sec for application to properly terminate the socket connections
   
 - Refer the snippet shared below :

**case RSI_WLAN_IOTHUB_LL_DEINIT_STATE**: {
IoTHubDeviceClient_LL_Destroy(device_ll_handle);
IoTHub_Deinit();
// Reset all the global variables
messages_sent = 0;
g_message_count_send_confirmations = 0;
g_message_recv_count = 0;
g_continueRunning = true;
LOG_PRINT("IoTHub DeInit Done. Re-INIT Application\r\n");
rsi_wlan_app_cb.state = RSI_WLAN_IOTHUB_LL_INIT_STATE ;

rsi_delay(10000);
#ifdef RSI_WITH_OS
rsi_semaphore_post(&rsi_mqtt_sem);
#endif
 break;

NOTE-2 :
 - rsi_recv() timeout value is by default configured as 5 seconds (RECV_TIMEOUT_VAL value in azure_iot_config.h)
 - If there is no data from Azure Hub, application thread will be blocked for 5 seconds in rsi_recv()
 - RECV_TIMEOUT_VAL can be modified to value less than 5 seconds to reduce the wait time in rsi_recv()

NOTE-3 :
 - There may be a delay observed in sending MQTT Keepalive packets from the application. 
 - The delay will be observed if application thread is waiting in rsi_recv() (Refer NOTE-2)  when Keepalive timeout expires.
 - The maximum delay obseved will be RECV_TIMEOUT_VAL.
 - Reducing the RECV_TIMEOUT_VAL will reduce the delay seen to send MQTT Keepalive packets.
```

##### **Appendix**

_**Appendix-1**_ : **Azure Account creation and IoT Device Registration**

1.1 _**Azure Account creation**_

- Azure offers a free 30-day trail account for all new account holders, later depending on the services you will be charged in [Pay-as-you-go way.](https://azure.microsoft.com/en-in/pricing/)
- You can follow the below steps or refer on [how to create an Azure Account.](https://docs.microsoft.com/en-us/learn/modules/create-an-azure-account/)  
  **Step 1:** Navigate to [https://azure.microsoft.com/](https://azure.microsoft.com/)  
  **Step 2:** Click on “Free Account” in the top right

![Azure account ](/wifibt-wc-snippet-examples/2.14.0/images/image360.png)

**Step 3:** Confirm that you wish to "Start for free".

![Azure free trial](/wifibt-wc-snippet-examples/2.14.0/images/image361.png)

**Step 4:** Enter the details requested to register to Microsoft Azure account. (Details like email, username, password etc...)

**Step 5:** Finally, agree to the Microsoft Azure terms and conditions to complete the setup process.

![Azure account complete](/wifibt-wc-snippet-examples/2.14.0/images/image362.png)

**Step 6:** At this stage you should be getting an Azure Link for your Azure Account.

You have now successfully created Azure account and you will be able to access all Azure Services.

1.2 _**Azure IoT Hub Creation**_

- Follow the steps below or refer [how to create an IoT Hub](https://docs.microsoft.com/en-us/azure/iot-hub/)Azure IoT Hub acts as a Gate way between IoT Devices and Azure Cloud Services,  
  Lets create a new IoT Hub service

**Step 1:** Login to your Azure account here [https://portal.azure.com/#home](https://portal.azure.com/#home)

![Azure login](/wifibt-wc-snippet-examples/2.14.0/images/image363.png)

**Step 2:** Search for “IoT Hub” or Click on the “Create a resource icon”

![Create Resource](/wifibt-wc-snippet-examples/2.14.0/images/image364.png)

**Step 3:** Search for “IoT Hub” in the marketplace

![Iot hub Search](/wifibt-wc-snippet-examples/2.14.0/images/image365.png)

**Step 4:** This will open a page given below, select “Create”

![Create IoT Hub](/wifibt-wc-snippet-examples/2.14.0/images/image366.png)

**Step 5:** Update the Basic details with below information

- _**Subscription:**_ Select the subscription to use for your hub.
- _**Resource Group:**_ Select a resource group or create a new one. To create a new one, select Create new and fill in the name you want to use. To use an existing resource group, select that resource group.
- _**Region:**_ Select the region in which you want your hub to be located. Select the location closest to you.
- _**IoT Hub Name:**_ Enter a name for your hub. This name must be globally unique.

![IoT Hub Name](/wifibt-wc-snippet-examples/2.14.0/images/image367.png)

**Step 6:** Next update the Networking details to continue creating your hub.

- Choose the endpoints that can connect to your IoT Hub. You can select the default setting **Public endpoint (all networks)**, or choose **Public endpoint (selected IP ranges)**, or **Private endpoint**. Accept the default setting for this example.

![Default settings IoT Hub](/wifibt-wc-snippet-examples/2.14.0/images/image368.png)

**Step 7:** Next update the Management deatils to continue creating your hub.

![Management setting for IoT Hub](/wifibt-wc-snippet-examples/2.14.0/images/image369.png)

Select your required Azure IoT Hub tier.

**Step 8:** Skip “Tags”

**Step 9:** Next click on Review and Create > Create

![Create IoT Hub ](/wifibt-wc-snippet-examples/2.14.0/images/image370.png)

This should create your IoT Hub.

**Step 10:**  In the Azure Portal you should see your IoT Hub resource

![IoT Hub resource](/wifibt-wc-snippet-examples/2.14.0/images/image371.png)

We have IoT Hub ready, Next steps will walk through Device creation and attaching device to IoT Hub.

1.3 _**IoT Device registration**_

1.3.1 - _**Register IoT Device with symmetric key authentication in IoT Hub:**_

Create a device identity in the identity registry in your IoT hub. A device cannot connect to a hub unless it has an entry in the identity registry.

Follow the steps below or refer Register a [device with Symmetric Key](https://docs.microsoft.com/en-us/azure/iot-edge/how-to-authenticate-downstream-device?view=iotedge-2021-11#register-device-with-iot-hub)

**Step 1:**  Navigate to your IoT Hub resource,

![IoT Hub Resource page](/wifibt-wc-snippet-examples/2.14.0/images/image372.png)

**Step 2:** Open “IoT Devices” and select “New” to register a device.

![Select IoT Device](/wifibt-wc-snippet-examples/2.14.0/images/image373.png)

**Step 3:** In **Create a device,** provide a name for your new device and select authentication type as "Symmetric key" and Save. This action creates a device identity for your IoT hub.

![Create Device](/wifibt-wc-snippet-examples/2.14.0/images/image374.png)

**Step 4:** After the device is created, open the device from the list in the **IoT devices** pane. Select Device created  and copy the **Primary Connection String** for use later.

![Primary connection string](/wifibt-wc-snippet-examples/2.14.0/images/image375.png)

**Step 5:** The primary connection string is used in application to connect device to IoT Hub.

Device is now successfully registered to IoT Hub with Symmetric key authentication type.

1.3.2 - _**Register a New X.509 Authenticated Device with IoT Hub**_

For X.509 self-signed authentication, sometimes referred to as thumbprint authentication, you need to create certificates to place on your device. These certificates have a thumbprint in them that you share with IoT Hub for authentication.

Follow the steps below or refer to the [Register a X.509 Device](https://docs.microsoft.com/en-us/azure/iot-edge/how-to-authenticate-downstream-device?view=iotedge-2021-11#x509-self-signed-authentication)

**Step 1:** Generating X509 Self Signed certificates

Generate the IoT device's x509 Certificate and the Private Key Certificate by using the below OpenSSL command from a Powershell window

`Openssl req -newkey rsa:2048 -nodes -keyout mydevkitkey.pem -x509 -days 365 -out mydevkitcertificate.pem`

- `mydevkitkey.pem` is the Private Key file
- `mydevkitcertificate.pem` is the x509 device certificate file

**Step 2:** Capture the x509 certificate's Fingerprint either SHA1 or SHA256 type.[your choice]

command for SHA-1 : openssl x509 -in mydevkitcertificate.pem -fingerprint -noout.

Command for SHA-256 : openssl x509 -in mydevkitcertificate.pem -fingerprint -noout -sha256

Copy the fingerprint hexadecimal number with 40 length [have considered SHA1 type].

Remove the **':'** from the fingerprint and it will look as shown below :

`3989467851D9C76811C3B1DF939AE0A103E838CA`

**Step 3:** Go to Azure Portal-IoTHub to create new device with authentication type as X.509 Self-signed

![Create x509 Device](/wifibt-wc-snippet-examples/2.14.0/images/image376.png)

**Step 4:** Connection string to be given in the application should be as follows

`HostName=<Hub name>;DeviceId=<Device id(myselfsigned)>;x509=true`

Device is now successfully registered with the IoT Hub with X.509 self signed authentication type.

_**Appendix-2**_ : **Steps to check Telemetry message on Azure cloud**

- Login to Azure portal.

![Azure portal login](/wifibt-wc-snippet-examples/2.14.0/images/image378.png)

- Click on Cloud shell in the portal.

![Cloud shell](/wifibt-wc-snippet-examples/2.14.0/images/image379.png)

- To check the telemetry message sent from application, type the below command in the shell:  
  az iot hub monitor-events --hub-name {YourIoTHubName} --output table
- The received telemetry message will be displayed as follows

![Azure telemetry messages](/wifibt-wc-snippet-examples/2.14.0/images/image380.png)

_**Appendix-3**_ : **Steps to send c2d message from the cloud**

- az iot hub monitor-events --hub-name 9116Hub --output table
- Login to Azure portal.

![Azure portal login](/wifibt-wc-snippet-examples/2.14.0/images/image381.png)

- Go to the Hub that the device is created in

![Azure portal login](/wifibt-wc-snippet-examples/2.14.0/images/image381a.png)

- Click on Cloud shell in the portal.

![Cloud shell](/wifibt-wc-snippet-examples/2.14.0/images/image382.png)

- To send C2D message from the cloud, type the below command in the azure cli:  
  az iot device c2d-message send -d RS9116_Device_SelfSign -n 9116Hub --data "sdvjhdhdb"

![C2D messages](/wifibt-wc-snippet-examples/2.14.0/images/image383.png)

- The device upon receiving the messages will display on the terminal.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Three SSL Client Sockets

##### 1. Purpose / Scope

This application demonstrates how RS9116W EVK will connect to three different SSL servers with three different set of SSL certificates and loading certificates into the FLASH.

##### 2. Prerequisites / Setup Requirements

Before running the application, set up the following:

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- AWS server information like domain name running in the cloud which supports SSL connection.
- Wireless Access Point
- TCP server over SSL running in Windows PC (This application uses OpenSSL to create TCP server over SSL)

![Setup Diagram](/wifibt-wc-snippet-examples/2.14.0/images/image210.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - [OpenSSL Application](http://ufpr.dl.sourceforge.net/project/gnuwin32/openssl/0.9.8h-1/openssl-0.9.8h-1-bin.zip) in Windows PC (Remote PC).

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan/three_ssl_concurrent_client_sockets/projects/three_ssl_concurrent_client_sockets-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan/three_ssl_concurrent_client_sockets/projects/three_ssl_concurrent_client_sockets-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan/three_ssl_concurrent_client_sockets/projects/three_ssl_concurrent_client_sockets-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image210a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity studio) are provided with bare metal configuration in the SDK.

##### 4. Application Configuration Parameters

The application can be configured to suit user requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 Open rsi_three_ssl_client_sockets.c file

###### 4.1.1 User must update the below parameters (heading level 7)

SSID refers to the name of the Access point.

```c
   #define SSID                                       "SILABS_AP"
```

SECURITY_TYPE refers to the type of security. In this application STA supports Open, WPA-PSK, WPA2-PSK securities.

Valid configuration is:

- RSI_OPEN - For OPEN security mode
- RSI_WPA  - For WPA security mode
- RSI_WPA2 - For WPA2 security mode

```c
   #define SECURITY_TYPE                              RSI_WPA2
```

PSK refers to the secret key if the Access point configured in WPA-PSK /WPA2-PSK security modes.

```c
   #define PSK                                        "1234567890"
```

DEVICE_PORT1 port refers TCP client port number

```c
   #define DEVICE_PORT1                               <local port>
```

SERVER_PORT1 port refers remote TCP server port number which is opened in remote peer/ which is running on cloud.

```c
   #define SERVER_PORT1                               <remote port>
```

DEVICE_PORT2 refers another TCP client port number

```c
   #define DEVICE_PORT2                               <local port>
```

SERVER_PORT2 port refers another remote TCP server port number which is opened in remote peer/ which is running on cloud.

```c
   #define SERVER_PORT2                               <remote port>
```

DEVICE_PORT3 refers another TCP client port number

```c
   #define DEVICE_PORT3                               <local port>
```

SERVER_PORT3 port refers another remote TCP server port number which is opened in remote peer/ which is running on cloud.

```c
   #define SERVER_PORT3                               <remote port>
```

SERVER_IP_ADDRESS refers remote peer IP address to connect with TCP server socket over SSL running on the Windows PC.

```c
   #define SERVER_ADDR                                0x640AA8C0
```

IP address should be in long format and in little endian byte order.

Example: To configure "192.168.10.100" as IP address, update the macro DEVICE_IP as 0x640AA8C0.

Note:
For Servers running on cloud, get the IP using DNS server.

###### 4.1.2 The desired parameters are provided below. User can also modify the parameters as per their needs and requirements. (heading level 7)

The following parameters are configured if OS is used. WLAN task should be of low priority

```c
#define RSI_WLAN_TASK_PRIORITY                   1
```

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 2
```

WLAN Task stack size is configured by this macro

```c
#define RSI_WLAN_TASK_STACK_SIZE           500
```

Driver Task stack size is configured by this macro

```c
#define RSI_DRIVER_TASK_STACK_SIZE         500
```

Application memory length which is required by the driver

```c
   #define GLOBAL_BUFF_LEN                            15000
```

RSI_SSL_BIT_ENABLE

0 - Disable SSL bitmap
1 - Enable SSL bitmap
This bit should be enabled for SSL connection

```c
   #define RSI_SSL_BIT_ENABLE                         1
```

> Note:
> If certificates are not there in flash, then ssl handshake will fail.

DHCP_MODE refers whether IP address configured through DHCP or STATIC

```c
   #define DHCP_MODE                                  1
```

> Note:
> If user wants to configure STA IP address through DHCP then set DHCP_MODE to "1" and skip configuring the following DEVICE_IP, GATEWAY and NETMASK macros.
> (Or)
> If user wants to configure STA IP address through STATIC then set DHCP_MODE macro to "0" and configure following DEVICE_IP, GATEWAY and NETMASK macros.

IP address to be configured to the device in STA mode should be in long format and in little endian byte order.

Example: To configure "192.168.10.10" as IP address, update the macro DEVICE_IP as 0x0A0AA8C0.

```c
   #define DEVICE_IP                                  0X0A0AA8C0
```

IP address of the gateway should also be in long format and in little endian byte order.

Example: To configure "192.168.10.1" as Gateway, update the macro GATEWAY as 0x010AA8C0.

```c
   #define GATEWAY                                    0x010AA8C0
```

IP address of the network mask should also be in long format and in little endian byte order.

Example: To configure "255.255.255.0" as network mask, update the macro NETMASK as 0x00FFFFFF.

```c
   #define NETMASK                                    0x00FFFFFF
```

AWS_DOMAIN_NAME refers to domain name of the AWS server

```c
   #define AWS_DOMAIN_NAME                            "a25jwtlmds8eip-ats.iot.us-east-2.amazonaws.com"
```

###### 4.2 Open rsi_wlan_config.h file. User can also modify the below parameters as per their needs and requirements. (heading level 7)

```c
   #define CONCURRENT_MODE                            RSI_DISABLE
   #define RSI_FEATURE_BIT_MAP                        FEAT_SECURITY_OPEN
   #define RSI_TCP_IP_BYPASS                          RSI_DISABLE
   #define RSI_TCP_IP_FEATURE_BIT_MAP                 (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_SSL | TCP_IP_FEAT_DNS_CLIENT | TCP_IP_FEAT_EXTENSION_VALID)
   #define RSI_EXT_TCPIP_FEATURE_BITMAP               EXT_TCP_IP_FEAT_SSL_THREE_SOCKETS
   #define RSI_CUSTOM_FEATURE_BIT_MAP                 FEAT_CUSTOM_FEAT_EXTENTION_VALID
   #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP             RAM_LEVEL_NWP_ALL_MCU_ZERO
   #define RSI_BAND                                   RSI_BAND_2P4GHZ
```

**Power save configuration**

- By default, the application is configured without power save.

```c
  #define ENABLE_POWER_SAVE              0
```

- If user wants to run the application in power save, modify the below macro.

```c
  #define ENABLE_POWER_SAVE              1
```

###### 4.3 Setting up Security Certificates

To authenticate and securely connect with AWS, your Wi-Fi device requires a unique x.509 security certificate and private key, as well as a CA certificate which is used to verify the AWS server. Security credentials need to be converted into a C-array rather than [PEM format](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) provided by AWS; they also need to be added to your project.

The RS9116 SDK includes a Python 3 script to streamline the conversion process. This script
certificate_to_array.py is in the SDK 'resources' directory [certificate_to_array.py](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/).

To convert the device certificate and private key to C arrays, open a system command prompt and use the script as indicated in the following examples.

```sh
$> python3 certificate_to_array.py <input filename> <output arrayname>

For example:
$> python3 certificate_to_array.py d8f3a44d3f.cert.pem    aws_client_certificate
$> python3 certificate_to_array.py d8f3a44d3f.private.key aws_client_private_certificate
```

After running the script on the certificate and private key, two new files are created.

```sh
aws_client_certificate.pem.crt.h
aws_client_private_key.pem.key.h
```

Copy the two files aws_client_certificate.pem.crt.h and aws_client_private_key.pem.key.h to the WiSeConnect directory: /resources/certificates, overwriting any existing files with same name.

The Root CA certificate used by your Wi-Fi device to verify the AWS server is already included in the RS9116 SDK; no additional setup is required.
For reference, Amazon uses [Starfield Technologies](https://www.starfieldtech.com/) to secure the AWS website, the RS9116 SDK includes the [Starfield CA Certificate](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/tree/master/resources/certificates/aws_starfield_ca.pem.h).

> NOTE :
> For AWS connectivity, StarField Root CA Class 2 certificate has the highest authority being at the top of the signing hierarchy.
> 
> The StarField Root CA Class 2 certificate is an expected/required certificate which usually comes pre-installed in the operating systems and it plays a key part in certificate chain verification when a device is performing TLS authentication with the IoT endpoint.
> 
> On RS9116 device, we do not maintain root CA trust repository due to memory constraints, so it is mandatory to load StarField Root CA Class 2 certificate for successful connection to AWS server.
> 
> The certificate chain sent by AWS server is as below:
> id-at-commonName=Amazon,id-at-organizationalUnitName=Server CA 1B,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Amazon Root CA 1,id-at-organizationName=Amazon,id-at-countryName=US
> id-at-commonName=Starfield Services Root Certificate Authority ,id-at-organizationName=Starfield Technologies, Inc.,id-at-localityName=Scottsdale,id-at-  stateOrProvinceName=Arizona,id-at-countryName=US)
> 
> On RS9116 to authenticate the AWS server, firstly Root CA is validated (validate the Root CA received with the Root CA loaded on the device). Once the Root CA is validation is successful , other certificates sent from the AWS server are validated.
> RS9116 don't authenticate to AWS server if intermediate CA certificates are loaded instead of StarField Root CA Class 2 certificate and would result in Handshake error.
> StarField Root CA Class 2 certificate is at [https://certs.secureserver.net/repository/sf-class2-root.crt](https://certs.secureserver.net/repository/sf-class2-root.crt)
> 
> Reference links :
> [https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/](https://aws.amazon.com/blogs/security/how-to-prepare-for-aws-move-to-its-own-certificate-authority/)

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with a PC](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware file is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32 (heading level 7)

Refer [Getting started with STM32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-stm32/)

- Open the project `<SDK>/examples/snippets/wlan/three_ssl_concurrent_client_sockets/projects/three_ssl_concurrent_client_sockets-nucleo-f411re.uvprojx`
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [Getting started with EFX32](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Open Simplicity Studio and import the EFR32/EFM32 project from `<SDK>/examples/snippets/wlan/three_ssl_concurrent_client_sockets/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **5.3**

###### 5.3 Common Steps (heading level 7)

1. Configure the Access point in OPEN / WPA-PSK / WPA2-PSK mode to connect RS9116W EVK in STA mode.
2. Copy the certificates server-cert and server-key into Openssl/bin folder in the Windows PC (Remote PC).

> Note:
> All the certificates are given in the SDK. Path: `<SDK>/resources/certificates`

1. In Windows PC (Remote PC) which is connected to AP, run the Openssl server by giving the following command  
   ```sh  
   Openssl.exe s_server -accept<SERVER_PORT> -cert <server_certificate_file_path> -key <server_key_file_path> -tls<tls_version>  
   Example: openssl.exe s_server -accept 5001 -cert server-cert.pem -key server-key.pem -tls1  
   ```

![Run the Openssl server](/wifibt-wc-snippet-examples/2.14.0/images/image203.png)

1. Make sure the SSL server is running in the cloud (check with the domain name)
2. After the program gets executed, RS9116W EVK would be connected to Access point having the configuration same that of in the application and get IP.
3. The Device which is configured as SSL client will connect to three different remote SSL servers.

##### Appendix

###### Create an AWS Thing

Create a thing in the AWS IoT registry to represent your IoT Device.

- In the [AWS IoT console](https://console.aws.amazon.com/iot/home), in the navigation pane, under Manage, choose All devices, and then choose Things.  
  ![AWS console](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-step1.png)
- If a **You don't have any things yet** dialog box is displayed, choose **Register a thing**. Otherwise, choose **Create**.
- Click on **Create things**.  
  ![AWS thing](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-step2.png)
- On the **Create things** page, choose **Create a single thing** and click next.  
  ![AWS thing creation](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-step3.png)
- On the **Specify thing properties** page, enter a name for your IoT thing (for example, **Test_IoT**), and choose **Unnamed shadow (classic)** in the Device Shadow section, then choose **Next**. You can't change the name of a thing after you create it. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.  
  ![Add Device 1](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-step4.png)
- During **Configure device certificate** step, choose **Auto-generate a new certificate (recommended)** option, and click next.  
  ![Add Device 2](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-step5.png)
- Attach the policy to the thing created  
  - If you have any existing policy, attach it, and click on create thing.    
    !["Attach policy"](/wifibt-wc-snippet-examples/2.14.0/images/aws-choosing-policy.png)  
  - If policy is not yet created, follow the following steps:    
    - Choose Create policy and fill the fields as per your requirements.      
      !["Create policy"](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-attach-policy.png)    
    - Give the **Name** to your Policy, Fill **Action** and **Resource ARN** as shown in the following image, Click on **Allow** under **Effect**, and click **Create**      
      ![Register Thing](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-thing-policy-create.png)    
    - Choose the created policy, and click on **Create thing**
- Choose the **Download** links to download the device certificate, private key, and root CA certificate. Root CA certificate is already present in SDK (aws_starfield_ca.pem.h), and can be directly used.  
  > **Warning:** This is the only instance you can download your device certificate and private key. Make sure to save them safely.  
  ![Downloading certificates](/wifibt-wc-snippet-examples/2.14.0/images/aws-thing-certificates-download.png)
- Click Done.
- The created thing should now be visible on the AWS console (Manage > All devices > Things).

###### **Appendix**: Steps to create a policy from AWS console

- Navigate to **AWS IoT console**
- Choose **Policies** under **Secure**  
  ![AWS console create policy](/wifibt-wc-snippet-examples/2.14.0/images/image451.png)
- Click on **Create**  
  ![Create policy](/wifibt-wc-snippet-examples/2.14.0/images/aws-create-policy.png)

##### Compressed Debug Logging

To enable the compressed debug logging feature see [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Debug Utils RAM Dump

##### 1. Purpose / Scope

This section provides examples to easily configure and execute debug applications of RS9116 module.

The RAM dump application is use to read the RAM content of RS9116W module for a given address.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)

![Setup Diagram for RAM Dump Example](/wifibt-wc-snippet-examples/2.14.0/images/image302.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms and the RS9116W EVK.
- The SAPI driver provides APIs to enable other host interfaces if SPI is not suitable for your needs.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/debug_utils/ram_dump/projects/ram_dump-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/debug_utils/ram_dump/projects/ram_dump-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/debug_utils/ram_dump/projects/ram_dump-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image302a.png)

###### 3.4 Bare Metal Support

This application supports only bare metal environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_ram_dump.c` file and update/modify following macros,

Path : /examples/snippets/debug_utils/ram_dump

This define should be ENABLE only in case of linux platform with USB interface, by default, it is DISABLE

```c
#define LINUX_PLATFORM         DISABLE
```

Address in Silicon Labs module

```c
#define READ_ADDRESS           0x0
```

##### 5. Testing the Application

User has to follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/debug_utils/ram_dump/projects/ram_dump-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Import the project from `<SDK>/examples/snippets/debug_utils/ram_dump/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Build and launch the application.
2. After the program gets executed RAM content is saved in ram_content buffer. In case of USB interface RAM content is saved in file dump.txt.

##### 6. Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN Throughput BT SPP BLE Dual Role

##### 1. Purpose / Scope

This example demonstrates throughput measurements of WLAN/BT/BLE in individual or with protocol combinations in the RS9116W EVK.

The application can measure throughput ranges for TCP/UDP/SSL TX/RX to and from remote servers, while BT/BLE data transfers are in progress. It has provision to control other protocol activities while measuring WLAN/BLE throughputs.

The Application can be configured for the individual protocol throughput measurement as well the combination of protocols throughputs (WiFi+BT, WiFi+BLE, BT+BLE).

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface (UART / SPI).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Smart phone/tablet with BT Application (Ex: Bluetooth SPP Manager App)
- Smart phone/tablet with BLE Application (Ex: Light Blue / BLE Connect App)
- Windows PC with iperf and openssl applications.

![Setup Diagram for WLAN Throughput BT SPP BLE Dual Role](/wifibt-wc-snippet-examples/2.14.0/images/image1-dual.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - Download and install iperf from this link [Iperf Application](https://iperf.fr/iperf-download.php).  
  - Download and install OpenSSL from this link [OpenSSL](http://ufpr.dl.sourceforge.net/project/gnuwin32/openssl/0.9.8h-1/openssl-0.9.8h-1-bin.zip) to download openssl in remote PC.
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing the BLE applications.
- Download and install the Silicon Labs [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_IN) in the android smart phones for testing the BT applications.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

To get better throughput, **suggest to run the application under 'O3' optimization**

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects/wlan_throughput_bt_spp_ble_dual_role-nucleo-f411re.uvprojx`  
  - Open project in Keil IDE and click on 'Options for Target'  
  - Go to 'C/C++' tab and select the Optimization to 'Level 3(-O3)'  
  - Click on 'OK' button to save the settings

![project settings in Keil IDE](/wifibt-wc-snippet-examples/2.14.0/images/image1-a.png)

- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects/wlan_throughput_bt_spp_ble_dual_role-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects/wlan_throughput_bt_spp_ble_dual_role-brd4180b-mg21.slsproj`    
    - User can find the Radio Board version as given below

![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image1-b.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan/station_ping/projects/station_ping-brd2204a-gg11.slsproj`
- Open project in Simplicity Studio
- Right click on the project and choose 'Properties'
- Go to 'C/C++ Build' → 'Settings' → 'GNU ARM C Compiler' → 'Optimization' and change Optimization level to '-O3'
- Click on 'Apply' and 'OK' to save the settings.

![project settings in Simplicity Studio](/wifibt-wc-snippet-examples/2.14.0/images/image1-c.png)

###### 3.4 RTOS Support

The Application supports both FreeRTOS. By default, the application project files (Keil and Simplicity studio) are provided with RTOS enabled in the SDK, so the application can be tested/validated under OS environment.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

###### 4.1 WLAN Throughputs

**4.1.1** Open `rsi_common_config.h` file and configure below macros.

This section explains how to configure the application to measure TCP/UDP/SSL unidirectional throughputs in alone or with combination of BT/BLE activities.

Set below macros to 1 to measure **WLAN** alone throughput

```c
#define RSI_ENABLE_WLAN_TEST    1 //Set this to 0 to disable WLAN
#define WLAN_THROUGHPUT_TEST    1 //Set this to 0 while measuring BLE throughput
```

Set below macros to 1 to measure **WLAN** throughput along with specific **BLE** activity.

```c
#define RSI_ENABLE_WLAN_TEST    1 //Set this to 0 to disable WLAN
#define WLAN_THROUGHPUT_TEST    1 //Set this to 0 while measuring BLE throughput
#define RSI_ENABLE_BLE_TEST     1 //Set this to 0 to disable BLE
```

> Note:
> 
> While measuring WLAN throughput along with BLE activities, ensure 'BLE_THROUGHPUT_TEST' is set to '0'

Set below macros to 1 to measure **WLAN** throughput along with specific **BT** activity.

```c
#define RSI_ENABLE_WLAN_TEST    1 //Set this to 0 to disable WLAN
#define WLAN_THROUGHPUT_TEST    1 //Set this to 0 while measuring BLE throughput
#define RSI_ENABLE_BT_TEST      1 //Set this to 0 to disable BT
```

Set below macros to 1 to measure **WLAN** throughput along with **BT and BLE** activities.

```c
#define RSI_ENABLE_WLAN_TEST    1 //Set this to 0 to disable WLAN
#define WLAN_THROUGHPUT_TEST    1 //Set this to 0 while measuring BLE throughput
#define RSI_ENABLE_BLE_TEST     1 //Set this to 0 to disable BLE
#define RSI_ENABLE_BT_TEST      1 //Set this to 0 to disable BT
```

> Note:
> 
> While measuring WLAN throughput with BT and BLE activities ensure 'BLE_THROUGHPUT_TEST' is set to '0'

If BT/BLE is enabled, configure specific activity of BT/BLE using below macros.

- **BLE operations**: Set any one of below macros to choose desired BLE activity

```c
#define BLE_INIT_DONE                       0           //! make it 1 for BLE init only
#define BLE_CONNECTED                       0           //! make it 1 for BLE connection only
#define BLE_DATA_TRANSFER_START             1           //! make it 1 for BLE data transfer
```

- **BT SPP operations:** Set any of one of below 3 macros to choose desired BT SPP activity

```c
#define BT_SPP_INIT_DONE                    0           //! make it 1 for BT init only
#define BT_SPP_CONNECT_ONLY                 0           //! make it 1 for BT SPP connection only
#define BT_DATA_TRANSFER_START              1           //! make it 1 for BT SPP data transfer
```

By default, BT_DATA_TRANSFER_START and BLE_DATA_TRANSFER_START are set to '1', that means WLAN measurement will start after BT SPP and BLE Gatt data transfers choose the required **operational mode** of RS9116W EVK.

```c
#define RSI_COEX_MODE           9
```

Valid Configurations are:

- 0  - WLAN alone mode
- 5  - BT alone mode
- 9  - WLAN + BT + BLE  mode
- 13 - BLE alone mode

> Note:
> 
> By default, opermode is set to WLAN+BT+BLE

**4.1.2** Select WLAN configurations in `rsi_wlan_config.h` file

Enter the AP Connectivity essentials configs as the value to SSID, SECURITY_TYPE and PSK

```c
#define     SSID                       "SILABS_AP"
#define     SECURITY_TYPE              RSI_WPA2
#define     PSK                        "12345678"
```

Channel no in which device should scan choose

```c
#define     CHANNEL_NO                 0       //! 0 - scan all channels
```

Port number of remote server

```c
#define     SERVER_PORT                5001
```

While verifying SSL RX throughput, port number of remote server should be configured below

```c
#define     SSL_RX_SERVER_PORT         5002
```

IP address of remote server

```c
#define     SERVER_IP_ADDRESS          "192.168.0.102"
```

Port number of module

```c
#define     DEVICE_PORT                5001
```

To select the ip, configure below macros

```c
#define     DHCP_MODE                  1           // 0 enable or disable
#if !DHCP_MODE                                     // Need to configure manually if DHCP is disabled     
  #define     DEVICE_IP                  0x6500A8C0  // 192.168.0.101
  #define     GATEWAY                    0x0100A8C0  // 192.168.0.1
  #define     NETMASK                    0x00FFFFFF  // 255.255.255.0
#endif 
```

Choose the throughput type by configuring below macro

```c
#define     THROUGHPUT_TYPE            TCP_TX 
```

Valid Configurations of THROUGHPUT_TYPE:

- UDP_TX → UDP transmit
- UDP_RX → UDP receive
- TCP_TX → TCP transmit
- TCP_RX → TCP receive
- SSL_TX → SSL transmit
- SSL_RX → SSL receive

Average time required to measure UDP_TX/TCP_TX throughputs

```c
#define     THROUGHPUT_AVG_TIME        60000    //60sec of throughput numbers average
```

Maximum no. of packets required to measure UDP_RX

```c
#define     MAX_TX_PKTS                10000
```

Configure below macro to choose throughput measurement type . This option is valid while measuring WLAN alone throughputs

```c
#define     CONTINUOUS_THROUGHPUT      0
```

If **CONTINUOUS_THROUGHPUT** is set to '1', then application measures throughput for every interval of 'THROUGHPUT_AVG_TIME' independent of throughput type. If **CONTINUOUS_THROUGHPUT** is set to '0', then throughput is calculated only once for interval of 'THROUGHPUT_AVG_TIME' in case of UDP/TCP TX , for MAX_TX_PKTS in case of UDP RX/ SSL TX and for default interval provided by server in case of TCP RX/SSL RX.

> Note:
> 
> 1. By default, 'CONTINUOUS_THROUGHPUT' is set to '0'
> 2. If CONTINUOUS_THROUGHPUT is set to '1', then ensure that client/server should run with interval atleast greater than THROUGHPUT_AVG_TIME

**4.1.3** Open `rsi_ble_config.h` file

BLE Advertise name

```c
#define     RSI_BLE_APP_GATT_TEST       (void *)"SI_COEX_MAX_DEMO" 
```

Configure BLE advertising interval

```c
#define     RSI_BLE_ADV_INT_MIN         0x06a8 //! 1065ms
#define     RSI_BLE_ADV_INT_MAX         0x06a8 //! 1065ms
```

Configure below macros to set connection interval, connection latency and connection supervision timeout

```c
#define     CONN_INTERVAL_M1            1600    // connection interval:2s
#define     CONN_LATENCY_M1             0       // latency : 0
#define     CONN_SUPERVISION_TIMEOUT_M1 1600   
```

**4.1.4** Select BT configurations in `rsi_bt_config.h` file

Enter the remote BT device address as the value to RSI_BT_REMOTE_BD_ADDR

```c
#define     RSI_BT_REMOTE_BD_ADDR       (void *)"B8:D5:0B:9B:D6:B2"
```

SPP_MODE refers to type of Module Mode, whether its MASTER/SLAVE

```c
#define     SPP_MODE                    SPP_SLAVE
```

PIN_CODE refers 4 bytes string required for pairing process

```c
#define     PIN_CODE                    "0000"
```

RSI_BT_LOCAL_NAME refers to name of Silicon Labs Module to appear during scanning by remote device

```c
#define     RSI_BT_LOCAL_NAME           "SPP_SLAVE"
```

###### 4.2 BLE throughputs:

This section explains user how to configure the application for measuring BLE Tx/Rx throughputs using sniffer in alone or with combination of WLAN/BT.

**4.2.1** Open `rsi_common_config.h` file

Set below macro to 1 to measure **BLE** alone throughput

```c
#define     RSI_ENABLE_BLE_TEST        1 //Set this to 0 to disable BLE
#define     BLE_THROUGHPUT_TEST        1 //Set this to 0 for normal BLE operation
```

Set below macros to 1 to measure **BLE** throughput along with specific **WLAN** activity.

```c
#define     RSI_ENABLE_BLE_TEST        1 //Set this to 0 to disable BLE
#define     BLE_THROUGHPUT_TEST        1 //Set this to 0 for normal BLE operation
#define     RSI_ENABLE_WLAN_TEST       1 //Set this to 0 to disable WLAN
```

> Note:
> While measuring BLE throughput with WLAN activities, ensure 'WLAN_THROUGHPUT_TEST' is set to '0'

Set below macros to 1 to measure **BLE** throughput along with specific **BT** activity.

```c
#define     RSI_ENABLE_BLE_TEST        1 //Set this to 0 to disable BLE
#define     BLE_THROUGHPUT_TEST        1 //Set this to 0 for normal BLE operation
#define     RSI_ENABLE_BT_TEST         1 //Set this to 0 to enable BT
```

Set below macros to 1 to measure **BLE** throughput along with **BT** and **WLAN** activities.

```c
#define     RSI_ENABLE_BLE_TEST        1 //Set this to 0 to disable BLE
#define     BLE_THROUGHPUT_TEST        1 //Set this to 0 for normal BLE operation
#define     RSI_ENABLE_WLAN_TEST       1 //Set this to 0 to disable WLAN
#define     RSI_ENABLE_BT_TEST         1 //Set this to 0 to enable BT
```

> Note:
> While measuring BLE throughput with WLAN and BT activities ensure 'WLAN_THROUGHPUT_TEST' is set to '0'.

If WLAN/BT is enabled, configure specific activity of WLAN/BT using below macros.

**WLAN operations:** set any one of below macros to choose desired **BLE** activity

```c
#define     WLAN_SCAN_ONLY             0           //! make it 1 for WLAN scan only
#define     WLAN_CONNECT_ONLY          0           //! make it 1 for WLAN connection only
#define     WLAN_DATATRANSFER          1           //! make it 1 for WLAN TCP TX
```

**BT SPP operations:** set any of one of below 3 macros to choose desired BT SPP activity

```c
#define     BT_SPP_INIT_DONE           0           //! make it 1 for BT init only
#define     BT_SPP_CONNECT_ONLY        0           //! make it 1 for BT SPP connection only
#define     BT_DATA_TRANSFER_START     1           //! make it 1 for BT SPP data transfer
```

> NOTE:
> By default, BT_DATA_TRANSFER_START and WLAN_DATATRANSFER are set to '1'

Choose the required **operational mode** of RS9116

```c
#define     RSI_COEX_MODE              9
```

Valid Configurations are:

- 0  - WLAN alone mode
- 5  - BT alone mode
- 9  - WLAN + BT + BLE  mode
- 13 - BLE alone mode

**4.2.2** Open `rsi_ble_config.h` file

BLE Advertise name

```c
#define     RSI_BLE_APP_GATT_TEST       (void *)"SI_COEX_MAX_DEMO"
```

Configure BLE advertising interval

```c
#define     RSI_BLE_ADV_INT_MIN         0x06a8 //! 1065ms
#define     RSI_BLE_ADV_INT_MAX         0x06a8 //! 1065ms
```

Configure below macros to set connection interval, connection latency and connection supervision timeout

```c
#define     CONN_INTERVAL_M1            9   // connection interval:1.125ms
#define     CONN_LATENCY_M1             0   // latency : 0
#define     CONN_SUPERVISION_TIMEOUT_M1 1600   
```

Configure below macros to enable/disable data length extension mode

```c
#define     DLE_ON_M1                   1   // 1- DLE ON, 0- DLE OFF 
```

Configure BLE data transfer type

```c
#define     RX_NOTIFICATIONS_FROM_M1    0  //! set below macro to receive 'gatt notifications' from remote device
#define     RX_INDICATIONS_FROM_M1      0  //! set below macro to receive 'gatt indications' from remote device
#define     TX_NOTIFICATIONS_TO_M1      1  //! set below macro to Transmit 'gatt notifications' to remote device
#define     TX_WRITES_TO_M1             0  //! set below macro to Transmit 'gatt write with response' to remote device
#define     TX_WRITES_NO_RESP_TO_M1     0  //! set below macro to Transmit 'gatt write without response' to remote device
#define     TX_INDICATIONS_TO_M1        0  //! set below macro to Transmit 'gatt indications' to remote device
```

> Note:
> By default, all BLE configurations are choosen to get high BLE throughput.

**4.2.3** Select WLAN configurations in `rsi_wlan_config.h`

Enter the AP Connectivity essentials configs as the value to SSID, SECURITY_TYPE and PSK

```c
#define     SSID                        "SILABS_AP"
#define     SECURITY_TYPE               RSI_WPA2
#define     PSK                         "12345678"
```

Channel no in which device should scan choose

```c
#define     CHANNEL_NO                  0       //! 0 - scan all channels
```

Configure throughput type as TCP_TX

```c
#define     THROUGHPUT_TYPE          TCP_TX 
```

**4.2.4** Select BT SPP configurations in `rsi_bt_config.h`

Enter the remote BT device address as the value to RSI_BT_REMOTE_BD_ADDR

```c
#define     RSI_BT_REMOTE_BD_ADDR       (void *)"B8:D5:0B:9B:D6:B2"
```

SPP_MODE refers to type of Module Mode, whether its MASTER/SLAVE

```c
#define     SPP_MODE                    SPP_SLAVE
```

PIN_CODE refers 4 bytes string required for pairing process

```c
#define     PIN_CODE                    "0000"
```

RSI_BT_LOCAL_NAME refers to name of Silicon Labs Module to appear during scanning by remote device

```c
#define     RSI_BT_LOCAL_NAME           "SPP_SLAVE"
```

**4.2.4** Open `rsi_common_app.c` file and configure below macros.

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 3
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects/wlan_throughput_bt_spp_ble_dual_role-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the project from `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

###### 5.3.1 WLAN throughputs: UDP/TCP/SSL unidirectional:

1. Compile the project and flash the binary onto STM32
2. To measure **WLAN throughput** , run the below iperf commands or ssl scripts

- To measure **UDP Tx** throughput, configure module as UDP client and open UDP server in remote port using below command

```sh
         iperf.exe -s -u -p <SERVER_PORT> -i 1
```

ex: iperf.exe -s -u -p 5001 -i 1

- To measure **UDP Rx** througput, configure module as UDP server and open UDP client in remote port using below command

```sh
         iperf.exe -c <Module_IP> -u -p <DEVICE_PORT> -i 1 -b<Bandwidth> -t <duration in sec>
```

ex: iperf.exe -c 192.168.0.1 -u -p 5001 -i 1 -b50M -t 100

- To measure **TCP Tx** throughput, configure module as TCP client and open TCP server in remote port using below command

```sh
         iperf.exe -s -p <SERVER_PORT> -i 1
```

ex: iperf.exe -s -p 5001 -i 1

- To measure **TCP Rx** througput, configure module as TCP server and open TCP client in remote port using below command

```sh
         iperf.exe -c <Module_IP> -p <DEVICE_PORT> -i 1 -t <duration in sec>
```

ex: iperf.exe -c 192.168.0.1 -p 5001 -i 1 -t 100

- To measure **SSL Tx** throughput, configure module in SSL client and follow below steps to run SSL server in windows  
  - Copy SSL_Server_throughput_d.py from release/resources/scripts/ to release/resources/certificates/  
  - Open command prompt in folder release/resources/certificates/ and run below command

```sh
         python SSL_Server_throughput_d.py
```

- To measure **SSL Rx** throughput, configure module in SSL client and follow below steps to run SSL server in windows  
  - Copy SSL_tx_throughput.py from release/resources/scripts/ to release/resources/certificate  
  - Change port no. from "5001" to the value configured in "SSL_RX_SERVER_PORT"  
  - Open command prompt in folder release/resources/certificates/ and run below command

```sh
         python SSL_tx_throughput.py
```

1. After the program gets executed, Module scans for the configured Access point, connects to it.
2. Acquires the ip address and waits for bt/ble activities to complete if configured.
3. If BT SPP is configured, open "Bluetooth SPP Manager"(android app) from mobile, scan for 'RSI_BT_LOCAL_NAME' and initiate connection if found.
4. Scan for BLE advertise name (RSI_BLE_APP_GATT_TEST) using nRF connect (Android app)/ BLE dongles and initiate ble connection if found.
5. For BLE data transfer, enable Gatt notifications of Module on service characteristic RSI_BLE_ATTRIBUTE_1_UUID (0x1AA1) using nRF connect.
6. If Gatt Notification are enabled, module continuously transmits notifications per connection interval of size 20/232 bytes.
7. For BT data transfer, open Bluetooth SPP Manager app and send the data.
8. Module receives the data transmitted by app and retransmits the same to BT SPP manager app.
9. Once above activities are completed, Module transmits/receives packets based on the configuration selected and measures the WLAN throughput

> Note:
> Verify that all connections are stable and throughput is as expected.

**Note:** In this release, due to low SPI frequency in EFR, wlan throughputs are less compared to STM. Work is in progress to support the high frequency.

###### 5.3.2 BLE throughputs:

1. Compile the project and flash the binary onto STM32
2. If WLAN is configured, run the below iperf command (Note: Ensure module is configured as TCP client)  
   ```sh  
     iperf.exe -s -p <SERVER_PORT> -i 1  
   ```  
   ex: iperf.exe -s -p 5001 -i 1
3. After the program gets executed, Module scans for the configured Accesspoint, connects to it and acquires the ip address
4. After acquiring ip address, connects to remote server and starts tcp download
5. If **BT SPP is configured**, then open "Bluetooth SPP Manager"(android app) from mobile, scan for 'RSI_BT_LOCAL_NAME' and initiate connection if found.
6. After successfull connection, transmit the data using same android app to module.
7. Module receives the data transmitted by app and retransmits the same to BT SPP manager app.
8. After completion of WLAN and BT activites , scan for BLE advertise name (RSI_BLE_APP_GATT_TEST) using nRF connect (Android app)/ BLE dongles and initiate ble connection if found.
9. After successfull connection, enable Gatt notifications of Module on service characteristic RSI_BLE_ATTRIBUTE_1_UUID (0x1AA1) using nRF connect.
10. If Gatt Notification are enabled, module continuously transmits notifications per connection interval of size 232 bytes.
11. While transmitting, measure the throughput using BLE sniffer

> Note:
> Verify that all connections are stable and throughput is as expected.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### WLAN HTTPS BT SP BLE Dual Role

##### 1. Purpose / Scope

This example demonstrates the ability of RS9116W EVK connecting and transferring the data simultaneously in BT/BLE/WiFi wireless interfaces.

In the Coex mode (WiFi+BT+BLE), the module will connect to AP and then download the fixed file from PC acting as Server and supports BT/BLE connection/data transfers simultaneously.

The Application can be configured for the individual protocol execution as well the combination of protocols execution (WiFi+BT, WiFi+BLE, BT+BLE). Two BLE connections (Master and Slave) are supported.

> Note:
> This application is not supported on Silicon Labs EFR32MG21 host. Supported for next release.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI) in case of WiSeConnect.
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Wireless Access Point
- Smart phone/tablet with BT Application (Ex: Bluetooth SPP Manager App)
- Smart phone/tablet with BLE Application (Ex: )
- Windows PC2 (Remote PC) with HTTP/HTTPS server running.  
  ![Setup Diagram for WLAN HTTP/HTTPs BT SPP BLE Dual Role Example](/wifibt-wc-snippet-examples/2.14.0/images/image300.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)  
  - Download and install OpenSSL from this link [OpenSSL](http://ufpr.dl.sourceforge.net/project/gnuwin32/openssl/0.9.8h-1/openssl-0.9.8h-1-bin.zip) to download openssl in remote PC.
- Download and install the Silicon Labs [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_IN) in the android smart phones for testing the BT applications.?

##### 3. Application Build Environment

###### 3.1 Platform

TThe Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role/projects/wlan_https_bt_spp_ble_dual_role-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role/projects/wlan_https_bt_spp_ble_dual_role-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role/projects/wlan_https_bt_spp_ble_dual_role-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below  
  ![EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image7a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/wlan_bt_ble/wlan_https_bt_spp_ble_dual_role/projects/wlan_https_bt_spp_ble_dual_role-brd2204a-gg11.slsproj`

###### 3.4 RTOS Support

The Application supports both FreeRTOS. By default, the application project files (Keil) are provided with RTOS enabled in the SDK. So the application can be tested/validated under OS environment.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** Open `rsi_common_config.h` file and configure below macros.

Set below macro to 1 to run **BLE** application

```c
#define RSI_ENABLE_BLE_TEST                          1 //Set this to 0 to disable BLE
```

Set below macro to 1 to run **BT** application

```c
#define RSI_ENABLE_BT_TEST                           1 //Set this to 0 to disable BT
```

Set below macro to 1 to run **WLAN** application

```c
#define RSI_ENABLE_WLAN_TEST                         1 //Set this to 0 to disable WLAN
```

> Note:
> By default, all protocols are enabled.

Choose the required **operational mode** of RS9116W EVK.

```c
#define RSI_COEX_MODE                                9
```

Valid Configurations are:

- 0  - WLAN alone mode
- 5  - BT alone mode
- 9  - WLAN + BT + BLE  mode
- 13 - BLE alone mode

> Note:
> By default, opermode is set to WLAN+BT+BLE

**4.2** Select **BLE** configurations in `rsi_ble_config.h` file

To select number of BLE connections, configure below macros.

Set below macro to required slave connections.

```c
#define RSI_BLE_MAX_NBR_SLAVES                       1
```

Set below macro to required master connections.

```c
#define RSI_BLE_MAX_NBR_MASTERS                      1
```

> Note:
> Maximum no. of  RSI_BLE_MAX_NBR_MASTERS can be configured to '2' and RSI_BLE_MAX_NBR_SLAVES to '3'.

If CONNECT_OPTION is set to CONN_BY_NAME, configure below macros.

```c
#define CONNECT_OPTION                               CONN_BY_NAME //CONN_BY_NAME or CONN_BY_ADDR
```

To identify remote device with BD Address/device name.

Add the remote BLE device name to connect

```c
#define RSI_REMOTE_DEVICE_NAME1                      "slave1"
#define RSI_REMOTE_DEVICE_NAME2                      "slave2"
#define RSI_REMOTE_DEVICE_NAME3                      "slave3"
```

If CONNECT_OPTION is set to CONN_BY_ADDR, configure the below macros.

Configure the address type of remote device as either Public Address or Random Address

```c
#define RSI_BLE_DEV_ADDR_TYPE                        LE_PUBLIC_ADDRESS //!LE_PUBLIC_ADDRESS or LE_RANDOM_ADDRESS
```

Add the BD Address of remote BLE device to connect

```c
#define RSI_BLE_DEV_1_ADDR                           "88:DA:1A:FE:2A:2C"
#define RSI_BLE_DEV_2_ADDR                           "7E:E6:5E:30:77:6F"
#define RSI_BLE_DEV_3_ADDR                           "70:1A:69:32:7C:8E
```

Configure below macros to select the profile characteristics uuid for data transfer.

```c
#define RSI_BLE_CLIENT_WRITE_SERVICE_UUID_M1             0x180D //! Heart Rate service uuid
#define RSI_BLE_CLIENT_WRITE_CHAR_UUID_M1                0x2A39 //! Heart Rate control Point
#define RSI_BLE_CLIENT_WRITE_NO_RESP_SERVICE_UUID_M1     0x1802 //! Immediate Alert service uuid
#define RSI_BLE_CLIENT_WRITE_NO_RESP_CHAR_UUID_M1        0x2A06 //! Alert level char uuid
#define RSI_BLE_CLIENT_INIDCATIONS_SERVICE_UUID_M1       0x1809 //! Health thermometer Alert service uuid
#define RSI_BLE_CLIENT_INIDCATIONS_CHAR_UUID_M1          0x2A1C //! Temperature measurement
#define RSI_BLE_CLIENT_NOTIFICATIONS_SERVICE_UUID_M1     0x180D //! Heart Rate service uuid
#define RSI_BLE_CLIENT_NOTIFICATIONS_CHAR_UUID_M1        0x2A37 //! Heart Rate measurement 
```

Configure below macros to select each connection configurations

`Master1 configurations: (where XX=M1)`

Set below macro to enable secure connection between Silicon Labs device(peripheral) and remote ble device(central)

```c
#define SMP_ENABLE_XX               0  //By default, this macro is set to '0' 
```

Set below macro to add remote device to whitelist

```c
#define ADD_TO_WHITELIST_XX         0  //By default, this macro is set to '0' 
```

Set below macro to discover remote profiles.

```c
#define PROFILE_QUERY_XX            1  //By default, this macro is set to '1'
```

Set below macro to enable data transfer between devices

```c
#define DATA_TRANSFER_XX            1  //By default, this macro is set to '1'
```

To select the type of data transfer configure below macros

Set below macro to receive 'gatt notifications' from remote device.

```c
#define RX_NOTIFICATIONS_FROM_XX    0  //By default, this macro is set to '1'
```

> Note:
> Make sure to set below macros to 0.

Set below macro to receive 'gatt indications' from remote device.

```c
#define RX_INDICATIONS_FROM_XX      0  //By default, this macro is set to '0'
```

Set below macro to Transmit 'gatt notifications' to remote device.

```c
#define TX_NOTIFICATIONS_TO_XX      1  //By default, this macro is set to '1'
```

> Note:
> Make sure to set below macros to 0

```c
#define  TX_WRITES_TO_XX            0  //Set this to 0 
#define  TX_WRITES_NO_RESP_TO_XX    0  //Set this to 0 
#define  TX_INDICATIONS_TO_XX       0  //Set this to 0 
```

Set below macro to Transmit 'gatt write with response' to remote device.

```c
#define TX_WRITES_TO_XX             0  //By default, this macro is set to '0' 
```

Set below macro to Transmit 'gatt write without response' to remote device.

```c
#define TX_WRITES_NO_RESP_TO_XX     0  //By default, this macro is set to '0' 
```

Set below macro to Transmit 'gatt indications to remote device.

```c
#define TX_INDICATIONS_TO_XX        0  //By default, this macro is set to '0' 
```

To select data length extension for each connection configure below macro

Set below macro to enable data length extension

```c
#define DLE_ON_XX                   0  //By default, this macro is set to '0' 
```

Configure below macros to set connection interval, connection latency and connection supervision timeout.

Below configuration is for connection interval of 45ms, latency 0 and timeout as 400ms

```c
#define CONN_INTERVAL_XX            36
#define CONN_LATENCY_XX             0
#define CONN_SUPERVISION_TIMEOUT_XX  400 
```

> Note:
> Follow the above instructions to configure for remaining connections (slave1(XX = S1), slave2 (XX =S2), slave3(XX=S3) and master2(XX=M2))

**4.3** Select BT configurations in `rsi_bt_config.h` file

Enter the remote BT device address as the value to RSI_BT_REMOTE_BD_ADDR

```c
#define   RSI_BT_REMOTE_BD_ADDR     "EA:D1:01:01:82:4C"
```

SPP_MODE refers to type of Module Mode, whether its MASTER/SLAVE

```c
#define   SPP_MODE                  SPP_SLAVE 
```

PIN_CODE refers 4 bytes string required for pairing process

```c
#define   PIN_CODE                  "0000" 
```

RSI_BT_LOCAL_NAME refers to name of RS9116W EVK to appear during scanning by remote device

```c
#define   RSI_BT_LOCAL_NAME         "SPP_SLAVE" 
```

**4.4** Select WLAN configurations in `rsi_wlan_config.h` file

Enter the AP Connectivity essential configs as the value to SSID, SECURITY_TYPE and PSK

```c
#define     SSID                    "SILABS_AP"
#define     SECURITY_TYPE           RSI_WPA2 
#define     PSK                     "1234567890"
```

To select the ip, configure below macros

```c
#define     DHCP_MODE               1           // 0 enable or disable
#if !DHCP_MODE                                  // Need to configure manually if DHCP is disabled
#define     DEVICE_IP               0x6500A8C0  // 192.168.0.101
#define     GATEWAY                 0x0100A8C0  // 192.168.0.1
#define     NETMASK                 0x00FFFFFF  // 255.255.255.0
#endif 
```

Configure below macros to make Use of Local HTTP server to download the files.

```c
#define   RSI_DNS_CLIENT            0           // set to '1' only if using server name instead of server ip address, by default it is set to '0'
#define   HTTPS_DOWNLOAD            0           // set to '0' to choose HTTP download
#define   SERVER_PORT               80          // by default http runs on port 80
#define   SERVER_IP_ADDRESS         "192.168.0.103"   // Local server ip address
#define   DOWNLOAD_FILENAME         "5MB.txt"   // File to download
#define   CONTINUOUS_HTTP_DOWNLOAD  1           // set to '1' to download continuously, if reset download happens only once.
```

Configure below macros to make Use of Local HTTPS server to download the files.

```c
#define   RSI_DNS_CLIENT            0           // set to '1' only if using server name instead of server ip address, by default it is set to '0'
#define   HTTPS_DOWNLOAD            1           // set to '1' to choose HTTPs download
#define   SERVER_PORT               443         // by default https runs on port 443
#define   SERVER_IP_ADDRESS         "192.168.0.101"   // Local server ip address
#define   DOWNLOAD_FILENAME         "5MB.txt"   // File to download, by default this file is provided in the demo
#define   CONTINUOUS_HTTP_DOWNLOAD  1           // set to '1' to download continuously, if reset download happens only once.
```

> Note:
> BY default, when 'HTTPS_DOWNLOAD' is set, SSL and LOAD_CERTIFICATE will be set to '1' as it is required for HTTPS download.

**4.5** Open `main.c` file and configure below macros.

Driver task should have the highest priority among all threads

```c
#define RSI_DRIVER_TASK_PRIORITY                 3
```

##### 5. Testing the Application

Follow the below steps for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2.1 Building the Application on the STM32 Host Platform

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects/wlan_throughput_bt_spp_ble_dual_role-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the project from `<SDK>/examples/snippets/wlan_bt_ble/wlan_throughput_bt_spp_ble_dual_role/projects`
- Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3**
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Compile the project and flash the binary onto STM32.
2. Before running below commands, make sure the file configured in 'DOWNLOAD_FILENAME' is present under below path  
   [File path: `/<SDK>/resources/scripts/`]
3. To download the files from local http server, navigate to below folder and run below command.  
   [File path: `/<SDK>/resources/scripts/`]  
   python simple_http_server.py 80
4. To download the files from local https server, copy ssl certificates 'server-cert.pem' , 'server-key.pem' from below 'source path' and paste in to 'destination path'.  
   [source path: `/<SDK>/resources/certificates/`]  
   [destination path: `/<SDK>/resources/scripts/`]  
   Open command prompt, navigate to above destination path and run below command.  
   openssl s_server -accept 443 -cert server-cert.pem -key server-key.pem -tls1 -WWW
5. After the program gets executed, module scans for the configured Accesspoint, connects to it and acquires the ip address
6. After acquiring ip address, initiates connection to remote server.(ex: simple_http_server.py running in same network where Module is also connected)
7. If connection is successful,

- RS9116W EVK starts advertising and scanning BLE
- Advertises BT and simultaneoulsy downloads http packets sent from remote server

1. If connection is not successful, step 5 is repeated untill connection is success
2. While downloading is happening, user can initiate both the BT SPP and BLE connections (both peripheral and central).
3. To check BLE peripheral connection, scan and initiate connection from nRF connect/dongles.
4. RS9116W EVK accepts the BLE connections if initiated by remote BLE device(max 2 central connections are accepted) and starts data transfer based on the user configuration.
5. To check data transfer, enable Gatt notifications of Module on service characteristic RSI_BLE_ATTRIBUTE_1_UUID
6. If enabled RS9116W EVK continuously transmits 20 notifications per connection interval of size 20bytes.
7. To check BLE central connection, advertise the remote ble devices using phone/dongles.
8. Module scans for advertised devices, crosschecks the ble device names/ble device address as configured in application, if matches initiate connection.
9. If BLE connection is successful, RS9116W EVK enables the Gatt notifications of remote device for RSI_BLE_CLIENT_NOTIFICATIONS_CHAR_UUID_M1 (Heart Rate measurement) and receives notifications/connection interval.
10. While BLE and WLAN data transfer is happening, initiate BT SPP connection using Bluetooth SPP Manager app.
11. After successful BT connection, RS9116W EVK echos the data transmitted from Bluetooth SPP Manager app.

> Note:
> Steps 9 to 12 can be repeated for 2 peripheral connection and steps 13 to 15 can be repeated for 3 central connections based on the RSI_BLE_MAX_NBR_MASTERS and RSI_BLE_MAX_NBR_SLAVES. Verify that all connections are stable and simultaneous data transfer is happening from all the radios of RS9116W EVK.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### BT/BLE Dual Mode

##### 1. Purpose / Scope

This application demonstrates how information can be exchanged seamlessly using wireless protocols ( BT and BLE) running in the same device.

The BT BLE dual mode application demonstrates how information can be exchanged seamlessly using wireless protocols (BT and BLE) running in the same device.

##### 2. Prerequisites / Setup Requirements

Before running the application, the user will need the following things to setup.

###### 2.1 Hardware Requirements

- Windows PC with Host interface(UART/ SPI/ SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)
- Smart phone/tablet with BT Application (Ex: Bluetooth SPP Pro)
- Smart phone/tablet with BLE Application (Ex: Light Blue APP for iPhone/BLE Connect APP for android)

![Setup Diagram for BT BLE Dual Mode](/wifibt-wc-snippet-examples/2.14.0/images/image82.png)

###### 2.2 Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.
- Download and install the Silicon Labs [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager&hl=en_IN) in the android smart phones for testing BT applications. Users can also use their choice of BT apps available in Android/iOS smart phones.

##### 3. Application Build Environment

###### 3.1 Platform

The Application can be built and executed on below Host platforms

- [STM32F411 Nucleo](https://st.com/)
- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)

###### 3.2 Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### 3.3 Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/bt_ble/bt_ble_dual_role/projects/bt_ble_dual_role-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/bt_ble/bt_ble_dual_role/projects/bt_ble_dual_role-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/bt_ble/bt_ble_dual_role/projects/bt_ble_dual_role-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![Figure: EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image82a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/ble/bt_ble_dual_role/projects/bt_ble_dual_role-brd2204a-gg11.slsproj`

###### 3.4 Bare Metal/RTOS Support

This application supports bare metal/RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal and RTOS configuration.

##### 4. Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

**4.1** `rsi_wlan_config.h` file and update/modify following macros,

**4.1.1** User must update the below parameters

```c
#define CONCURRENT_MODE                    RSI_DISABLE
#define RSI_FEATURE_BIT_MAP                FEAT_SECURITY_OPEN
#define RSI_TCP_IP_BYPASS                  RSI_DISABLE
#define RSI_TCP_IP_FEATURE_BIT_MAP         TCP_IP_FEAT_DHCPV4_CLIENT
#define RSI_CUSTOM_FEATURE_BIT_MAP         FEAT_CUSTOM_FEAT_EXTENTION_VALID
#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP     RAM_LEVEL_NWP_ALL_MCU_ZERO 
```

**4.1.2** Open `rsi_bt_app.c` file and update/modify following macros:

- RSI_BT_LOCAL_NAME **-** Name of the BT device
- PIN_CODE - Four byte string required for pairing process.

**4.1.3** Open `rsi_ble_app.c` file and update/modify following macros,

- RSI_BLE_NEW_SERVICE_UUID - The attribute value of the newly created service. Ex: 0xAABB
- RSI_BLE_ATTRIBUTE_1_UUID - The attribute type of the first attribute under this Service. Ex: 0x1AA1
- RSI_BLE_ATTRIBUTE_2_UUID - The attribute type of the second attribute under this Service. Ex: 0x1BB1
- RSI_BLE_MAX_DATA_LEN - Maximum length of the attribute data(limited to max of 20 bytes)
- RSI_BLE_APP_DEVICE_NAME - Name of the Silicon Labs device to appear during Scanning by peer devices.

**4.1.4** The desired parameters are provided below. User can also modify the parameters as per their needs and requirements.

**Configuring the BT task**

Following are the **non-configurable** Macros in the Application file.

- RSI_APP_EVENT_CONNECTED - Event number to be set on connection establishment.
- RSI_APP_EVENT_DISCONNECTED - Event number to be set on disconnection.
- RSI_APP_EVENT_PINCODE_REQ - Event number to be set on Pincode request for pairing.
- RSI_APP_EVENT_LINKKEY_SAVE - Event number to be set on link key save.
- RSI_APP_EVENT_AUTH_COMPLT - Event number to be set on authentication complete.
- RSI_APP_EVENT_LINKKEY_REQ - Event number to be set on link key request for connection.
- RSI_APP_EVENT_SPP_CONN - Event number to be set on SPP connection.
- RSI_APP_EVENT_SPP_DISCONN - Event number to be set on SPP disconnection.
- RSI_APP_EVENT_SPP_RX - Event number to be set on SPP data received from Master.

**Configuring the BLE Application**

Following are the **non-configurable** macros in the application.

- RSI_BLE_ATT_PROPERTY_READ – Used to set read property to an attribute value.
- RSI_BLE_ATT_PROPERTY_WRITE - Used to set write property to an attribute value.
- RSI_BLE_ATT_PROPERTY_NOTIFY - Used to set notify property to an attribute value.
- RSI_BLE_CHAR_SERV_UUID - The attribute type of the characteristics to be added in a service. Ex: 0x2803
- RSI_BLE_CLIENT_CHAR_UUID - The attribute type of the client characteristics descriptor to be added in a service characteristic. Ex: 0x2902
- BT_GLOBAL_BUFF_LEN – Number of bytes required for the Application and the Driver.

##### 5. Testing the Application

Follow the steps below for the successful execution of the application.

###### 5.1 Loading the RS9116W Firmware

Refer [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### 5.2 Building the Application on the Host Platform

###### 5.2.1 Using STM32

Refer [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/bt_ble/bt_ble_dual_role/projects/bt_ble_dual_role-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from STM32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run.  
  - If RESET pin is not connected from STM32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run.
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.2.2 Using EFX32 (heading level 7)

Refer [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/), for settin-up EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/bt_ble/bt_ble_dual_role/projects`  
  - Select the appropriate .slsproj as per Radio Board type mentioned in **Section 3.3** for EFR32 board.    
    (or)  
  - Select the *.brd2204a-gg11.slsproj  for EFM32GG11 board.
- Compile and flash the project in to Host MCU
- Debug the project
- Check for the RESET pin:  
  - If RESET pin is connected from EFX32 to RS9116W EVK, then user need not press the RESET button on RS9116W EVK before free run  
  - If RESET pin is not connected from EFX32 to RS9116W EVK, then user need to press the RESET button on RS9116W EVK before free run
- Free run the project
- Then continue the common steps from **Section 5.3**

###### 5.3 Common Steps

1. Connect Silicon Labs device to the Windows PC running KEIL or IAR IDE
2. Build and launch the application.
3. After the program gets executed, Silicon Labs BT is in Discoverable state and BLE is in Advertising state.
4. Now initiate connection from the SPP App running in the Smartphone1.
5. In the App, Silicon Labs BT would appear with the name configured in the macro RSI_BT_LOCAL_NAME.
6. After BT SPP connection is established, send a message from the App to Silicon Labs BT.
7. Open a LE App in the Smartphone and do Scan.
8. In the App, Silicon Labs BLE would appear with the name configured in the macro RSI_BLE_APP_DEVICE_NAME.
9. Initiate BLE connection from the App.
10. After BLE connection, user can write or read messages through BLE.

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

#### Gain Table Update Example

##### Purpose / Scope

This application demonstrates how to modify gain table offset/max power details. The app can be used to overwrite the default region based gain table with a user-defined region-based gain table.

There are two types of gain tables for BT and BLE protocols

- Gain table holding maximum transmit power values
- Gain table with maximum power vs. offset values

Both gain tables must be configured in the correct order to successfully apply changes in the firmware.

##### Pre-requisites / Setup Requirements

###### Hardware Requirements

- Windows PC with Host interface (UART / SPI / SDIO).
- Silicon Labs [RS9116 Wi-Fi Evaluation Kit](https://www.silabs.com/development-tools/wireless/wi-fi/rs9116x-sb-evk-development-kit)
- Host MCU Eval Kit. This example has been tested with:  
  - Silicon Labs [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)  
  - Silicon Labs [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)  
  - [STM32F411 Nucleo](https://st.com/)

###### Software Requirements

- [RS9116 SDK](https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk/)
- Embedded Development Environment  
  - For STM32, use licensed [Keil IDE](https://www.keil.com/demo/eval/arm.htm)  
  - For Silicon Labs EFx32, use the latest version of [Simplicity Studio](https://www.silabs.com/developers/simplicity-studio)
- Download and install the Silicon Labs [EFR Connect App](https://www.silabs.com/developers/efr-connect-mobile-app) in the Android smart phones for testing BLE applications. Users can also use their choice of BLE apps available in Android/iOS smart phones.
- Download and install the [Bluetooth SPP manager](https://play.google.com/store/apps/details?id=at.rtcmanager) Android app for testing BT applications. Users can also use their choice of BT apps available in Android/iOS smart phones.

##### Application Build Environment

###### Platform

The application can be built and executed on the following host platforms

- [WSTK + EFR32MG21](https://www.silabs.com/development-tools/wireless/efr32xg21-bluetooth-starter-kit)
- [WSTK + EFM32GG11](https://www.silabs.com/development-tools/mcu/32-bit/efm32gg11-starter-kit)
- [STM32F411 Nucleo](https://st.com/)

###### Host Interface

- By default, the application is configured to use the SPI bus for interfacing between Host platforms(STM32F411 Nucleo / EFR32MG21) and the RS9116W EVK.
- This application is also configured to use the SDIO bus for interfacing between Host platforms(EFM32GG11) and the RS9116W EVK.

###### Project Configuration

The Application is provided with the project folder containing Keil and Simplicity Studio project files.

- Keil Project  
  - The Keil project is used to evaluate the application on STM32.  
  - Project path: `<SDK>/examples/snippets/bt_ble/update_gain_table/projects/update_gain_table-nucleo-f411re.uvprojx`
- Simplicity Studio  
  - The Simplicity Studio project is used to evaluate the application on EFR32MG21.  
  - Project path:    
    - If the Radio Board is **BRD4180A** or **BRD4181A**, then access the path `<SDK>/examples/snippets/bt_ble/update_gain_table/projects/update_gain_table-brd4180a-mg21.slsproj`    
    - If the Radio Board is **BRD4180B** or **BRD4181B**, then access the path `<SDK>/examples/snippets/bt_ble/update_gain_table/projects/update_gain_table-brd4180b-mg21.slsproj`      
      - User can find the Radio Board version as given below

![Figure: EFR Radio Boards](/wifibt-wc-snippet-examples/2.14.0/images/image82a.png)

- EFM32GG11 platform  
  - The Simplicity Studio project is used to evaluate the application on EFM32GG11.    
    - Project path:`<SDK>/examples/snippets/bt_ble/update_gain_table/projects/update_gain_table-brd2204a-gg11.slsproj`

###### Bare Metal/RTOS Support

The application supports bare metal and RTOS environment. By default, the application project files (Keil and Simplicity Studio) are provided with bare metal and RTOS configuration.

##### Application Configuration Parameters

The application can be configured to suit your requirements and development environment. Read through the following sections and make any changes needed.

###### `rsi_wlan_config.h` modifications

```c
  #define CONCURRENT_MODE                RSI_DISABLE
  #define RSI_FEATURE_BIT_MAP            FEAT_SECURITY_OPEN
  #define RSI_TCP_IP_BYPASS              RSI_DISABLE
  #define RSI_TCP_IP_FEATURE_BIT_MAP     TCP_IP_FEAT_DHCPV4_CLIENT
  #define RSI_CUSTOM_FEATURE_BIT_MAP     FEAT_CUSTOM_FEAT_EXTENTION_VALID
  #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP RAM_LEVEL_NWP_ALL_MCU_ZERO 
```

###### `rsi_update_gain_table.c` modifications

To set opermode, update `RSI_BT_BLE_MODE`.
By default `RSI_BT_BLE_MODE` is set to Dual Mode i.e. `9`

- `12` - BLE only mode
- `4` - BT only mode
- `9` - Dual mode

```c
#define RSI_BT_BLE_MODE 9
```

The API used to update the gain table is:

```c
int32_t rsi_bt_cmd_update_gain_table_offset_or_max_pwr(uint8_t node_id,
                                                       uint8_t payload_len,
                                                       uint8_t *payload,
                                                       uint8_t req_type)
```

---

**Note!**

- This command must be used immediately after opermode request
- Internally, the firmware maintains two tables  
  - Gain table holding Max Tx power values for all regions  
  - Gain table with Max power vs offset values for each channel of all regions
- There are 5 regions supported and are FCC, ETSI, TELEC, KCC, WORLDWIDE. These FCC/ETSI/TELEC/KCC gain table max power level and offset values should be loaded in end-to-end mode via BT/BLE User Gain table. This has to be called upon every boot-up since this information is not saved inside flash. SoC uses these tables in FCC/ETSI/TELEC/KCC to limit power and not to violate allowed limits.
- For Worldwide region firmware uses Worldwide values for Tx. For other regions(FCC/ETSI/TELEC/KCC), Firmware uses min value out of Worldwide & Region based values for Tx.  Also there will be part to part variation across chips and offsets are estimated during manufacturing flow which will be applied as correction factor during normal mode of operation.
- This frame has to be used by customers who has done FCC/ETSI/TELEC/KCC certification with their own antenna. All other customers should not use this. Inappropriate use of this frame may result in violation of FCC/ETSI/TELEC/KCC or any certifications and Silicon labs is not liable for that.

---

- for ACX module
- BT power offset like <CHANNEL_NUM>, <1M_OFFSET>, <2M_OFFSET>, <3M_oFFSET>
- BLE power offset like <CHANNEL_NUM>, <1M_OFFSET>, <2M_OFFSET>, <500kbps_oFFSET>, <125kbps_oFFSET>

---

**req_type** can be set to one of the following macros :

```c
#define UPDATE_GAIN_TABLE_MAX_POWER 0  // For updating Gain table Max power
#define UPDATE_GAIN_TABLE_OFFSET    1  // For updating Gain table offset
```

**node_id** can be set to one of the following macros :

```c
#define BLE_NODE 0  // For selecting BLE node
#define BT_NODE  1  // For selecting BT node
```

The following arrays will be used to update_gain_table based on `node_id` and `req_type`.

|`node_id`|`req_type`|Payload Array|
|---|---|---|
|`BLE_NODE`|`UPDATE_GAIN_TABLE_MAX_POWER`|`RS9116_BLE_REGION_BASED_MAXPOWER_XX`|
|`BLE_NODE`|`UPDATE_GAIN_TABLE_OFFSET`|`RS9116_BLE_REGION_BASED_MAXPOWER_VS_OFFSET_XX`|
|`BT_NODE`|`UPDATE_GAIN_TABLE_MAX_POWER`|`RS9116_BT_REGION_BASED_MAXPOWER_XX`|
|`BT_NODE`|`UPDATE_GAIN_TABLE_OFFSET`|`RS9116_BT_REGION_BASED_MAXPOWER_VS_OFFSET_XX`|

The following arrays will be used to update_gain_table for ACX module based on `node_id` and `req_type`.

|`node_id`|`req_type`|Payload Array|
|---|---|---|
|`BLE_NODE`|`UPDATE_GAIN_TABLE_MAX_POWER`|`RS9116_BLE_REGION_BASED_MAXPOWER_AC1`|
|`BLE_NODE`|`UPDATE_GAIN_TABLE_OFFSET`|`RS9116_BLE_REGION_BASED_MAXPOWER_VS_OFFSET_AC1`|
|`BT_NODE`|`UPDATE_GAIN_TABLE_MAX_POWER`|`RS9116_BT_REGION_BASED_MAXPOWER_AC1`|
|`BT_NODE`|`UPDATE_GAIN_TABLE_OFFSET`|`RS9116_BT_REGION_BASED_MAXPOWER_VS_OFFSET_AC1`|
|**Gain Table Max Power Array Format**|

```c
uint8_t _RS9116_BT/BLE_REGION_BASED_MAXPOWER_XX[] = {}; //! Fill the user gain table max power values in the below mentioned way.

<TABLE NAME>[] = { 
                   <REGION NAME 1>, <MAX POWER>, 
                   <REGION NAME 1>, <MAX POWER>,
                    .
                    .
                   <REGION NAME N>, <MAX POWER> 
                 };
```

**Gain Table Max Power Array Format for ACX module**

```c
uint8_t _RS9116_BT/BLE_REGION_BASED_MAXPOWER_AC1[] = {}; //! Fill the user gain table max power values in the below mentioned way.

<TABLE NAME>[] = {
                   <REGION NAME 1>, <MAX POWER>,
                   <REGION NAME 1>, <MAX POWER>,
                    .
                    .
                   <REGION NAME N>, <MAX POWER>
                 };
```

**Gain Table Offset Array Format**

```c
uint8_t _RS9116_BT/BLE_REGION_BASED_MAXPOWER_VS_OFFSET_XX[] = {};  // Fill the user gain table offset values as shown.
 
<TABLE NAME>[] = {
                  <Number Of Regions - 'r'>, 
                    <REGION NAME 1>, <Number of Channels - 'm'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, 
                      <CHANNEL NUMBER 2>, <OFFSET>,
                      . 
                      .
                      <CHANNEL NUMBER m>, <OFFSET>,
                    <REGION NAME 2>, <Number of Channels - 'n'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, 
                      <CHANNEL NUMBER 2>, <OFFSET>,
                      . 
                      .
                      <CHANNEL NUMBER n>, <OFFSET>,
                     .
                     .
                     <REGION NAME r>, <Number of Channels - 'n'>,
                       <CHANNEL NUMBER 1>, <OFFSET>, 
                       <CHANNEL NUMBER 2>, <OFFSET>,
                       .
                       .
                       <CHANNEL NUMBER n>, <OFFSET>,
                   };
```

**Gain Table Offset Array Format for ACX module**

```c
uint8_t _RS9116_BLE_REGION_BASED_MAXPOWER_VS_OFFSET_AC1[] = {};  // Fill the user gain table offset values as shown.

<TABLE NAME>[] = {
                  <Number Of Regions - 'r'>,
                    <REGION NAME 1>, <Number of Channels - 'm'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                      <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                      .
                      .
                      <CHANNEL NUMBER m>, <OFFSET>,
                    <REGION NAME 2>, <Number of Channels - 'n'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                      <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                      .
                      .
                      <CHANNEL NUMBER n>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                     .
                     .
                     <REGION NAME r>, <Number of Channels - 'n'>,
                       <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                       <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                       .
                       .
                       <CHANNEL NUMBER n>, <OFFSET>, <OFFSET>, <OFFSET>, <OFFSET>
                   };

uint8_t _RS9116_BT_REGION_BASED_MAXPOWER_VS_OFFSET_AC1[] = {};  // Fill the user gain table offset values as shown.

<TABLE NAME>[] = {
                  <Number Of Regions - 'r'>,
                    <REGION NAME 1>, <Number of Channels - 'm'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>
                      <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>
                      .
                      .
                      <CHANNEL NUMBER m>, <OFFSET>,
                    <REGION NAME 2>, <Number of Channels - 'n'>,
                      <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>
                      <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>
                      .
                      .
                      <CHANNEL NUMBER n>, <OFFSET>, <OFFSET>, <OFFSET>
                     .
                     .
                     <REGION NAME r>, <Number of Channels - 'n'>,
                       <CHANNEL NUMBER 1>, <OFFSET>, <OFFSET>, <OFFSET>
                       <CHANNEL NUMBER 2>, <OFFSET>, <OFFSET>, <OFFSET>
                       .
                       .
                       <CHANNEL NUMBER n>, <OFFSET>, <OFFSET>, <OFFSET>
                   };
```

**Region Name and Values**

|Region Name|Value|
|---|---|
|`FCC`|`0`|
|`ETSI`|`1`|
|`TELEC`|`2`|
|`WORLDWIDE`|`3`|
|`KCC`|`4`|

##### Testing the Application

Follow the steps below for the successful execution of the application.

###### Loading the RS9116W Firmware

See [Getting started with PC ](https://docs.silabs.com/rs9116/latest/wiseconnect-getting-started) to load the firmware into RS9116W EVK. The firmware binary is located in `<SDK>/firmware/`

###### Building the Application on the Host Platform

**Using EFX32**

See [EFx32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/) to setup EFR & EFM host platforms

- Import the EFR32/EFM32 project from `<SDK>/examples/snippets/bt_ble/update_gain_table/projects`  
  - Select the appropriate .slsproj to match the EFR32 radioboard, or  
  - Select the *.brd2204a-gg11.slsproj for EFM32GG11 board.
- Compile and flash the project to the EFx32
- Debug the project and pause execution
- If the RS9116W reset pin is **NOT** connected to the EFx32, press the RS9116W EVK Reset button
- Free run the project
- Review gain table updates on the serial terminal

**Using STM32**

See [STM32 Getting Started](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-getting-started-with-efx32/)

- Open the project `<SDK>/examples/snippets/bt_ble/update_gain_table/projects/update_gain_table-nucleo-f411re.uvprojx` in Keil IDE.
- Build and Debug the project, pause execution
- If the RS9116W reset pin is **NOT** connected to the STM32, press the RS9116W EVK reset button
- Run the project on the STM32
- Review gain table updates on the serial terminal

##### Compressed Debug Logging

To enable the compressed debug logging feature please refer to [Logging User Guide](https://docs.silabs.com/rs9116-wiseconnect/latest/wifibt-wc-sapi-reference/logging-user-guide)

## Additional Resources

### Product Information

- [Product Information](https://www.silabs.com/wireless/wi-fi)
### Discussion Forum

- [Discussion Forum](https://www.silabs.com/community)
### Technical Support

- [Technical Support](https://www.silabs.com/support)