This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with binding in zigbee devices

Hello to all,

I'm working on a project based on sending data collected from a sensor network to a Zigbee Coordinator: the sensors are End Devices and must be tied to a Coordinator to make this save the data recorded by the sensors. The example I'm basing myself on is that of multi-sensor.
But I don't want to use the command line interface but I want to build a Coordinator that presents a "temperature Measurement" client-side cluster and that can bind with the single sensor and then enable reporting of the MeasuredValue attribute.
My problem is that the binding between the Coordinator and the sensor does not happen: I briefly explain what I do.
The Coordinator and the sensor are connected to the same network; after that, the Coordinator sends the request for Match Descriptor and I find the short address and the endpoint of the sensor. After that I make an Extended Address request and get the device address. I already have both the eee address and the coordinator endpoint. At this point the Bind request starts: after sending the request, I see that the associated callback is never called. Am I wrong in interpreting the data? The struct zb_zdo_bind_req_param_t is filled like this: everything that is part of the destination is filled with sensor data, while everything concerning the source is filled with the data of the Coordinator. Am I doing something wrong? I'm sending the bind_req from the Coordinator firmware and not from the sensor. I also attach the part of the code written by me.

typedef struct attr_query_s
{
    zb_ieee_addr_t             remote_ieee_addr;
    zb_ieee_addr_t             src_ieee_addr;
    zb_addr_u                  remote_node;
    zb_uint8_t                 remote_addr_mode;
    zb_uint8_t                 remote_ep;
    zb_uint16_t                profile_id;
    zb_uint16_t                cluster_id;
    zb_uint8_t                 dst_endpoint;
    zb_uint8_t                 attr_type;
    zb_uint8_t                 attr_value[32];
    zb_zcl_frame_direction_t   direction;
} attr_query_t;

static attr_query_t m_attr_table[ATTRIBUTE_TABLE_SIZE];

static zb_void_t bind_device(zb_uint8_t param)
{
    zb_zdo_bind_req_param_t * p_req;
    zb_buf_t                * p_buf= ZB_BUF_FROM_REF(param);
    zb_ret_t                  zb_err_code;

    ZB_BUF_INITIAL_ALLOC(p_buf, sizeof(zb_zdo_bind_req_param_t), p_req);

    ZB_LETOH64(p_req->dst_address.addr_long,m_attr_table[item].src_ieee_addr); //ieee address of coordinator
    p_req->src_endp = m_attr_table[item].remote_ep; //endpoint of sensor
    p_req->cluster_id = ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;  
    p_req->dst_addr_mode = ZB_BIND_DST_ADDR_MODE_64_BIT_EXTENDED;   //ieee address mode of coordinator

    ZB_LETOH64(p_req->src_address,m_attr_table[item].remote_ieee_addr);  //ieee address of sensor
    p_req->dst_endp = HA_TEMP_SENSOR_ENDPOINT;   //endpoint of coordinator
    p_req->req_dst_addr = m_attr_table[item].remote_node.addr_short;    //short address of sensor

    UNUSED_RETURN_VALUE(zb_zdo_bind_req(param, bind_device_cb));
    }

Best regards,

Raffaela

