From 3374553a90855633a55265db984e098ff5a12f75 Mon Sep 17 00:00:00 2001 From: shgutte <102281713+shgutte@users.noreply.github.com> Date: Tue, 10 Oct 2023 21:31:41 +0530 Subject: [PATCH] Added fix for the 917 BLE power cycle issue fix (#29628) * Added fix for the BLE power cycle issue * Added restyle changes * Added restyle changes * Added changes for the ble config --- src/platform/silabs/rs911x/rsi_ble_config.h | 96 ++++++-------------- src/platform/silabs/rs911x/wfx_sl_ble_init.c | 8 +- 2 files changed, 32 insertions(+), 72 deletions(-) diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index 3e2e6b13378707..5ac4b0dca2659d 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -20,11 +20,11 @@ #include "rsi_ble_apis.h" #if (SIWX_917 | EXP_BOARD) -#include "rsi_bt_common_apis.h" #include "rsi_user.h" #else #include #endif + /****************************************************** * * Macros * ******************************************************/ @@ -57,18 +57,6 @@ #define RSI_BLE_DEV_NAME "CCP_DEVICE" #define RSI_BLE_SET_RAND_ADDR "00:23:A7:12:34:56" -#define CLEAR_WHITELIST (0x00) -#define ADD_DEVICE_TO_WHITELIST (0x01) -#define DELETE_DEVICE_FROM_WHITELIST (0x02) - -#define CLEAR_ACCEPTLIST (0x00) -#define ADD_DEVICE_TO_ACCEPTLIST (0x01) -#define DELETE_DEVICE_FROM_ACCEPTLIST (0x02) - -#define RSI_BLE_TX_OCTETS 251 -#define RSI_BLE_TX_TIME 2120 // microseconds -#define RSI_BLE_CS_DATA_LENGTH 240 - #define ALL_PHYS (0x00) #define RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE (0) @@ -84,41 +72,45 @@ #define RSI_BLE_NAME_SPACE (0x01) #define RSI_BLE_DESCRIPTION (0x010B) +#define RSI_BLE_MAX_NBR_ATT_REC (80) + //! BLE characteristic custom service uuid #define RSI_BLE_CUSTOM_SERVICE_UUID (0xFFF6) #define RSI_BLE_CUSTOM_LEVEL_UUID (0x1FF1) - -#ifdef RSI_M4_INTERFACE -#define RSI_BLE_MAX_NBR_ATT_REC (20) - -#if (SIWX_917 | EXP_BOARD) -#define RSI_BLE_MAX_NBR_PERIPHERALS (1) -#else -#define RSI_BLE_MAX_NBR_SLAVES (1) -#endif - -#define RSI_BLE_NUM_CONN_EVENTS (2) -#else -#define RSI_BLE_MAX_NBR_ATT_REC (80) +#define RSI_BLE_TX_OCTETS 251 +#define RSI_BLE_TX_TIME 2120 +#define RSI_BLE_MATTER_CUSTOM_SERVICE_DATA_LENGTH 240 #if (SIWX_917 | EXP_BOARD) +#define CLEAR_ACCEPTLIST (0x00) +#define ADD_DEVICE_TO_ACCEPTLIST (0x01) +#define DELETE_DEVICE_FROM_ACCEPTLIST (0x02) #define RSI_BLE_MAX_NBR_PERIPHERALS (3) -#else +#define RSI_BLE_MAX_NBR_CENTRALS (1) +#define RSI_FEATURE_BIT_MAP \ + (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map +#define RSI_TCP_IP_FEATURE_BIT_MAP \ + (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features +#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map +#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ + (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ + SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0) #define RSI_EXT_TCPIP_FEATURE_BITMAP 0 +#define RSI_BT_FEATURE_BITMAP (SL_SI91X_BT_RF_TYPE | SL_SI91X_ENABLE_BLE_PROTOCOL) +#define RSI_CONFIG_FEATURE_BITMAP 0 +#define RSI_TCP_IP_BYPASS RSI_ENABLE //! TCP IP BYPASS feature check +#else // For RS9116 #define RSI_BLE_MAX_NBR_SLAVES (3) +#define RSI_BLE_MAX_NBR_MASTERS (1) +//! set handshake type of power mode +#define RSI_HAND_SHAKE_TYPE GPIO_BASED #endif - +#define CLEAR_WHITELIST (0x00) +#define ADD_DEVICE_TO_WHITELIST (0x01) +#define DELETE_DEVICE_FROM_WHITELIST (0x02) #define RSI_BLE_NUM_CONN_EVENTS (20) -#endif #define RSI_BLE_MAX_NBR_ATT_SERV (10) -#if (SIWX_917 | EXP_BOARD) -#define RSI_BLE_MAX_NBR_CENTRALS (1) -#define FRONT_END_SWITCH_SEL2 BIT(30) -#else -#define RSI_BLE_MAX_NBR_MASTERS (1) -#endif - #define RSI_BLE_GATT_ASYNC_ENABLE (1) #define RSI_BLE_GATT_INIT (0) @@ -265,38 +257,6 @@ #define BLE_ATT_REC_SIZE (500) #define NO_OF_VAL_ATT (5) //! Attribute value count -#if (SIWX_917 | EXP_BOARD) -#define RSI_FEATURE_BIT_MAP \ - (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map -#define RSI_TCP_IP_FEATURE_BIT_MAP \ - (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features -#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map -#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION // Adding Support for WPA3 transition -#ifdef CHIP_9117 -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ - SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0 | SL_SI91X_EXT_FEAT_IEEE_80211W) -#else -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2)) -#endif /* CHIP_9117 */ -#else -#ifdef CHIP_9117 -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ - SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0) -#else -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2)) -#endif /* CHIP_9117 */ -#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ -#define RSI_EXT_TCPIP_FEATURE_BITMAP 0 -#define RSI_BT_FEATURE_BITMAP (SL_SI91X_BT_RF_TYPE | SL_SI91X_ENABLE_BLE_PROTOCOL) -#define RSI_CONFIG_FEATURE_BITMAP 0 -#define RSI_TCP_IP_BYPASS RSI_ENABLE //! TCP IP BYPASS feature check -#else -//! set handshake type of power mode -#define RSI_HAND_SHAKE_TYPE GPIO_BASED -#endif - /***********************************************************************************************************************************************/ //! user defined structure /***********************************************************************************************************************************************/ diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c index b0e1e2378ef341..ef44d380d90740 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.c +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.c @@ -349,10 +349,10 @@ void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_t uint32_t rsi_ble_add_matter_service(void) { - uuid_t custom_service = { RSI_BLE_MATTER_CUSTOM_SERVICE_UUID }; - custom_service.size = RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE; - custom_service.val.val16 = RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16; - uint8_t data[RSI_BLE_CS_DATA_LENGTH] = { RSI_BLE_MATTER_CUSTOM_SERVICE_DATA }; + uuid_t custom_service = { RSI_BLE_MATTER_CUSTOM_SERVICE_UUID }; + custom_service.size = RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE; + custom_service.val.val16 = RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16; + uint8_t data[RSI_BLE_MATTER_CUSTOM_SERVICE_DATA_LENGTH] = { RSI_BLE_MATTER_CUSTOM_SERVICE_DATA }; static const uuid_t custom_characteristic_RX = { .size = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE, .reserved = { RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED },