Skip to content

Commit

Permalink
Merge branch 'master' into patch-21
Browse files Browse the repository at this point in the history
  • Loading branch information
lboue authored Nov 28, 2024
2 parents 75cf8cf + 29c2647 commit 95c438b
Show file tree
Hide file tree
Showing 27 changed files with 132 additions and 209 deletions.
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/lit-icd-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
#endif
#include "sl_uartdrv_instances.h"
#if SL_WIFI
#include "spi_multiplex.h"
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#endif // SL_WIFI
#ifdef SL_CATALOG_UARTDRV_EUSART_PRESENT
#include "sl_uartdrv_eusart_vcom_config.h"
Expand Down
6 changes: 3 additions & 3 deletions examples/refrigerator-app/silabs/src/RefrigeratorUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include "lcd.h"
#include <lib/support/logging/CHIPLogging.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 <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#endif // SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE)

// LCD line define
constexpr uint8_t kTempLcdInitialX = 30;
Expand Down
4 changes: 2 additions & 2 deletions examples/smoke-co-alarm-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/thermostat/silabs/src/ThermostatUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#endif // SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE)

// LCD line define
constexpr uint8_t kTempLcdInitialX = 30;
Expand Down
4 changes: 2 additions & 2 deletions examples/window-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/platform/silabs/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions src/platform/silabs/SiWx917/SiWxPlatformInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

#include <app/icd/server/ICDServerConfig.h>

namespace {
#ifdef ENABLE_CHIP_SHELL
bool ps_requirement_added = false;
#endif // ENABLE_CHIP_SHELL
} // namespace

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/platform/silabs/multi-ota/OTACustomProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@

#include <app/clusters/ota-requestor/OTARequestorInterface.h>

#if SL_WIFI
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#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
Expand Down
7 changes: 4 additions & 3 deletions src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@

#include <app/clusters/ota-requestor/OTARequestorInterface.h>

#if SL_WIFI
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#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
Expand Down
7 changes: 4 additions & 3 deletions src/platform/silabs/multi-ota/OTAMultiImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ using namespace ::chip::DeviceLayer::Internal;

static chip::OTAMultiImageProcessorImpl gImageProcessor;

#if SL_WIFI
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#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 {
Expand Down
13 changes: 11 additions & 2 deletions src/platform/silabs/wifi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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
}
Expand All @@ -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",
Expand Down
54 changes: 17 additions & 37 deletions src/platform/silabs/wifi/SiWx/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<uint32_t>(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<uint32_t>(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);
Expand Down Expand Up @@ -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<uint32_t>(status));
return status;
}

return SL_STATUS_OK;
}
#endif
58 changes: 13 additions & 45 deletions src/platform/silabs/wifi/WifiInterfaceAbstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
}
Loading

0 comments on commit 95c438b

Please sign in to comment.