Skip to content

Commit f1e837e

Browse files
kkasperczyk-noArekBalysNordic
authored andcommitted
samples: matter: Enabled use of OT without Zephyr L2
Pulled Matter change that enabled by default usage of openthread without Zephyr L2 networking. Signed-off-by: Kamil Kasperczyk <[email protected]>
1 parent cc14948 commit f1e837e

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ Gazell
172172
Matter
173173
------
174174

175-
* Added FastTrack Recertification and Portfolio Certification programs.
175+
* Added:
176+
177+
* FastTrack Recertification and Portfolio Certification programs.
178+
* Matter-over-Thread apps can now use the OpenThread API directly, instead of using intermediate Zephyr L2 layer.
179+
This change significantly reduces memory usage in Matter applications.
180+
On the :zephyr:board:`nrf54l15dk`, it saves approximately 15 kB of RAM and 40 kB of flash.
176181

177182
* Updated:
178183

@@ -515,6 +520,7 @@ Matter samples
515520
* Added:
516521

517522
* Support for the NFC onboarding for the ``nrf54l15dk/nrf54l15/cpuapp/ns`` board target.
523+
* Disabled usage of Zephyr L2 networking layer in favor of using the OpenThread API directly in the Matter over Thread applications.
518524

519525
* Updated:
520526

samples/matter/common/src/app/matter_init.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
#ifdef CONFIG_OPENTHREAD
5454
#include <platform/OpenThread/GenericNetworkCommissioningThreadDriver.h>
55+
#include <openthread.h>
5556
#endif
5657

5758
#include <app/InteractionModelEngine.h>
@@ -194,6 +195,18 @@ CHIP_ERROR InitNetworkingStack()
194195
return error;
195196
}
196197

198+
#if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT
199+
void LockOpenThreadTask(void)
200+
{
201+
chip::DeviceLayer::ThreadStackMgr().LockThreadStack();
202+
}
203+
204+
void UnlockOpenThreadTask(void)
205+
{
206+
chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack();
207+
}
208+
#endif /* CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT */
209+
197210
#elif defined(CONFIG_CHIP_WIFI)
198211

199212
CHIP_ERROR InitNetworkingStack()
@@ -205,7 +218,7 @@ CHIP_ERROR InitNetworkingStack()
205218
return CHIP_NO_ERROR;
206219
}
207220
#else
208-
#error "No valid L2 network backend selected");
221+
#error "No valid networking backend selected");
209222
#endif /* CONFIG_OPENTHREAD */
210223

211224
#define VerifyInitResultOrReturn(ec, msg) \
@@ -238,7 +251,7 @@ void DoInitChipServer(intptr_t /* unused */)
238251
VerifyInitResultOrReturn(sInitResult, "Custom pre server initialization failed");
239252
}
240253

241-
/* Initialize L2 networking backend. */
254+
/* Initialize networking backend. */
242255
sInitResult = InitNetworkingStack();
243256
VerifyInitResultOrReturn(sInitResult, "Cannot initialize IPv6 networking stack");
244257

@@ -291,6 +304,15 @@ void DoInitChipServer(intptr_t /* unused */)
291304
/* The default CommissionableDataProvider is set internally in the GenericConfigurationManagerImpl::Init(). */
292305
#endif
293306

307+
#if CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT
308+
// Set up OpenThread configuration when OpenThread is included
309+
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
310+
nativeParams.lockCb = LockOpenThreadTask;
311+
nativeParams.unlockCb = UnlockOpenThreadTask;
312+
nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance();
313+
sLocalInitData.mServerInitParams->endpointNativeParams = static_cast<void *>(&nativeParams);
314+
#endif /* CHIP_SYSTEM_CONFIG_USE_OPENTHREAD_ENDPOINT */
315+
294316
#ifdef CONFIG_NCS_SAMPLE_MATTER_SETTINGS_SHELL
295317
VerifyOrReturn(Nrf::PersistentStorageShell::Init(),
296318
LOG_ERR("Matter settings shell has been enabled, but it cannot be initialized."));

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ manifest:
157157
- name: matter
158158
repo-path: sdk-connectedhomeip
159159
path: modules/lib/matter
160-
revision: b1a600e3613187046a9a3cfa61886ad3e73c9885
160+
revision: pull/621/head
161161
west-commands: scripts/west/west-commands.yml
162162
submodules:
163163
- name: nlio

0 commit comments

Comments
 (0)