itead / Sonoff_Zigbee_Dongle_Firmware

155 stars 18 forks source link

[REQUEST] ZDongle-E Silicon Labs RCP (Radio Co-Processor) firmware concurrent multiprotocol Zigbee and OpenThread #5

Open Hedda opened 1 year ago

Hedda commented 1 year ago

Request a Silicon Labs RCP (Radio Co-Processor) firmware image for ITead Sonoff Zigbee 3.0 USB Dongle Plus V2 (ZBDongle-E) that can support concurrent Zigbee and OpenThread multiprotocol similar to the upcoming "Home Assistant SkyConnect USB Stick", see:

https://github.com/zigpy/zigpy/discussions/894

and

https://community.home-assistant.io/t/home-assistant-skyconnect-usb-stick-announced-will-be-compatible-with-both-zigbee-and-thread-including-matter-chip-over-thread/433594

Update: These are the three network protocol application firmware variants are available from Silicon Labs for EFR32 family:

Your "ZBDongle-E" USB adapter is based on Silabs EFR32MG21 chip and it is possible to build an RCP (Radio Co-Processor) firmware for it, and the specific RCP Multi-PAN firmware can then in turn be used by supporting applications as a dumb radio co-processor mode which offloads the Zigbee stack and the OpenThread stack to the system CPU on the host system which in turn runs zigbeed (Zigbee Daemon) and t-daemon (OpenThread Daemon).

External reference explaining these different co-processor designs at a high level:

Short term goal would be to provide firmware for existing Silabs EFR32MG1x and EFR32MG1x based adapters that should be compatible with the "SiliconLabs Zigbee/OpenThread Multiprotocol Add-on" and "OpenThread Border Router Add-on" that Home Assistant developer agners (Nabu Casa employee Stefan Agner) is currently developing. Check out:

https://github.com/zigpy/zigpy/discussions/894

https://github.com/home-assistant/addons-development/tree/master/silabs-multiprotocol

https://github.com/home-assistant/addons-development/tree/master/openthread_border_router

https://github.com/agners

https://community.home-assistant.io/u/agners/summary

https://groups.google.com/g/openthread-users/

The main reason for this request is that an "RPC" firmware with OTBR (OpenThread Border Router) support will make your adapter will be compatible with upcoming Thread based "Matter" (Project CHIP / Connected Home over IP) devices if used in Home Assistant with their other add-ons for the that is also in development. This addon by agners requires that the radio hard a firmware in "RPC" mode instead of the no traditional "NCP" mode:

https://github.com/home-assistant/addons-development/tree/master/chip_controller_repl

https://github.com/home-assistant/addons-development/tree/master/chip_tool

https://github.com/project-chip/connectedhomeip

https://buildwithmatter.com

https://csa-iot.org/all-solutions/matter/

OTBR have a list of certified chips under "Thread Certified Component" which currently lists EFR32MG12, EFR32MG13. and EFR32MG21:

https://github.com/openthread/ot-efr32

https://github.com/openthread/openthread/tree/main/examples/platforms

https://openthread.io/vendors/silicon-labs

https://www.threadgroup.org/What-is-Thread/Thread-Benefits#certifiedproducts

Tagging @Daniel-zhan-itead as ITead project manager of the Sonoff ZDongle-E USB dongle.

PS: Elelabs have also by the way have RCP firmware for EFR32MG21 but it is only meant for their upcoming new USB adapter that I understand is still in development:

https://github.com/Elelabs/elelabs-zigbee-ezsp-utility/blob/master/README.md

https://github.com/Elelabs/elelabs-zigbee-ezsp-utility/tree/master/data/EFR32MG21

PPS: Reposting this request here as this question was just asked regarding ZDongle-E adapter in Home Assistant community forum here:

https://community.home-assistant.io/t/openthread-rpc-zbdongle-e/465390

Hedda commented 1 year ago

FYI, Silicon Labs Zigbee EmberZNet SDK 7.1.0.0 (from Silabs Gecko SDK Suite 4.1) has added initial/experimental Alpha support for "Concurrent Multiprotocol Zigbee in NCP mode and OpenThread in RCP mode" which I guess means that could have a multiprotocol firmware that is simultaneously backwards compatible with an Zigbee NCP application as well as also compatible OpenThread RPC application support too at the same time?

https://github.com/SiliconLabs/gecko_sdk/releases

Silabs Zigbee EmberZNet SDK 7.1.0.0

https://www.silabs.com/documents/public/release-notes/emberznet-release-notes-7.1.0.0.pdf

OpenThread SDK 2.1.0.0 for Silabs

https://www.silabs.com/documents/public/release-notes/open-thread-release-notes-2.1.0.0.pdf

New in release 7.1.0.0

The Z3GatewayCpc application has been added a host-side application that can send and receive EZSP frames using CPC. This application is meant to work with an NCP application that also uses the CPC feature. This application requires the CPC daemon to be running on the host. CPC setup is described in https://github.com/SiliconLabs/cpc-daemon/blob/main/readme.md.

