Skip to content

Commit

Permalink
Clean up CSL support
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Feb 1, 2024
1 parent 00b59b0 commit 3590b82
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 65 deletions.
3 changes: 1 addition & 2 deletions examples/light-switch-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ openthread_external_platform =

# ICD Default configurations
chip_enable_icd_server = true
enable_synchronized_sed = true
chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true

# Openthread Configuration flags
sl_ot_idle_interval_ms = 500 # 30s Idle Intervals
sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals
sl_ot_active_interval_ms = 500 # 500ms Active Intervals

# ICD Matter Configuration flags
Expand Down
17 changes: 1 addition & 16 deletions examples/light-switch-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,24 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "BindingHandler.h"

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

#include "LEDWidget.h"

#include "LightSwitchMgr.h"

#ifdef DISPLAY_ENABLED
#include "lcd.h"
#ifdef QR_CODE_ENABLED
#include "qrcodegen.h"
#endif // QR_CODE_ENABLED
#endif // DISPLAY_ENABLED

#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <assert.h>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

/**********************************************************
* Defines and Constants
*********************************************************/
Expand Down Expand Up @@ -128,12 +119,6 @@ void AppTask::AppTaskMain(void * pvParameter)
#endif

SILABS_LOG("App Task started");

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
SILABS_LOG("----------------------------------------------- ADING EM1 requirement ---------------------------------");
sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1);
#endif

while (true)
{
BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY);
Expand Down
3 changes: 1 addition & 2 deletions examples/lock-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ openthread_external_platform =

# ICD Default configurations
chip_enable_icd_server = true
enable_synchronized_sed = true
chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true

# Openthread Configuration flags
sl_ot_idle_interval_ms = 500 # 5s Idle Intervals
sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals
sl_ot_active_interval_ms = 500 # 500ms Active Intervals

# ICD Matter Configuration flags
Expand Down
18 changes: 0 additions & 18 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys
#include <openthread/tasklet.h>
#include <openthread/thread.h>

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

// ================================================================================
// Matter Networking Callbacks
// ================================================================================
Expand Down Expand Up @@ -152,20 +148,6 @@ void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds32(OTAConfig::kInitOTARequestorDelaySec),
InitOTARequestorHandler, nullptr);
#endif

SILABS_LOG("------------------------------------ Send Data Request -------------------------------------")
otLinkSendDataRequest(chip::DeviceLayer::ThreadStackMgrImpl().OTInstance());

}

if (event->Type == DeviceLayer::DeviceEventType::kCommissioningComplete)
{
#if CHIP_ENABLE_OPENTHREAD
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
SILABS_LOG("------------------------------------ REMOVE EM 1 REQUIREMENT -------------------------------------")
sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1);
#endif
#endif // CHIP_ENABLE_OPENTHREAD
}
}

Expand Down
21 changes: 9 additions & 12 deletions examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,39 @@
// 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_CSL_ENABLE) && SL_CSL_ENABLE

#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_CHILD_SUPERVISION_CHECK_TIMEOUT 0
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD 750
#define OPENTHREAD_CONFIG_CSL_TIMEOUT SL_CSL_TIMEOUT
#define SL_OPENTHREAD_CSL_TX_UNCERTAINTY 200

#endif // SL_CSL_ENABLE

#endif // SL_ICD_ENABLED

/****Uncomment below section for OpenThread Debug logs*/
// #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG

// #ifndef OPENTHREAD_CONFIG_LOG_CLI
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PKT_DUMP
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #endif

// EFR32MG21A020F1024IM32 has 96k of RAM. Reduce the number of buffers to
// conserve RAM for this Series 2 part.
#if defined(EFR32MG21)
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22
#define OPENTHREAD_CONFIG_CLI_UART_TX_BUFFER_SIZE 512
#define OPENTHREAD_CONFIG_CLI_UART_RX_BUFFER_SIZE 512
#endif

#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1

Expand Down
4 changes: 4 additions & 0 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ else
optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false "
shift
;;
--ssed)
optArgs+="enable_synchronized_sed=true "
shift
;;
--low-power)
optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true "
shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,10 @@ GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetThreadDeviceType(Connec
#endif
case ConnectivityManager::kThreadDeviceType_MinimalEndDevice:
case ConnectivityManager::kThreadDeviceType_SleepyEndDevice:
#if CHIP_DEVICE_CONFIG_THREAD_SSED
case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice:
break;
#endif
default:
ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT);
}
Expand All @@ -558,9 +560,11 @@ GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetThreadDeviceType(Connec
case ConnectivityManager::kThreadDeviceType_SleepyEndDevice:
deviceTypeStr = "SLEEPY END DEVICE";
break;
#if CHIP_DEVICE_CONFIG_THREAD_SSED
case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice:
deviceTypeStr = "SYNCHRONIZED SLEEPY END DEVICE";
break;
#endif
default:
deviceTypeStr = "(unknown)";
break;
Expand Down Expand Up @@ -592,7 +596,7 @@ GenericThreadStackManagerImpl_OpenThread<ImplClass>::_SetThreadDeviceType(Connec
case ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice:
linkMode.mDeviceType = false;
linkMode.mRxOnWhenIdle = false;
linkMode.mNetworkData = true;
// linkMode.mNetworkData = true;
break;
default:
break;
Expand Down
17 changes: 3 additions & 14 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ declare_args() {
# ICD Openthread Configuration flags
sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals
sl_ot_active_interval_ms = 200 # 200ms Active Intervals

# SSED Specific configurations
sl_ot_csl_timeout_sec = 30 # 30s CSL timeout

Expand Down Expand Up @@ -301,13 +301,6 @@ template("efr32_sdk") {
#"__STACK_SIZE=0",
]

if (!(use_silabs_thread_lib || use_silabs_thread_lib)) {
#Enabling this config temporarly to fix a build issue until
#official fix is pushed

defines += [ "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1" ]
}

# Temporary configuration to enable COAP specific configurations
if (use_thread_coap_lib) {
defines += [ "SL_USE_COAP_CONFIG=1" ]
Expand Down Expand Up @@ -442,12 +435,8 @@ template("efr32_sdk") {
if (enable_synchronized_sed) {
defines += [
"CHIP_DEVICE_CONFIG_THREAD_SSED=1",
"OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1",
"OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1",
"OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE=1",
"OPENTHREAD_CONFIG_CHILD_SUPERVISION_CHECK_TIMEOUT=0",
"SL_OPENTHREAD_CSL_TX_UNCERTAINTY=200",
"OPENTHREAD_CONFIG_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}",
"SL_CSL_ENABLE=1",
"SL_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}",
]
}
}
Expand Down

0 comments on commit 3590b82

Please sign in to comment.