This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2531USB-RD: Couldn't get the needed data after sending ZB_SEND_DATA_REQUEST command

Part Number: CC2531USB-RD
Other Parts Discussed in Thread: CC2531, CC2530

Dear TI support team,

 

I would like to ask for help as I got stuck when trying to get data from ZigBee end-device. Below is the overview of the problem and my environment.

I have two CC2531 USB dongle from TI. The first one, I used it as a protocol sniffer to capture the packet information over the air.

And the other one, I flashed it with the ZNP coordinator firmware because I don't want to use the built-in USB, instead I wanted to do serial communication via UART(similar as the CC2530). Link: https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator I wanted to connect it to host processor (TIVA) and do serial communication between Tiva microcontroller and CC2531 via UART.

And then, I have another ZigBee temperature monitoring as end-device and bind it to ZigBee coordinator. From Tiva microcontroller I was sending UART command to get/read the temperature from the ZigBee temperature device. Unfortunately, I was not getting anything. The ZigBee temperature device seems not sending back its temperature to the ZigBee coordinator.

 

Setup overview:

 

What I have done so far.

1. Before connecting/binding the ZigBee end-device, I have configured first the ZigBee coordinator as stated in the document under 3.2 CC2530-ZNP startup procedure.

I checked the configuration of the ZigBee coordinator ZB_READ_CONFIGURATION 
Tx: 0xfe 0x01 0x26 0x04 0x83 0xA0
Tx: 0xfe 0x01 0x26 0x04 0x87 0xA4
Tx: 0xfe 0x01 0x26 0x04 0x84 0xA7

and getting the expected results.

And then I sent the ZB_APP_REGISTER_REQUEST and ZB_START_REQUEST. After sending the ZB_START_REQUEST , the ZigBee coordinator will become available (I can see it in the sniffer software).

2. Once ZigBee coordinator is ready, I bind/connect the ZigBee end-device (temperature monitoring). Binding was okay as I can see it in the sniffer software also I can see some data from the end-device. 

3. And then in here, I tried to send ZB_SEND_DATA_REQUEST. And it seems the temperature from end-device was not sent to coordinator. I got this data after sending the ZB_SEND_DATA_REQUEST.

FE 00 66 03 65 -> Confirmation looks okay.

FE 02 46 83 22 F0 15 -> Not sure about this F0. If I look at the status table F0 is not listed there.

 

Can you please help/advice on what I should do in able to read/get the temperature from the end-device?

Looking forward for your response.

 

