Connected Power Save Modes#

The SiWx917 supports Connected Power Save operation when the device is in a connected state. Based on the advertising interval, scan duration, or connection interval, the SiWx917 switches between Active and Sleep states.

Before you configure Connected Power Save, understand the Sleep/Active switching mechanism and the wake interval behavior of the Network Processor (NWP) during connected operation.

Sleep/Active State Switching

  • When the SiWx917 is in Advertising Mode

    • The SiWx917 wakes at every advertising interval, sends an advertising packet, and enters Sleep.

    • If it receives a scan request (according to the configured advertising filter policy), it sends a scan response or ignores the request.

  • When the SiWx917 is in Scanning Mode:

    • It wakes and listens for the scan window duration, and then goes back to Sleep.

    • It sends scan requests based on the configured scan type.

    • Depending on the scan filter policy, it wakes for every advertising report or only for advertising reports from devices in the accept list.

  • When the SiWx917 is in Connected Mode:

    • It remains in Sleep between connection events.

    • It wakes for each connection interval.

    • The effective wake pattern is determined by the connection parameters, including slave latency, which the NWP manages.

    • Transmit (TX) and receive (RX) operations occur only during the connection intervals.

Advertising Interval

  • When the SiWx917 is configured for advertising, it wakes at each advertising interval, sends advertising packets on the configured channels according to the filter policy, and then returns to Sleep.

  • For example, if the advertising interval is set to 1 second with a 37-byte payload in 3 channels, the device wakes up every 1 second to send the 37-byte payload in 3 channels. After sending the packets in the 3 channels, the SiWx917 device goes to sleep and listens for scan requests in accordance with the advertising filter policy.

    SiWx917 Device Advertising IntervalSiWx917 Device Advertising Interval

  • Configuration:

    #define RSI_BLE_ADV_TYPE              UNDIR_CONN
    #define RSI_BLE_ADV_FILTER_TYPE       ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY
    #define RSI_BLE_ADV_DIR_ADDR_TYPE     LE_PUBLIC_ADDRESS
    #define RSI_BLE_ADV_DIR_ADDR          "00:15:83:6A:64:17"
    #define RSI_BLE_ADV_INT_MIN           0x0100
    #define RSI_BLE_ADV_INT_MAX           0x0200
    #define RSI_BLE_ADV_CHANNEL_MAP       0x07

Scan Interval

  • When the SiWx917 is configured for scanning, it wakes at the scan interval and listens for advertising reports during the scan window. If the device uses active scanning, it sends a scan request after it receives an advertising report.

  • For example, if the scanning interval is set to 1 second with a 100 ms scan window, the device will wake up every 1 second, listen for advertising reports for 100 ms, and then go back to sleep. According to the scanning filter policy, the SiWx917 device will wake up when it receives advertising reports.

    SiWx917 Device Scanning IntervalSiWx917 Device Scanning Interval

  • Configuration:

    • According to the requirement, define the scanning parameters in the ble_config.h file. These parameters will be executed using the either the rsi_ble_start_scanning() API or rsi_ble_start_scanning_with_values() API.

      #define RSI_BLE_SCAN_TYPE             SCAN_TYPE_ACTIVE
      #define RSI_BLE_SCAN_FILTER_TYPE      SCAN_FILTER_TYPE_ALL
      #define LE_SCAN_INTERVAL              0x0100   // 160 ms
      #define LE_SCAN_WINDOW                0x0050   // 50 ms

Connection Interval

  • When the SiWx917 device successfully connects to a remote device, it wakes up for every connection interval and then goes to sleep.

  • When sending data (TX), the SiWx917 device wakes up, sends the data, and if there is no data, the device sends a null packet and then goes back to sleep. When receiving data (RX), the SiWx917 wakes up, receives the packet, processes it according to the application, and then goes back to sleep.

    SiWx917 Device Connection IntervalSiWx917 Device Connection Interval

  • Configuration:

    • When the SiWx917 device is configured as central, update the foloowing connection parameters in the ble_config.h file as required. These parameters will be executed using one of the following APIs: rsi_ble_connect(), or rsi_ble_connect_with_params(), or rsi_ble_enhance_connect_with_params().

      #define CONNECTION_INTERVAL_MIN   0x00A0
      #define CONNECTION_INTERVAL_MAX   0x00A0
      #define CONNECTION_LATENCY        0x0000
      #define SUPERVISION_TIMEOUT       0x07D0
    • When the SiWx917 device is configured as a peripheral,

      //! Connection parameters
      #define CONNECTION_INTERVAL_MIN   0x00A0
      #define CONNECTION_INTERVAL_MAX   0x00A0
      #define CONNECTION_LATENCY        0x0000
      #define SUPERVISION_TIMEOUT       0x07D0
      
      //! Register the conn update params in the gap register callback
      rsi_ble_gap_register_callbacks(
        NULL,
        rsi_ble_on_connect_event,
        rsi_ble_on_disconnect_event,
        NULL,
        NULL,
        NULL,
        rsi_ble_on_enhance_conn_status_event,
        NULL,
        rsi_ble_on_conn_update_complete_event,
        NULL
      );
      
      //! Declare the rsi_ble_on_conn_update_complete_event as below
      void rsi_ble_on_conn_update_complete_event(
        rsi_ble_event_conn_update_t *rsi_ble_event_conn_update_complete,
        uint16_t resp_status
      ) {
        UNUSED_PARAMETER(resp_status);
      
        memcpy(
          &event_conn_update_complete,
          rsi_ble_event_conn_update_complete,
          sizeof(rsi_ble_event_conn_update_t)
        );
      
        LOG_PRINT("\n Connection parameters update completed \n");
        LOG_PRINT(
          "\n Connection interval = %d, Latency = %d, Supervision Timeout = %d \n",
          event_conn_update_complete.conn_interval,
          event_conn_update_complete.conn_latency,
          event_conn_update_complete.timeout
        );
      }
      //! Connection parameters
      #define CONNECTION_INTERVAL_MIN   0x00A0
      #define CONNECTION_INTERVAL_MAX   0x00A0
      #define CONNECTION_LATENCY        0x0000
      #define SUPERVISION_TIMEOUT       0x07D0
      
      //! Trigger the below API after the connection
      status = rsi_ble_conn_params_update(remote_dev_address,
                                          CONNECTION_INTERVAL_MIN,
                                          CONNECTION_INTERVAL_MAX,
                                          CONNECTION_LATENCY,
                                          SUPERVISION_TIMEOUT);

