diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml
index e188826..0e3d2e8 100644
--- a/.github/workflows/examples-ameba.yaml
+++ b/.github/workflows/examples-ameba.yaml
@@ -38,7 +38,7 @@
         if: github.actor != 'restyled-io[bot]'
 
         container:
-            image: connectedhomeip/chip-build-ameba:0.7.3
+            image: connectedhomeip/chip-build-ameba:0.7.14
             options: --user root
 
         steps:
diff --git a/src/platform/Ameba/AmebaConfig.cpp b/src/platform/Ameba/AmebaConfig.cpp
index 08d552f..e91905e 100644
--- a/src/platform/Ameba/AmebaConfig.cpp
+++ b/src/platform/Ameba/AmebaConfig.cpp
@@ -21,6 +21,8 @@
 
 #include <core/CHIPEncoding.h>
 #include <platform/Ameba/AmebaConfig.h>
+#include <platform/Ameba/AmebaUtils.h>
+#include <platform/Ameba/KeyValueStoreManagerImpl.h>
 #include <support/CHIPMem.h>
 #include <support/CHIPMemString.h>
 #include <support/CodeUtils.h>
@@ -35,6 +37,8 @@
     kPrefsTypeBinary  = 5
 };
 
+using namespace chip::DeviceLayer::PersistedStorage;
+
 namespace chip {
 namespace DeviceLayer {
 namespace Internal {
@@ -84,114 +88,112 @@
 
 CHIP_ERROR AmebaConfig::ReadConfigValue(Key key, bool & val)
 {
+    CHIP_ERROR err;
+    int32_t error;
     uint8_t intVal;
-    int32_t success = 0;
 
-    success = getPref_bool_new(key.Namespace, key.Name, &intVal);
-    if (success != 0)
+    error = getPref_bool_new(key.Namespace, key.Name, &intVal);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "getPref_bool_new: %s/%s failed\n", StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
     }
 
     val = (intVal != 0);
-
-    if (success == 0)
-        return CHIP_NO_ERROR;
-    else
-        return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ReadConfigValue(Key key, uint32_t & val)
 {
-    int32_t success = 0;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = getPref_u32_new(key.Namespace, key.Name, &val);
-    if (success != 0)
+    error = getPref_u32_new(key.Namespace, key.Name, &val);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "getPref_u32_new: %s/%s failed\n", StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
     }
 
-    if (success == 0)
-        return CHIP_NO_ERROR;
-    else
-        return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ReadConfigValue(Key key, uint64_t & val)
 {
-    int32_t success = 0;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = getPref_u64_new(key.Namespace, key.Name, &val);
-    if (success != 0)
+    error = getPref_u64_new(key.Namespace, key.Name, &val);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
-        ChipLogProgress(DeviceLayer, "getPref_u32_new: %s/%s failed\n", StringOrNullMarker(key.Namespace),
+        ChipLogProgress(DeviceLayer, "getPref_u64: %s/%s failed\n", StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
     }
 
-    if (success == 0)
-        return CHIP_NO_ERROR;
-    else
-        return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen)
 {
-    int32_t success = 0;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = getPref_str_new(key.Namespace, key.Name, buf, bufSize, &outLen);
-    if (success != 0)
+    error = getPref_str_new(key.Namespace, key.Name, buf, bufSize, &outLen);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    outLen -= 1; // Don't count trailing null
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "getPref_str_new: %s/%s failed\n", StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
+        outLen = 0;
     }
 
-    if (success == 0)
-    {
-        outLen -= 1; // Don't count trailing null
-        return CHIP_NO_ERROR;
-    }
-    else
-    {
-        outLen = 0;
-        return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
-    }
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen)
 {
-    int32_t success = 0;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = getPref_bin_new(key.Namespace, key.Name, buf, bufSize, &outLen);
-    if (success != 0)
+    error = getPref_bin_new(key.Namespace, key.Name, buf, bufSize, &outLen);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "getPref_bin_new: %s/%s failed\n", StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
+        outLen = 0;
     }
 
-    if (success == 0)
-    {
-        return CHIP_NO_ERROR;
-    }
-    else
-    {
-        outLen = 0;
-        return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
-    }
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::WriteConfigValue(Key key, bool val)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
     uint8_t value;
 
     if (val == 1)
         value = 1;
     else
         value = 0;
-    success = setPref_new(key.Namespace, key.Name, &value, 1);
-    if (!success)
+
+    if (checkExist(key.Name, key.Name))
+    {
+        err = ClearConfigValue(key);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old KVS value");
+        }
+    }
+
+    error = setPref_new(key.Namespace, key.Name, &value, 1);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "setPref: %s/%s = %s failed\n", StringOrNullMarker(key.Namespace), StringOrNullMarker(key.Name),
                      value ? "true" : "false");
@@ -202,15 +204,26 @@
                         val ? "true" : "false");
     }
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::WriteConfigValue(Key key, uint32_t val)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = setPref_new(key.Namespace, key.Name, (uint8_t *) &val, sizeof(uint32_t));
-    if (!success)
+    if (checkExist(key.Name, key.Name))
+    {
+        err = ClearConfigValue(key);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old KVS value");
+        }
+    }
+
+    error = setPref_new(key.Namespace, key.Name, (uint8_t *) &val, sizeof(uint32_t));
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "setPref: %s/%s = %d(0x%x) failed\n", StringOrNullMarker(key.Namespace),
                      StringOrNullMarker(key.Name), val, val);
