Objective
To measure the Received Signal Strenght Indicator (RSSI) of the radio cc2420 for sky motes using Contiki OS 3.0. I tested this code in Ubuntu 16.04.Code
The library cc2420.h already brings a variable that stores the RSSI of the last received packet. The variable is known as cc2420_last_rssi. Then, all you need to do is to add the mentioned library and use the variable cc2420_last_rssi, however, you must decrease the variable 45 in order to get the right RSSI. You can read the datasheet of the cc2420 in page 49, here it says that you must decrease the variable 45. The resulting RSSI is in dBm. The following link is the datasheet of the cc2420.
http://web.stanford.edu/class/cs244e/papers/cc2420.pdf
Here is the code.
#include "/home/YOURUSER/contiki-3.0/dev/cc2420/cc2420.h" // In order to recognize the variable cc2420_last_rssi //Your code... // Declare the variables that you will use static signed char rss; static signed char rss_val; static signed char rss_offset; rss_val = cc2420_last_rssi; // Get the RSSI from the last received packet rss_offset = -45; // Datasheet of cc2420 page 49 says you must decrease the value in -45 rss = rss_val + rss_offset; // The RSSI correct value in dBm printf("RSSI of Last Received Packet = %d\n",rss);
This comment has been removed by the author.
ReplyDeleteThere's already a constant RSSI_OFFSET = -45. So I dont think u need to add one more time -45.
ReplyDeleteHow is the RSSI value calculated in contiki EXP5438?
ReplyDelete