Skip to content

Commit

Permalink
Merge branch 'master' into idm-4.2-troubleshoot
Browse files Browse the repository at this point in the history
  • Loading branch information
raul-marquez-csa authored Jul 2, 2024
2 parents a992265 + 0b39d3b commit f3ed1e7
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 109 deletions.
30 changes: 16 additions & 14 deletions examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ extern "C" {
#include <CHIPProjectConfig.h>

#include <stdint.h>
#include <stdio.h>

#ifdef SLI_SI91X_MCU_INTERFACE
#include "si91x_device.h"
extern uint32_t SystemCoreClock;
#else // For EFR32
#if SL_ICD_ENABLED
#include "sl_si91x_m4_ps.h"
#endif // SL_ICD_ENABLED
#else // For EFR32
#include "RTE_Components.h"
#include CMSIS_device_header

Expand Down Expand Up @@ -141,21 +145,18 @@ extern uint32_t SystemCoreClock;
/* Energy saving modes. */
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#define configUSE_TICKLESS_IDLE 1
#elif SL_ICD_ENABLED && SI917_M4_SLEEP_ENABLED
#elif (SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED)
#define configUSE_TICKLESS_IDLE 1
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 70
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x) vTaskPreSuppressTicksAndSleepProcessing(&x)
#define configPRE_SLEEP_PROCESSING(x) sl_wfx_host_si91x_sleep(&x)
#define configPOST_SLEEP_PROCESSING(x) sl_si91x_post_sleep_update_ticks(&x)
#define configPRE_SLEEP_PROCESSING(x)
#define configPOST_SLEEP_PROCESSING(x)
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x) sl_si91x_pre_supress_ticks_and_sleep(&x)
#else
#define configUSE_TICKLESS_IDLE 0
#endif // SL_CATALOG_POWER_MANAGER_PRESENT

#if defined(SLI_SI91X_MCU_INTERFACE)
#define configTICK_RATE_HZ (1000)
#else
#define configTICK_RATE_HZ (1024)
#endif // SLI_SI91X_MCU_INTERFACE

/* Definition used by Keil to replace default system clock source. */
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1

Expand All @@ -175,7 +176,11 @@ extern uint32_t SystemCoreClock;

/* Software timer related definitions. */
#define configUSE_TIMERS (1)
#ifdef SLI_SI917
#define configTIMER_TASK_PRIORITY (55) /* Highest priority */
#else
#define configTIMER_TASK_PRIORITY (40) /* Highest priority */
#endif // SLI_SI917
#define configTIMER_QUEUE_LENGTH (10)
#define configTIMER_TASK_STACK_DEPTH (1024)

Expand Down Expand Up @@ -211,11 +216,8 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configUSE_PORT_OPTIMISED_TASK_SELECTION (0)
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configMAX_PRIORITIES (56)
#if SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED
#define configMINIMAL_STACK_SIZE (1024) /* Number of words to use for Idle and Timer stacks */
#else // For EFR32
#define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */
#endif // SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED
#define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */

#ifdef HEAP_MONITORING
#define configMAX_TASK_NAME_LEN (24)
#else
Expand Down
65 changes: 4 additions & 61 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@

#ifdef SLI_SI91X_MCU_INTERFACE
#include "wfx_rsi.h"
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#include "rsi_m4.h"
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#endif // SLI_SI91X_MCU_INTERFACE
#endif /* SLI_SI91X_MCU_INTERFACE */

