Receiving ZDO command and responses
Incoming ZDO commands and responses are handled by the XBee application by default. In order to receive and work with incoming ZDO commands, you must configure the device to pass ZDOs to the serial port instead of the XBee handling them. AO (API Options) is used to control this.
When operating in API mode and with AO set to 0, the output format for received data packets is Digi's native 0x90 receive frame format. In this configuration, the XBee application will handle and respond to any incoming ZDO requests. For unsupported ZDO commands, the XBee 3 Zigbee RF Module will respond with: ZDO not supported. The following figure shows AO set to 0.
When AO is non-zero, the API frame format for received data packets is an explicit 0x91 receive frame. This frame contains the additional fields necessary to interpret ZDO messages.
Bits 1, 2, and 3 of the AO command dictate the routing of incoming ZDO messages. When these bits are cleared, the XBee 3 Zigbee RF Module will handle and respond to ZDO commands. When these bits are set, then Supported ZDO, Unsupported ZDO, and/or Bind Requests are passed through the UART and the XBee device will not respond.
Bit 4 of the AO command will allow any supported ZDO commands that the XBee application handles to be echoed out of the serial port. This is useful as a diagnostic tool to identify when the XBee 3 Zigbee RF Module is responding to ZDO commands and what types.
Setting bit 5 of AO will suppress all ZDO output and disable pass through. Setting bit 5 will behave as if bits 1, 2, and 3 are 0 (XBee device handles incoming requests). This is useful if you want to use the 0x91 receive frame, but only emit Digi-specific messages out of the serial port. The following figure shows AO set to a non-zero value.
When a ZDO message is received on endpoint 0 and profile ID 0, the cluster ID indicates the type of ZDO message received. The first byte of payload is generally a sequence number that corresponds to a sequence number of a request. The remaining bytes are set as defined by the ZDO. Similar to a ZDO request, all multi-byte values in the response are in little endian byte order.