diff --git a/examples/all-clusters-app/p6/README.md b/examples/all-clusters-app/p6/README.md
index 90e7ca06ec1eb5..95b82a4cd147e9 100644
--- a/examples/all-clusters-app/p6/README.md
+++ b/examples/all-clusters-app/p6/README.md
@@ -9,7 +9,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Building](#building)
- [Flashing the Application](#flashing-the-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- - [Setting up Python Controller](#setting-up-python-controller)
+ - [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
@@ -74,57 +74,37 @@ will then join the network.
Commissioning can be carried out using BLE.
-
+
-### Setting up Python Controller
+### Setting up Chip tool
-Once P6 is up and running, we need to set up a device controller on Raspberry Pi
-4 to perform commissioning and cluster control.
+Once P6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to
+perform commissioning and cluster control.
- Set up python controller.
$ cd {path-to-connectedhomeip}
- $ ./scripts/build_python.sh -m platform
+ $ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
- Execute the controller.
- $ source ./out/python_env/bin/activate
- $ chip-device-ctrl
+ $ ./out/debug/chip-tool
### Commissioning over BLE
-- Establish the secure session over BLE.
+Run the built executable and pass it the discriminator and pairing code of the
+remote device, as well as the network credentials to use.
- - chip-device-ctrl > ble-scan
- - chip-device-ctrl > connect -ble 3840 20202021 1234
+ $ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840
Parameters:
1. Discriminator: 3840
2. Setup-pin-code: 20202021
- 3. Node ID: Optional.
- If not passed in this command, then it is auto-generated by the controller and
- displayed in the output of connect.
- The same value should be used in the next commands.
- We have chosen a random node ID which is 1234.
-
-- Add credentials of the Wi-Fi network you want the P6 to connect to, using
- the `AddOrUpdateWiFiNetwork` command and then enable the P6 to connect to it
- using `EnableWiFiNetwork` command. In this example, we have used `WIFI_SSID`
- and `WIFI_PASSWORD` as the SSID and passphrase respectively.
-
- - chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 1234 0 0 ssid=str:WIFI_SSID credentials=str:WIFI_PASSWORD breadcrumb=0
-
- - chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 1234 0 0 networkID=str:WIFI_SSID breadcrumb=0
-
-- Close the BLE connection to P6, as it is not required hereafter.
-
- - chip-device-ctrl > close-ble
-
-- Resolve DNS-SD name and update address of the node in the device controller.
-
- - chip-device-ctrl > resolve 1234
+ 3. Node ID: 1234 (you can assign any node id)
+ 4. SSID : Wi-Fi SSID
+ 5. PASSWORD : Wi-Fi Password
diff --git a/examples/lighting-app/p6/README.md b/examples/lighting-app/p6/README.md
index e47e12d74c4bb0..c7327703c346fb 100644
--- a/examples/lighting-app/p6/README.md
+++ b/examples/lighting-app/p6/README.md
@@ -9,7 +9,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Building](#building)
- [Flashing the Application](#flashing-the-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- - [Setting up Python Controller](#setting-up-python-controller)
+ - [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Cluster control](#cluster-control)
@@ -75,57 +75,37 @@ will then join the network.
Commissioning can be carried out using BLE.
-
+
-### Setting up Python Controller
+### Setting up Chip tool
-Once P6 is up and running, we need to set up a device controller on Raspberry Pi
-4 to perform commissioning and cluster control.
+Once P6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to
+perform commissioning and cluster control.
- Set up python controller.
$ cd {path-to-connectedhomeip}
- $ ./scripts/build_python.sh -m platform
+ $ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
- Execute the controller.
- $ source ./out/python_env/bin/activate
- $ chip-device-ctrl
+ $ ./out/debug/chip-tool
### Commissioning over BLE
-- Establish the secure session over BLE.
+Run the built executable and pass it the discriminator and pairing code of the
+remote device, as well as the network credentials to use.
- - chip-device-ctrl > ble-scan
- - chip-device-ctrl > connect -ble 3840 20202021 1234
+ $ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840
Parameters:
1. Discriminator: 3840
2. Setup-pin-code: 20202021
- 3. Node ID: Optional.
- If not passed in this command, then it is auto-generated by the controller and
- displayed in the output of connect.
- The same value should be used in the next commands.
- We have chosen a random node ID which is 1234.
-
-- Add credentials of the Wi-Fi network you want the P6 to connect to, using
- the `AddOrUpdateWiFiNetwork` command and then enable the P6 to connect to it
- using `EnableWiFiNetwork` command. In this example, we have used `WIFI_SSID`
- and `WIFI_PASSWORD` as the SSID and passphrase respectively.
-
- - chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 1234 0 0 ssid=str:WIFI_SSID credentials=str:WIFI_PASSWORD breadcrumb=0
-
- - chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 1234 0 0 networkID=str:WIFI_SSID breadcrumb=0
-
-- Close the BLE connection to P6, as it is not required hereafter.
-
- - chip-device-ctrl > close-ble
-
-- Resolve DNS-SD name and update address of the node in the device controller.
-
- - chip-device-ctrl > resolve 1234
+ 3. Node ID: 1234 (you can assign any node id)
+ 4. SSID : Wi-Fi SSID
+ 5. PASSWORD : Wi-Fi Password
@@ -145,9 +125,9 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
- After successful commissioning, use the OnOff cluster command to toggle
device between On or Off states.
- `chip-device-ctrl > zcl OnOff Off 1234 1 0`
+ `$ ./out/debug/chip-tool onoff on 1234 1`
- `chip-device-ctrl > zcl OnOff On 1234 1 0`
+ `$ ./out/debug/chip-tool onoff off 1234 1`
- Cluster OnOff can also be done using the `USER_BTN1` button on the board.
This button is configured with `APP_LIGHT_BUTTON` in `include/AppConfig.h`.
diff --git a/examples/lock-app/p6/README.md b/examples/lock-app/p6/README.md
index de111919321ad9..acfa2bb2a37e74 100644
--- a/examples/lock-app/p6/README.md
+++ b/examples/lock-app/p6/README.md
@@ -9,7 +9,7 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
- [Building](#building)
- [Flashing the Application](#flashing-the-application)
- [Commissioning and cluster control](#commissioning-and-cluster-control)
- - [Setting up Python Controller](#setting-up-python-controller)
+ - [Setting up chip-tool](#setting-up-chip-tool)
- [Commissioning over BLE](#commissioning-over-ble)
- [Notes](#notes)
- [Cluster control](#cluster-control)
@@ -49,11 +49,6 @@ will then join the network.
* Build the example application:
- $ cd ~/connectedhomeip
- $ ./gn_build.sh enable_p6_builds=true
-
- Or Using P6 build script
-
$ ./scripts/examples/gn_p6_example.sh examples/lock-app/p6 out/lock_app_p6
- To delete generated executable, libraries and object files use:
@@ -71,11 +66,6 @@ will then join the network.
- On the command line:
- $ cd ~/connectedhomeip
- $ python3 out/debug/p6_lock_app/chip-p6-lock-example.flash.py
-
- Or when using P6 Build script
-
$ cd ~/connectedhomeip
$ python3 out/lock_app_p6/chip-p6-lock-example.flash.py
@@ -85,57 +75,37 @@ will then join the network.
Commissioning can be carried out using BLE.
-
+
-### Setting up Python Controller
+### Setting up Chip tool
-Once P6 is up and running, we need to set up a device controller on Raspberry Pi
-4 to perform commissioning and cluster control.
+Once P6 is up and running, we need to set up chip-tool on Raspberry Pi 4 to
+perform commissioning and cluster control.
- Set up python controller.
$ cd {path-to-connectedhomeip}
- $ ./scripts/build_python.sh -m platform
+ $ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
- Execute the controller.
- $ source ./out/python_env/bin/activate
- $ chip-device-ctrl
+ $ ./out/debug/chip-tool
### Commissioning over BLE
-- Establish the secure session over BLE.
+Run the built executable and pass it the discriminator and pairing code of the
+remote device, as well as the network credentials to use.
- - chip-device-ctrl > ble-scan
- - chip-device-ctrl > connect -ble 3840 20202021 1234
+ $ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840
Parameters:
1. Discriminator: 3840
2. Setup-pin-code: 20202021
- 3. Node ID: Optional.
- If not passed in this command, then it is auto-generated by the controller and
- displayed in the output of connect.
- The same value should be used in the next commands.
- We have chosen a random node ID which is 1234.
-
-- Add credentials of the Wi-Fi network you want the P6 to connect to, using
- the `AddOrUpdateWiFiNetwork` command and then enable the P6 to connect to it
- using `EnableWiFiNetwork` command. In this example, we have used `WIFI_SSID`
- and `WIFI_PASSWORD` as the SSID and passphrase respectively.
-
- - chip-device-ctrl > zcl NetworkCommissioning AddOrUpdateWiFiNetwork 1234 0 0 ssid=str:WIFI_SSID credentials=str:WIFI_PASSWORD breadcrumb=0
-
- - chip-device-ctrl > zcl NetworkCommissioning ConnectNetwork 1234 0 0 networkID=str:WIFI_SSID breadcrumb=0
-
-- Close the BLE connection to P6, as it is not required hereafter.
-
- - chip-device-ctrl > close-ble
-
-- Resolve DNS-SD name and update address of the node in the device controller.
-
- - chip-device-ctrl > resolve 1234
+ 3. Node ID: 1234 (you can assign any node id)
+ 4. SSID : Wi-Fi SSID
+ 5. PASSWORD : Wi-Fi Password
@@ -155,9 +125,9 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
- After successful commissioning, use the OnOff cluster command to toggle
device between On or Off states.
- `chip-device-ctrl > zcl OnOff Off 1234 1 0`
+ `$ ./out/debug/chip-tool onoff on 1234 1`
- `chip-device-ctrl > zcl OnOff On 1234 1 0`
+ `$ ./out/debug/chip-tool onoff off 1234 1`
- Cluster OnOff can also be done using the `USER_BTN1` button on the board.
This button is configured with `APP_LOCK_BUTTON` in `include/AppConfig.h`.
diff --git a/examples/platform/p6/LEDWidget.cpp b/examples/platform/p6/LEDWidget.cpp
index 4b91402bfda0fd..60924cea47edb5 100644
--- a/examples/platform/p6/LEDWidget.cpp
+++ b/examples/platform/p6/LEDWidget.cpp
@@ -243,7 +243,6 @@ void LEDWidget::SetBrightness(uint32_t led_brightness)
{
printf("PWM failed to set dutycycle!");
}
- PWM_start();
}
}
diff --git a/src/platform/P6/KeyValueStoreManagerImpl.cpp b/src/platform/P6/KeyValueStoreManagerImpl.cpp
index 2cbda30f38dd7f..2cb94828e8cef1 100644
--- a/src/platform/P6/KeyValueStoreManagerImpl.cpp
+++ b/src/platform/P6/KeyValueStoreManagerImpl.cpp
@@ -172,6 +172,16 @@ CHIP_ERROR KeyValueStoreManagerImpl::ConvertCyResultToChip(cy_rslt_t err) const
return CHIP_ERROR_INTERNAL;
}
+CHIP_ERROR KeyValueStoreManagerImpl::Erase(void)
+{
+ if (!init_success)
+ {
+ return CHIP_ERROR_WELL_UNINITIALIZED;
+ }
+
+ cy_rslt_t result = mtb_kvstore_reset(&kvstore_obj);
+ return ConvertCyResultToChip(result);
+}
} // namespace PersistedStorage
} // namespace DeviceLayer
} // namespace chip
diff --git a/src/platform/P6/KeyValueStoreManagerImpl.h b/src/platform/P6/KeyValueStoreManagerImpl.h
index 29515f28218c67..62bead34c37033 100644
--- a/src/platform/P6/KeyValueStoreManagerImpl.h
+++ b/src/platform/P6/KeyValueStoreManagerImpl.h
@@ -41,6 +41,7 @@ class KeyValueStoreManagerImpl final : public KeyValueStoreManager
CHIP_ERROR _Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size = nullptr, size_t offset = 0) const;
CHIP_ERROR _Delete(const char * key);
CHIP_ERROR _Put(const char * key, const void * value, size_t value_size);
+ CHIP_ERROR Erase(void);
private:
// ===== Members for internal use by the following friends.
diff --git a/src/platform/P6/P6Config.cpp b/src/platform/P6/P6Config.cpp
index b44d6f2baf9680..e36e27099aa52d 100644
--- a/src/platform/P6/P6Config.cpp
+++ b/src/platform/P6/P6Config.cpp
@@ -213,6 +213,7 @@ bool P6Config::ConfigValueExists(Key key)
// Clear out keys in config namespace
CHIP_ERROR P6Config::FactoryResetConfig(void)
{
+ CHIP_ERROR err = CHIP_NO_ERROR;
const Key * config_keys[] = { &kConfigKey_FabricId, &kConfigKey_ServiceConfig, &kConfigKey_PairedAccountId,
&kConfigKey_ServiceId, &kConfigKey_GroupKeyIndex, &kConfigKey_LastUsedEpochKeyId,
&kConfigKey_FailSafeArmed, &kConfigKey_WiFiStationSecType, &kConfigKey_WiFiSSID,
@@ -220,7 +221,7 @@ CHIP_ERROR P6Config::FactoryResetConfig(void)
for (uint32_t i = 0; i < (sizeof(config_keys) / sizeof(config_keys[0])); i++)
{
- CHIP_ERROR err = ClearConfigValue(*config_keys[i]);
+ err = ClearConfigValue(*config_keys[i]);
// Something unexpected happened
if (err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND && err != CHIP_NO_ERROR)
{
@@ -228,6 +229,13 @@ CHIP_ERROR P6Config::FactoryResetConfig(void)
}
}
+ // Erase all key-values including fabric info.
+ err = PersistedStorage::KeyValueStoreMgrImpl().Erase();
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(DeviceLayer, "Clear Key-Value Storage failed");
+ }
+
return CHIP_NO_ERROR;
}