Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Add CSL support to silabs platform #31838

Merged
merged 6 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/openthread.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chip_subscription_timeout_resumption = false
sl_use_subscription_synching = true

# Openthread Configuration flags
sl_ot_idle_interval_ms = 30000 # 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
7 changes: 1 addition & 6 deletions examples/light-switch-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,24 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "BindingHandler.h"

#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
4 changes: 4 additions & 0 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router));
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if CHIP_DEVICE_CONFIG_THREAD_SSED
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice));
#else
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice));
#endif
#else // CHIP_CONFIG_ENABLE_ICD_SERVER
ReturnErrorOnFailure(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice));
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
Expand Down
28 changes: 16 additions & 12 deletions examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +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
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
#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
10 changes: 10 additions & 0 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ if [ "$#" == "0" ]; then
chip_enable_icd_server
Configure has a Intermitently connected device. (Default false)
Must also set chip_openthread_ftd=false
enable_synchronized_sed
Enable Synchronized Sleepy end device. (Default false)
Must also set chip_enable_icd_server=true chip_openthread_ftd=false
use_rs9116
Build wifi example with extension board rs9116. (Default false)
use_SiWx917
Expand Down Expand Up @@ -121,6 +124,9 @@ if [ "$#" == "0" ]; then
--icd
enable ICD features, set thread mtd
For minimum consumption, add --low-power
--ssed
enable synchronized sleepy end device, with csl
For minimum consumption, add --low-power
--low-power
disables all power consuming features for the most power efficient build
This flag is to be used with --icd
Expand Down Expand Up @@ -192,6 +198,10 @@ else
optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false "
shift
;;
--ssed)
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
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
16 changes: 0 additions & 16 deletions src/platform/silabs/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,6 @@

// ========== Platform-specific Configuration Overrides =========

#ifndef CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY
#define CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY (configTIMER_TASK_PRIORITY - 1)
#endif // CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY

#ifndef CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY
#define CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY (CHIP_DEVICE_CONFIG_BLE_LL_TASK_PRIORITY - 1)
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
#endif // CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY

#ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_PRIORITY
#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_PRIORITY (CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY - 1)
#endif // CHIP_DEVICE_CONFIG_BLE_STACK_TASK_PRIORITY

#ifndef CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE
#define CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE 1536
#endif // CHIP_DEVICE_CONFIG_BLE_APP_TASK_STACK_SIZE

#ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
#define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE (6 * 1024)
#endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE
Expand Down
22 changes: 14 additions & 8 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ declare_args() {
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

# ICD Matter Configuration flags
sl_idle_mode_interval_s = 600 # 10min Idle Mode Interval
sl_active_mode_interval_ms = 1000 # 1s Active Mode Interval
Expand All @@ -59,6 +62,9 @@ declare_args() {

silabs_log_enabled = true

# Enable Synchronized Sleepy End Device
enable_synchronized_sed = false

# Argument to enable IPv4 for wifi
# aligning to match chip_inet_config_enable_ipv4 default configuration
chip_enable_wifi_ipv4 = false
Expand Down Expand Up @@ -160,7 +166,6 @@ template("efr32_sdk") {
"${efr32_sdk_root}/platform/radio/rail_lib/protocol/ieee802154",
"${efr32_sdk_root}/platform/radio/rail_lib/protocol/ble",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_power_manager_init",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_pti",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/rail_util_power_manager_init",
"${efr32_sdk_root}/platform/service/device_init/inc",
Expand Down Expand Up @@ -296,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 @@ -433,6 +431,14 @@ template("efr32_sdk") {
"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",
"SL_CSL_ENABLE=1",
"SL_CSL_TIMEOUT=${sl_ot_csl_timeout_sec}",
]
}
}

if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) {
Expand Down
Loading