RSSI measurement with 802.15.4 My Wireless App example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RSSI measurement with 802.15.4 My Wireless App example

Jump to solution
1,795 Views
carrie15
Contributor I

Hi, I am using the FRDM-KW20Z dev board to develop an application based on the 802.15.4 My Wireless App sample application provided in the Connectivity Software.

I would like the Coordinator to be able to record the RSSI value after receiving a message from an End Device. I tried doing this by calling Asp_GetRSSILevel() (from ASP.c) within the App_HandleMcpsInput() function in App.c. Here is what the function looks like with the 2 lines I added in bold:

static void App_HandleMcpsInput(mcpsToNwkMessage_t *pMsgIn, uint8_t appInstance)

{

  uint8_t rssi = 0;

  switch(pMsgIn->msgType)

  {

    /* The MCPS-Data confirm is sent by the MAC to the network or application layer when data has been sent. */

  case gMcpsDataCnf_c:

    if(mcPendingPackets)

      mcPendingPackets--;

    break;

  case gMcpsDataInd_c:

    /* The MCPS-Data indication is sent by the MAC to the network

       or application layer when data has been received. We simply

       copy the received data to the UART. */

    rssi = Asp_GetRSSILevel();

    Serial_SyncWrite( interfaceId,pMsgIn->msgData.dataInd.pMsdu, pMsgIn->msgData.dataInd.msduLength );

    break;

  }

}

I didn't change anything else in the My Wireless App code, except for #include "AspInterface.h" in the App.c file.

The values that the function is returning are always within the range of about 157-170 (in decimal), even when the boards are separated by about 20m. I was expecting values from 0 to 102 since the FRDM documentation states that the radio has accurate RSSI indication for RF inputs from -102 dBm to 0 dBm.

The Asp_GetRSSILevel() function calls the PhyPlmeGetRSSILevelRequest(), which gets the value from ZLL_RD_LQI_AND_RSSI_RSSI(ZLL). I am not sure whether this value is supposed to be signed or unsigned. 

Is this the correct way to go about this problem?

I also tried the PhyGetLastRxRssiValue(void) function from the PhyISR.c file, this was giving me values in the 200's.

Thanks in advance!

Labels (1)
0 Kudos
1 Solution
1,280 Views
georgecapraru
NXP Employee
NXP Employee

Hi,

For KW20Z and KW40Z, the RSSI value reported by the XCVR is signed, but the API is legacy and returns unsigned integers.

The Asp_GetRSSILevel() function returns the current RSSI level, not the value of the received packet.

Converting 157-170 values to int8_t will result -99 to -86 dBm, which represents the noise from the channel.

The PhyPlmeGetRSSILevelRequest() function returns the RSSI level for the last packet received by the PHY, not necessarily the last packet received by the application.

Converting the values reported to int8_t, results in values around -56dBm which represents the RSSI for a received packet.

You can use the mpduLinkQuality reported in the gMcpsDataInd_c message, and if you really need the RSSI value, you can use the int8_t PhyConvertLQIToRSSI(uint8_t lqi) function to convert LQI into RSSI.

The PhyConvertLQIToRSSI() function will return signed values!

Regards,

George

View solution in original post

3 Replies
1,281 Views
georgecapraru
NXP Employee
NXP Employee

Hi,

For KW20Z and KW40Z, the RSSI value reported by the XCVR is signed, but the API is legacy and returns unsigned integers.

The Asp_GetRSSILevel() function returns the current RSSI level, not the value of the received packet.

Converting 157-170 values to int8_t will result -99 to -86 dBm, which represents the noise from the channel.

The PhyPlmeGetRSSILevelRequest() function returns the RSSI level for the last packet received by the PHY, not necessarily the last packet received by the application.

Converting the values reported to int8_t, results in values around -56dBm which represents the RSSI for a received packet.

You can use the mpduLinkQuality reported in the gMcpsDataInd_c message, and if you really need the RSSI value, you can use the int8_t PhyConvertLQIToRSSI(uint8_t lqi) function to convert LQI into RSSI.

The PhyConvertLQIToRSSI() function will return signed values!

Regards,

George

1,280 Views
carrie15
Contributor I

Hi George,

Thanks for the helpful answer! So, am I understanding correctly that there is no way to obtain a per-packet RSSI value without doing an LQI to RSSI conversion? I am asking because I am trying to implement a distance estimation application that requires the measurement of the RSSI value upon receiving a data packet.

Thanks,

Carrie

0 Kudos
1,280 Views
georgecapraru
NXP Employee
NXP Employee

Hi Carrie,

You are correct. The best method to obtain a per-packet RSSI is to convert the LQI value received in the MCPS-DATA.Indication into RSSI.

Regards,

George