[NXP] fix issue when joining predefined wifi AP (#35091)

diff --git a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h
index 28e2603..ba2321c 100644
--- a/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h
+++ b/src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h
@@ -118,3 +118,7 @@
 #ifndef CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM
 #define CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM 1
 #endif // CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM
+
+#ifndef CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL
+#define CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL 300
+#endif // CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL in Milliseconds
diff --git a/src/platform/nxp/common/CHIPDevicePlatformEvent.h b/src/platform/nxp/common/CHIPDevicePlatformEvent.h
index 5c6a5c3..2f0947b 100644
--- a/src/platform/nxp/common/CHIPDevicePlatformEvent.h
+++ b/src/platform/nxp/common/CHIPDevicePlatformEvent.h
@@ -70,6 +70,7 @@
     kPlatformNxpIpChangeEvent,
     kPlatformNxpStartWlanConnectEvent,
     kPlatformNxpScanWiFiNetworkDoneEvent,
+    kPlatformNxpStartWlanInitWaitTimerEvent,
 };
 
 } // namespace DeviceEventType
diff --git a/src/platform/nxp/common/ConnectivityManagerImpl.cpp b/src/platform/nxp/common/ConnectivityManagerImpl.cpp
index 9c3eb7f..09d716a 100644
--- a/src/platform/nxp/common/ConnectivityManagerImpl.cpp
+++ b/src/platform/nxp/common/ConnectivityManagerImpl.cpp
@@ -162,6 +162,11 @@
         NetworkCommissioning::NXPWiFiDriver::GetInstance().ScanWiFINetworkDoneFromMatterTaskContext(
             event->Platform.ScanWiFiNetworkCount);
     }
+    else if (event->Type == kPlatformNxpStartWlanInitWaitTimerEvent)
+    {
+        DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kWlanInitWaitMs), ConnectNetworkTimerHandler,
+                                              (void *) event->Platform.pNetworkDataEvent);
+    }
 #endif
 }
 
@@ -662,10 +667,10 @@
     }
     else
     {
-        PlatformMgr().LockChipStack();
-        DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL),
-                                              ConnectNetworkTimerHandler, context);
-        PlatformMgr().UnlockChipStack();
+        /* Post an event to start a delay timer asynchronously in the Matter task context */
+        event.Type                       = DeviceEventType::kPlatformNxpStartWlanInitWaitTimerEvent;
+        event.Platform.pNetworkDataEvent = (struct wlan_network *) context;
+        (void) PlatformMgr().PostEvent(&event);
     }
 }
 
diff --git a/src/platform/nxp/common/ConnectivityManagerImpl.h b/src/platform/nxp/common/ConnectivityManagerImpl.h
index 9327e4d..a187d0b 100644
--- a/src/platform/nxp/common/ConnectivityManagerImpl.h
+++ b/src/platform/nxp/common/ConnectivityManagerImpl.h
@@ -144,6 +144,7 @@
 
     BitFlags<GenericConnectivityManagerImpl_WiFi::ConnectivityFlags> mFlags;
     static netif_ext_callback_t sNetifCallback;
+    static constexpr uint32_t kWlanInitWaitMs = CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL;
 
 #if CHIP_ENABLE_OPENTHREAD
     static constexpr uint8_t kMaxIp6Addr = 3;