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.

CC2652P: LQI to link cost mapping question

Part Number: CC2652P
Other Parts Discussed in Thread: Z-STACK

Why does the function not use MIN_LQI_COST_2, MIN_LQI_COST_4, MIN_LQI_COST_6?

Does it make sense to add them to get more accurate "cost"?

/*********************************************************************
 * @fn          nwkConvertLqiToCost
 *
 * @brief       Convert Link Qualiy valuel (lqi 1~255) to link cost (1~7)
 *
 * @param       lqi - link quality value
 *
 * @return      uint8_t - link cost
 */
uint8_t nwkConvertLqiToCost( uint8_t lqi )
{
  uint8_t cost;

  cost = MAX_LINK_COST ;

  if ( lqi > MIN_LQI_COST_1 )
  {
    cost = 1;
  }
  else if ( lqi > MIN_LQI_COST_3 )
  {
    cost = 3;
  }
  else if ( lqi > MIN_LQI_COST_5 )
  {
    cost = 5;
  }
  else if ( lqi == LINK_AGEOUT_COST )
  {
    cost = LINK_AGEOUT_COST;
  }

  return cost;
}

In the topic https://e2e.ti.com/support/wireless-connectivity/zigbee-thread-group/zigbee-and-thread/f/zigbee-thread-forum/1094338/cc2652p-lqi-to-link-cost-mapping said that the mapping was outdated and it would be updated in newer SDK. When will it be done?

  • Hi Alex,

    The Z-Stack source code only uses nwkConvertLqiToCost for approximations of the neighbor cost (i.e. good, poor, or no link) and thus does not need to be more accurate.  Improving this feature has been neglected in favor of other development needs, but the Software Development Team is still aware of the issue and may be able to address it during the second half of this year.  Can you please explain what specific obstacles your application encounters by not having a more accurate LQI to cost conversion, and how you expect a more robust implementation would improve your system's behavior?

    Regards,
    Ryan

  • I don't see any serious issues, just qurious, why it is implemented by this way, what was reason.

    Actually I have a few routers in my network, and they are placed in a chain ~55m.

    When I check Link Status messages with a sniffer, I usually see costs 1 or 7. So, it jumps quite quickly from 1 to 7 without midway values 3,5 at all.

    And sometimes routers try to send message directly to coordinator, ignoring neighbors.

    Also I found a graph LQI vs distance and my LQI/distance looks quite similar and it looks like COST calculation is not effective.

    https://www.researchgate.net/figure/LQI-vs-distance-d-between-Zigbee-based-sensor-nodes-B1B4-and-a-coordinator-node_fig1_4319141

  • Thanks for the detailed response.  Have you tried altering the MIN_LQI_COST_* values like suggested in the other thread?  This could at least improve the operation of midway values.  If the ZR has the same cost between intermediate neighbors and the ZC then it would logically forgo the hop and send the message directly.

    Regards,
    Ryan

  • Thanks for your answers!

    No, I've not tried altering MIN_LQI_COST, because I thought that probably there was a reason to have them as low as is. That is why I asked the question, to confirm (or refute) my thoughs. I though that it was done intentionally to force sending messages by the way with min hops number.

    For example, if we had more "accurate" cost with midway values and they were evenly spread along the LQI graph, it could be that a Node that see a neighbor and a coordiantor, would prefer to send message to the neihbor, because it had higher cost. But it doesn't make sense, because the coordinator is also visible. And direct message (even with low cost) is preferable. Otherwise, if we send message to the neighbor, we increase network traffic, increase the number of hops, delay the message, etc.

    I have another question. Is there any difference for efficiense of routing for these two group of routers:

    1. All routers were paired directly to a coordinator, the coordinator is their parent. Then we place the routers randomly in a long chain.

    2. All routers were paired one by one. ZR1 to ZC, ZR2 to ZR1, ZR3 to ZR2, etc. So, previous router is parent of the next one. And then we place them one by one accordingly to their relationship in a long chain.

    Which case is preferable? Is "Parent Network Address" affects the routing somehow or it doesn't matter at all?

  • Routing devices (ZC/ZR) are neighbor relationships, not parent/children (as would be the case for ZED), and the routing layer is a healing mesh setup which means that ideally routers will age out broken neighbor links and pick up new ones as routers move in/out of distance from the node.  The best situation would be to establish neighbor links which are expected in the deployed application.  Hence the original node for which the ZR joins the network from should not hold any relevance to the ZR's ability to route packets once it starts receiving Link Status messages from nearby routers.

    Regards,
    Ryan