GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bitEngineTech/bitengine-hub-zigbee-ncp: EFR32MG24 Zigbee 3.0 NCP (EmberZNet / EZSP) for bitEngine Hub — Simplicity Studio project, bootloader and release images

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
config
config
 
 
docs
docs
 
 
ncp
ncp
 
 
release
release
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
NOTICE
NOTICE
 
 
README.md
README.md
 
 
build_ncp.sh
build_ncp.sh
 
 
build_railtest.sh
build_railtest.sh
 
 
commander_path.txt
commander_path.txt
 
 
flash_mg24.bat
flash_mg24.bat
 
 
flash_mg24.sh
flash_mg24.sh
 
 
flash_mg24_simple.bat
flash_mg24_simple.bat
 
 
ncp_image_check.py
ncp_image_check.py
 
 
ncp_probe.py
ncp_probe.py
 
 
ncp_stress.py
ncp_stress.py
 
 
nvm3_budget.py
nvm3_budget.py
 
 
nvm3_stats.py
nvm3_stats.py
 
 
ota_mg24.ps1
ota_mg24.ps1
 
 
ota_mg24.sh
ota_mg24.sh
 
 
regress.sh
regress.sh
 
 
zigbee_walk.sh
zigbee_walk.sh
 
 

Repository files navigation

bitEngine Hub — EFR32MG24 Zigbee NCP firmware

Zigbee 3.0 coordinator firmware for the Silicon Labs EFR32MG24 (EFR32MG24B020F1536IM40) in the bitEngine Hub. The MG24 runs Silicon Labs EmberZNet 8.2.2 as a Network Co-Processor (NCP) and speaks EZSP (protocol version 18) over UART at 460800 baud with RTS/CTS flow control to the hub's ESP32-C5. The ESP32-C5 forwards the EZSP byte stream unchanged to TCP port 6638, where Home Assistant connects to it (ZHA, or Zigbee2MQTT with the ember adapter).

Status: pre-release. Images and interfaces may still change before the first tagged release.

  • Host-side firmware (ESP32-C5): bitengine-hub-firmware
  • Hardware: bitengine-hub-hardware

This repository is also used as the mg24/ submodule of the firmware repository. The ESP32-C5 build embeds release/mg24_gbl_signing_key.pub, and the ESP32-C5 updates the MG24 over the UART link through the Gecko Bootloader (XMODEM).

Repository layout

Path Contents
ncp/ The NCP project: bitengine_ncp.slcp (derived from the SDK example zigbee_ncp_uart_hw), app.c, main.c, the XNCP and TX-power sources, ref/ (transcript of the upstream country table), test_host/ (host-side tests and wire-format vectors), check_table.py, VERIFY.sh
config/ UART configuration of the NCP application (sl_iostream_usart_vcom_config.h). The Gecko Bootloader's UART header is a Silicon Labs MSLA template and is not redistributed; its values are listed in docs/building.md
release/ Release images, SHA256SUMS, the GBL signing public key and ncp_version.txt (see Release images)
build_ncp.sh Builds, checks and signs the NCP image — see docs/building.md
build_railtest.sh Builds Silicon Labs' RAILtest radio test application so it can be loaded through the hub without touching the bootloader or NVM3 — see docs/building.md
flash_mg24.sh, flash_mg24.bat SWD (J-Link) programming of bootloader + NCP with Simplicity Commander; verify SHA256SUMS first
flash_mg24_simple.bat Minimal ASCII-only Windows fallback of the above; does not verify SHA256SUMS
commander_path.txt Tells the Windows scripts where commander.exe is installed
ota_mg24.sh, ota_mg24.ps1 Update the NCP through the hub's REST API, then check the UART link — see docs/flashing.md
ncp_image_check.py Refuses images that would boot-loop on a chip that has run this release (NVM3 cache guard)
ncp_probe.py Asks the NCP directly whether it still holds its Zigbee network (use it around firmware changes)
ncp_stress.py Stress test for concurrent in-flight unicasts on the NCP
nvm3_budget.py Build-time check that the NVM3 cache can hold every token object
nvm3_stats.py Decoder for the NVM3 statistics returned by private XNCP command 0x7002
regress.sh Regression checks against a running hub (parts of it need the firmware repository)
zigbee_walk.sh Coverage walk helper for a ZHA installation in Docker
docs/ Building, flashing and updates, TX power and region, changelog

