It is true that Digi does not provide examples nor good documentation when it comes to ZigBee ZDO/ZCL support. I suspect this could be a licensing related issue as ZigBee specification is provided publicly only for non-commercial purposes. In any case wanted to add an example to get ZDO support working in the Programmable XBee using the built in ZDO code. Hope this is of help to someone.
By default if your AO parameter is either 0 or 1, the XBee radio firmware will respond to the ZDO requests. The easiest to try this out is by sending "Active Endpoints Request" (Cluster ID 0x0005) to the module. The module will respond with E8 (Digi Endpoint) and E6 (Digi Command) being available. When AO is set to 3 or if you have one of the following defined in your project:
Code:
- ENABLE_XBEE_HANDLE_RX
- ENABLE_OTA_UPDATE
- ENABLE_XBEE_HANDLE_ND_RESPONSE_FRAMES
or directly <code>ENABLE_XBEE_HANDLE_RX_ZCL_FRAMES</code> which sets AO=3 at boot, you will notice that you will not receive any reply for the ZDO Active Endpoints Request - because by default ZDO endpoint is not added to active list. To do so, you need to:
1. Create a global for ZDO transaction tracking.
Code:
wpan_ep_state_t zdo_ep_state;
2. Add the ZDO endpoint to the list in custom.h (based on xbee_custom_endpoint example):
Code:
#include <zigbee/zdo.h>
extern wpan_ep_state_t zdo_ep_state;
#define CUSTOM_ENDPOINT 0x13
#define CUSTOM_EP_PROFILE 0x5EBA
#define EP_INCLUDE_DECLARATIONS extern const wpan_cluster_table_entry_t custom_ep_clusters[]; int custom_ep_default_cluster(const wpan_envelope_t FAR *, void FAR *);
#define ADDITIONAL_ENDPOINTS {CUSTOM_ENDPOINT, CUSTOM_EP_PROFILE, custom_ep_default_cluster, NULL, 0x0000, 0x00, custom_ep_clusters}, \
ZDO_ENDPOINT(zdo_ep_state)
If you resend the "Active Endpoints Request" you'll notice that E8 (Digi Endpoint) and 13 (your custom endpoint) will be sent back in the reply.