找回密码
 立即注册

微信扫码登录

查看: 252|回复: 2

ZDP Clustrer

[复制链接]

8

主题

18

回帖

204

积分

华贵铂金

积分
204
发表于 2025-5-2 23:32:20 | 显示全部楼层 |阅读模式 来自 俄罗斯
information
说明:   建议参照本版块置顶帖内容输入必要信息
芯片型号: TLSR8258
SDK及版本: V3.7.1.2_Patch_0001(PR)
Hi.


How can I send a LQI ​​request to the coordinator?
This code does not request anything. No response is received.



// dstAddr = 0x0000, startIndex = 0
void send_mgmt_lqi_req(u16 dstAddr, u8 startIndex)
{
    u8 buf[8];
    buf[0] = startIndex; // StartIndex

    printf("Sent Mgmt_LQI_req to 0x%04x with startIndex = %d\r\n", dstAddr, startIndex);

    if(zb_isDeviceJoinedNwk()) {


        epInfo_t dstEpInfo;
        TL_SETSTRUCTCONTENT(dstEpInfo, 0);

        dstEpInfo.profileId = ZDO_PROFILE_ID; //HA_PROFILE_ID;
        dstEpInfo.dstAddrMode = APS_SHORT_DSTADDR_WITHEP;
        dstEpInfo.dstEp = APP_ENDPOINT1;
        dstEpInfo.dstAddr.shortAddr = dstAddr;


        uint8_t apsCnt = 0;
        u8 ret = af_dataSend(APP_ENDPOINT1, &dstEpInfo, MGMT_LQI_REQ_CLID, 1, buf, &apsCnt);

        printf("af_dataSend ret: %d\r\n", ret);
    }
}




sharex-17-46-09-444.jpg


How to do this correctly?


Thanks.

13

主题

60

回帖

359

积分

流光翡翠

积分
359
发表于 2025-5-3 08:28:07 | 显示全部楼层 来自 澳大利亚
I am not sure that it is it, but do you have correct EP of the coordinator?
You have:
  1. dstEpInfo.dstEp = APP_ENDPOINT1;
复制代码

And your source ep is:
  1. af_dataSend(APP_ENDPOINT1,
复制代码

8

主题

18

回帖

204

积分

华贵铂金

积分
204
 楼主| 发表于 2025-5-4 01:04:29 | 显示全部楼层 来自 俄罗斯
Hi.

I want to get the signal level of my device (LQI).

  1.     int8_t rssi = ZB_RADIO_RSSI_GET();
  2.     ZB_RADIO_RSSI_TO_LQI(0, rssi, lqi);
复制代码


ZB_RADIO_RSSI_GET always returns a value around -100.

I would like to request LQI from the coordinator.

This code does it.

  1. static uint8_t lqi = 0;
  2. static bool lqi_true = false;
  3. static uint8_t t_index = 0;

  4. static void start_lqi_scan(uint8_t idx);

  5. static void parse_mqmt_lqi(void *args) {

  6.     zdo_zdpDataInd_t *p = (zdo_zdpDataInd_t *)args;
  7.     zdo_mgmt_lqi_resp_t *rsp = (zdo_mgmt_lqi_resp_t *)p->zpdu;

  8.     uint8_t n_tbl_cnt = rsp->neighbor_tbl_lst_cnt;

  9.     uint16_t src_addr = zb_getLocalShortAddr();

  10.     for (uint8_t i = 0; i < n_tbl_cnt; i++) {
  11.         if (src_addr == rsp->neighbor_tbl_lst[i].network_addr) {
  12.             lqi = rsp->neighbor_tbl_lst[i].lqi;
  13.             lqi_true = true;
  14.             t_index = rsp->start_index;
  15. //            printf("LQI: %d, start_index: %d\r\n", lqi, rsp->start_index);
  16.             return;
  17.         }
  18.     }

  19.     if (n_tbl_cnt) {
  20.         start_lqi_scan(n_tbl_cnt);
  21.     }
  22. }

  23. static void start_lqi_scan(uint8_t idx) {

  24.     static uint8_t start_index = 0;
  25.     lqi_true = false;

  26.     if (!zb_isDeviceJoinedNwk()) {
  27.         t_index = 0;
  28.         lqi = 0;
  29.         return;
  30.     }

  31.     if (idx == 0) {
  32.         if (t_index == 0)
  33.             start_index = 0;
  34.         else
  35.             start_index = t_index;
  36.     }

  37. //    printf("idx: %d, t_index: %d\r\n", idx, t_index);
  38.     start_index += idx;
  39.     u8 sn = 0;
  40.     zdo_mgmt_lqi_req_t req;
  41.     u16 dstAddr = 0x0000;
  42.     req.start_index = start_index;
  43.     zb_mgmtLqiReq(dstAddr, &req, &sn, parse_mqmt_lqi);
  44. }

  45. uint8_t app_get_lqi() {
  46.     if (lqi_true) {
  47.         return lqi;
  48.     }

  49.     return 0;
  50. }

  51. int32_t app_lqiCb(void *args) {

  52.     start_lqi_scan(0);

  53.     if (lqi == 0)
  54.         return TIMEOUT_250MS;

  55.     return TIMEOUT_1MIN;
  56. }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2025-6-1 11:41 , Processed in 0.098674 second(s), 24 queries .

Powered by Telink 隐私政策

泰凌微电子版权所有 © 。保留所有权利。 2024

快速回复 返回顶部 返回列表