diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 6a0d0d389a92e2..26e5dd35496282 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -210,9 +210,10 @@ extern "C" void app_main() { ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } bool lowPowerClusterSleep() diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 4972e775bd6f31..8a9a74e4c7f124 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -186,8 +186,9 @@ extern "C" void app_main() ESP_LOGE(TAG, "GetAppTask().StartAppTask() failed : %" CHIP_ERROR_FORMAT, error.Format()); } - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } bool lowPowerClusterSleep() diff --git a/examples/energy-management-app/esp32/main/main.cpp b/examples/energy-management-app/esp32/main/main.cpp index 9e1dff9b43b745..9dff90bf9443cb 100644 --- a/examples/energy-management-app/esp32/main/main.cpp +++ b/examples/energy-management-app/esp32/main/main.cpp @@ -294,7 +294,8 @@ extern "C" void app_main() #endif SetDeviceAttestationCredentialsProvider(get_dac_provider()); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } diff --git a/examples/light-switch-app/esp32/main/main.cpp b/examples/light-switch-app/esp32/main/main.cpp index f8127433f14f60..564639327e7b65 100644 --- a/examples/light-switch-app/esp32/main/main.cpp +++ b/examples/light-switch-app/esp32/main/main.cpp @@ -19,6 +19,7 @@ #include "DeviceCallbacks.h" #include #include +#include #include "AppTask.h" #include "BindingHandler.h" @@ -135,21 +136,10 @@ extern "C" void app_main() SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD - if (DeviceLayer::ThreadStackMgr().InitThreadStack() != CHIP_NO_ERROR) - { - ESP_LOGE(TAG, "Failed to initialize Thread stack"); - return; - } - if (DeviceLayer::ThreadStackMgr().StartThreadTask() != CHIP_NO_ERROR) - { - ESP_LOGE(TAG, "Failed to launch Thread task"); - return; - } -#endif - chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + ESPOpenThreadInit(); + error = GetAppTask().StartAppTask(); if (error != CHIP_NO_ERROR) { diff --git a/examples/lighting-app/esp32/main/main.cpp b/examples/lighting-app/esp32/main/main.cpp index 120c004782c895..ba3edee4669e86 100644 --- a/examples/lighting-app/esp32/main/main.cpp +++ b/examples/lighting-app/esp32/main/main.cpp @@ -210,10 +210,11 @@ extern "C" void app_main() #endif SetDeviceAttestationCredentialsProvider(get_dac_provider()); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + ESPOpenThreadInit(); + error = GetAppTask().StartAppTask(); if (error != CHIP_NO_ERROR) { diff --git a/examples/lit-icd-app/esp32/main/main.cpp b/examples/lit-icd-app/esp32/main/main.cpp index 4bb736b219eabd..04565a922b3bb5 100644 --- a/examples/lit-icd-app/esp32/main/main.cpp +++ b/examples/lit-icd-app/esp32/main/main.cpp @@ -130,10 +130,11 @@ extern "C" void app_main() #else SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER - ESPOpenThreadInit(); static UatButton sButton; sButton.Init(UAT_GPIO, ESP_EXT1_WAKEUP_ANY_LOW); sButton.SetUatButtonPressCallback(UatButtonHandler); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } diff --git a/examples/thermostat/nxp/zap/thermostat_matter_br.matter b/examples/thermostat/nxp/zap/thermostat_matter_br.matter index 1ba87a1fbd58b5..e2847b561b4cc1 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_br.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_br.matter @@ -291,56 +291,6 @@ cluster Identify = 3 { command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } -/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ -cluster Identify = 3 { - revision 4; - - enum EffectIdentifierEnum : enum8 { - kBlink = 0; - kBreathe = 1; - kOkay = 2; - kChannelChange = 11; - kFinishEffect = 254; - kStopEffect = 255; - } - - enum EffectVariantEnum : enum8 { - kDefault = 0; - } - - enum IdentifyTypeEnum : enum8 { - kNone = 0; - kLightOutput = 1; - kVisibleIndicator = 2; - kAudibleBeep = 3; - kDisplay = 4; - kActuator = 5; - } - - attribute int16u identifyTime = 0; - readonly attribute IdentifyTypeEnum identifyType = 1; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; - - request struct IdentifyRequest { - int16u identifyTime = 0; - } - - request struct TriggerEffectRequest { - EffectIdentifierEnum effectIdentifier = 0; - EffectVariantEnum effectVariant = 1; - } - - /** Command description for Identify */ - command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; - /** Command description for TriggerEffect */ - command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; -} - /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; @@ -2423,7 +2373,6 @@ endpoint 0 { endpoint 1 { device type ma_thermostat = 769, version 1; - binding cluster Identify; server cluster Identify { ram attribute identifyTime default = 0x0000; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_br.zap b/examples/thermostat/nxp/zap/thermostat_matter_br.zap index b4973ba5ca1245..02efbc71935f32 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_br.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_br.zap @@ -2999,32 +2999,6 @@ "deviceTypeCode": 769, "deviceTypeProfileId": 259, "clusters": [ - { - "name": "Identify", - "code": 3, - "mfgCode": null, - "define": "IDENTIFY_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "Identify", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "TriggerEffect", - "code": 64, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - } - ] - }, { "name": "Identify", "code": 3, diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter index af687b2ba11bcb..db8bc803bffdbf 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.matter @@ -291,56 +291,6 @@ cluster Identify = 3 { command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } -/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ -cluster Identify = 3 { - revision 4; - - enum EffectIdentifierEnum : enum8 { - kBlink = 0; - kBreathe = 1; - kOkay = 2; - kChannelChange = 11; - kFinishEffect = 254; - kStopEffect = 255; - } - - enum EffectVariantEnum : enum8 { - kDefault = 0; - } - - enum IdentifyTypeEnum : enum8 { - kNone = 0; - kLightOutput = 1; - kVisibleIndicator = 2; - kAudibleBeep = 3; - kDisplay = 4; - kActuator = 5; - } - - attribute int16u identifyTime = 0; - readonly attribute IdentifyTypeEnum identifyType = 1; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; - - request struct IdentifyRequest { - int16u identifyTime = 0; - } - - request struct TriggerEffectRequest { - EffectIdentifierEnum effectIdentifier = 0; - EffectVariantEnum effectVariant = 1; - } - - /** Command description for Identify */ - command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; - /** Command description for TriggerEffect */ - command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; -} - /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; @@ -2348,7 +2298,6 @@ endpoint 0 { endpoint 1 { device type ma_thermostat = 769, version 1; - binding cluster Identify; server cluster Identify { ram attribute identifyTime default = 0x0000; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap index 8917a97d4261ee..2542a8023caa35 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap @@ -3752,32 +3752,6 @@ "deviceTypeCode": 769, "deviceTypeProfileId": 259, "clusters": [ - { - "name": "Identify", - "code": 3, - "mfgCode": null, - "define": "IDENTIFY_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "Identify", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "TriggerEffect", - "code": 64, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - } - ] - }, { "name": "Identify", "code": 3, diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter index 825a527c59b155..12daa4885ee26d 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.matter @@ -291,56 +291,6 @@ cluster Identify = 3 { command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; } -/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ -cluster Identify = 3 { - revision 4; - - enum EffectIdentifierEnum : enum8 { - kBlink = 0; - kBreathe = 1; - kOkay = 2; - kChannelChange = 11; - kFinishEffect = 254; - kStopEffect = 255; - } - - enum EffectVariantEnum : enum8 { - kDefault = 0; - } - - enum IdentifyTypeEnum : enum8 { - kNone = 0; - kLightOutput = 1; - kVisibleIndicator = 2; - kAudibleBeep = 3; - kDisplay = 4; - kActuator = 5; - } - - attribute int16u identifyTime = 0; - readonly attribute IdentifyTypeEnum identifyType = 1; - readonly attribute command_id generatedCommandList[] = 65528; - readonly attribute command_id acceptedCommandList[] = 65529; - readonly attribute event_id eventList[] = 65530; - readonly attribute attrib_id attributeList[] = 65531; - readonly attribute bitmap32 featureMap = 65532; - readonly attribute int16u clusterRevision = 65533; - - request struct IdentifyRequest { - int16u identifyTime = 0; - } - - request struct TriggerEffectRequest { - EffectIdentifierEnum effectIdentifier = 0; - EffectVariantEnum effectVariant = 1; - } - - /** Command description for Identify */ - command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; - /** Command description for TriggerEffect */ - command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; -} - /** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ cluster Descriptor = 29 { revision 2; @@ -2213,7 +2163,6 @@ endpoint 0 { endpoint 1 { device type ma_thermostat = 769, version 1; - binding cluster Identify; server cluster Identify { ram attribute identifyTime default = 0x0000; diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap index 7012d1ba11a95e..da639e7bc2cd08 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -2999,32 +2999,6 @@ "deviceTypeCode": 769, "deviceTypeProfileId": 259, "clusters": [ - { - "name": "Identify", - "code": 3, - "mfgCode": null, - "define": "IDENTIFY_CLUSTER", - "side": "client", - "enabled": 1, - "commands": [ - { - "name": "Identify", - "code": 0, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - }, - { - "name": "TriggerEffect", - "code": 64, - "mfgCode": null, - "source": "client", - "isIncoming": 0, - "isEnabled": 1 - } - ] - }, { "name": "Identify", "code": 3, diff --git a/examples/thread-br-app/esp32/main/main.cpp b/examples/thread-br-app/esp32/main/main.cpp index dcafcc1c74ae40..a03e29d6031097 100644 --- a/examples/thread-br-app/esp32/main/main.cpp +++ b/examples/thread-br-app/esp32/main/main.cpp @@ -149,9 +149,10 @@ extern "C" void app_main() SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); #endif // CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER esp_openthread_set_backbone_netif(esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")); - ESPOpenThreadInit(); chip::DeviceLayer::PlatformMgr().ScheduleWork(InitServer, reinterpret_cast(nullptr)); + + ESPOpenThreadInit(); } extern "C" void otSysProcessDrivers(otInstance * aInstance) diff --git a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp index bf056d2e37ced9..6f41bf798742e4 100644 --- a/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp +++ b/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-provider.cpp @@ -248,8 +248,6 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a #if CHIP_DEVICE_CONFIG_THREAD_FTD uint8_t maxRouterId = otThreadGetMaxRouterId(otInst); - CHIP_ERROR chipErr = CHIP_ERROR_INCORRECT_STATE; - for (uint8_t i = 0; i <= maxRouterId; i++) { if (otThreadGetRouterInfo(otInst, i, &routerInfo) == OT_ERROR_NONE) @@ -268,11 +266,10 @@ CHIP_ERROR WriteThreadNetworkDiagnosticAttributeToTlv(AttributeId attributeId, a routeTable.linkEstablished = routerInfo.mLinkEstablished; ReturnErrorOnFailure(aEncoder.Encode(routeTable)); - chipErr = CHIP_NO_ERROR; } } - - return chipErr; + // Returning empty list with no error in case thread network is not up + return CHIP_NO_ERROR; #else // OPENTHREAD_MTD otError otErr = otThreadGetParentInfo(otInst, &routerInfo); diff --git a/src/lib/shell/streamer_nxp.cpp b/src/lib/shell/streamer_nxp.cpp index 355015ce8f1ddd..6e71198ecde9b6 100644 --- a/src/lib/shell/streamer_nxp.cpp +++ b/src/lib/shell/streamer_nxp.cpp @@ -221,6 +221,9 @@ ssize_t streamer_nxp_read(streamer_t * streamer, char * buffer, size_t length) if (bytesRead == 0) { readDone = true; + /* Return -1 to cancel the cli command, this command is empty as we are reading uart input until it + is empty but for matter shell empty command is meaning stop the shell loop */ + return -1; } } diff --git a/src/platform/nxp/common/Logging.cpp b/src/platform/nxp/common/Logging.cpp index 671a8dcbb123ef..aa22376fa9da46 100644 --- a/src/platform/nxp/common/Logging.cpp +++ b/src/platform/nxp/common/Logging.cpp @@ -34,6 +34,9 @@ namespace chip { namespace Logging { namespace Platform { +#if (configSUPPORT_STATIC_ALLOCATION == 1) +StaticSemaphore_t xLoggingSemaphoreBuffer; +#endif /** * CHIP log output function. @@ -41,6 +44,13 @@ namespace Platform { */ void LogV(const char * module, uint8_t category, const char * msg, va_list v) { +#if (configSUPPORT_STATIC_ALLOCATION == 1) + static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutexStatic(&xLoggingSemaphoreBuffer); +#else + static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutex(); +#endif + assert(xLoggingSemaphore != NULL); + char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE] = { 0 }; size_t prefixLen; @@ -77,7 +87,9 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) /* Add CR+LF */ snprintf(formattedMsg + prefixLen, sizeof(formattedMsg) - prefixLen, "%s", "\r\n"); + xSemaphoreTake(xLoggingSemaphore, portMAX_DELAY); PRINTF("%s", formattedMsg); + xSemaphoreGive(xLoggingSemaphore); } /**