0

As picture below, how to use get_properties ? I fail to understand AN625, how to use get_properties to get RSSI ?

enter image description here

Adding source code based on RH_RF24 functions.

#include <SPI.h>
#include <RH_RF24.h>

// Singleton instance of the radio driver
RH_RF24 rf24;


uint8_t Recieve_Data[20];

uint8_t receive_buffer[RH_RF24_MAX_MESSAGE_LEN];
uint8_t receive_buffer_length = sizeof(receive_buffer);

uint8_t Rssi;

unsigned long Micro_Time;

uint8_t status[8];
uint8_t buf[RH_RF24_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);

void setup()
{
  Serial.begin(115200);
  if (!rf24.init())
    Serial.println("init failed");
  // Defaults after init are 434.0MHz, modulation GFSK_Rb5Fd10, power 0x10
   while(!rf24.setFrequency(443));
  rf24.setModemConfig(rf24.GFSK_Rb50Fd100);  //设置成GFSK_Rb50Fd100
}


void loop()
{
  rf24.setModeRx();
  delay(100);
  rf24.setModeIdle();
  rf24.command(RH_RF24_CMD_GET_INT_STATUS, NULL, 0, status, sizeof(status));
  Serial.print("Id   ");
  for (int i = 0; i <= 8; i++)
  {
    Serial.print((uint8_t)status[i]);
    Serial.print("   ");
  }
  Serial.println();
  /*
    if (status[2])
    {
      uint8_t modem_status[6];
      rf24.command(RH_RF24_CMD_GET_MODEM_STATUS, NULL, 0, modem_status, sizeof(modem_status));
      delay(100);
      for (int i = 0; i <= 6; i++)
      {
        Serial.print(modem_status[i]);
        Serial.print("   ");
      }
      Serial.println();
    }
  */
  delay(400);
}
7
  • What part are you using, as that function is only available for Silicon Labs Si4460/4461/4463/4464 family of transceivers chip, and the equivalent HopeRF RF24/26/27 family of chips and the HopeRF RFM24W/26W/27W modules – Gerben Dec 14 '16 at 14:46
  • @Gerben I use Si4463. – lanse7pty Dec 14 '16 at 15:01
  • As coded in the "Github - lora_chisterapi/lib/radiohead/RH_RF24.cpp", firstProperty = (GROUP << 8) + (START_PROP) and uint8_t* values + uint8_t count are used to stored the read properties. – J. Piquard Dec 14 '16 at 15:56
  • @J.Piquard Could you write an example, I don't understand it well. Seemly, I can get RSSI just use RH_RF24::command as in web you given. – lanse7pty Dec 15 '16 at 2:57
  • Instead of using the command() as a static call (RH_RF24::command), the best approach should be to use a class instantiation and declare a RH_RF24 rf24; before setup() function and initialize the instance with a rf24.init() call. So, could you provide what source code you have tried in your Arduino in order to give you a more concrete example ? – J. Piquard Dec 15 '16 at 9:27
1

By using the RH_RF24 rf24;(Singleton instance of the radio driver), read a series of properties is really simple.

  • The properties shall be in the same GROUP,
  • Up to 16 properties could be read in the same request,

Hereafter is a example to read from SYNC_CONFIG to SYNC_BITS_7_0 (5 properties).

Step 1 - Declare your own uint8_t sync_stat[5]; or use the still declared uint8_t status[8];.

 uint8_t sync_stat[5];

Step 2 - The firstProperty is in fact the first property to be read and count is the number successive properties to be read (from SYNC_CONFIG = 0x1100 to SYNC_BITS_7_0 = 0x1104.

// And check the returned code
if (rf24.get_properties(SYNC_CONFIG,sync_stat,5)) {
    // sync_stat[0]= SYNC_CONFIG
    // ...
    // sync_stat[4]= SYNC_BITS_7_0
}

Then, the equivalent command() is:

uint8_t buf[3];
buf[0] = SYNC_CONFIG >> 8;
buf[1] = 5;
buf[2] = SYNC_CONFIG & 0xff;
if (rf24.command(RH_RF24_CMD_GET_PROPERTY, buf, sizeof(buf),sync_stat,5)) {
    // Same array
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.