@@ -221,15 +234,26 @@
                         StringOrNullMarker(key.Name), val, val);
     }
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::WriteConfigValue(Key key, uint64_t val)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = setPref_new(key.Namespace, key.Name, (uint8_t *) &val, sizeof(uint64_t));
-    if (!success)
+    if (checkExist(key.Name, key.Name))
+    {
+        err = ClearConfigValue(key);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old KVS value");
+        }
+    }
+
+    error = setPref_new(key.Namespace, key.Name, (uint8_t *) &val, sizeof(uint64_t));
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "setPref: %s/%s = %d(0x%x) failed\n", StringOrNullMarker(key.Namespace),
                      StringOrNullMarker(key.Name), val, val);
@@ -240,15 +264,26 @@
                         StringOrNullMarker(key.Name), val, val);
     }
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::WriteConfigValueStr(Key key, const char * str)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = setPref_new(key.Namespace, key.Name, (uint8_t *) str, strlen(str) + 1);
-    if (!success)
+    if (checkExist(key.Name, key.Name))
+    {
+        err = ClearConfigValue(key);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old KVS value");
+        }
+    }
+
+    error = setPref_new(key.Namespace, key.Name, (uint8_t *) str, strlen(str) + 1);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "setPref: %s/%s = %s failed\n", StringOrNullMarker(key.Namespace), StringOrNullMarker(key.Name),
                      StringOrNullMarker(str));
@@ -258,7 +293,8 @@
         ChipLogProgress(DeviceLayer, "NVS set: %s/%s = \"%s\"", StringOrNullMarker(key.Namespace), StringOrNullMarker(key.Name),
                         StringOrNullMarker(str));
     }
-    return CHIP_NO_ERROR;
+
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen)
@@ -279,10 +315,21 @@
 
 CHIP_ERROR AmebaConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = setPref_new(key.Namespace, key.Name, (uint8_t *) data, dataLen);
-    if (!success)
+    if (checkExist(key.Name, key.Name))
+    {
+        err = ClearConfigValue(key);
+        if (err != CHIP_NO_ERROR)
+        {
+            ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old KVS value");
+        }
+    }
+
+    error = setPref_new(key.Namespace, key.Name, (uint8_t *) data, dataLen);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "setPref: %s/%s failed\n", StringOrNullMarker(key.Namespace), StringOrNullMarker(key.Name));
     }
@@ -292,15 +339,17 @@
                         StringOrNullMarker(key.Name), dataLen);
     }
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ClearConfigValue(Key key)
 {
-    int32_t success;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = deleteKey(key.Namespace, key.Name);
-    if (!success)
+    error = deleteKey(key.Namespace, key.Name);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "%s : %s/%s failed\n", __FUNCTION__, StringOrNullMarker(key.Namespace),
                         StringOrNullMarker(key.Name));
@@ -310,7 +359,7 @@
         ChipLogProgress(DeviceLayer, "NVS erase: %s/%s", StringOrNullMarker(key.Namespace), StringOrNullMarker(key.Name));
     }
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 bool AmebaConfig::ConfigValueExists(Key key)
@@ -320,40 +369,50 @@
 
 CHIP_ERROR AmebaConfig::InitNamespace()
 {
-    int32_t success = -1;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = registerPref();
-    if (success != 0)
+    error = registerPref();
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "DCT modules registration failed");
+        goto exit;
     }
 
-    success = registerPref2();
-    if (success != 0)
+    error = registerPref2();
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "DCT2 modules registration failed");
     }
 
-    return CHIP_NO_ERROR;
+exit:
+    return err;
 }
 
 CHIP_ERROR AmebaConfig::ClearNamespace()
 {
-    int32_t success = -1;
+    CHIP_ERROR err;
+    int32_t error;
 
-    success = clearPref();
-    if (success != 0)
+    error = clearPref();
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "DCT modules unregistration failed\n");
+        goto exit;
     }
 
-    success = clearPref2();
-    if (success != 0)
+    error = clearPref2();
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogError(DeviceLayer, "DCT2 modules unregistration failed\n");
     }
 
