2025-03-19 6:46 AM
Hello,
I'm working on a project started from Zigbee_APS_coord and Zigbee_APS_router examples on NUCLEO-WB55.USBDongle with STM32Cube_FW_WB_V1.21.0.
The project is based on data exchange between the coordinator and several devices acting as routers (from 2 to 10) at the APS layer. The commonunication works fine in unicast mode, but I got error ZB_APS_STATUS_ILLEGAL_REQUEST = 0xa3 from ZbApsdeDataReqCallback if I try to send a broadcast message with the following code:
struct ZbApsdeDataReqT zb_aps_req_current;
struct ZbApsAddrT dst;
dst.endpoint = clusterId;
dst.mode = ZB_APSDE_ADDRMODE_SHORT;
dst.nwkAddr = 0xffff; /* Broadcast */
memset(&zb_aps_req_current, 0, sizeof(zb_aps_req_current));
zb_aps_req_current.dst = dst;
zb_aps_req_current.profileId = profileId;
zb_aps_req_current.clusterId = clusterId;
zb_aps_req_current.srcEndpt = srcEndpt;
zb_aps_req_current.asdu = payload;
zb_aps_req_current.asduLength = payloadLength;
zb_aps_req_current.asduHandle = zigbee_app_info.aps_info.asduHandle++;
zb_aps_req_current.txOptions |= ZB_APSDE_DATAREQ_TXOPTIONS_SECURITY;
zb_aps_req_current.discoverRoute = false;
status = ZbApsdeDataReqCallback(zigbee_app_info.zb, &zb_aps_req_current, callback, arg);
The error message is too generic, and Zigbee specifications refer to the network layer for broadcast addressing, so does anyone have any hint on how to correct this behaviour?
Solved! Go to Solution.
2025-03-19 9:27 AM
Hi @tcpctrnk ,
The packet is rejected in broadcast mode because the APS security configured in Tx Option is enabled which has to be used only for Unicast transmissions, for the Broadcast mode, transmission should use NWK security instead where the network key is known by all devices.
Best regards,
Ouadi
2025-03-19 9:27 AM
Hi @tcpctrnk ,
The packet is rejected in broadcast mode because the APS security configured in Tx Option is enabled which has to be used only for Unicast transmissions, for the Broadcast mode, transmission should use NWK security instead where the network key is known by all devices.
Best regards,
Ouadi
2025-03-19 9:58 AM - edited 2025-03-19 10:05 AM
Hi @Ouadi,
Thanks for the quick response!
Now I can send the message, but I'm not able to get the notification on the reception, is there a way to register a callback for this event?
EDIT: I misread your response and substitute ZB_APSDE_DATAREQ_TXOPTIONS_SECURITY with ZB_APSDE_DATAREQ_TXOPTIONS_NWKKEY. Now I set both flags and it's workin just fine!
2025-03-19 10:12 AM
Hi @tcpctrnk ,
When both flags are set, only Network security will be used for the transmission as described in the header file so that the broadcast should be possible.
Regards,
Ouadi