2023-06-08 07:39 AM
I have successfully implemented a ZigBee coordinator/router with an on/off-server-cluster based on a STM32WB5MMG module.
My application is able to form a network and automatically allows certain off-the-shelf ZigBee On/Off-Clients to join the network and bind to the cluster within my device. Persistency is working well, too.
As long as my coordinator is fabric new it starts forming the network and allows other devices to join for a certain periode of time.
But when there is valid persistence data no additional devices can join, because the network forming process is skipped (I followed the "Zigbee_OnOff_Coord_NVM" example from STM32Cube_FW_WB_V1.16.0).
This raises two questions:
1) How can I allow more devices to join the network? Wich API functions must I call for that?
2) How can I detected that the joining-window has closed on my coordinator?
Thank you very much for any hints or help
Thomas
Solved! Go to Solution.
2023-06-11 02:40 AM
Found an answer myself by reading through ZigBee documents and made some experiments.
To permit joining of new devices, when my device is a coordinater/router, I follow the procedure given in "16-02828-012-PRO-BDB-v3.0.1-Specification.pdf" figure 3:
void APP_ZIGBEE_AllowJoining(void)
{
struct ZbNlmePermitJoinReqT req = { .permitDuration = APP_ZIGBEE_PERMIT_JOIN_DURATION };
struct ZbNlmePermitJoinConfT conf;
ZbBdbSetEndpointStatus(zigbee_app_info.zb, ZB_BDB_COMMISS_STATUS_IN_PROGRESS, ZB_ENDPOINT_BCAST);
ZbNlmePermitJoinReq(zigbee_app_info.zb, &req, &conf);
if (conf.status != ZB_STATUS_SUCCESS) {
APP_DBG("ZbNlmePermitJoinReq failed: %d", conf.status);
} else {
APP_DBG("ZbNlmePermitJoinReq succeeded");
ZbBdbSetEndpointStatus(zigbee_app_info.zb, ZB_BDB_COMMISS_STATUS_SUCCESS, ZB_ENDPOINT_BCAST);
}
}
And to check whether devices are still allowed to join, a simple read-out of the NWK-Database is enough:
uint8_t remaining_join_permit_seconds;
ZbNwkGet(zigbee_app_info.zb, ZB_NWK_NIB_ID_PermitJoinCounter, &remaining_join_permit_seconds, 1);
When the variable "remaining_join_permit_seconds" is count down to 0, the join-permit window has closed.
Please take all this code with a grain of salt. I am far away from being a ZigBee expert, but at least in my application it works.
/Thomas
2023-06-11 02:40 AM
Found an answer myself by reading through ZigBee documents and made some experiments.
To permit joining of new devices, when my device is a coordinater/router, I follow the procedure given in "16-02828-012-PRO-BDB-v3.0.1-Specification.pdf" figure 3:
void APP_ZIGBEE_AllowJoining(void)
{
struct ZbNlmePermitJoinReqT req = { .permitDuration = APP_ZIGBEE_PERMIT_JOIN_DURATION };
struct ZbNlmePermitJoinConfT conf;
ZbBdbSetEndpointStatus(zigbee_app_info.zb, ZB_BDB_COMMISS_STATUS_IN_PROGRESS, ZB_ENDPOINT_BCAST);
ZbNlmePermitJoinReq(zigbee_app_info.zb, &req, &conf);
if (conf.status != ZB_STATUS_SUCCESS) {
APP_DBG("ZbNlmePermitJoinReq failed: %d", conf.status);
} else {
APP_DBG("ZbNlmePermitJoinReq succeeded");
ZbBdbSetEndpointStatus(zigbee_app_info.zb, ZB_BDB_COMMISS_STATUS_SUCCESS, ZB_ENDPOINT_BCAST);
}
}
And to check whether devices are still allowed to join, a simple read-out of the NWK-Database is enough:
uint8_t remaining_join_permit_seconds;
ZbNwkGet(zigbee_app_info.zb, ZB_NWK_NIB_ID_PermitJoinCounter, &remaining_join_permit_seconds, 1);
When the variable "remaining_join_permit_seconds" is count down to 0, the join-permit window has closed.
Please take all this code with a grain of salt. I am far away from being a ZigBee expert, but at least in my application it works.
/Thomas