Parents
  • Hi,

    Take a look at how binding is performed in our multisensor example. The 'source' address and endpoint should be filled in with the sensor information, while the 'destination' fields are for the coordinator.

    You also need to place the binding request parameters inside the buffer you pass to zb_zdo_bind_req() using ZB_GET_BUF_PARAM. You can take a look at the function cmd_zb_bind() inside the CLI example for reference. 

    I also recommend you set up the nRF Sniffer for 802.15.4, so it will be easier for you to debug if the application is doing what you want or not. Double check that you are sending the binding request from the coordinator and check if you are receiving a binding response from the multisensor example so you know if you can expect to go into the bind_device_cb calback or not.

    Best regards,

    Marjeris

  • Hi,

    At the moment I'm using the Nordic sniffer and I see that I actually don't send the request.

    I changed the source and the destination: the data of the source are those of the sensor and the data of the destination are those of the coordinator.


    I'm looking at the example of the CLI but it doesn't work anyway.


    It is as if the data I am sending is incorrect.
    Is there any trick that I have to use in order for the data I'm sending to be read correctly?

    Best regards,

    Raffaela

  • Hi,

    Why do you change the indianess of both the source and destination address? Also I think the dts_addr_mode should be ZB_APS_ADDR_MODE_64_ENDP_PRESENT.

    I have done some modifications to the code you sent me, you can try to do something like this instead:

    static void zb_void_t bind_device(zb_ieee_addr_t ieee_addr)
    {
        zb_zdo_bind_req_param_t  *  p_req;
    	uint8_t						tsn;
        zb_buf_t                 *  p_buf= ZB_BUF_FROM_REF(param);
        zb_ret_t                    zb_err_code;
    	zb_ieee_addr_t            dst_ieee_addr;
        zb_osif_get_ieee_eui64(dst_ieee_addr);
    
        p_buf = ZB_GET_OUT_BUF();
        if (!p_buf)
        {
            NRF_LOG_INFO("failed to execute command (buf alloc failed)");
            return;
        }
        p_req = ZB_GET_BUF_PARAM(p_buf, zb_zdo_bind_req_param_t);
    	    for (uint8_t i=0; i<8; i++)
        {
            p_req->src_address[i] = ieee_addr[i]; //ieee address of the sensor
            p_req->dst_address.addr_long[i] = dst_ieee_addr[i]; //ieee address of the coordinator
        }
    	p_req->dst_addr_mode = ZB_APS_ADDR_MODE_64_ENDP_PRESENT;   //ieee address mode of coordinator
    
        p_req->src_endp = m_attr_table[item].remote_ep; //endpoint of sensor
    	p_req->dst_endp = HA_TEMP_SENSOR_ENDPOINT;   //endpoint of coordinator
    		
        p_req->cluster_id = ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT; 
    	
        p_req->req_dst_addr = m_attr_table[item].remote_node.addr_short;    //short address of sensor	
     
        tsn= zb_zdo_bind_req(param, bind_device_cb);
    	if (tsn == ZB_ZDO_INVALID_TSN)
    		{
    			NRF_LOG_INFO("failed to send request, %d", tsn);
    			return;
    		}
    	return;
    }
    

    Also if you are not sure the parameters you are sending are right you can try to print them using NRF_LOG_INFO before calling zb_zdo_bind_req to check everything is in order.

    Best regards,

    Marjeris

  • Hi, 

    I am using two dongles (one for the CLI the other one is for the multi sensor).

    The exemple works fine to me but the results it showing seems wired a little bit! i got some  values like 3200 1025... are they in C(Celsius)? If not how can I convert them and printing them in C !! 

    Please have a look at the posted picture 

       

  • Hi ,

    It looks good to me. If you take a look at the Zigbee Cluster Library specification (can be found on the Zigbee Alliance/Connectivity Standards Alliance website), you will see the following information about the MeasuredValue attribute in the Temperature Measurement cluster (cluster ID 0x0402):

    And for the Pressure Measurement cluster (cluster ID 0x0403):

    I hope this answers your question, if you have any follow-ups please open a new Devzone ticket so we can have this in an own thread Slight smile

    Best regards,

    Marjeris

Reply
  • Hi ,

    It looks good to me. If you take a look at the Zigbee Cluster Library specification (can be found on the Zigbee Alliance/Connectivity Standards Alliance website), you will see the following information about the MeasuredValue attribute in the Temperature Measurement cluster (cluster ID 0x0402):

    And for the Pressure Measurement cluster (cluster ID 0x0403):

    I hope this answers your question, if you have any follow-ups please open a new Devzone ticket so we can have this in an own thread Slight smile

    Best regards,

    Marjeris

Children
No Data
Related