diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 4ec1c04a927404..88dcdef98ebd06 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -36,8 +36,8 @@ chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 2100000 # 35 minutes Idle Intervals -sl_ot_active_interval_ms = 1000 # 1000ms Active Intervals +sl_transport_idle_interval_ms = 2100000 # 35 minutes Idle Intervals +sl_transport_active_interval_ms = 1000 # 1000ms Active Intervals # ICD Matter Configuration flags sl_idle_mode_duration_s = 1800 # 30min Idle Mode Duration diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index c09176354a3d76..9f38cd9136ba5f 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -37,8 +37,8 @@ chip_enable_icd_lit = true chip_enable_icd_dsls = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval -sl_ot_active_interval_ms = 1000 # 1000ms Active Polling Interval +sl_transport_idle_interval_ms = 3600000 # 60mins Idle Polling Interval +sl_transport_active_interval_ms = 1000 # 1000ms Active Polling Interval # ICD Matter Configuration flags sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index 46359c13e89276..f9b6888d597afd 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -33,8 +33,8 @@ chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals -sl_ot_active_interval_ms = 500 # 500ms Active Intervals +sl_transport_idle_interval_ms = 5000 # 5s Idle Intervals +sl_transport_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration diff --git a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h index ed56c7a5785d8a..c0c79c95ac40f2 100644 --- a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h +++ b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h @@ -40,7 +40,7 @@ #define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0 // In seconds -#define SL_MLE_TIMEOUT_s (SL_OT_IDLE_INTERVAL / 1000) +#define SL_MLE_TIMEOUT_s (SL_TRANSPORT_IDLE_INTERVAL / 1000) // Timeout after 2 missed checkin or 4 mins if sleep interval is too short. #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1)) diff --git a/examples/platform/silabs/uart.cpp b/examples/platform/silabs/uart.cpp index c460554c6afc57..809c4e53e05b7a 100644 --- a/examples/platform/silabs/uart.cpp +++ b/examples/platform/silabs/uart.cpp @@ -53,7 +53,7 @@ extern "C" { #endif #include "sl_uartdrv_instances.h" #if SL_WIFI -#include "spi_multiplex.h" +#include #endif // SL_WIFI #ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT #include "sl_uartdrv_eusart_vcom_config.h" diff --git a/examples/refrigerator-app/silabs/src/RefrigeratorUI.cpp b/examples/refrigerator-app/silabs/src/RefrigeratorUI.cpp index 655c803f218dc2..f1b7d7698d08fe 100644 --- a/examples/refrigerator-app/silabs/src/RefrigeratorUI.cpp +++ b/examples/refrigerator-app/silabs/src/RefrigeratorUI.cpp @@ -26,10 +26,10 @@ #include "lcd.h" #include -#if SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) // Only needed for wifi NCP devices -#include "spi_multiplex.h" -#endif // SL_WIFI +#if SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) +#include +#endif // SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) // LCD line define constexpr uint8_t kTempLcdInitialX = 30; diff --git a/examples/smoke-co-alarm-app/silabs/openthread.gni b/examples/smoke-co-alarm-app/silabs/openthread.gni index f2a7ab6ed78434..a9b6527c41c351 100644 --- a/examples/smoke-co-alarm-app/silabs/openthread.gni +++ b/examples/smoke-co-alarm-app/silabs/openthread.gni @@ -36,8 +36,8 @@ chip_icd_report_on_active_mode = true chip_enable_icd_lit = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval -sl_ot_active_interval_ms = 1000 # 1000ms Active Polling Interval +sl_transport_idle_interval_ms = 3600000 # 60mins Idle Polling Interval +sl_transport_active_interval_ms = 1000 # 1000ms Active Polling Interval # ICD Matter Configuration flags sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration diff --git a/examples/thermostat/silabs/src/ThermostatUI.cpp b/examples/thermostat/silabs/src/ThermostatUI.cpp index f82ee36387e99a..4ac0263a0c4eb6 100644 --- a/examples/thermostat/silabs/src/ThermostatUI.cpp +++ b/examples/thermostat/silabs/src/ThermostatUI.cpp @@ -25,10 +25,10 @@ #include "glib.h" #include "lcd.h" -#if SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) // Only needed for wifi NCP devices -#include "spi_multiplex.h" -#endif // SL_WIFI +#if SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) +#include +#endif // SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) // LCD line define constexpr uint8_t kTempLcdInitialX = 30; diff --git a/examples/window-app/silabs/openthread.gni b/examples/window-app/silabs/openthread.gni index 47c5860c9fb10d..0736dc61e4a64b 100644 --- a/examples/window-app/silabs/openthread.gni +++ b/examples/window-app/silabs/openthread.gni @@ -33,8 +33,8 @@ chip_subscription_timeout_resumption = false sl_use_subscription_syncing = true # Openthread Configuration flags -sl_ot_idle_interval_ms = 1000 # 1s Idle Intervals -sl_ot_active_interval_ms = 500 # 500ms Active Intervals +sl_transport_idle_interval_ms = 1000 # 1s Idle Intervals +sl_transport_active_interval_ms = 500 # 500ms Active Intervals # ICD Matter Configuration flags sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index 7e86c64694de5b..387c9c934b2f39 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -169,10 +169,10 @@ #if SL_ICD_ENABLED #ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL -#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_IDLE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_TRANSPORT_IDLE_INTERVAL) #endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL #ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL -#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_ACTIVE_INTERVAL) +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_TRANSPORT_ACTIVE_INTERVAL) #endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL #endif // SL_ICD_ENABLED diff --git a/src/platform/silabs/SiWx917/SiWxPlatformInterface.h b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h index 8589db3b3f4484..1b654332f11c72 100644 --- a/src/platform/silabs/SiWx917/SiWxPlatformInterface.h +++ b/src/platform/silabs/SiWx917/SiWxPlatformInterface.h @@ -19,6 +19,12 @@ #include +namespace { +#ifdef ENABLE_CHIP_SHELL +bool ps_requirement_added = false; +#endif // ENABLE_CHIP_SHELL +} // namespace + #ifdef __cplusplus extern "C" { #endif @@ -27,6 +33,7 @@ extern "C" { #include "sl_si91x_button.h" #include "sl_si91x_button_pin_config.h" #include "sl_si91x_driver_gpio.h" +#include "sl_si91x_power_manager.h" /** * @brief invoked when button press event is received when in sleep diff --git a/src/platform/silabs/multi-ota/OTACustomProcessor.cpp b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp index 6b87638adb9639..852866e94e03cc 100644 --- a/src/platform/silabs/multi-ota/OTACustomProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTACustomProcessor.cpp @@ -22,12 +22,13 @@ #include +#if SL_WIFI +#include +#endif // SL_WIFI + extern "C" { #include "btl_interface.h" #include "sl_core.h" -#if SL_WIFI -#include "spi_multiplex.h" -#endif // SL_WIFI } /// No error, operation OK diff --git a/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp index 07dc974dd7b54d..2f1277a311fdca 100644 --- a/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp +++ b/src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp @@ -22,12 +22,13 @@ #include +#if SL_WIFI +#include +#endif // SL_WIFI + extern "C" { #include "btl_interface.h" #include "sl_core.h" -#if SL_WIFI -#include "spi_multiplex.h" -#endif // SL_WIFI } /// No error, operation OK diff --git a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp index 42a9788c2868eb..85859f29fafde6 100644 --- a/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp +++ b/src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp @@ -30,12 +30,13 @@ using namespace ::chip::DeviceLayer::Internal; static chip::OTAMultiImageProcessorImpl gImageProcessor; +#if SL_WIFI +#include +#endif // SL_WIFI + extern "C" { #include "btl_interface.h" #include "sl_core.h" -#if SL_WIFI -#include "spi_multiplex.h" -#endif // SL_WIFI } namespace chip { diff --git a/src/platform/silabs/wifi/BUILD.gn b/src/platform/silabs/wifi/BUILD.gn index 882a66deb4fa9f..db58633599a9e3 100644 --- a/src/platform/silabs/wifi/BUILD.gn +++ b/src/platform/silabs/wifi/BUILD.gn @@ -31,6 +31,9 @@ declare_args() { #default Wifi Password chip_default_wifi_psk = "" + + # Argument to enable LwIP debug logs + sl_enable_wifi_debug = false } if (chip_enable_wifi && !wifi_soc) { @@ -51,6 +54,12 @@ config("wifi-platform-config") { defines = [] include_dirs = [] + if (sl_enable_wifi_debug) { + defines += [ "WIFI_DEBUG_ENABLED=1" ] + } else { + defines += [ "WIFI_DEBUG_ENABLED=0" ] + } + if (use_rs9116) { # All the stuff from wiseconnect include_dirs += rs911x_inc_plat @@ -65,6 +74,7 @@ config("wifi-platform-config") { "SL_WIFI_SSID=\"${chip_default_wifi_ssid}\"", ] } + if (chip_default_wifi_psk != "") { assert(chip_default_wifi_ssid != "", "ssid can't be null if psk is provided") @@ -120,8 +130,6 @@ source_set("wifi-platform") { # All the stuff from wiseconnect sources += rs9117_src_sapi - - #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk } else if (use_wf200) { sources += wf200_plat_src } @@ -142,6 +150,7 @@ source_set("wifi-platform") { if (use_wf200 || use_rs9116) { sources += [ "${silabs_platform_dir}/wifi/lwip-support/dhcp_client.cpp", + "${silabs_platform_dir}/wifi/lwip-support/dhcp_client.h", "${silabs_platform_dir}/wifi/lwip-support/ethernetif.cpp", "${silabs_platform_dir}/wifi/lwip-support/ethernetif.h", "${silabs_platform_dir}/wifi/lwip-support/lwip_netif.cpp", diff --git a/src/platform/silabs/wifi/SiWx/WifiInterface.cpp b/src/platform/silabs/wifi/SiWx/WifiInterface.cpp index 0b4135a50a7fd1..514af648af07b3 100644 --- a/src/platform/silabs/wifi/SiWx/WifiInterface.cpp +++ b/src/platform/silabs/wifi/SiWx/WifiInterface.cpp @@ -93,9 +93,6 @@ namespace { #if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE // TODO: should be removed once we are getting the press interrupt for button 0 with sleep bool btn0_pressed = false; -#ifdef ENABLE_CHIP_SHELL -bool ps_requirement_added = false; -#endif // ENABLE_CHIP_SHELL #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE bool hasNotifiedWifiConnectivity = false; @@ -550,37 +547,6 @@ int32_t sl_wifi_platform_disconnect(void) return sl_net_down((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE); } -/****************************************************************** - * @fn wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) - * @brief - * Setting the RS911x in DTIM sleep based mode - * - * @param[in] sl_si91x_ble_state : State to set for the BLE - * @param[in] sl_si91x_wifi_state : State to set for the WiFi - * @return - * None - *********************************************************************/ -int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) -{ - int32_t status; - - status = rsi_bt_power_save_profile(sl_si91x_ble_state, 0); - if (status != RSI_SUCCESS) - { - ChipLogError(DeviceLayer, "rsi_bt_power_save_profile failed: 0x%lx", static_cast(status)); - return status; - } - sl_wifi_performance_profile_t wifi_profile = { .profile = sl_si91x_wifi_state }; - status = sl_wifi_set_performance_profile(&wifi_profile); - if (status != RSI_SUCCESS) - { - ChipLogError(DeviceLayer, "sl_wifi_set_performance_profile failed: 0x%lx", static_cast(status)); - return status; - } - - return status; -} - sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) { SL_WIFI_ARGS_CHECK_NULL_POINTER(scan_result); @@ -897,9 +863,23 @@ void wfx_dhcp_got_ipv4(uint32_t ip) * @return SL_STATUS_OK if successful, * SL_STATUS_FAIL otherwise ***********************************************************************/ -sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, - sl_si91x_performance_profile_t sl_si91x_wifi_state) // TODO : Figure out why the extern C is necessary +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) { - return (wfx_rsi_power_save(sl_si91x_ble_state, sl_si91x_wifi_state) ? SL_STATUS_FAIL : SL_STATUS_OK); + int32_t error = rsi_bt_power_save_profile(sl_si91x_ble_state, 0); + if (error != RSI_SUCCESS) + { + ChipLogError(DeviceLayer, "rsi_bt_power_save_profile failed: %ld", error); + return SL_STATUS_FAIL; + } + + sl_wifi_performance_profile_t wifi_profile = { .profile = sl_si91x_wifi_state }; + sl_status_t status = sl_wifi_set_performance_profile(&wifi_profile); + if (status != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "sl_wifi_set_performance_profile failed: 0x%lx", static_cast(status)); + return status; + } + + return SL_STATUS_OK; } #endif diff --git a/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp b/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp index 430b9bbddb7d38..698c839a10e43a 100644 --- a/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp +++ b/src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp @@ -41,7 +41,6 @@ namespace { constexpr uint8_t kWlanMinRetryIntervalsInSec = 1; constexpr uint8_t kWlanMaxRetryIntervalsInSec = 60; -constexpr uint8_t kWlanRetryIntervalInSec = 5; uint8_t retryInterval = kWlanMinRetryIntervalsInSec; osTimerId_t sRetryTimer; @@ -52,7 +51,7 @@ osTimerId_t sRetryTimer; void RetryConnectionTimerHandler(void * arg) { #if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE - wfx_rsi_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); + wfx_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE if (wfx_connect_to_ap() != SL_STATUS_OK) { @@ -178,54 +177,23 @@ void wfx_ip_changed_notify(int got_ip) *************************************************************************************/ void wfx_retry_connection(uint16_t retryAttempt) { - // During commissioning, we retry to join the network MAX_JOIN_RETRIES_COUNT - if (/*BaseApplication::sAppDelegate.isCommissioningInProgress()*/ true) + if (retryInterval > kWlanMaxRetryIntervalsInSec) { - if (retryAttempt < MAX_JOIN_RETRIES_COUNT) - { - ChipLogProgress(DeviceLayer, "wfx_retry_connection : Next attempt after %d Seconds", kWlanRetryIntervalInSec); - if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(CONVERT_SEC_TO_MS(kWlanRetryIntervalInSec))) != osOK) - { - ChipLogProgress(DeviceLayer, "Failed to start retry timer"); - // Sending the join command if retry timer failed to start - if (wfx_connect_to_ap() != SL_STATUS_OK) - { - ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); - } - return; - } - } - else - { - ChipLogProgress(DeviceLayer, "Connect failed after max %d tries", retryAttempt); - } + retryInterval = kWlanMaxRetryIntervalsInSec; } - else + if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(CONVERT_SEC_TO_MS(retryInterval))) != osOK) { - /* After disconnection or power cycle the DUT - * At the telescopic time interval device try to reconnect with AP, upto WLAN_MAX_RETRY_TIMER_MS intervals - * are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at - * WLAN_MAX_RETRY_TIMER_MS intervals. - */ - if (retryInterval > kWlanMaxRetryIntervalsInSec) - { - retryInterval = kWlanMaxRetryIntervalsInSec; - } - if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(CONVERT_SEC_TO_MS(retryInterval))) != osOK) + ChipLogProgress(DeviceLayer, "Failed to start retry timer"); + // Sending the join command if retry timer failed to start + if (wfx_connect_to_ap() != SL_STATUS_OK) { - ChipLogProgress(DeviceLayer, "Failed to start retry timer"); - // Sending the join command if retry timer failed to start - if (wfx_connect_to_ap() != SL_STATUS_OK) - { - ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); - } - return; + ChipLogError(DeviceLayer, "wfx_connect_to_ap() failed."); } -#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE - wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE - ChipLogProgress(DeviceLayer, "wfx_retry_connection : Next attempt after %d Seconds", retryInterval); - retryInterval += retryInterval; return; } +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + wfx_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE + ChipLogProgress(DeviceLayer, "wfx_retry_connection : Next attempt after %d Seconds", retryInterval); + retryInterval += retryInterval; } diff --git a/src/platform/silabs/wifi/WifiInterfaceAbstraction.h b/src/platform/silabs/wifi/WifiInterfaceAbstraction.h index f6364d040e5189..012683aef60333 100644 --- a/src/platform/silabs/wifi/WifiInterfaceAbstraction.h +++ b/src/platform/silabs/wifi/WifiInterfaceAbstraction.h @@ -63,11 +63,6 @@ #define GET_IPV6_FAIL (0) #define IP_STATUS_SUCCESS (1) -#define SL_WFX_STARTUP_IND_ID (1) -#define SL_WFX_CONNECT_IND_ID (2) -#define SL_WFX_DISCONNECT_IND_ID (3) -#define SL_WFX_SCAN_COMPLETE_ID (4) - // TASK and Interrupt Macros #define SUCCESS_STATUS (1) @@ -275,14 +270,6 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); int32_t sl_wifi_platform_disconnect(); -#if CHIP_CONFIG_ENABLE_ICD_SERVER -#if SLI_SI917 -int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); -#else -int32_t wfx_rsi_power_save(); -#endif /* SLI_SI917 */ -#endif /* SL_ICD_ENABLED */ - /** * @brief Posts an event to the Wi-Fi task * @@ -304,7 +291,6 @@ void sl_button_on_change(uint8_t btn, uint8_t btnAction); #ifdef WF200_WIFI void sl_wfx_host_gpio_init(void); void wfx_bus_start(void); -sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); #endif /* WF200_WIFI */ #ifdef __cplusplus diff --git a/src/platform/silabs/wifi/lwip-support/ethernetif.cpp b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp index 7e880f62e9a36b..c37d6ab93337e8 100644 --- a/src/platform/silabs/wifi/lwip-support/ethernetif.cpp +++ b/src/platform/silabs/wifi/lwip-support/ethernetif.cpp @@ -140,7 +140,7 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) if (!(ip6_addr_ispreferred(netif_ip6_addr_state(netif, 0))) && (memcmp(netif->hwaddr, src_mac, netif->hwaddr_len) == 0) && (memcmp(netif->hwaddr, dst_mac, netif->hwaddr_len) != 0)) { -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "lwip_input: DROP, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", @@ -163,7 +163,7 @@ static void low_level_input(struct netif * netif, uint8_t * b, uint16_t len) memcpy((uint8_t *) q->payload, (uint8_t *) b + bufferoffset, q->len); bufferoffset += q->len; } -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "lwip_input: ACCEPT %ld, [%02x:%02x:%02x:%02x:%02x:%02x]<-[%02x:%02x:%02x:%02x:%02x:%02x] type=%02x%02x", bufferoffset, @@ -255,7 +255,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) int i = 0; result = SL_STATUS_FAIL; -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "WF200: Out %d", (int) framelength); #endif @@ -302,7 +302,7 @@ void sl_wfx_host_received_frame_callback(sl_wfx_received_ind_t * rx_buffer) len = rx_buffer->body.frame_length; buffer = (uint8_t *) &(rx_buffer->body.frame[rx_buffer->body.frame_padding]); -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "WF200: In %d", (int) len); #endif @@ -310,14 +310,14 @@ void sl_wfx_host_received_frame_callback(sl_wfx_received_ind_t * rx_buffer) } else { -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "WF200: NO-INTF"); #endif } } else { -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "WF200: Invalid frame IN"); #endif } @@ -354,7 +354,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) struct pbuf * q; uint16_t framelength = 0; uint16_t datalength = 0; -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "LWIP : low_level_output"); #endif if (xSemaphoreTake(ethout_sem, portMAX_DELAY) != pdTRUE) @@ -370,7 +370,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) { framelength = LWIP_FRAME_ALIGNMENT; } -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "EN-RSI: Output"); #endif if ((netif->flags & (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) != (NETIF_FLAG_LINK_UP | NETIF_FLAG_UP)) @@ -387,7 +387,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_IF; } -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED uint8_t * b = (uint8_t *) p->payload; ChipLogProgress(DeviceLayer, "EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13]); @@ -403,7 +403,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* Add junk data to the end for frame alignment if framelength is less than 60 */ wfx_rsi_pkt_add_data(packet, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - datalength, datalength); } -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "EN-RSI: Sending %d", framelength); #endif @@ -417,7 +417,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_IF; } -#ifdef WIFI_DEBUG_ENABLED +#if WIFI_DEBUG_ENABLED ChipLogProgress(DeviceLayer, "EN-RSI:Xmit %d", framelength); #endif xSemaphoreGive(ethout_sem); diff --git a/src/platform/silabs/wifi/rs911x/WifiInterface.cpp b/src/platform/silabs/wifi/rs911x/WifiInterface.cpp index c918b3af362196..8b811534ca3e20 100644 --- a/src/platform/silabs/wifi/rs911x/WifiInterface.cpp +++ b/src/platform/silabs/wifi/rs911x/WifiInterface.cpp @@ -234,39 +234,6 @@ int32_t sl_wifi_platform_disconnect(void) return rsi_wlan_disconnect(); } -#if SL_ICD_ENABLED -/****************************************************************** - * @fn wfx_rsi_power_save(void) - * @brief - * Setting the RS911x in DTIM sleep based mode - * - * @param[in] None - * @return - * None - *********************************************************************/ -int32_t wfx_rsi_power_save(void) -{ - int32_t status; -#ifdef RSI_BLE_ENABLE - status = rsi_bt_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP); - if (status != RSI_SUCCESS) - { - ChipLogError(DeviceLayer, "BT Powersave Config Failed, Error Code : 0x%lX", status); - return status; - } -#endif /* RSI_BLE_ENABLE */ - - status = rsi_wlan_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP); - if (status != RSI_SUCCESS) - { - ChipLogError(DeviceLayer, "Powersave Config Failed, Error Code : 0x%lX", status); - return status; - } - ChipLogDetail(DeviceLayer, "Powersave Config Success"); - return status; -} -#endif /* SL_ICD_ENABLED */ - /****************************************************************** * @fn wfx_rsi_join_cb(uint16_t status, const uint8_t *buf, const uint16_t len) * @brief @@ -964,8 +931,26 @@ int32_t wfx_rsi_send_data(void * p, uint16_t len) * @return SL_STATUS_OK if successful, * SL_STATUS_FAIL otherwise ***********************************************************************/ -sl_status_t wfx_power_save(void) // TODO : Figure out why the extern C is necessary +sl_status_t wfx_power_save(void) { - return (wfx_rsi_power_save() ? SL_STATUS_FAIL : SL_STATUS_OK); + int32_t status; +#ifdef RSI_BLE_ENABLE + status = rsi_bt_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP); + if (status != RSI_SUCCESS) + { + ChipLogError(DeviceLayer, "BT Powersave Config Failed, Error Code : 0x%lX", status); + return SL_STATUS_FAIL; + } +#endif /* RSI_BLE_ENABLE */ + + status = rsi_wlan_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP); + if (status != RSI_SUCCESS) + { + ChipLogError(DeviceLayer, "Powersave Config Failed, Error Code : 0x%lX", status); + return SL_STATUS_FAIL; + } + + ChipLogDetail(DeviceLayer, "Powersave Config Success"); + return SL_STATUS_OK; } #endif /* SL_ICD_ENABLED */ diff --git a/src/platform/silabs/wifi/wf200/WifiInterface.cpp b/src/platform/silabs/wifi/wf200/WifiInterface.cpp index fef3cb3a63a022..ebeaa2d4a42ec1 100644 --- a/src/platform/silabs/wifi/wf200/WifiInterface.cpp +++ b/src/platform/silabs/wifi/wf200/WifiInterface.cpp @@ -26,6 +26,7 @@ #include "sl_wfx_cmd_api.h" #include "sl_wfx_constants.h" #include "task.h" +#include #include #include #include @@ -224,16 +225,6 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s sl_wfx_get_counters_cnf_t * counters; -/**************************************************************************** - * @brief - * get the wifi state - * @return returns wificonetext state - *****************************************************************************/ -sl_wfx_state_t wfx_get_wifi_state(void) -{ - return wifiContext.state; -} - sl_status_t get_all_counters(void) { sl_status_t result; @@ -328,7 +319,7 @@ static void wfx_events_task_start(void) * @returns Returns SL_STATUS_OK if successful, *SL_STATUS_FAIL otherwise *****************************************************************************/ -sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload) +extern "C" sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload) { switch (event_payload->header.id) { @@ -739,14 +730,14 @@ static void wfx_events_task(void * p_arg) retryJoin = 0; wfx_lwip_set_sta_link_up(); #if CHIP_CONFIG_ENABLE_ICD_SERVER - if (!(wfx_get_wifi_state() & SL_WFX_AP_INTERFACE_UP)) + if (!(wifiContext.state & SL_WFX_AP_INTERFACE_UP)) { // Enable the power save ChipLogProgress(DeviceLayer, "WF200 going to DTIM based sleep"); sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1, 0 /*timeout*/); sl_wfx_enable_device_power_save(); } -#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER } if (flags & SL_WFX_DISCONNECT) diff --git a/src/platform/silabs/wifi/wf200/platform/efr_spi.c b/src/platform/silabs/wifi/wf200/platform/efr_spi.c index 6f80fc83d90984..434253f855dfbf 100644 --- a/src/platform/silabs/wifi/wf200/platform/efr_spi.c +++ b/src/platform/silabs/wifi/wf200/platform/efr_spi.c @@ -437,8 +437,6 @@ sl_status_t sl_wfx_host_post_lcd_spi_transfer(void) #endif // SL_SPICTRL_MUX return SL_STATUS_OK; } -#else -#error still not working #endif // SL_LCDCTRL_MUX #if SL_UARTCTRL_MUX diff --git a/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h b/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h index dc9bcd28524623..d33b5fb6801264 100644 --- a/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h +++ b/src/platform/silabs/wifi/wf200/platform/sl_wfx_host.h @@ -15,6 +15,8 @@ * limitations under the License. */ +// TODO: Should use the file from simplicity sdk + #pragma once #include "FreeRTOS.h" @@ -26,6 +28,7 @@ #ifdef __cplusplus extern "C" { #endif +sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); uint8_t sl_wfx_host_get_waited_event(void); sl_status_t wfx_soft_init(void); diff --git a/src/platform/silabs/wifi/wf200/platform/wf200_init.c b/src/platform/silabs/wifi/wf200/platform/wf200_init.c index 40f1aaf08af6bb..92663f9b059e4a 100644 --- a/src/platform/silabs/wifi/wf200/platform/wf200_init.c +++ b/src/platform/silabs/wifi/wf200/platform/wf200_init.c @@ -319,6 +319,7 @@ sl_status_t sl_wfx_host_reset_chip(void) *****************************************************************************/ sl_status_t sl_wfx_host_wait_for_wake_up(void) { + xSemaphoreTake(wfx_wakeup_sem, pdMS_TO_TICKS(0)); xSemaphoreTake(wfx_wakeup_sem, pdMS_TO_TICKS(3)); return SL_STATUS_OK; diff --git a/src/platform/silabs/wifi/wf200/wf200.gni b/src/platform/silabs/wifi/wf200/wf200.gni index 437f9def5d47bb..c8e1308f5fb31a 100644 --- a/src/platform/silabs/wifi/wf200/wf200.gni +++ b/src/platform/silabs/wifi/wf200/wf200.gni @@ -26,5 +26,4 @@ wf200_plat_src = [ "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_task.h", "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_custom_board.h", "${chip_root}/src/platform/silabs/wifi/wf200/platform/spi_multiplex.h", - "${chip_root}/src/platform/silabs/wifi/wf200/platform/sl_wfx_board.h", ] diff --git a/src/platform/silabs/wifi/wfx_msgs.h b/src/platform/silabs/wifi/wfx_msgs.h index af167a1f2c2f95..ec1744c998611b 100644 --- a/src/platform/silabs/wifi/wfx_msgs.h +++ b/src/platform/silabs/wifi/wfx_msgs.h @@ -26,6 +26,15 @@ #include "sl_wfx_api.h" #include "sl_wfx_constants.h" #else + +// These names exists in the Si SDK as typedef enum. If they are present in the WF200 builds, we end up with conflicting +// definitions but no erros because one is a define the other is a typedef enum. This causes different files to use different +// values. +#define SL_WFX_STARTUP_IND_ID (1) +#define SL_WFX_CONNECT_IND_ID (2) +#define SL_WFX_DISCONNECT_IND_ID (3) +#define SL_WFX_SCAN_COMPLETE_ID (4) + typedef struct { uint8_t octet[6]; ///< Table to store a MAC address diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 9ca85baa47bf5b..40296046cc8bad 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -53,8 +53,8 @@ declare_args() { sl_matter_ble_extended_adv = false # ICD Openthread Configuration flags - sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals - sl_ot_active_interval_ms = 200 # 200ms Active Intervals + sl_transport_idle_interval_ms = 15000 # 15s Idle Intervals + sl_transport_active_interval_ms = 200 # 200ms Active Intervals # SSED Specific configurations sl_ot_csl_timeout_sec = 30 # 30s CSL timeout @@ -630,15 +630,12 @@ template("efr32_sdk") { "SL_ACTIVE_MODE_DURATION_MS=${sl_active_mode_duration_ms}", "SL_IDLE_MODE_DURATION_S=${sl_idle_mode_duration_s}", "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", + "SL_TRANSPORT_IDLE_INTERVAL=${sl_transport_idle_interval_ms}", + "SL_TRANSPORT_ACTIVE_INTERVAL=${sl_transport_active_interval_ms}", ] if (defined(invoker.chip_enable_openthread) && invoker.chip_enable_openthread) { - defines += [ - "SL_OT_IDLE_INTERVAL=${sl_ot_idle_interval_ms}", - "SL_OT_ACTIVE_INTERVAL=${sl_ot_active_interval_ms}", - ] - if (enable_synchronized_sed) { defines += [ "CHIP_DEVICE_CONFIG_THREAD_SSED=1", @@ -646,18 +643,6 @@ template("efr32_sdk") { ] } } - - if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { - defines += [ - # Used for wifi devices to get packet details - # TODO: Remove this flag, once the communication is fixed - "WIFI_DEBUG_ENABLED=1", - ] - - # This is kept due to the warning on the LWIP when on demand timer is added - # TODO: remove this flag once the warning is fixed in SiSDK MATTER-3946 - cflags_c = [ "-Wno-implicit-function-declaration" ] - } } if (chip_build_libshell) { # matter shell @@ -1025,7 +1010,6 @@ template("efr32_sdk") { sources += [ "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus/sl_wfx_bus.c", "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/bus/sl_wfx_bus_spi.c", - "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/secure_link/sl_wfx_secure_link.c", "${efr32_sdk_root}/platform/radio/wifi/wfx_fmac_driver/sl_wfx.c", ] }