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.

Help for getting a LQI value

Other Parts Discussed in Thread: CC2431, TIMAC, Z-STACK, CC2530

Hello. I'm trying to get the LQI value using cc2431. 

I'm using the TIMAC software.

In the source code, there is a function for obtaining a LQI value. 

The function is, 

uint8 macRadioComputeLQI(int8 rssiDbm, uint8 corr)
{
(void) corr; /* suppress compiler warning of unused parameter */

/*
* Note : Currently the LQI value is simply the energy detect measurement.
* A more accurate value could be derived by using the correlation
* value along with the RSSI value.
*/
return(radioComputeED(rssiDbm));
}

But the return value of the function is not  the combination value of RSSI and correlation value.

I think that the function is not completely coded.

I would like to get the LQI value accurately. How can I get the value?

Kindly reply ASAP..

  • Hi,

    there are more than one ways of the RSSI and correlation combining. You can do it yourself or just take a code from Z-stack.

    Regards,

    Ilya

  • Hello.  Ilya Averin.

    Thank you for asking. I found the function from the z-stack. The function is as followed.

    static void ZMacLqiAdjust( uint8 corr, uint8 *lqi )
    {
    if ( lqiAdjMode != LQI_ADJ_OFF )
    {
    uint16 adjLqi = *lqi;

    // Keep correlation within theoretical limits
    if ( corr < LQI_CORR_MIN )
    {
    corr = LQI_CORR_MIN;
    }
    else if ( corr > LQI_CORR_MAX )
    {
    corr = LQI_CORR_MAX;
    }

    if ( lqiAdjMode == LQI_ADJ_MODE1 )
    {
    /* MODE1 - linear scaling of incoming LQI with a "correlation percentage"
    which is computed from the incoming correlation value between
    theorectical minimum/maximum values. This is a very simple way
    of 'derating' the incoming LQI as correlation value drops. */
    adjLqi = (adjLqi * (corr - LQI_CORR_MIN)) / (LQI_CORR_MAX - LQI_CORR_MIN);
    }
    else if ( lqiAdjMode == LQI_ADJ_MODE2 )
    {
    /* MODE2 - location for developer to implement a proprietary algorithm */
    }

    // Replace incoming LQI with scaled value
    *lqi = (adjLqi > 255) ? 255 : (uint8)adjLqi;
    }
    }

    Is this function correct for me? 

    Regards,

    Jay yoo


  • Yes, this approach can be chosen as a starting point. It should be mentioned here that the max/min correlation values may differ for different chips.

    Regards,

    Ilya

  • Hi Dears,

    Is there a way to get LQI values by hal_rf or basic_rf functions? (in CC2530)

    Regards

    hiCret

  • Dear All,

    I have done something thanks to .

    I have succeed to debug something without error, but I have not read LQI value, It shows as "0", I want to mention what I have done...

    Firstly, I have read your link and load Timac, and found timac folder there was a project there and I have opened  mac project forCC2530.

    After that I have found LQI function and it's header files; mac_api.h, saddr.h, sdata.h. I have written to my program that include function; #include "mac_api.h".

    After that I have lots of error because of "bool" and I do not need them so I have cleared them.

    Then, I have run and also some errors again and I have cleared them, because I only need LQI,

    Finally without error I have run the program, before that to read data I have written a function to call LQI which is:

                 static macDataInd_t  dataIND;

                  LQ[m] = dataIND.mpduLinkQuality;

    to read data from LQ..(mpduLinkQuality and macDataInd_t placed in the mac_api.h to read received LQI )

    finally the program has run without error but I have read from the LQ is "zero".

    Could you help me any more?

    Regards,

    ES

  • Hi,

    have you looked at the mac_radio.c function in Z-stack?

    Regards,

    Ilya

  • Dear Ilya,

    I have Smartrf05 Evolution board, but I will have checked it.

    Thank you,

    Regards,

    ES

  • Oh Dear,

    I have not reached something really convenient,

    I have looked for so much but no result any more:(!

    Anybody use LQI to estimate location?

    Thanks,,,