Two Zigbee - NCP + OpenThread – RCP applications have been added, one for UART and one for SPI. These applications demonstrate the Zigbee NCP and OpenThread RCP running concurrently using an RTOS. For more information on these applications, see AN1333: Running Zigbee, OpenThread, and Bluetooth Concurrently on a Linux Host with a Multiprotocol RCP.

https://www.silabs.com/documents/public/application-notes/an1333-concurrent-protocols-with-802-15-4-rcp.pdf

Hedda commented 1 year ago

FYI, looks like Nabu Casa developers are working experimental RCP Multi-PAN firmware image that is not compatible with NCP:

https://github.com/NabuCasa/silabs-firmware

https://github.com/NabuCasa/silabs-firmware/tree/main/RCPMultiPAN

Nabu Casa developers are also working on NCP + RPC beta firmware to make Home Assistant SkyConnect backwards-compatible:

https://github.com/NabuCasa/silabs-firmware/tree/main/EmberZNetAndOpenThreadRCP/beta

The reason for this is that Home Assistant 2022.12 has now been released with initial multiprotocol support Zigbee and Thread (including Matter over Thread) with "Home Assistant SkyConnect" USB adapter and "Home Assistant Yellow" embedded radio:

https://www.crowdsupply.com/nabu-casa/home-assistant-yellow/updates/more-yellows-shipping-and-thread-plus-matter-updates

https://www.home-assistant.io/blog/2022/12/07/release-202212/

https://community.home-assistant.io/t/home-assistant-skyconnect-usb-stick-announced-will-be-compatible-with-both-zigbee-and-thread-including-matter-chip-over-thread/433594/

Looks like as an experimental feature user can choose RPC Multi-PAN firmware for multiprotocol support is flashed if the user chooses to enable multiprotocol support in the "Home Assistant SkyConnect" and "Home Assistant Yellow" add-ons for Home Assistant, which is listed as an experimental feature. And at this point, moving back to an EmberZNet Zigbee NCP firmware requires manually reflashing the adapter.

RPC Multi-PAN firmware requires that the application support connecting to Zigbeed (Silicon Labs Zigbee Daemon) via socket to be able to use for ezsp adapters wih EmberZNet RPC firmware (instead of EmberZNet NCP firmware).

image

Hedda commented 1 year ago

FYI, for those wanting to experiment with Multi-PAN RCP firmware for OpenThread/Thread on ITead's Sonoff ZBDongle-E USB dongles you should know that skgsergio has compiled and published unofficial SiLabs Multi-PAN RPC firmware images for ZB-GW04 USB dongle (from EasyIoT / eWeSmart Store) which used the same EFR32MG21 SoC and has a board that is pin-compatible so if flashed should allow you to enable multiprotocol support to use Thread/OpenThread using Sonoff Dongle-E with the Home Assistant's Silicon Labs Multiprotocol Addon, and while not optimized for the antenna used on the ITead's Sonoff ZBDongle-E USB dongle board it should at least on paper technically work for a lab if want to test it:

https://github.com/skgsergio/silabs-multiprotocol-firmware-zbgw04-usb

also read:

https://github.com/xsp1989/zigbeeFirmware/issues/32

To go further down the rabbit hole read and follow the developers + advanced beta-tester's ongoing bleeding-edge discussions/tests here:

https://github.com/zigpy/zigpy/discussions/894

That firmware and use case is of course all highly experimental so use at your own risk and do not expect anything to work out-of-the-box even with the right type of firmware:

https://www.home-assistant.io/blog/2023/02/08/state-of-matter-and-thread/

Note that you currently need to use Home Assistant Operating System for the Home Assistant's Silicon Labs Multiprotocol Addon and its dependencies to work properly

https://github.com/home-assistant/addons/tree/master/silabs-multiprotocol

https://github.com/NabuCasa/universal-silabs-flasher

https://github.com/NabuCasa/silabs-firmware-builder

https://www.home-assistant.io/integrations/thread

https://www.home-assistant.io/integrations/matter

PS: Regardless be sure to take the actions suggested in this best practice guide for Zigbee to avoid electromagnetic interference which will also affect Thread/OpenThread communication -> https://community.home-assistant.io/t/guide-for-zigbee-interference-avoidance-and-network-range-coverage-optimization/515752

ksjh commented 1 year ago

I played a bit with the NabuCasa firmware builder and created a fork that aims at supporting more dongles. Most of the magic happens in github actions. I just tested the generated ZBDongle-E (115200 baud) firmware briefly, it seems to work so far. Please feel free to test, fork and create pull requests. The code is located at ksjh/silabs-firmware-builder.

P1X3L8 commented 1 year ago

I played a bit with the NabuCasa firmware builder and created a fork that aims at supporting more dongles. Most of the magic happens in github actions. I just tested the generated ZBDongle-E (115200 baud) firmware briefly, it seems to work so far. Please feel free to test, fork and create pull requests. The code is located at ksjh/silabs-firmware-builder.

