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

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

I found the following defines in zmac_internal.h:

// LQI to Cost mapping
#define MIN_LQI_COST_1 12 //24
#define MIN_LQI_COST_2 9 //20
#define MIN_LQI_COST_3 6 //16
#define MIN_LQI_COST_4 4 //12
#define MIN_LQI_COST_5 2 //8
#define MIN_LQI_COST_6 1 //4
#define MIN_LQI_COST_7 0 //0

Does this mean the link cost will be 1 if LQI is larger than 12? My customer wants to check that because the values have a big gap to the stack they were using. Would you please confirm this? Thanks.

BR,

Shuyang 

  • Hi Shuyang,

    Your interpretation is correct, below is the nwkConvertLqiToCost function from the internal Z-Stack source code:

    /*********************************************************************
     * @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;
    }

    Software Development is aware that the cost mapping is outdated and needs revising, below are the currently recommended changes:

    #define MIN_LQI_COST_1                64  //192
    #define MIN_LQI_COST_2                32  //128
    #define MIN_LQI_COST_3                16  //96
    #define MIN_LQI_COST_4                12  //64
    #define MIN_LQI_COST_5                8   //32
    #define MIN_LQI_COST_6                4   //16
    #define MIN_LQI_COST_7                1   //1
    #define MIN_LQI_COST_0                0   //0

    Regards,
    Ryan

  • Hi Ryan,

    Thanks, that's very helpful. May I know if there is any plan to update the values in the future SDK?

    BR,

    Shuyang

  • Yes, the Development Team plans to address this in an upcoming SDK.

    Regards,
    Ryan