SiWx917 SoC Device Connected Power Save Mode Mechanism#

The SiWx917 SoC device is in the BLE-connected state and in Connected Power Save mode.

  • When the SiWx917 SoC device needs to send a packet. The M4 wakes up the NWP by setting the M4_wakeup_TA flag.

  • The NWP processes the packet and sends it to the remote device at the connection interval.

  • When the remote device sends a packet, the NWP receives and processes it, then sets the TA_wakeup_M4 flag. Once the NWP is active, the M4 sends the received packet.

  • After the packet is sent or received, the SiWx917 SoC returns to Sleep by clearing the corresponding flag.

    SiWx917 Device Connected Power Save Mode MechanismSiWx917 Device Connected Power Save Mode Mechanism

SiWx917 NCP Device Connected Power Save Mode Mechanism#

The SiWx917 NCP device is in the BLE-connected state and in Connected Power Save mode, it follows the MAX PSP mode.

  • When the SiWx917 NCP device needs to send a packet, the host wakes up the SiWx917 NCP device by asserting the UULP_VBAT_GPIO_2.

  • The SiWx917 NCP device acknowledges the host by asserting the UULP_VBAT_GPIO_0 or UULP_VBAT_GPIO_3. Once acknowledged, the host sends the packet, and the SiWx917 NCP device processes it before sending it to the remote device at the connection interval.

  • On the other hand, when the remote device sends a packet, the SiWx917 NCP receives and processes the packet. After processing, the SiWx917 NCP device wakes up the host by asserting the UULP_VBAT_GPIO_0/UULP_VBAT_GPIO_3 pin. In response, the host acknowledges the wakeup by asserting the UULP_VBAT_GPIO_2 pin. The host then receives and processes the packet.

  • After the packet is sent or received, the SiWx917 NCP device enters sleep mode by de-asserting the UULP_VBAT_GPIO_0 or UULP_VBAT_GPIO_3.

    SiWx917 device connected power save mode mechanismSiWx917 device connected power save mode mechanism

Configuration:

  1. When the SiWx917 NCP device in connected states, configure it by calling both rsi_bt_power_save_profile() andsl_wifi_set_performance_profile.

  2. Set the rsi_bt_power_save_profile parameters:

    • PSP_MODE as RSI_SLEEP_MODE_2

    • PSP_TYPE as RSI_MAX_PSP

  3. Call sl_wifi_set_performance_profile with the profile member sl_wifi_performance_profile_t.sl_performance_profile_t set to ASSOCIATED_POWER_SAVE.

  4. To switch the NWP from Associated Power Save Mode to High-Performance mode, configure it by calling both rsi_bt_power_save_profile() and sl_wifi_set_performance_profile.

    1. Set the rsi_bt_power_save_profile API parameters:

      • PSP_MODE as RSI_ACTIVE

      • PSP_TYPE as RSI_MAX_PSP

    2. Call sl_wifi_set_performance_profile with the profile member sl_wifi_performance_profile_t.sl_performance_profile_t set to HIGH_PERFORMANCE.

  5. After you set the NWP to High‑Performance mode, you do not need to reinitialize it. The previous device state is retained, and the host can directly call the BLE advertising and scanning APIs.

Code Snippet:

  • To keep the SiWx917 NWP/NCP in power save, set the following parameters:

    //! Power Save Profile Mode
    #define PSP_MODE    RSI_SLEEP_MODE_2
    
    //! Power Save Profile type
    #define PSP_TYPE    RSI_MAX_PSP
    
    //! Wi-Fi power save profile
    sl_wifi_performance_profile_t wifi_profile = {
        .profile = ASSOCIATED_POWER_SAVE
    };
  • To keep the SiWx917 NWP/NCP in an active state, set the following parameters:

    //! Power Save Profile Mode
    #define PSP_MODE        RSI_ACTIVE
    //! Power Save Profile type
    #define PSP_TYPE        RSI_MAX_PSP
    //! Wi-Fi power save profile
    sl_wifi_performance_profile_t wifi_profile = { .profile = HIGH_PERFORMANCE };
  • To enable the power save or to wake up the device, depending on the variable's values, run the following:

    status = rsi_bt_power_save_profile(PSP_MODE, PSP_TYPE);
    if (status != RSI_SUCCESS) {
      LOG_PRINT("\r\n Failed to initiate power save in BLE mode \r\n");
      return status;
    }
    
    //! Initiating power save in WLAN mode
    status = sl_wifi_set_performance_profile(&wifi_profile);
    if (status != SL_STATUS_OK) {
      LOG_PRINT("\r\n Failed to initiate power save in Wi-Fi mode :%ld\r\n", status);
      return status;
    }