diff --git a/examples/lighting-app/bouffalolab/bl602/README.md b/examples/lighting-app/bouffalolab/bl602/README.md
index 398562aaa17b63..52d87bab0820fe 100644
--- a/examples/lighting-app/bouffalolab/bl602/README.md
+++ b/examples/lighting-app/bouffalolab/bl602/README.md
@@ -1,10 +1,10 @@
# BL602
This example functions as a wifi light bulb device type, with on/off
-capabilities. The steps were verified on BL602 development board.
+capabilities. The steps were verified on BL602-IoT-Matter-V1 board.
-BL602 development board:
-
+BL602-IoT-Matter-V1 board:
+
## Initial setup
@@ -85,6 +85,54 @@ picocom -b 115200 /dev/ttyACM0
2.To reset the board, press the RESET button, and you will see the log in the
`picocom terminal`.
+```
+Starting bl602 now....
+Booting BL602 Chip...
+```
+
+3.To control the development board after successfully debugging the development
+board, press the BOOT button and you should see the following output in the
+terminal:
+
+```
+[ 404197][:588238200] Short press
+[ 404198][:588238200] receiving event type: 0
+[ 404203][:588238200] sending event type: 0
+[ 404207][:588238200] receiving event type: 0
+[ 404211][:588238200] Turning light ON
+[ 406211][:588238200] sending event type: 1
+[ 406212][:588238200] receiving event type: 1
+[ 406217][:588238200] Light ON
+[ 406220][:588238200] updating on/off = 1
+```
+
+4.To restore the board to factory Settings, press and hold the BOOT button for 5
+seconds, and you should see the following output in the terminal:
+
+```
+[ 37268][:588238200] LongLong press
+[ 37269][:588238200] receiving event type: 0
+[ 37274][:588238200] FactoryReset! please release button!!!
+[ 37279][:588238200] Toggling state to 1
+[ 37283][:588238200] brightness: 255, mHue: 0, mSaturation: 0, red: 255, green: 255, blue: 255
+[ 37292][:588238200] red level: 10000
+[ 38296][:588238200] Toggling state to 0
+[ 38297][:588238200] brightness: 0, mHue: 0, mSaturation: 0, red: 0, green: 0, blue: 0
+[ 38305][:588238200] red level: 0
+[ 39308][:588238200] Toggling state to 1
+[ 39309][:588238200] brightness: 255, mHue: 0, mSaturation: 0, red: 255, green: 255, blue: 255
+[ 39318][:588238200] red level: 10000
+[ 42323][:588238200] [DL] Easyflash erase: f/1/n
+[ 42327][:588238200] [DL] Easyflash erase: f/1/i
+[ 42332][:588238200] [DL] Easyflash erase: f/1/r
+[ 42335][:588238200] [DL] Easyflash erase: f/1/m
+[ 42340][:588238200] [DL] Easyflash erase: f/1/o
+[ 42349][:588238200] [DIS] Fabric (0x1) deleted. Calling OnFabricDeletedFromStorage
+[ 42403][:588238200] [DL] Easyflash erase: f/1/k/0
+[ 42462][:588238200] [DL] Easyflash erase: f/1/g
+[ 42465][:588238200] [DMG] AccessControl: removing fabric 1
+```
+
## Commission a device using chip-tool
To initiate a client commissioning request to a device, run the built executable
diff --git a/examples/platform/bouffalolab/bl602/doc/images/BL602-IoT-Matter_V1.png b/examples/platform/bouffalolab/bl602/doc/images/BL602-IoT-Matter_V1.png
new file mode 100644
index 00000000000000..6cb4dc049f6ef5
Binary files /dev/null and b/examples/platform/bouffalolab/bl602/doc/images/BL602-IoT-Matter_V1.png differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/bl602_iot_3S_v2.jpg b/examples/platform/bouffalolab/bl602/doc/images/bl602_iot_3S_v2.jpg
deleted file mode 100755
index 2506a1e2aa3901..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/bl602_iot_3S_v2.jpg and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/dev-cube-home.png b/examples/platform/bouffalolab/bl602/doc/images/dev-cube-home.png
deleted file mode 100755
index 6988dc3dc050d0..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/dev-cube-home.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/dev-cube-iot.png b/examples/platform/bouffalolab/bl602/doc/images/dev-cube-iot.png
deleted file mode 100644
index c7898b331d0bf9..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/dev-cube-iot.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/dev-cube.png b/examples/platform/bouffalolab/bl602/doc/images/dev-cube.png
deleted file mode 100755
index 518a972ddfc608..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/dev-cube.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/image-dev-cube.png b/examples/platform/bouffalolab/bl602/doc/images/image-dev-cube.png
deleted file mode 100755
index 2e7ceff5c2430f..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/image-dev-cube.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/image-web-login.png b/examples/platform/bouffalolab/bl602/doc/images/image-web-login.png
deleted file mode 100755
index d8d610dd30549f..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/image-web-login.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/doc/images/image-web.png b/examples/platform/bouffalolab/bl602/doc/images/image-web.png
deleted file mode 100755
index 02e07b2fffa3b3..00000000000000
Binary files a/examples/platform/bouffalolab/bl602/doc/images/image-web.png and /dev/null differ
diff --git a/examples/platform/bouffalolab/bl602/hal-config-app-common.h b/examples/platform/bouffalolab/bl602/hal-config-app-common.h
deleted file mode 100644
index b19a61575b89e2..00000000000000
--- a/examples/platform/bouffalolab/bl602/hal-config-app-common.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Copyright (c) 2020 Project CHIP Authors
- * All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/******************************************************************************
- * @file
- * @brief hal-config-app-common.h
- *******************************************************************************
- * # License
- * Copyright 2018 Silicon Laboratories Inc. www.silabs.com
- *******************************************************************************
- *
- * The licensor of this software is Silicon Laboratories Inc. Your use of this
- * software is governed by the terms of Silicon Labs Master Software License
- * Agreement (MSLA) available at
- * www.silabs.com/about-us/legal/master-software-license-agreement. This
- * software is distributed to you in Source Code format and is governed by the
- * sections of the MSLA applicable to Source Code.
- *
- ******************************************************************************/
-
-#pragma once
-
-#include "em_device.h"
-#include "hal-config-types.h"
-
-#if defined(FEATURE_IOEXPANDER)
-#include "hal-config-ioexp.h"
-#endif
-
-#define HAL_EXTFLASH_FREQUENCY (1000000)
-
-#define HAL_PTI_ENABLE (1)
-#define HAL_PTI_MODE (HAL_PTI_MODE_UART)
-#define HAL_PTI_BAUD_RATE (1600000)
-
-#define HAL_PA_RAMP (10)
-#define HAL_PA_2P4_LOWPOWER (0)
-#define HAL_PA_POWER (252)
-#define HAL_PA_CURVE_HEADER "pa_curves_efr32.h"
-
-#define HAL_PA_VOLTAGE BSP_PA_VOLTAGE
-
-// Select antenna path on EFR32xG2x devices:
-// - RF2G2_IO1: 0
-// - RF2G2_IO2: 1
-#define GECKO_RF_ANTENNA 1
-#if defined(FEATURE_EXP_HEADER_USART3)
-
-#define BSP_EXP_USART USART3
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART3_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART3_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART3_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART3_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART3_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART3_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART3_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART3_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART3_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART3_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART3_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART3_TX_LOC
-
-#elif defined(FEATURE_EXP_HEADER_USART1)
-
-#define BSP_EXP_USART USART1
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART1_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART1_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART1_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART1_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART1_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART1_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART1_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART1_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART1_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART1_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART1_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART1_TX_LOC
-
-#else
-
-#define BSP_EXP_USART USART0
-
-#define BSP_EXP_USART_CTS_PIN BSP_USART0_CTS_PIN
-#define BSP_EXP_USART_CTS_PORT BSP_USART0_CTS_PORT
-#define BSP_EXP_USART_CTS_LOC BSP_USART0_CTS_LOC
-
-#define BSP_EXP_USART_RTS_PIN BSP_USART0_RTS_PIN
-#define BSP_EXP_USART_RTS_PORT BSP_USART0_RTS_PORT
-#define BSP_EXP_USART_RTS_LOC BSP_USART0_RTS_LOC
-
-#define BSP_EXP_USART_RX_PIN BSP_USART0_RX_PIN
-#define BSP_EXP_USART_RX_PORT BSP_USART0_RX_PORT
-#define BSP_EXP_USART_RX_LOC BSP_USART0_RX_LOC
-
-#define BSP_EXP_USART_TX_PIN BSP_USART0_TX_PIN
-#define BSP_EXP_USART_TX_PORT BSP_USART0_TX_PORT
-#define BSP_EXP_USART_TX_LOC BSP_USART0_TX_LOC
-
-#endif // FEATURE_EXP_HEADER_USART3
diff --git a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp
index 9740ab472c7976..9b47273db31c28 100644
--- a/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp
+++ b/src/platform/bouffalolab/BL602/DiagnosticDataProviderImpl.cpp
@@ -77,14 +77,14 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeap
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeapUsed)
{
- currentHeapUsed = _heap_size - xPortGetFreeHeapSize();
+ currentHeapUsed = (uint32_t) &_heap_size - xPortGetFreeHeapSize();
return CHIP_NO_ERROR;
}
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark)
{
- currentHeapHighWatermark = _heap_size - xPortGetMinimumEverFreeHeapSize();
+ currentHeapHighWatermark = (uint32_t) &_heap_size - xPortGetMinimumEverFreeHeapSize();
return CHIP_NO_ERROR;
}
diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
index 6b1e798806bdbe..da0d3d2c2f87f4 100644
--- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
+++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
@@ -45,6 +45,7 @@ constexpr char blWiFiSSIDKeyName[] = "bl-wifi-ssid";
constexpr char blWiFiCredentialsKeyName[] = "bl-wifi-pass";
static uint8_t WiFiSSIDStr[DeviceLayer::Internal::kMaxWiFiSSIDLength];
+static uint8_t scan_type = 0;
} // namespace
CHIP_ERROR BLWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback)
@@ -162,7 +163,6 @@ CHIP_ERROR BLWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen,
wifi_interface = wifi_mgmr_sta_enable();
wifi_mgmr_sta_connect(wifi_interface, ssid, passwd, NULL, NULL, 0, 0);
- // Configure the WiFi interface.
ReturnErrorOnFailure(ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled));
return ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Enabled);
@@ -200,8 +200,8 @@ void BLWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callback
Status networkingStatus = Status::kSuccess;
static int save = 0;
- // VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound);
- // VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError);
+ VerifyOrExit(NetworkMatch(mStagingNetwork, networkId), networkingStatus = Status::kNetworkIDNotFound);
+ VerifyOrExit(mpConnectCallback == nullptr, networkingStatus = Status::kUnknownError);
ChipLogProgress(NetworkProvisioning, "BL NetworkCommissioningDelegate: SSID: %.*s", static_cast(networkId.size()),
networkId.data());
@@ -230,11 +230,13 @@ CHIP_ERROR BLWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid)
{
memset(WiFiSSIDStr, 0, sizeof(WiFiSSIDStr));
memcpy(WiFiSSIDStr, ssid.data(), ssid.size());
- err = (CHIP_ERROR) wifi_mgmr_scan_adv(NULL, NULL, NULL, 0, WiFiSSIDStr);
+ err = (CHIP_ERROR) wifi_mgmr_scan_adv(NULL, NULL, NULL, 0, WiFiSSIDStr);
+ scan_type = 1;
}
else
{
- err = (CHIP_ERROR) wifi_mgmr_scan(NULL, NULL);
+ err = (CHIP_ERROR) wifi_mgmr_scan(NULL, NULL);
+ scan_type = 0;
}
if (err != CHIP_NO_ERROR)
{
@@ -260,7 +262,7 @@ void BLWiFiDriver::OnScanWiFiNetworkDone()
}
wifi_mgmr_ap_item_t * ScanResult = (wifi_mgmr_ap_item_t *) pvPortMalloc(ap_num * sizeof(wifi_mgmr_ap_item_t));
- wifi_mgmr_get_scan_result(ScanResult, ap_num);
+ wifi_mgmr_get_scan_result(ScanResult, &ap_num, scan_type, WiFiSSIDStr);
if (ScanResult)
{
diff --git a/third_party/bouffalolab/bl602_sdk/repo b/third_party/bouffalolab/bl602_sdk/repo
index 12e69c3f71fcad..38b4bd921d3620 160000
--- a/third_party/bouffalolab/bl602_sdk/repo
+++ b/third_party/bouffalolab/bl602_sdk/repo
@@ -1 +1 @@
-Subproject commit 12e69c3f71fcadbc048f7bd604d52b427f558d48
+Subproject commit 38b4bd921d3620a85d5306874247f45aab64eace