coexistence: fix protocol switch back to Zigbee#122
Conversation
94036db to
8f8db7c
Compare
Documentation PreviewThe documentation has been built successfully. You can view the preview here: preview Generated at: Expand to view changed pagesNo documentation files were changed in this PR.
|
8f8db7c to
b5a426d
Compare
There was a problem hiding this comment.
Pull request overview
This PR hardens the Zigbee↔Matter coexistence runtime to prevent OpenThread from starting while Zigbee owns the 802.15.4 radio, and improves the Matter→Zigbee→Matter switch path by ensuring a clean Zigbee NWK Leave before tearing down ZBOSS (to avoid TCLK mismatch on re-join).
Changes:
- Disables OpenThread autostart at build time and adds explicit “start Thread if commissioned” logic after radio handover.
- Adds pre-/post-Matter-server-init hooks to safely switch the 802.15.4 callbacks dispatcher during
InitThreadStack()/StartServer(). - Defers Matter switch until ZBOSS sends a NWK Leave, wiring the leave completion signal through the sample.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| subsys/lib/zigbee_matter_coexistence/Kconfig | Updates help text to reflect new signaling path. |
| subsys/lib/zigbee_matter_coexistence/coexistence.cpp | Adds dispatcher handover hooks, explicit Thread start, and Zigbee leave gating before switch. |
| subsys/lib/zigbee_matter_coexistence/CMakeLists.txt | Forces CHIP_DEVICE_CONFIG_ENABLE_THREAD_AUTOSTART=0 for coexistence builds. |
| samples/light_switch/src/app_task_zigbee.c | Forwards ZBOSS leave completion to coexistence runtime. |
| samples/light_switch/src/app_task_matter.cpp | Integrates new pre-/post-server-init coexistence hooks. |
| samples/light_bulb/src/app_task_matter.cpp | Integrates new pre-/post-server-init coexistence hooks. |
| include/zigbee/matter_coexistence.h | Updates/extends public coexistence API for new integration flow and leave signaling. |
| docs/includes/matter_extension_protocol_switch.txt | Documents new integration call sites and behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b5a426d to
8fc6a59
Compare
|
Addressed Copilot comments. |
ArekBalysNordic
left a comment
There was a problem hiding this comment.
Added some comments to improve semaphors in coexistence.
I think we should do a similar thing for app_task_zigbee in the light bulb.
For example in the line 594 as:
#ifdef CONFIG_ZIGBEE_MATTER_COEXISTENCE
if (bufid) {
zb_zdo_app_signal_hdr_t *sig_handler = nullptr;
zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &sig_handler);
if (sig == ZB_ZDO_SIGNAL_LEAVE &&
ZB_ZDO_APP_SIGNAL_STATUS(sig_handler) == RET_OK) {
zb_zdo_signal_leave_params_t *leave_params =
ZB_ZDO_SIGNAL_GET_PARAMS(sig_handler, zb_zdo_signal_leave_params_t);
if (leave_params->leave_type == ZB_NWK_LEAVE_TYPE_RESET) {
/* Unblock a pending Matter switch deferred until Leave completes. */
zigbee_matter_coexistence_on_zboss_leave_signal();
}
}
}
#endif
ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
``
To reflect the same case as for light switch.
8fc6a59 to
f6e76da
Compare
A bus fault in the openthread thread was triggered when InitThreadStack() auto-started the radio stack while Zigbee still owned the 802.15.4 radio. Disable CHIP_DEVICE_CONFIG_ENABLE_THREAD_AUTOSTART via a CMake compile definition so OpenThread never starts autonomously; the coexistence runtime starts Thread explicitly once the radio dispatcher is handed over. On the Matter→Zigbee switch, kill ZBOSS only after sending a clean NWK Leave so the coordinator removes the device's unique TCLK entry. This prevents the fresh-join TCLK mismatch that caused the coordinator to fail the Transport-Key delivery after the next reboot. Introduce zigbee_matter_coexistence_on_server_started() as the single entry point that samples call unconditionally after StartServer(). It encapsulates the BT_ADV_WHILE_ZIGBEE/FabricCount branching that was previously duplicated in every sample's AppTask::Init(). Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Add zigbee_matter_coexistence_handle_zboss_signal() so samples forward bufid before the default handler instead of duplicating leave parsing. Wire the helper into the light bulb and light switch samples. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
f6e76da to
56a715e
Compare
I've moved the checks to the coex module. See |
A bus fault in the openthread thread was triggered when InitThreadStack() auto-started the radio stack while Zigbee still owned the 802.15.4 radio. Disable CHIP_DEVICE_CONFIG_ENABLE_THREAD_AUTOSTART via a CMake compile definition so OpenThread never starts autonomously; the coexistence runtime starts Thread explicitly once the radio dispatcher is handed over.
On the Matter→Zigbee switch, kill ZBOSS only after sending a clean NWK Leave so the coordinator removes the device's unique TCLK entry. This prevents the fresh-join TCLK mismatch that caused the coordinator to fail the Transport-Key delivery after the next reboot.