Thank you very much in advance.

 

  • Hi Depeng,

    Looking at the Monitor and Test API, packets are structured as SOF | LEN | CMD0 | CMD1| DATA | FCS, so for the last packet you've provided this would be 0xFE | 0x02 | 0x46 | 0x83 | 0x22 0xF0 | 15.  CMD0 of 0x46 is a SAPI AREQ and CMD1of 0x83 would be a MT_SAPI_SEND_DATA_CNF (likewise 0x66 is a SAPI SRSP and 0x03 is MT_SAPI_SEND_DATA_REQ).  0x22 is the handle, and 0xF0 is the status which translates to ZMacTransactionExpired.  What this means is that although the ZNP received the ZB_SEND_DATA_REQUEST, it was not able to send it over the air.  This is most likely because the ZNP's NWK_INDIRECT_MSG_TIMEOUT occurred before the ZED polled for data.  You can confirm this with your sniffer log, then modify your application to improve this condition.  You should also make sure that your ZB_SEND_DATA_REQUEST has the correct data for a ZCL Read Attribute Request. 

    It would be much more useful for the ZNP to have a ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT out cluster registered for an endpoint so that the temperature sensor ZED could recognize and report to it, or for the ZNP to issue a ZCL_CMD_CONFIG_REPORT so that the temperature sensor ZED begins to automatically report its ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT cluster's ATTRID_TEMPERATURE_MEASUREMENT_MEASURED_VALUE attribute value.

    Regards,
    Ryan

  • Hello Ryan,
    Depeng posted above query on my behalf since I could not post on the forum yet. Thanks Depeng for the help :)
    Thanks a lot Ryan for your quick and detailed response.
    I have tried below test iterations and still no success to read the temperature data from the end-device.
    Please advice on what I have done wrong. Maybe my steps and test procedures are not correct or maybe the data I'm sending was not correct. Please let me know your thought.
    Please note:
    Tx means the command is sent by the coordinator.
    Rx means the data received by coordinator.
    coordinator address = 0x0000
    end-device address = 0xa31a
    Test Iteration #1:
    1.] I have read the configuration to make sure eveything is okay.
    ZB_READ_CONFIGURATION 
    Length = 0x01 
    Cmd0 = 0x26 
    Cmd1 = 0x04 
    ConfigId = ZCD_NV_PANID/ZCD_NV_LOGICAL_TYPE/ZCD_NV_CHANLIST
    Tx: 0xfe 0x01 0x26 0x04 0x83 0xA0 ->for ZCD_NV_PANID
    Rx: 0xfe 0x05 0x66 0x04 0x00 0x83 0x02 0x34 0x23 0xf1
    Tx: 0xfe 0x01 0x26 0x04 0x87 0xa4 -> for ZCD_NV_LOGICAL_TYPE
    Rx: 0xfe 0x04 0x66 0x04 0x00 0x87 0x01 0x00 0xe0
    Tx: 0xfe 0x01 0x26 0x04 0x84 0xa7 -> ZCD_NV_CHANLIST
    Rx: 0xfe 0x07 0x66 0x04 0x00 0x84 0x04 0x00 0x08 0x00 0x0x00 0xed
    2.] The clusterId is placed in input command list.
    ZB_APP_REGISTER_REQUEST 
    Length = 0x0d 
    Cmd0 = 0x26 
    Cmd1 = 0x0A 
    AppEndPoint = 0x01
    AppProfileID = 0x0104
    DeviceId = 0x0302
    DeviceVersion = 0x01
    Unused = 0x00
    InputCommandsNum = 0x01
    InputCommandsList = 0x0402
    OutputCommandsNum = 0x00
    OutputCommandsList = 0x0000
    Tx: 0xfe 0x0d 0x26 0x0a 0x01 0x04 0x01 0x02 0x03 0x01 0x00 0x01 0x02 0x04 0x00 0x00 0x00 0x22
    Rx: 0xfe 0x01 0x66 0x0a 0x00 0x6d 
    3.] ZB_START_REQUEST
    Tx: 0xfe 0x00 0x26 0x00 0x26
    Rx: 0xfe 0x00 0x66 0x00 0x66 
    Rx: 0xfe 0x01 0x45 0xC0 0x09 0x8d 
    Rx: 0xfe 0x01 0x46 0x80 0x00 0xc7 
    4.] ZB_SEND_DATA_REQUEST
    Length = 0x0a
    Cmd0 = 0x26 
    Cmd1 = 0x03 
    Destination = 0xa31a (end-device address)
    CommandId = 0x0402
    Handle = 0x22
    Ack = 0x01/0x10
    Radius = 0x0f
    Len = 0x02
    Data = 0x0000
    Tx: 0xfe 0x0a 0x26 0x03 0x1a 0xa3 0x02 0x04 0x22 0x01 0x0f 0x02 0x00 0x00 0xbe
    Rx: 0xfe 0x00 0x66 0x03 0x65 
    Rx: 0xfe 0x02 0x46 0x83 0x22 0xF0 0x15
    Tx: 0xfe 0x0a 0x26 0x03 0x1a 0xa3 0x02 0x04 0x22 0x10 0x0f 0x02 0x00 0x00 0xaf
    Rx: 0xfe 0x00 0x66 0x03 0x65 
    Rx: 0xfe 0x02 0x46 0x83 0x22 0xF0 0x15
    Test Iteration #2:
    In here, basically it is the same as Test Iteration #1 except I changed the "step 2.]" with the following information.
    2.] The clusterId is placed in output command list.
    ZB_APP_REGISTER_REQUEST
    Length = 0x0d 
    Cmd0 = 0x26 
    Cmd1 = 0x0A 
    AppEndPoint = 0x01
    AppProfileID = 0x0104
    DeviceId = 0x0302
    DeviceVersion = 0x01
    Unused = 0x00
    InputCommandsNum = 0x00
    InputCommandsList = 0x0000
    OutputCommandsNum = 0x01
    OutputCommandsList = 0x0402
    Tx: 0xfe 0x0d 0x26 0x0a 0x01 0x04 0x01 0x02 0x03 0x01 0x00 0x00 0x00 0x00 0x01 0x02 0x04 0x22
    Rx: 0xfe 0x01 0x66 0x0a 0x00 0x6d 
    Test Iteration #3:
    In here, basically it is the same as Test Iteration #1 except I changed the "step 2.]" with the following information.
    2.] The clusterId is placed in input and output command list.
    ZB_APP_REGISTER_REQUEST
    Length = 0x0d 
    Cmd0 = 0x26 
    Cmd1 = 0x0A 
    AppEndPoint = 0x01
    AppProfileID = 0x0104
    DeviceId = 0x0302
    DeviceVersion = 0x01
    Unused = 0x00
    InputCommandsNum = 0x01
    InputCommandsList = 0x0402
    OutputCommandsNum = 0x01
    OutputCommandsList = 0x0402
    Tx: 0xfe 0x0d 0x26 0x0a 0x01 0x04 0x01 0x02 0x03 0x01 0x00 0x01 0x02 0x04 0x01 0x02 0x04 0x25
    Rx: 0xfe 0x01 0x66 0x0a 0x00 0x6d 
    With above test iterations that I have done so far, please let me know which part I'm not doing correctly.
    In addition, you mentioned that this NWK_INDIRECT_MSG_TIMEOUT, I can improve it in the application.
    Can you please send to me the link where I can download the application so that I can update the timeout and do compilation then update my firmware?
    Also, if you can point-out the exact location of the file or variable or macro that I need to update, it would be very helpful.
    Thank you very much.
    Regards,
    Rudy
  • Do you use sniffer to check what exactly happens over the air? If yes, can you provide sniffer log to check it?

  • You have not put ZCL_CLUSTER_ID_GENERAL_IDENTIFY (0x0003) in the input or output commands list, making it difficult for your ZED temperature sensor to identify the ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT (0x0402) output cluster to bind.  

    ZB_SEND_DATA_REQUEST basically translates to a AF data request, and yet your data length and contents do not correspond to a Read Attributes Command.  For example, I would expect a data length of 0x05 and data of framecontrol (1 byte) | transID (1 byte) | commandID (1 byte) | attributeID (2 bytes), even though for this example they can be filled with all 0x00s.

    As you are using the Zigbee2MQTT project, you should be following their instructions for downloading, modifying, and compiling the ZNP.  They have provided adequate documentation on their Github.  In fact, I'd highly recommend that you request help on their forums as you are seeking advice on how to use their system and setup.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you very much for your response.

    After I followed your advice by adding the cluster ID 0x0003 and correcting the data length to 0x05 and providing the Read Attributes command ID, I could able to read the temperature value from the end-device. The end-device sends its temperature value to coordinator everything coordinator asks for it (by sending the read attributes command).

    However, after sometime when there is no activity between coordinator and end-device, the end-device goes into sleep. And while end-device is sleeping and then coordinator asks for its temperature value, end-device won't response and instead I'm getting timeout.

    Now my question, what command should the coordinator send to end-device to tell that its temperature value must be sent to coordinator everytime the end-device is awake? It is like, the end-device will automatically send its temperature value to coordinator once end-device is awake and coordinator does not need to request for it.

    Thank you.

    Regards,

    Rudy

  • To send a configure reporting command, the data would be a direction byte (ZCL_SEND_ATTR_REPORTS/0x00), Attribute ID (ATTRID_TEMPERATURE_MEASUREMENT_MEASURED_VALUE/0x0000),  data type (ZCL_DATATYPE_INT16/0x29), min and maximum reporting intervals (two bytes each, in units of seconds), and reportable change (same length as defined in data type and in units supported by the attribute ID (0x2C01 is 300/3 degrees in int16_t).  A sniffer setup would greatly assist with your development, as you would better understand what is happening during over-the-air communications.

    Regards,
    Ryan

  • Hi Ryan,

    Everything is working as expected now.

    Thank you very much.

    Regards,

    Rudy