-    return CHIP_NO_ERROR;
+exit:
+    return err;
 }
 
 void AmebaConfig::RunConfigUnitTest() {}
diff --git a/src/platform/Ameba/AmebaUtils.cpp b/src/platform/Ameba/AmebaUtils.cpp
index 578ffab..12118df 100644
--- a/src/platform/Ameba/AmebaUtils.cpp
+++ b/src/platform/Ameba/AmebaUtils.cpp
@@ -40,10 +40,10 @@
 
 CHIP_ERROR AmebaUtils::StartWiFi(void)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
     // Ensure that the WiFi layer is started.
-    matter_wifi_on(RTW_MODE_STA);
-    return err;
+    int32_t error  = matter_wifi_on(RTW_MODE_STA);
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
+    return CHIP_NO_ERROR; // will fail if wifi is already initialized, let it pass
 }
 
 CHIP_ERROR AmebaUtils::IsStationEnabled(bool & staEnabled)
@@ -60,22 +60,23 @@
 
 CHIP_ERROR AmebaUtils::IsStationConnected(bool & connected)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    connected      = (matter_wifi_is_connected_to_ap() == RTW_SUCCESS) ? 1 : 0;
+    int32_t error  = matter_wifi_is_connected_to_ap();
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
+    connected      = (err == CHIP_NO_ERROR) ? true : false;
     return err;
 }
 
 CHIP_ERROR AmebaUtils::EnableStationMode(void)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
     // Ensure that station mode is enabled in the WiFi layer.
-    matter_wifi_set_mode(RTW_MODE_STA);
+    int32_t error  = matter_wifi_set_mode(RTW_MODE_STA);
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
     return err;
 }
 
 CHIP_ERROR AmebaUtils::SetWiFiConfig(rtw_wifi_config_t * config)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
