diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 0782e29eb4f4fa..360856f31e6096 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -142,6 +142,8 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void) #if CHIP_CONFIG_ENABLE_ICD_SERVER #if CHIP_DEVICE_CONFIG_THREAD_SSED ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice)); +#elif CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_EnhancedCslSleepyEndDevice)); #else ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice)); #endif diff --git a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h index d7492f4044f3fa..801bf00d1046d1 100644 --- a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h +++ b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h @@ -45,6 +45,16 @@ // 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)) +#if defined(SL_ECSL_ENABLE) && SL_ECSL_ENABLE + +#define OPENTHREAD_CONFIG_MAC_CSL_PERIPHERAL_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE 1 +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 +#define OPENTHREAD_CONFIG_CSL_TIMEOUT SL_CSL_TIMEOUT + +#endif // SL_ECSL_ENABLE + #if defined(SL_CSL_ENABLE) && SL_CSL_ENABLE #define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index 424abc833af55e..6584f98d06f7d9 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -91,6 +91,10 @@ if [ "$#" == "0" ]; then Enable Synchronized Sleepy end device. (Default false) Must also set chip_enable_icd_server=true chip_openthread_ftd=false --icd can be used to configure both arguments + enable_ecsl_mobile_sed + Enable Enhanced CSL Sleepy end device for Thread in Mobile. (Default false) + Must also set chip_enable_icd_server=true chip_openthread_ftd=false + --icd can be used to configure both arguments use_rs9116 Build wifi example with extension board rs9116. (Default false) use_SiWx917 diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 785b47656dd5a3..230505d27c9137 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -965,6 +965,17 @@ static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN <= CHIP_DEVICE #define CHIP_DEVICE_CONFIG_THREAD_SSED 0 #endif +/** + * CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + * + * Enable support for Thread Enhanced CSL Sleepy End Device behavior. + * (For Thread in Mobile) + * + */ +#ifndef CHIP_DEVICE_CONFIG_THREAD_ECSL_SED +#define CHIP_DEVICE_CONFIG_THREAD_ECSL_SED 0 +#endif + /** * CHIP_DEVICE_CONFIG_THREAD_BORDER_ROUTER * diff --git a/src/include/platform/ConnectivityManager.h b/src/include/platform/ConnectivityManager.h index ed881f78cc2c3c..6203272a972a54 100644 --- a/src/include/platform/ConnectivityManager.h +++ b/src/include/platform/ConnectivityManager.h @@ -143,6 +143,7 @@ class ConnectivityManager kThreadDeviceType_MinimalEndDevice = 3, kThreadDeviceType_SleepyEndDevice = 4, kThreadDeviceType_SynchronizedSleepyEndDevice = 5, + kThreadDeviceType_EnhancedCslSleepyEndDevice = 6, }; enum BLEAdvertisingMode diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp index 0a961a9f8e4afa..529c18c63860c5 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp @@ -266,6 +266,8 @@ ThreadCapabilities GenericThreadDriver::GetSupportedThreadFeatures() capabilites.SetField(ThreadCapabilities::kIsFullThreadDevice, CHIP_DEVICE_CONFIG_THREAD_FTD); capabilites.SetField(ThreadCapabilities::kIsSynchronizedSleepyEndDeviceCapable, (!CHIP_DEVICE_CONFIG_THREAD_FTD && CHIP_DEVICE_CONFIG_THREAD_SSED)); + capabilites.SetField(ThreadCapabilities::kIsEnhancedCslSleepyEndDeviceCapable, + (!CHIP_DEVICE_CONFIG_THREAD_FTD && CHIP_DEVICE_CONFIG_THREAD_ECSL_SED)); return capabilites; } diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 707e1f710743ec..b997ab8b6ff501 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -521,6 +521,11 @@ ConnectivityManager::ThreadDeviceType GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec case ConnectivityManager::kThreadDeviceType_SleepyEndDevice: #if CHIP_DEVICE_CONFIG_THREAD_SSED case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice: +#endif +#if CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + case ConnectivityManager::kThreadDeviceType_EnhancedCslSleepyEndDevice: #endif break; default: @@ -574,6 +582,11 @@ GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice: deviceTypeStr = "SYNCHRONIZED SLEEPY END DEVICE"; break; +#endif +#if CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + case ConnectivityManager::kThreadDeviceType_EnhancedCslSleepyEndDevice: + deviceTypeStr = "ENHANCED CSL SLEEPY END DEVICE"; + break; #endif default: deviceTypeStr = "(unknown)"; @@ -1153,6 +1166,9 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetPollingInter // Get CSL period in units of 10 symbols, convert it to microseconds and divide by 1000 to get milliseconds. uint32_t curIntervalMS = otLinkCslGetPeriod(mOTInst) * OT_US_PER_TEN_SYMBOLS / 1000; #endif // OPENTHREAD_API_VERSION +#elif CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + // Get CSL period in units of us and divide by 1000 to get milliseconds. + uint32_t curIntervalMS = otLinkGetCslPeriod(mOTInst) / 1000; #else uint32_t curIntervalMS = otLinkGetPollPeriod(mOTInst); #endif @@ -1169,6 +1185,10 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetPollingInter otErr = otLinkCslSetPeriod(mOTInst, pollingInterval.count() * 1000 / OT_US_PER_TEN_SYMBOLS); curIntervalMS = otLinkCslGetPeriod(mOTInst) * OT_US_PER_TEN_SYMBOLS / 1000; #endif // OPENTHREAD_API_VERSION +#elif CHIP_DEVICE_CONFIG_THREAD_ECSL_SED + // Set CSL period in units of us and divide by 1000 to get milliseconds. + otErr = otLinkSetCslPeriod(mOTInst, pollingInterval.count() * 1000); + curIntervalMS = otLinkGetCslPeriod(mOTInst) / 1000; #else otErr = otLinkSetPollPeriod(mOTInst, pollingInterval.count()); curIntervalMS = otLinkGetPollPeriod(mOTInst); diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 2e7a88018195aa..2108f40f8d6492 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -56,6 +56,9 @@ declare_args() { # SSED Specific configurations sl_ot_csl_timeout_sec = 30 # 30s CSL timeout + # eCSL-SED Specific configurations + sl_ot_ecsl_timeout_sec = 20 # 20s CSL timeout + # ICD Matter Configuration flags sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration sl_active_mode_duration_ms = 1000 # 1s Active Mode Duration @@ -68,6 +71,9 @@ declare_args() { # Enable Synchronized Sleepy End Device enable_synchronized_sed = false + # Enable Enhanced CSL Sleepy End Device (Thread in Mobile) + enable_ecsl_mobile_sed = false + # Argument to enable IPv4 for wifi # aligning to match chip_inet_config_enable_ipv4 default configuration chip_enable_wifi_ipv4 = false @@ -461,6 +467,14 @@ template("efr32_sdk") { "SL_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}", ] } + + if (enable_ecsl_mobile_sed) { + defines += [ + "CHIP_DEVICE_CONFIG_THREAD_ECSL_SED=1", + "SL_ECSL_ENABLE=1", + "SL_CSL_TIMEOUT=${sl_ot_ecsl_timeout_sec}", + ] + } } if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 42a54b95ee944f..e9535e8217bc0b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1041,6 +1041,7 @@ enum class ThreadCapabilitiesBitmap : uint16_t kIsSleepyEndDeviceCapable = 0x4, kIsFullThreadDevice = 0x8, kIsSynchronizedSleepyEndDeviceCapable = 0x10, + kIsEnhancedCslSleepyEndDeviceCapable = 0x20, }; // Bitmap for WiFiSecurityBitmap