build_ncp.sh, build_railtest.sh, regress.sh and ncp/VERIFY.sh expect to run inside a checkout of the firmware repository, where this repository is the mg24/ submodule.

Both sides must be paired

The UART settings of the MG24 and the ESP32-C5 are coupled. Updating only one side breaks the link:

MG24 (this repository) ESP32-C5 (firmware repository)
Baud rate 460800, in both the bootloader and the NCP application CONFIG_BITENGINE_MG24_BOOTLOADER_BAUD=460800
Hardware flow control RTS/CTS (usartHwFlowControlCtsAndRts; bootloader SL_SERIAL_UART_FLOW_CONTROL 1) CONFIG_BITENGINE_EZSP_HW_FLOWCTRL=y

If flow control is enabled on only one side, the link stalls: with flow control on in the ESP32-C5 but not in the MG24, the ESP32-C5 waits forever for a CTS signal the MG24 never drives. Transmission blocks permanently and Zigbee is silently dead — no error, no log line, just silence. This applies to any NCP image you load, including your own or third-party builds: they must use 460800 baud and RTS/CTS on the same UART.

To check the link on a running hub (both update scripts do this automatically):

curl -u ":<password>" -X POST http://<hub-ip>/api/v1/diag/uart   # start the test
curl -u ":<password>"         http://<hub-ip>/api/v1/diag/uart   # poll the result

Expect tx_blocked=false, ncp_alive=true and uart_rx_errors=0. tx_blocked=true is exactly the one-sided flow-control fault. (The hub uses HTTP Basic authentication and only checks the password; omit -u if no password is set.)

What differs from the Silicon Labs example

The NCP is derived from the Simplicity SDK 2025.6.3 example protocol/zigbee/app/projects/ncp/zigbee_ncp_uart_hw. The SDK tree itself is not patched. The differences are:

  • UART (NCP application and bootloader): 115200 → 460800 baud, flow control none → RTS/CTS, and the peripheral/pin assignment of the hub board. The SDK only ships pin configurations for Silicon Labs development kits; for a custom board these values have to be filled in (config/).
  • Added SDK components:
    • zigbee_xncp — vendor extension commands carried in EZSP customFrame, used for the region-based TX power cap and chip information (docs/tx-power.md).
    • bootloader_interface — links the application at 0x08006000, above the Gecko Bootloader.
    • zigbee_token_interface — lets the host read and write NVM3 tokens over EZSP, so ZHA and Zigbee2MQTT can rewrite the coordinator's IEEE address when migrating a network (otherwise bellows can only write it once, permanently, to the USERDATA page). Nabu Casa's NCP builds include it too.
  • Sources: app.c replaces the example's app.c (keeping its required callbacks), main.c is the standard bare-metal main loop, and bitengine_xncp.c, tx_power_table.c, tx_power_clamp.c hold the XNCP and TX-power logic. Those three files include no SDK headers and are tested on a PC (bash ncp/test_host/run.sh, needs only gcc).
  • One linker wrap: -Wl,--wrap=sli_zigbee_stack_set_radio_power — the only wrapped symbol. It enforces the TX power cap; build_ncp.sh checks after every build that the EZSP handler really calls the wrapper (also under LTO).
  • Table sizes and NVM3 cache (below). Most values follow Nabu Casa's ZBT-2 NCP build (also an MG24 with 256 KB RAM); the coordinator child table is larger, and the tables stored in NVM3 keep their previous sizes.
  • Bootloader: SDK example bootloader-uart-xmodem (non-secure variant) with the bootloader_gpio_activation component (active low, on the line the ESP32-C5 uses as nBOOT), plus the UART settings above.

SL_ZIGBEE_BUILD_NUMBER is not changed, so the NCP reports the same EmberZNet version string as a stock SDK build (8.2.2.0 build 532). Builds from this repository are identified by their SHA-256 and by the XNCP build string (see Versions).

XNCP commands