+    CHIP_ERROR err;
     // don't store if ssid is null
     if (config->ssid[0] == 0)
     {
@@ -95,7 +96,7 @@
 
 CHIP_ERROR AmebaUtils::GetWiFiConfig(rtw_wifi_config_t * config)
 {
-    CHIP_ERROR err        = CHIP_NO_ERROR;
+    CHIP_ERROR err;
     size_t ssidLen        = 0;
     size_t credentialsLen = 0;
 
@@ -117,8 +118,8 @@
 CHIP_ERROR AmebaUtils::ClearWiFiConfig()
 {
     /* Clear Wi-Fi Configurations in Storage */
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    err            = PersistedStorage::KeyValueStoreMgr().Delete(kWiFiSSIDKeyName);
+    CHIP_ERROR err;
+    err = PersistedStorage::KeyValueStoreMgr().Delete(kWiFiSSIDKeyName);
     SuccessOrExit(err);
 
     err = PersistedStorage::KeyValueStoreMgr().Delete(kWiFiCredentialsKeyName);
@@ -130,43 +131,46 @@
 
 CHIP_ERROR AmebaUtils::WiFiDisconnect(void)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    ChipLogProgress(DeviceLayer, "matter_wifi_disconnect");
-    err = (matter_wifi_disconnect() == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL;
+    ChipLogProgress(DeviceLayer, "Disconnecting WiFi");
+    int32_t error  = matter_wifi_disconnect();
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
+    if (err == CHIP_NO_ERROR)
+    {
+        ChipLogProgress(DeviceLayer, "matter_lwip_releaseip");
+        matter_lwip_releaseip();
+    }
     return err;
 }
 
 CHIP_ERROR AmebaUtils::WiFiConnectProvisionedNetwork(void)
 {
-    CHIP_ERROR err             = CHIP_NO_ERROR;
     rtw_wifi_config_t * config = (rtw_wifi_config_t *) pvPortMalloc(sizeof(rtw_wifi_config_t));
     memset(config, 0, sizeof(rtw_wifi_config_t));
     GetWiFiConfig(config);
     ChipLogProgress(DeviceLayer, "Connecting to AP : [%s]", (char *) config->ssid);
-    int ameba_err = matter_wifi_connect((char *) config->ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) config->password,
+    int32_t error  = matter_wifi_connect((char *) config->ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) config->password,
                                         strlen((const char *) config->ssid), strlen((const char *) config->password), 0, nullptr);
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
 
     vPortFree(config);
-    err = (ameba_err == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL;
     return err;
 }
 
 CHIP_ERROR AmebaUtils::WiFiConnect(const char * ssid, const char * password)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
     ChipLogProgress(DeviceLayer, "Connecting to AP : [%s]", (char *) ssid);
-    int ameba_err = matter_wifi_connect((char *) ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) password, strlen(ssid),
+    int32_t error  = matter_wifi_connect((char *) ssid, RTW_SECURITY_WPA_WPA2_MIXED, (char *) password, strlen(ssid),
                                         strlen(password), 0, nullptr);
-    err           = (ameba_err == RTW_SUCCESS) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL;
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
     return err;
 }
 
 CHIP_ERROR AmebaUtils::SetCurrentProvisionedNetwork()
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
     rtw_wifi_setting_t pSetting;
-    int ret = matter_get_sta_wifi_info(&pSetting);
-    if (ret < 0)
+    int32_t error  = matter_get_sta_wifi_info(&pSetting);
+    CHIP_ERROR err = MapError(error, AmebaErrorType::kWiFiError);
+    if (err != CHIP_NO_ERROR)
     {
         ChipLogProgress(DeviceLayer, "STA No Wi-Fi Info");
         goto exit;
@@ -197,3 +201,52 @@
 exit:
     return err;
 }
+
+CHIP_ERROR AmebaUtils::MapError(int32_t error, AmebaErrorType type)
+{
+    if (type == AmebaErrorType::kDctError)
+    {
+        return MapDctError(error);
+    }
+    if (type == AmebaErrorType::kFlashError)
+    {
+        return MapFlashError(error);
+    }
+    if (type == AmebaErrorType::kWiFiError)
+    {
+        return MapWiFiError(error);
+    }
+    return CHIP_ERROR_INTERNAL;
+}
+
+CHIP_ERROR AmebaUtils::MapDctError(int32_t error)
+{
+    if (error == DCT_SUCCESS)
+        return CHIP_NO_ERROR;
+    if (error == DCT_ERR_NO_MEMORY)
+        return CHIP_ERROR_NO_MEMORY;
+    if (error == DCT_ERR_NOT_FIND)
+        return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
+    if (error == DCT_ERR_SIZE_OVER)
+        return CHIP_ERROR_INVALID_ARGUMENT;
+    if (error == DCT_ERR_MODULE_BUSY)
+        return CHIP_ERROR_BUSY;
+
+    return CHIP_ERROR_INTERNAL;
+}
+
+CHIP_ERROR AmebaUtils::MapFlashError(int32_t error)
+{
+    if (error == 1)
+        return CHIP_NO_ERROR;
+
+    return CHIP_ERROR_INTERNAL;
+}
+
+CHIP_ERROR AmebaUtils::MapWiFiError(int32_t error)
+{
+    if (error == RTW_SUCCESS)
+        return CHIP_NO_ERROR;
+
+    return CHIP_ERROR_INTERNAL;
+}
diff --git a/src/platform/Ameba/AmebaUtils.h b/src/platform/Ameba/AmebaUtils.h
index 5fcc5c9..c1fa81b 100644
--- a/src/platform/Ameba/AmebaUtils.h
+++ b/src/platform/Ameba/AmebaUtils.h
@@ -24,6 +24,13 @@
 namespace DeviceLayer {
 namespace Internal {
 
+enum class AmebaErrorType
+{
+    kDctError,
+    kFlashError,
+    kWiFiError,
+};
+
 class AmebaUtils
 {
 public:
@@ -39,6 +46,14 @@
     static CHIP_ERROR WiFiConnectProvisionedNetwork(void);
     static CHIP_ERROR WiFiConnect(const char * ssid, const char * password);
     static CHIP_ERROR SetCurrentProvisionedNetwork(void);
+    static CHIP_ERROR WiFiConnect(void);
+
+    static CHIP_ERROR MapError(int32_t error, AmebaErrorType type);
+
+private:
+    static CHIP_ERROR MapDctError(int32_t error);
+    static CHIP_ERROR MapFlashError(int32_t error);
+    static CHIP_ERROR MapWiFiError(int32_t error);
 };
 
 } // namespace Internal
diff --git a/src/platform/Ameba/ConfigurationManagerImpl.cpp b/src/platform/Ameba/ConfigurationManagerImpl.cpp
index 16d7a8f..b3c6cbf 100644
--- a/src/platform/Ameba/ConfigurationManagerImpl.cpp
+++ b/src/platform/Ameba/ConfigurationManagerImpl.cpp
@@ -25,6 +25,7 @@
 #include <platform/internal/CHIPDeviceLayerInternal.h>
 
 #include <platform/Ameba/AmebaConfig.h>
+#include <platform/Ameba/AmebaUtils.h>
 #include <platform/ConfigurationManager.h>
 #include <platform/DiagnosticDataProvider.h>
 #include <platform/internal/GenericConfigurationManagerImpl.ipp>
@@ -152,13 +153,22 @@
 
 CHIP_ERROR ConfigurationManagerImpl::GetPrimaryWiFiMACAddress(uint8_t * buf)
 {
+    CHIP_ERROR err;
+    int32_t error;
+
     char temp[32];
     uint32_t mac[ETH_ALEN];
-    int i = 0;
-
-    wifi_get_mac_address(temp);
-
     char * token = strtok(temp, ":");
+    int i        = 0;
+
+    error = matter_wifi_get_mac_address(temp);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kWiFiError);
+    if (err != CHIP_NO_ERROR)
+    {
+        ChipLogError(DeviceLayer, "Failed to get mac address");
+        goto exit;
+    }
+
     while (token != NULL)
     {
         mac[i] = (uint32_t) strtol(token, NULL, 16);
@@ -169,7 +179,8 @@
     for (i = 0; i < ETH_ALEN; i++)
         buf[i] = mac[i] & 0xFF;
 
-    return CHIP_NO_ERROR;
+exit:
+    return err;
 }
 
 bool ConfigurationManagerImpl::CanFactoryReset()
@@ -188,10 +199,6 @@
     AmebaConfig::Key configKey{ AmebaConfig::kConfigNamespace_ChipCounters, key };
 
     CHIP_ERROR err = ReadConfigValue(configKey, value);
-    if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
-    {
-        err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
-    }
     return err;
 }
 
diff --git a/src/platform/Ameba/ConnectivityManagerImpl.cpp b/src/platform/Ameba/ConnectivityManagerImpl.cpp
index ba289b1..d42886b 100644
--- a/src/platform/Ameba/ConnectivityManagerImpl.cpp
+++ b/src/platform/Ameba/ConnectivityManagerImpl.cpp
@@ -524,7 +524,7 @@
         {
             WiFiStationState prevState = mWiFiStationState;
             ChangeWiFiStationState(kWiFiStationState_NotConnected);
-            if (prevState != kWiFiStationState_Connecting_Failed)
+            if (prevState == kWiFiStationState_Connecting_Failed)
             {
                 ChipLogProgress(DeviceLayer, "WiFi station failed to connect");
                 // TODO: check retry count if exceeded, then clearwificonfig
@@ -858,13 +858,13 @@
 
 void ConnectivityManagerImpl::DHCPProcessThread(void * param)
 {
-    matter_lwip_dhcp(0, DHCP_START);
+    matter_lwip_dhcp();
     PlatformMgr().LockChipStack();
     sInstance.OnStationIPv4AddressAvailable();
     PlatformMgr().UnlockChipStack();
 #if LWIP_VERSION_MAJOR > 2 || LWIP_VERSION_MINOR > 0
 #if LWIP_IPV6
-    matter_lwip_dhcp(0, DHCP6_START);
+    matter_lwip_dhcp6();
     PlatformMgr().LockChipStack();
     sInstance.OnIPv6AddressAvailable();
     PlatformMgr().UnlockChipStack();
diff --git a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp
index b9f2f01..ab1f243 100644
--- a/src/platform/Ameba/DiagnosticDataProviderImpl.cpp
+++ b/src/platform/Ameba/DiagnosticDataProviderImpl.cpp
@@ -25,10 +25,13 @@
 
 #include <crypto/CHIPCryptoPAL.h>
 #include <lib/support/CHIPMemString.h>
+#include <platform/Ameba/AmebaUtils.h>
 #include <platform/Ameba/DiagnosticDataProviderImpl.h>
 
 #include <lwip_netconf.h>
 
+using namespace chip::DeviceLayer::Internal;
+
 namespace chip {
 namespace DeviceLayer {
 
@@ -248,19 +251,25 @@
 #if CHIP_DEVICE_CONFIG_ENABLE_WIFI
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBssId(MutableByteSpan & BssId)
 {
+    CHIP_ERROR err;
+    int32_t error;
+
     constexpr size_t bssIdSize = 6;
     VerifyOrReturnError(BssId.size() >= bssIdSize, CHIP_ERROR_BUFFER_TOO_SMALL);
 
-    if (wifi_get_ap_bssid(BssId.data()) != 0)
+    error = matter_wifi_get_ap_bssid(BssId.data());
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kWiFiError);
+
+    if (err != CHIP_NO_ERROR)
     {
-        return CHIP_ERROR_READ_FAILED;
+        return err;
     }
 
     BssId.reduce_size(bssIdSize);
     ChipLogProgress(DeviceLayer, "%02x,%02x,%02x,%02x,%02x,%02x\n", BssId.data()[0], BssId.data()[1], BssId.data()[2],
                     BssId.data()[3], BssId.data()[4], BssId.data()[5]);
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiVersion(app::Clusters::WiFiNetworkDiagnostics::WiFiVersionEnum & wifiVersion)
@@ -273,20 +282,25 @@
 
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiSecurityType(app::Clusters::WiFiNetworkDiagnostics::SecurityTypeEnum & securityType)
 {
+    CHIP_ERROR err;
+    int32_t error;
+
     using app::Clusters::WiFiNetworkDiagnostics::SecurityTypeEnum;
 
     unsigned int _auth_type;
-    unsigned short _security = 0;
+    unsigned short security = 0;
     rtw_wifi_setting_t setting;
 
-#ifdef CONFIG_PLATFORM_8721D
-    if (wext_get_enc_ext("wlan0", &_security, &setting.key_idx, setting.password) < 0)
+    error = matter_wifi_get_security_type("wlan0", &security, &setting.key_idx, setting.password);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kWiFiError);
+    if (err != CHIP_NO_ERROR)
     {
         securityType = SecurityTypeEnum::kUnspecified;
     }
+#ifdef CONFIG_PLATFORM_8721D
     else
     {
-        switch (_security)
+        switch (security)
         {
         case IW_ENCODE_ALG_NONE:
             securityType = SecurityTypeEnum::kNone;
@@ -306,14 +320,9 @@
         }
     }
 #else
-    wext_get_enc_ext("wlan0", &_security, &setting.key_idx, setting.password);
-    if (wext_get_auth_type("wlan0", &_auth_type) < 0)
-    {
-        securityType = SecurityTypeEnum::kUnspecified;
-    }
     else
     {
-        switch (_security)
+        switch (security)
         {
         case IW_ENCODE_ALG_NONE:
             securityType = SecurityTypeEnum::kNone;
@@ -342,30 +351,40 @@
     }
 #endif
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiChannelNumber(uint16_t & channelNumber)
 {
+    CHIP_ERROR err;
+    int32_t error;
     unsigned char channel;
 
-    if (wext_get_channel("wlan0", &channel) < 0)
+    error = matter_wifi_get_wifi_channel_number("wlan0", &channel);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kWiFiError);
+    if (err != CHIP_NO_ERROR)
         channelNumber = 0;
     else
         channelNumber = (uint16_t) channel;
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiRssi(int8_t & rssi)
 {
-    int _rssi = 0;
-    if (wifi_get_rssi(&_rssi) < 0)
-        rssi = 0;
-    else
-        rssi = _rssi;
+    CHIP_ERROR err;
+    int32_t error;
 
-    return CHIP_NO_ERROR;
+    error = matter_wifi_get_rssi((int *) &rssi);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kWiFiError);
+
+    if (err != CHIP_NO_ERROR)
+    {
+        // set rssi to 0 upon error
+        rssi = 0;
+    }
+
+    return err;
 }
 
 CHIP_ERROR DiagnosticDataProviderImpl::GetWiFiBeaconLostCount(uint32_t & beaconLostCount)
diff --git a/src/platform/Ameba/FactoryDataDecoder.cpp b/src/platform/Ameba/FactoryDataDecoder.cpp
index 3c6874b..4e3536e 100644
--- a/src/platform/Ameba/FactoryDataDecoder.cpp
+++ b/src/platform/Ameba/FactoryDataDecoder.cpp
@@ -17,29 +17,28 @@
 
 #include "FactoryDataDecoder.h"
 #include "chip_porting.h"
+#include <platform/Ameba/AmebaUtils.h>
 #include <platform/internal/CHIPDeviceLayerInternal.h>
 
+using namespace chip::DeviceLayer::Internal;
+
 namespace chip {
 namespace DeviceLayer {
 
 CHIP_ERROR FactoryDataDecoder::ReadFactoryData(uint8_t * buffer, uint16_t * pfactorydata_len)
 {
-    uint32_t ret = 0;
-    ret          = ReadFactory(buffer, pfactorydata_len);
-    if (ret != 1)
-        return CHIP_ERROR_INTERNAL;
+    int32_t error  = ReadFactory(buffer, pfactorydata_len);
+    CHIP_ERROR err = AmebaUtils::MapError(error, AmebaErrorType::kFlashError);
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 CHIP_ERROR FactoryDataDecoder::DecodeFactoryData(uint8_t * buffer, FactoryData * fdata, uint16_t factorydata_len)
 {
-    uint32_t ret = 0;
-    ret          = DecodeFactory(buffer, fdata, factorydata_len);
-    if (ret != 0)
-        return CHIP_ERROR_INTERNAL;
+    int32_t error  = DecodeFactory(buffer, fdata, factorydata_len);
+    CHIP_ERROR err = AmebaUtils::MapError(error, AmebaErrorType::kFlashError);
 
-    return CHIP_NO_ERROR;
+    return err;
 }
 
 } // namespace DeviceLayer
diff --git a/src/platform/Ameba/KeyValueStoreManagerImpl.cpp b/src/platform/Ameba/KeyValueStoreManagerImpl.cpp
index 1fede31..282d58c 100644
--- a/src/platform/Ameba/KeyValueStoreManagerImpl.cpp
+++ b/src/platform/Ameba/KeyValueStoreManagerImpl.cpp
@@ -23,9 +23,12 @@
 /* this file behaves like a config.h, comes first */
 #include "FreeRTOS.h"
 #include "chip_porting.h"
+#include <platform/Ameba/AmebaUtils.h>
 #include <platform/KeyValueStoreManager.h>
 #include <support/CodeUtils.h>
 
+using namespace chip::DeviceLayer::Internal;
+
 namespace chip {
 namespace DeviceLayer {
 namespace PersistedStorage {
@@ -35,99 +38,79 @@
 CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size,
                                           size_t offset_bytes)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    int32_t ret    = -1;
+    CHIP_ERROR err;
+    int32_t error;
 
     if (!value)
     {
-        return (err = CHIP_ERROR_INVALID_ARGUMENT);
+        err = CHIP_ERROR_INVALID_ARGUMENT;
+        goto exit;
     }
 
     if (offset_bytes > 0)
     {
         // Offset and partial reads are not supported in nvs, for now just return NOT_IMPLEMENTED. Support can be added in the
         // future if this is needed.
-        return (err = CHIP_ERROR_NOT_IMPLEMENTED);
+        err = CHIP_ERROR_NOT_IMPLEMENTED;
+        goto exit;
     }
 
     if (read_bytes_size)
     {
-        ret = getPref_bin_new(key, key, (uint8_t *) value, value_size, read_bytes_size);
+        error = getPref_bin_new(key, key, (uint8_t *) value, value_size, read_bytes_size);
+        err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
     }
     else
     {
         size_t * dummy_read_bytes_size = (size_t *) pvPortMalloc(sizeof(size_t));
         if (!dummy_read_bytes_size)
         {
-            return CHIP_ERROR_INTERNAL;
+            err = CHIP_ERROR_INTERNAL;
+            goto exit;
         }
-        ret = getPref_bin_new(key, key, (uint8_t *) value, value_size, dummy_read_bytes_size);
+        error = getPref_bin_new(key, key, (uint8_t *) value, value_size, dummy_read_bytes_size);
+        err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
         vPortFree(dummy_read_bytes_size);
     }
-    switch (ret)
-    {
-    case 0:
-        return CHIP_NO_ERROR;
-    case -6:
-        return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
-    case -7:
-        return CHIP_ERROR_INVALID_ARGUMENT;
-    case -8:
-        return CHIP_ERROR_BUFFER_TOO_SMALL;
-    default:
-        break;
-    }
 
-    return CHIP_ERROR_INTERNAL;
+exit:
+    return err;
 }
 
 CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size)
 {
-    CHIP_ERROR err = CHIP_NO_ERROR;
-    int32_t ret    = -1;
+    CHIP_ERROR err;
+    int32_t error;
 
     if (!value)
     {
-        return (err = CHIP_ERROR_INVALID_ARGUMENT);
+        err = CHIP_ERROR_INVALID_ARGUMENT;
+        goto exit;
     }
 
     if (checkExist(key, key))
     {
-        ret = deleteKey(key, key);
-        if (ret != 0)
+        error = deleteKey(key, key);
+        err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
+        if (err != CHIP_NO_ERROR)
         {
             ChipLogError(DeviceLayer, "Warning, KVS leakage, failed to remove old kvs value");
         }
     }
 
-    ret = setPref_new(key, key, (uint8_t *) value, value_size);
+    error = setPref_new(key, key, (uint8_t *) value, value_size);
+    err   = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
 
-    if (TRUE == ret)
-        err = CHIP_NO_ERROR;
-    else
-        err = CHIP_ERROR_INTERNAL;
-
+exit:
     return err;
 }
 
 CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key)
 {
-    int32_t ret = deleteKey(key, key);
-    switch (ret)
-    {
-    case 0:
-        return CHIP_NO_ERROR;
-    case -6:
-        return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
-    case -7:
-        return CHIP_ERROR_INVALID_ARGUMENT;
-    case -8:
-        return CHIP_ERROR_BUFFER_TOO_SMALL;
-    default:
-        break;
-    }
+    int32_t error  = deleteKey(key, key);
+    CHIP_ERROR err = AmebaUtils::MapError(error, AmebaErrorType::kDctError);
 
-    return CHIP_ERROR_INTERNAL;
+    return err;
 }
 
 } // namespace PersistedStorage
diff --git a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
index 38be3f2..914e4f3 100644
--- a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
@@ -127,10 +127,13 @@
 CHIP_ERROR AmebaWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, const char * key, uint8_t keyLen)
 {
     CHIP_ERROR err = CHIP_NO_ERROR;
+    bool connected;
+
     // If device is already connected to WiFi, then disconnect the WiFi,
-    // clear the WiFi configurations and add the newly provided WiFi configurations.
-    if (chip::DeviceLayer::Internal::AmebaUtils::IsStationProvisioned())
+    chip::DeviceLayer::Internal::AmebaUtils::IsStationConnected(connected);
+    if (connected)
     {
+        ConnectivityMgrImpl().ChangeWiFiStationState(ConnectivityManager::kWiFiStationState_Disconnecting);
         ChipLogProgress(DeviceLayer, "Disconnecting WiFi station interface");
         err = chip::DeviceLayer::Internal::AmebaUtils::WiFiDisconnect();
         if (err != CHIP_NO_ERROR)
@@ -138,6 +141,11 @@
             ChipLogError(DeviceLayer, "WiFiDisconnect() failed");
             return err;
         }
+    }
+
+    // clear the WiFi configurations and add the newly provided WiFi configurations.
+    if (chip::DeviceLayer::Internal::AmebaUtils::IsStationProvisioned())
+    {
         err = chip::DeviceLayer::Internal::AmebaUtils::ClearWiFiConfig();
         if (err != CHIP_NO_ERROR)
         {
@@ -146,9 +154,12 @@
         }
     }
 
-    ConnectivityMgrImpl().ChangeWiFiStationState(ConnectivityManager::kWiFiStationState_Connecting);
+    DeviceLayer::ConnectivityManager::WiFiStationState state = DeviceLayer::ConnectivityManager::kWiFiStationState_Connecting;
+    DeviceLayer::SystemLayer().ScheduleLambda([state, ssid, key]() {
+        ConnectivityMgrImpl().ChangeWiFiStationState(state);
+        chip::DeviceLayer::Internal::AmebaUtils::WiFiConnect(ssid, key);
+    });
 
-    err = chip::DeviceLayer::Internal::AmebaUtils::WiFiConnect(ssid, key);
     return err;
 }
 
@@ -304,7 +315,7 @@
 CHIP_ERROR AmebaWiFiDriver::SetLastDisconnectReason(const ChipDeviceEvent * event)
 {
     VerifyOrReturnError(event->Type == DeviceEventType::kRtkWiFiStationDisconnectedEvent, CHIP_ERROR_INVALID_ARGUMENT);
-    mLastDisconnectedReason = wifi_get_last_error(); // TODO: change this to wrapper
+    mLastDisconnectedReason = matter_wifi_get_last_error();
     return CHIP_NO_ERROR;
 }
 
diff --git a/src/platform/Ameba/PlatformManagerImpl.cpp b/src/platform/Ameba/PlatformManagerImpl.cpp
index 0b89c4a..33ad2a6 100644
--- a/src/platform/Ameba/PlatformManagerImpl.cpp
+++ b/src/platform/Ameba/PlatformManagerImpl.cpp
@@ -39,7 +39,7 @@
 PlatformManagerImpl PlatformManagerImpl::sInstance;
 
 extern "C" {
-extern int rtw_get_random_bytes(void * dst, size_t size);
+extern int rtw_get_random_bytes(void * dst, uint32_t size);
 }
 static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
 {
diff --git a/src/platform/Ameba/SystemTimeSupport.cpp b/src/platform/Ameba/SystemTimeSupport.cpp
index 57e5d86..5b7d03b 100644
--- a/src/platform/Ameba/SystemTimeSupport.cpp
+++ b/src/platform/Ameba/SystemTimeSupport.cpp
@@ -28,14 +28,10 @@
 #include <platform/Ameba/SystemTimeSupport.h>
 #include <support/logging/CHIPLogging.h>
 
-#include "rtc_api.h"
 #include "task.h"
+#include <chip_porting.h>
 #include <time.h>
 
-extern void rtc_init(void);
-extern time_t rtc_read(void);
-extern void rtc_write(time_t t);
-
 struct rtkTimeVal
 {
     uint32_t tv_sec;  /* seconds */
@@ -69,7 +65,7 @@
     time_t seconds;
     struct rtkTimeVal tv;
 
-    seconds = rtc_read();
+    seconds = matter_rtc_read();
 
     tv.tv_sec  = (uint32_t) seconds;
     tv.tv_usec = 0;
@@ -98,8 +94,8 @@
     struct rtkTimeVal tv;
     tv.tv_sec  = static_cast<uint32_t>(aNewCurTime.count() / UINT64_C(1000000));
     tv.tv_usec = static_cast<uint32_t>(aNewCurTime.count() % UINT64_C(1000000));
-    rtc_init();
-    rtc_write(tv.tv_sec);
+    matter_rtc_init();
+    matter_rtc_write(tv.tv_sec);
 
     return CHIP_NO_ERROR;
 }
