From 49208c37a14493048c8abe71c89f00f5f7ea6121 Mon Sep 17 00:00:00 2001 From: sharad-patil24 <100128124+sharad-patil24@users.noreply.github.com> Date: Wed, 20 Sep 2023 18:42:02 +0530 Subject: [PATCH] [Silabs]: Enabled LCD for 2.0 917 SOC board (#29250) * added required files to GN, and solved build errors * Enabled LCD for BRD4338A (2.0) board * Updated Matter support pointer * Fixed build issues * Build error fixed * Update matter support pointer * Restyled by clang-format * Restyled by gn --------- Co-authored-by: srningap Co-authored-by: Restyled.io --- examples/platform/silabs/display/lcd.cpp | 12 ++++ third_party/silabs/SiWx917_sdk.gni | 71 ++++++++++++++++++++++-- third_party/silabs/matter_support | 2 +- third_party/silabs/silabs_board.gni | 4 +- 4 files changed, 82 insertions(+), 7 deletions(-) diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index b4baa7ea63547e..63a91795487963 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -25,6 +25,10 @@ #include "dmd.h" #include "glib.h" +#if (SIWX_917) +#include "rsi_chip.h" +#endif + #ifdef QR_CODE_ENABLED #include "qrcodegen.h" #endif // QR_CODE_ENABLED @@ -38,6 +42,7 @@ #define QR_CODE_VERSION 4 #define QR_CODE_MODULE_SIZE 3 #define QR_CODE_BORDER_SIZE 0 +#define SL_BOARD_ENABLE_DISPLAY_PIN 0 #ifdef QR_CODE_ENABLED static uint8_t qrCode[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)]; @@ -64,12 +69,19 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) } /* Enable the memory lcd */ +#if (SIWX_917) + RSI_NPSSGPIO_InputBufferEn(SL_BOARD_ENABLE_DISPLAY_PIN, 1U); + RSI_NPSSGPIO_SetPinMux(SL_BOARD_ENABLE_DISPLAY_PIN, 0); + RSI_NPSSGPIO_SetDir(SL_BOARD_ENABLE_DISPLAY_PIN, 0); + RSI_NPSSGPIO_SetPin(SL_BOARD_ENABLE_DISPLAY_PIN, 1U); +#else status = sl_board_enable_display(); if (status != SL_STATUS_OK) { SILABS_LOG("Board Display enable fail %d", status); err = CHIP_ERROR_INTERNAL; } +#endif /* Initialize the DMD module for the DISPLAY device driver. */ status = DMD_init(0); diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index aefc3033ecfb47..4a2aad5cc02d75 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -115,9 +115,27 @@ template("siwx917_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/include", "${wifi_sdk_root}/components/protocol/wifi/si91x", "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F", + + #for LCD + "${efr32_sdk_root}/platform/middleware/glib", + "${efr32_sdk_root}/platform/middleware/glib/config", + "${efr32_sdk_root}/platform/middleware/glib/glib", + "${efr32_sdk_root}/platform/middleware/glib/dmd", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc/memlcd_917", + "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/sleeptimer/inc", + "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/inc", + "${efr32_sdk_root}/hardware/driver/memlcd/src/ls013b7dh03", + "${efr32_sdk_root}/platform/service/sleeptimer/inc", + "${efr32_sdk_root}/platform/service/sleeptimer/config", + "${efr32_sdk_root}/platform/service/sleeptimer/src", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/inc", ] + if (silabs_board == "BRD4338A") { + _include_dirs += [ "${wifi_sdk_root}/components/siwx917_soc/core/config" ] + } + # Note that we're setting the mbedTLS and PSA configuration files through a # define. This means the build system by default does not pick up changes in # the content of these, only when changing the filename itself. @@ -164,11 +182,11 @@ template("siwx917_sdk") { "TA_DEEP_SLEEP_COMMON_FLASH", "SL_WIFI_COMPONENT_INCLUDED", "CHIP_917=1", - "ROMDRIVER_PRESENT", + "ROMDRIVER_PRESENT=1", "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1", "SL_PLATFORM_EXAMPLES_ENABLE", - "SI91X_DEVICE", - "SI917_RADIO_BOARD", + "SI91X_DEVICE=1", + "SI917_RADIO_BOARD=1", "FLASH_PAGE_SIZE", "SL_NVM3_PRESENT", "ROM_WIRELESS", @@ -185,7 +203,18 @@ template("siwx917_sdk") { "EXECUTION_FROM_RAM", ] if (silabs_board == "BRD4338A") { - defines += [ "SI917_RADIO_BOARD_V2=1" ] + defines += [ + "SI917_RADIO_BOARD_V2=1", + "SL_BOARD_NAME=\"BRD4338A\"", + "SL_BOARD_REV=\"A00\"", + "SPI_MULTI_SLAVE=1", + "SYSCALLS_WRITE=1", + "SI91X_PLATFORM=1", + "SI91X_SYSRTC_COUNT=1", + "SI91X_SYSRTC_PRESENT=1", + "SSI_ULP_MASTER=1", + "SL_MEMLCD_EXTCOMIN_PORT=0", + ] } } @@ -225,6 +254,15 @@ template("siwx917_sdk") { if (invoker.enable_dic) { _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] } + if (!disable_lcd) { + defines += [ + "CONFIG_ENABLE_UART", + "__STATIC_INLINE=static inline", + "SI91X_SYSRTC_COUNT=1", + "SYSCALLS_WRITE", + "SPI_MULTI_SLAVE", + ] + } # Enabling led interface if (use_wstk_leds) { @@ -428,6 +466,31 @@ template("siwx917_sdk") { ] } + if (!disable_lcd) { + sources += [ + "${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_narrow_6x8.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_normal_8x8.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_number_16x20.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c", + "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/SPI.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/memlcd_917/sl_memlcd_spi.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd_display.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_sysrtc.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/src/sl_si91x_ulp_timer.c", + ] + } + public_deps = [ ":siwx917_mbedtls_config", "${segger_rtt_root}:segger_rtt", diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 32535c94e815b6..d336c71c24b154 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 32535c94e815b60b9efd594abc20372850526c0b +Subproject commit d336c71c24b1541c9099a258216dfd4585ace9fe diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index 236be2e9e8bc47..c69a09820d9c7f 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -127,8 +127,8 @@ if (silabs_board == "BRD4304A") { } else if (silabs_board == "BRD4338A") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" - disable_lcd = true - show_qr_code = false + disable_lcd = false + show_qr_code = true wifi_soc = true wifi_soc_common_flash = true silabs_board_lower = "brd4338a"