ID Name Used by
0x0000 GET_SUPPORTED_FEATURES — returns 0x000000A8 (BUILD_STRING, CHIP_INFO, TX_POWER_INFO) ZHA (bellows)
0x0003 GET_BUILD_STRING ZHA (shown with the firmware version); the hub
0x0005 GET_CHIP_INFO — RAM size and part number ZHA (bellows ≥ 0.46)
0x0008 GET_TX_POWER_INFO — recommended and maximum power for a country ZHA
0x7000 Get power state (private) the hub, diagnostics
0x7001 Set or clear the hub's region declaration (private) the hub
0x7002 NVM3 statistics, read-only (private) ncp_probe.py

Commands 0x0000–0x0008 use the same wire format as Nabu Casa's firmware, so ZHA's built-in client works unchanged. When CHIP_INFO reports at least 100000 bytes of RAM, bellows lets ZHA keep 32 requests in flight instead of 8. Zigbee2MQTT does not use XNCP. The wire format is in docs/tx-power.md.

Table sizes and NVM3 cache

Setting SDK example This build Notes
MAX_END_DEVICE_CHILDREN 32 64 End devices whose parent is the coordinator
NEIGHBOR_TABLE_SIZE 16 26 SDK allows 1, 16 or 26
ADDRESS_TABLE_SIZE 12 128
SOURCE_ROUTE_TABLE_SIZE 7 254
ROUTE_TABLE_SIZE 16 254 Set as a compile define
MULTICAST_TABLE_SIZE 8 26 Set as a compile define
DISCOVERY_TABLE_SIZE 8 16 Set as a compile define
BROADCAST_TABLE_SIZE 15 64
APS_UNICAST_MESSAGE_COUNT 10 128
APS_DUPLICATE_REJECTION_MAX_ENTRIES 5 64
PACKET_BUFFER_HEAP_SIZE 8192 (LARGE) 16384 (HUGE)
KEY_TABLE_SIZE 20 20 Unchanged: stored in NVM3
BINDING_TABLE_SIZE 32 32 Unchanged: stored in NVM3
NVM3_DEFAULT_CACHE_SIZE 200 400 Required for 64 children; see below

What this means in practice:

  • Table sizes are fixed at compile time. A host can lower most of them at startup but cannot raise them (apart from one or two extra address-table entries), so the values above are the upper limits whatever ZHA or Zigbee2MQTT is configured to.
  • ZHA only ever raises these settings, so it runs with the values above.
  • Zigbee2MQTT (ember) writes MAX_END_DEVICE_CHILDREN at every start from stack_config.json (default 32, allowed 6–64). To use 64, put {"MAX_END_DEVICE_CHILDREN": 64} in stack_config.json in the Zigbee2MQTT data directory (next to coordinator_backup.json) and restart Zigbee2MQTT.
  • MAX_END_DEVICE_CHILDREN is not a device limit: it counts end devices joined directly to the coordinator. Routers (mains-powered devices) carry their own children.
  • No maximum device count is claimed. Networks with many tens to hundreds of real devices have not been tested on this hardware.
  • NVM3 cache: upgrade only. The larger child table stores more objects in NVM3. An image with a smaller NVM3 cache (the SDK default of 200, used by every earlier build) boot-loops on a chip that has run this release. The release tooling and the hub refuse such images; the reason and the recovery path are in docs/flashing.md.

Release images and verification

File in release/ Purpose SHA-256
bootloader-uart-xmodem.s37 Gecko Bootloader 3.1.3, UART XMODEM, 460800 + RTS/CTS. Written once over SWD; it cannot be updated from the hub dd491853fc10ec7c3f02a77f0e33d829730233cbed446acd2602c5b23b681986
zigbee_ncp_uart_hw.s37 NCP application for SWD programming bc176767b2108df3031e1c7532c44cf17287af2ab0563c68fa07a9f0033efe6e
zigbee_ncp_uart_hw.gbl The same build as a signed GBL, for updates through the hub 5a6ece4ccc182b9ba1a967bb5033627dce3aaf69dd963244690857c95612489f
mg24_gbl_signing_key.pub ECDSA P-256 public key; compiled into the hub firmware —
ncp_version.txt EmberZNet version string the NCP reports (8.2.2.0 build 532), as shown in the hub's /api/v1/status ncp_version —
SHA256SUMS Checksums of the three images —