Can you share the fw you compiled for the ZBDongle-E? I'd like to test this without having to build the docker container. Thank you.

ksjh commented 1 year ago

Can you share the fw you compiled for the ZBDongle-E? I'd like to test this without having to build the docker container. Thank you.

They are already on github, but rather hard to find (github builds them automatically after commits to the repo). On the top of the github page, under "Actions", you can find previous runs and "Artifacts" (lower part of the page of one run), e.g., the output of a previous run of the actions. The names of the resulting files are not that clear, the file rcp-uart-802154-zbdonglee.zip is the right one for the ZBDongle-E with RTS-CTS handshaking with 115200 baud. Among other things, it contains the required firmware file build/release/rcp-uart-802154.gbl.

P1X3L8 commented 1 year ago

ksjh, thank you. I tried both of these fw (115200 and 230400 baud) using the .gbl to flash in securecrt with xmodem. Both are seen in HA, but I can't get either to work with the Silicon Labs Concurrent Multiprotocol or OpenThread Border Router add-ons. Also, the normal discovery of SONOFF Zigbee 3.0 USB Dongle Plus V2 fails to initialize under devices & services. I'm probably doing something wrong.

ksjh commented 1 year ago

I just re-flashed my ZBDongle-E with the 115200 baud firmware I mentioned above. It works in my setup of Home Assistant with the Silicon Labs Multiprotocol add-on version 1.0.1. Perhaps we should continue the discussion on my firmware builder repo, you can open an issue or start a discussion there. We can thus avoid clutter in this issue, since it is not really relevant for this issue and repo.

P1X3L8 commented 1 year ago

I just noticed I was still using the older beta and not the official release 1.0.1. It's working now, thank you for the info. I'll update your github if I find any new issues. Thanks again!

wastez commented 1 year ago

Hello,

I want also to experiment with this firmware on a dongle-e. right now I’m using fw version 7.1.1. Does anybody know if the zigbee devices will still work which i added already to zigbee2mqtt if I’m going to flash this fw?

Would be great if someone can answer this.

Hedda commented 1 year ago

Perhaps we should continue the discussion on my firmware builder repo, you can open an issue or start a discussion there. We can thus avoid clutter in this issue, since it is not really relevant for this issue and repo.

Yes please do! 👍 Instead post to -> https://github.com/ksjh/silabs-firmware-builder/discussions (can also additional unofficial firmware images and tools in https://github.com/darkxst/silabs-firmware-builder and https://github.com/darkxst/multipan_flasher)

Guys! Please, respect this is a specific feature request to ITead/Sonoff so please avoid going off on a tangent with off-topic topics.

This issue is not the place to ask for support/help on how to flash firmware or use in various third-party software applications. etc..

9c97a6c65ca737844e48b4aec14d57d64a9e6ff0
image

Does anybody know if the zigbee devices will still work which i added already to zigbee2mqtt if I’m going to flash this fw?

That is really off-topic here so great if instead ask such questions in Z2M community -> https://github.com/Koenkk/zigbee2mqtt/

But FYI, if you read https://github.com/Koenkk/zigbee-herdsman/issues/319 you know that while backup of ezsp adapter has been implemented in zigbee-herdsman code the function to restore has not yet, but know can do so manually with zigpy-cli https://github.com/zigpy/zigpy-cli

francisp2 commented 10 months ago

Would love official support for multiprotocol from Sonoff. I tried some alternatives, but none worked.

wastez commented 10 months ago

Would love official support for multiprotocol from Sonoff. I tried some alternatives, but none worked.

But they are working.

So you flashed rcp firmware and installed the silabs addon after it and configured it as it should? In silabs you have to configure the serial device and if you use for example zigbee2mqtt you have to configure the network port instead the serial device.

Then it will work if everything is configured correctly.

Hedda commented 10 months ago

Yes unofficial firmware images should work but again that is off-topic discussions as this is a request for official firmware images.

Please instead post discussions/questions about unofficial firmware on other (unofficial) forums or repositories, like for example:

Hedda commented 2 weeks ago

Note! While Multi-PAN RCP (multiprotocol) for concurrent Zigbee and OpenThread running on a single SoC radio adapter is still supported it is no longer recommended by the community. Instead it is for now only recommended to use separate dedicated radio adapters for each IoT wireless protocol. For reference see links and dicussion here:

FYI, Be aware that the RCP MultiPAN in multiprotocol mode is no longer recommended because running multi-protocol with multiple active networks on a single radio adapter has proven to not be stable when using Zigbee and Thread network protocols simultaneously on the same radio adapter, it also increases the complexity of software component dependencies needed, so if already using RCP Multi-PAN then it is highly recommended that you plan to migrate to separate dedicated radio adapters instead, (using Zigbee NCP and Thread RCP firmware respectively), even if using RCP MultiPAN on a single radio adapter dongle has been working fine for you so far.