Other Parts Discussed in Thread: SYSCONFIG, , ENERGYTRACE
Tool/software:
In the ZBOOS stack ,the zb_aps_send_user_payload interface will cause a very long delay when sending data,for example the latency for a single-hop unicast transmission is 900 milliseconds.
I think the one-hop unicast delay is abnormal, Please check if the “zb_aps_send_user_payload” API interface is being used correctly. It should be the problem caused by the sending buffer,After the “zb_aps_send_user_payload” API interface was executed, the data transmission was not send out immediately.
typedef struct
{
unsigned char addr_mode;
unsigned char ack_enable;
unsigned char source_endpoint;
unsigned char dest_endpoint;
unsigned short cluster_id;
unsigned short profile_id;
}ws_send_frame_t;
static volatile unsigned char ws_rf_send_status=0;
static void ws_rf_send_cb(zb_uint8_t param)
{
zb_ret_t status=zb_buf_get_status(param);
zb_buf_free(param);
ws_rf_send_status=0;
ws_printf("ws_rf_send_cb:0x%x\r\n",status);
}
unsigned char ws_rf_send(zb_addr_u dest_addr,unsigned char *data, unsigned char len,ws_send_frame_t *param)
{
if (!ZB_JOINED())
{
return WS_SEND_NO_NET;
}
if(len>82)
{
return WS_SEND_TOO_LONG;
}
if(ws_rf_send_status==1)
{
return WS_SENDING;
}
ws_rf_send_status=1;
zb_bufid_t buf_id;
buf_id = zb_buf_get_out();
if (!buf_id)
{
return WS_SEND_BUF_ERR;
}
zb_aps_set_user_data_tx_cb(ws_rf_send_cb);
ws_send_addr=dest_addr.addr_short;
zb_ret_t ret=zb_aps_send_user_payload(
buf_id,
dest_addr, /* dst_addr */
param->profile_id,// WS_DEFAULT_PROFILEID, /* profile_id */
param->cluster_id,//WS_DEFAULT_CLUSTERID, /* cluster_id */
param->dest_endpoint,//WS_DEFAULT_DEST_ENDPOINT, /* dst_endpoint */
param->source_endpoint,//WS_DEFAULT_SOURE_ENDPOINT, /* src_endpoint */
param->addr_mode,//ZB_APS_ADDR_MODE_16_ENDP_PRESENT, /* addr_mode */
param->ack_enable,/*ZB_FALSE*//*ZB_TRUE*/ /* aps_ack_is_enabled */
data,
len
);
if(ret!=RET_OK)
{
return WS_SEND_BUF_ERR;
}
return 0;
}
unsigned char ws_at_send_rf_data(unsigned char *buf,unsigned short len)
{
unsigned char ret=0;
ws_send_frame_t ws_at_send_frame;
zb_addr_u dest_addr;
ws_at_send_frame.ack_enable=1;
ws_at_send_frame.addr_mode=ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
dest_addr.addr_short = 0; //The destination address is the coordinator.
ws_at_send_frame.source_endpoint =WS_DEFAULT_SOURE_ENDPOINT;
ws_at_send_frame.dest_endpoint = WS_DEFAULT_DEST_ENDPOINT;
ws_at_send_frame.cluster_id = WS_DEFAULT_CLUSTERID;
ws_at_send_frame.profile_id =WS_DEFAULT_PROFILEID;
ret=ws_rf_send(dest_addr,buf,len,&ws_at_send_frame);
return ret;
}