The image file names are kept from the SDK example so that existing tooling keeps working.

How an image is checked, from your PC to the chip:

  1. Checksums. cd release && sha256sum -c SHA256SUMS. flash_mg24.sh, flash_mg24.bat, ota_mg24.sh and ota_mg24.ps1 do this before using an image from release/.
  2. NVM3 cache guard. python3 ncp_image_check.py release/zigbee_ncp_uart_hw.gbl release/zigbee_ncp_uart_hw.s37 accepts only images whose build string carries nvm3c= ≥ 400 and that are not rescue (WIPE) builds.
  3. Signature. The .gbl carries an ECDSA P-256 signature over the SHA-256 of every byte before the signature tag (tag ID 0xF70A0AF7, 64-byte raw r||s, placed just before the END tag). The hub verifies it against the public key above before touching the MG24. It refuses images whose signature does not verify, and unsigned images unless a button-confirmed developer unlock is active (see docs/flashing.md). On a PC, the firmware repository's tools/gbl_verify.py <image.gbl> applies the same rules.
  4. Container checks on the hub. GBL magic 0x03A617EB, END tag 0xFC0404FC and the whole-file CRC-32 are checked on upload. This matters because the XMODEM bootloader erases the old application as it writes: a broken image must be rejected before the bootloader sees it.
  5. Signature stripping. The MG24 bootloader does not check signatures (it has no key provisioned and would reject a signed container). After verifying, the hub removes the signature tag and recomputes the CRC; the result is byte-identical to commander gbl create --app without --sign.

On a hub, GET /api/v1/zigbee/status reports image_sha256 (the SHA-256 of the signed .gbl as uploaded, which matches the SHA256SUMS line) and ncp_build_string (the XNCP build string). When the hub has no confirmed record of the image — the chip was programmed over SWD, or the last update through the hub did not reach success — image_source is "factory" and only the build string identifies the image.

Versions

Item Value
Chip EFR32MG24B020F1536IM40
EmberZNet 8.2.2.0 build 532
EZSP protocol version 18 (0x12)
Simplicity SDK 2025.6.3
Gecko Bootloader 3.1.3 (bootloader-uart-xmodem)
Toolchain Arm GNU Toolchain 12.2.Rel1
NCP build string (XNCP) bitEngine-xncp/1.0 v0.5.0-418-gc9ac5d1 2026-10-07 nvm3c=400
XNCP feature bitmap 0x000000A8

Changes per release: docs/CHANGELOG.md.

Documentation

  • docs/building.md — rebuilding the NCP, the bootloader and RAILtest
  • docs/flashing.md — updates from the hub, SWD programming, the NVM3 rule, recovery
  • docs/tx-power.md — region-based TX power cap and the XNCP wire format
  • docs/CHANGELOG.md

What is not in this repository, and why

The Zigbee stack itself — EmberZNet, part of the Silicon Labs Simplicity SDK — is proprietary to Silicon Labs and distributed under the Silicon Labs Master Software License Agreement (MSLA). We cannot relicense or redistribute its source. What we publish instead:

  • the project, configuration and sources needed to rebuild the NCP image yourself with the freely available Silicon Labs SDK;
  • the pre-built images used on the hub, so you can reflash them;
  • flashing and update instructions and the tools around them.

Home Assistant talks to the radio over standard EZSP; no proprietary host-side software is involved. This is the same model used by other EmberZNet-based coordinators in the Home Assistant ecosystem.

License

Copyright 2026 bitEngine, Inc.

The project files, configuration and documentation in this repository are licensed under the Apache License, Version 2.0 — see LICENSE. config/sl_iostream_usart_vcom_config.h is a Silicon Labs configuration template with the hub's values filled in and keeps its original Zlib license notice.

Pre-built images contain Silicon Labs code and are distributed under the terms of the Silicon Labs MSLA, for use on Silicon Labs devices only — see NOTICE.

About

EFR32MG24 Zigbee 3.0 NCP (EmberZNet / EZSP) for bitEngine Hub — Simplicity Studio project, bootloader and release images

home.bitengine.tech

Topics

efr32mg24emberznetezsphome-assistantzhazigbeezigbee2mqtt

Resources

Readme
Apache-2.0 license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.