#include <crypto/CHIPCryptoPAL.h>
// If building with the EFR32-provided crypto backend, we can use the
Expand Down Expand Up @@ -356,63 +353,9 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
// ================================================================================
// FreeRTOS Callbacks
// ================================================================================
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
static bool is_sleep_ready = false;
void vTaskPreSuppressTicksAndSleepProcessing(uint16_t * xExpectedIdleTime)
{
// pointer check
if (xExpectedIdleTime == NULL)
{
return;
}

if (!is_sleep_ready)
{
*xExpectedIdleTime = 0;
}
else
{
// a preliminary check of the expected idle time is performed without making M4 inactive
if (*xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP)
{
// Indicate M4 is Inactive
P2P_STATUS_REG &= ~M4_is_active;
// Waiting for one more clock cycle to make sure M4 H/W Register is updated
P2P_STATUS_REG;

// TODO: This delay is added to sync between M4 and TA. It should be removed once the logic is moved to wifi SDK
for (uint8_t delay = 0; delay < 10; delay++)
{
__ASM("NOP");
}
// Checking if TA has already triggered a packet to M4
// RX_BUFFER_VALID will be cleared by TA if any packet is triggered
if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA) || (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID)))
{
P2P_STATUS_REG |= M4_is_active;
*xExpectedIdleTime = 0;
}
else
{
M4SS_P2P_INTR_CLR_REG = RX_BUFFER_VALID;
M4SS_P2P_INTR_CLR_REG;

TASS_P2P_INTR_MASK_SET = (TX_PKT_TRANSFER_DONE_INTERRUPT | RX_PKT_TRANSFER_DONE_INTERRUPT |
TA_WRITING_ON_COMM_FLASH | NWP_DEINIT_IN_COMM_FLASH
#ifdef SL_SI91X_SIDE_BAND_CRYPTO
| SIDE_BAND_CRYPTO_DONE
#endif
);
}
}
}
}
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
extern "C" void vApplicationIdleHook(void)
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
invoke_btn_press_event();
// is_sleep_ready is required since wfx_is_sleep_ready() is not FreeRTOS scheduler agnostic
is_sleep_ready = wfx_is_sleep_ready();
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#if (SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER)
sl_si91x_invoke_btn_press_event();
#endif
}
1 change: 1 addition & 0 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ source_set("siwx917-common") {
public_configs = [
":siwx917-common-config",
"${efr32_sdk_build_root}:silabs_config",
":chip_examples_project_config",
]

include_dirs = [
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/silabs/SiWx917/SiWx917/sl_wlan_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#define RSI_CONFIG_H

#include "ble_config.h"
#if SLI_SI91X_MCU_INTERFACE
#include "rsi_wisemcu_hardware_setup.h"
#include "rsi_wlan_defines.h"
#endif // SLI_SI91X_MCU_INTERFACE
#include "sl_wifi_device.h"

//! Enable feature
Expand Down
50 changes: 25 additions & 25 deletions examples/platform/silabs/ldscripts/SiWx917-common.ld
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SECTIONS
{
KEEP(*(.isr_vector))
KEEP(*(.reset_handler))
*(EXCLUDE_FILE(*sl_si91x_bus.o *sl_si91x_driver.o *sli_si91x_multithreaded.o *rsi_hal_mcu_m4_ram.o *rsi_hal_mcu_m4_rom.o *rsi_deepsleep_soc.o *croutine.o *event_groups.o *list.o *queue.o *stream_buffer.o *tasks.o *timers.o *cmsis_os2.o *freertos_umm_malloc_host.o *malloc_buffers.o *sl_rsi_utility.o *port.o *sl_sleeptimer.o *sl_sleeptimer_hal_si91x_sysrtc.o *rsi_sysrtc.o *sl_si91x_low_power_tickless_mode.o *heap_*.o *sl_core_cortexm.o) .text*)
*(EXCLUDE_FILE(*sl_si91x_bus.c.o *sl_si91x_driver.c.o *sli_si91x_multithreaded.c.o *rsi_hal_mcu_m4_ram.c.o *rsi_hal_mcu_m4_rom.c.o *rsi_deepsleep_soc.c.o *croutine.c.o *event_groups.c.o *list.c.o *queue.c.o *stream_buffer.c.o *tasks.c.o *timers.c.o *cmsis_os2.c.o *freertos_umm_malloc_host.c.o *malloc_buffers.c.o *sl_rsi_utility.c.o *port.c.o *sl_sleeptimer.c.o *sl_sleeptimer_hal_si91x_sysrtc.c.o *rsi_sysrtc.c.o *sl_si91x_low_power_tickless_mode.c.o *heap_*.c.o *sl_core_cortexm.c.o) .text*)

/* .ctors */
*crtbegin.o(.ctors)
Expand Down Expand Up @@ -127,30 +127,30 @@ SECTIONS
*(.rodata*)
*(vtable)
*(.data*)
*sl_si91x_bus.o(.text*)
*sl_si91x_driver.o(.text*)
*sli_si91x_multithreaded.o(.text*)
*rsi_hal_mcu_m4_ram.o(.text*)
*rsi_hal_mcu_m4_rom.o(.text*)
*rsi_deepsleep_soc.o(.text*)
*croutine.o(.text*)
*event_groups.o(.text*)
*list.o(.text*)
*queue.o(.text*)
*cmsis_os2.o(.text*)
*stream_buffer.o(.text*)
*tasks.o(.text*)
*timers.o(.text*)
*freertos_umm_malloc_host.o(.text*)
*malloc_buffers.o(.text*)
*sl_rsi_utility.o(.text*)
*port.o(.text*)
*heap_*.o(.text*)
*sl_sleeptimer.o(.text*)
*sl_sleeptimer_hal_si91x_sysrtc.o(.text*)
*rsi_sysrtc.o(.text*)
*sl_si91x_low_power_tickless_mode.o(.text*)
*sl_core_cortexm.o(.text*)
*sl_si91x_bus.c.o(.text*)
*sl_si91x_driver.c.o(.text*)
*sli_si91x_multithreaded.c.o(.text*)
*rsi_hal_mcu_m4_ram.c.o(.text*)
*rsi_hal_mcu_m4_rom.c.o(.text*)
*rsi_deepsleep_soc.c.o(.text*)
*croutine.c.o(.text*)
*event_groups.c.o(.text*)
*list.c.o(.text*)
*queue.c.o(.text*)
*cmsis_os2.c.o(.text*)
*stream_buffer.c.o(.text*)
*tasks.c.o(.text*)
*timers.c.o(.text*)
*freertos_umm_malloc_host.c.o(.text*)
*malloc_buffers.c.o(.text*)
*sl_rsi_utility.c.o(.text*)
*port.c.o(.text*)
*heap_*.c.o(.text*)
*sl_sleeptimer.c.o(.text*)
*sl_sleeptimer_hal_si91x_sysrtc.c.o(.text*)
*rsi_sysrtc.c.o(.text*)
*sl_si91x_low_power_tickless_mode.c.o(.text*)
*sl_core_cortexm.c.o(.text*)

. = ALIGN(4);
/* preinit data */
Expand Down
7 changes: 5 additions & 2 deletions examples/platform/silabs/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
#pragma once

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

Expand Down Expand Up @@ -112,8 +113,10 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_rsi_reset_count();
int32_t wfx_rsi_disconnect();
int32_t wfx_wifi_rsi_init(void);
#if SL_ICD_ENABLED
void sl_wfx_host_si91x_sleep_wakeup();
#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if SLI_SI91X_MCU_INTERFACE
void sl_si91x_invoke_btn_press_event();
#endif // SLI_SI91X_MCU_INTERFACE
#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
Expand Down
4 changes: 4 additions & 0 deletions src/lwip/silabs/lwipopts-rs911x.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6

#if SL_ICD_ENABLED
#define SL_LWIP_MLD6_TIMERS_ONDEMAND 1
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

#ifdef LWIP_DEBUG

#define MEMP_OVERFLOW_CHECK (0)
Expand Down
4 changes: 4 additions & 0 deletions src/lwip/silabs/lwipopts-wf200.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@
#define DEFAULT_UDP_RECVMBOX_SIZE 6
#define DEFAULT_TCP_RECVMBOX_SIZE 6

#if SL_ICD_ENABLED
#define SL_LWIP_MLD6_TIMERS_ONDEMAND 1
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

#ifdef LWIP_DEBUG

#define MEMP_OVERFLOW_CHECK (0)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla

#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
static void HandleC3ReadRequest(void);
static void HandleC3ReadRequest(rsi_ble_read_req_t * rsi_ble_read_req);
#else
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
static void HandleC3ReadRequest(volatile sl_bt_msg_t * evt);
Expand Down
9 changes: 9 additions & 0 deletions src/platform/silabs/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS 1
#endif

/**
* CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH
*
* Unique ID length in bytes. The value should be 16-bytes or longer.
*/
#ifndef CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH
#define CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID_LENGTH 32
#endif

#if CHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS
/**
* @brief Fallback value for the basic information cluster's Vendor name attribute
Expand Down
16 changes: 12 additions & 4 deletions third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/firmware_upgrade",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/hal/inc",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/inc",

"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/power_manager/inc",
]

if (use_system_view) {
Expand Down Expand Up @@ -307,9 +309,9 @@ template("siwx917_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_SI91X_MCU_WIRELESS_BASED_WAKEUP=1",
"SL_SI91X_MCU_BUTTON_BASED_WAKEUP=1",
"SL_SI91X_MCU_ALARM_BASED_WAKEUP=1",
"SL_SI91X_NPSS_GPIO_BTN_HANDLER=1",
"SL_SI91X_POWER_MANAGER_UC_AVAILABLE=1",
"SL_SI91X_TICKLESS_MODE=1",
]

if (si91x_alarm_based_periodic_wakeup) {
Expand Down Expand Up @@ -644,6 +646,7 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/board/silabs/src/rsi_board.c",
"${wifi_sdk_root}/components/common/src/sl_utility.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/src/rsi_deepsleep_soc.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/src/rsi_ps_ram_func.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/src/rsi_system_config.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/src/system_si91x.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/common/src/rsi_debug.c",
Expand Down Expand Up @@ -769,9 +772,14 @@ template("siwx917_sdk") {

if (chip_enable_icd_server) {
sources += [
"${sdk_support_root}/matter/si91x/siwx917/BRD4338A/autogen/sl_si91x_power_manager_handler.c",
"${sdk_support_root}/matter/si91x/siwx917/BRD4338A/autogen/sl_si91x_power_manager_wakeup_handler.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/sl_si91x_m4_ps.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_rtc.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/power_manager/src/sl_si91x_power_manager.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/power_manager/src/sli_si91x_power_manager.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/service/power_manager/src/sli_si91x_power_manager_wakeup_init.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_time_period.c",
"${wifi_sdk_root}/third_party/silicon_labs/freertos/src/sl_si91x_low_power_tickless_mode.c",
]
}

Expand Down
4 changes: 4 additions & 0 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ template("efr32_sdk") {
# 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" ]
}
}

Expand Down

0 comments on commit f3ed1e7

Please sign in to comment.