4 Replies Latest reply on Oct 5, 2016 2:16 PM by Intel Corporation

    Attempting to control an RFM69HCW RF board

    Geeky121

      Hello, I am attempting to control an RFM69HCW RF board (Located here: https://www.adafruit.com/product/3070) with the Galileo Generation 2. When I run this code:

      #include <RFM69.h>    //get it here: https://www.github.com/lowpowerlab/rfm69

      #include <SPI.h>

       

      //*********************************************************************************************

      // *********** IMPORTANT SETTINGS - YOU MUST CHANGE/ONFIGURE TO FIT YOUR HARDWARE *************

      //*********************************************************************************************

      #define NETWORKID     100  // The same on all nodes that talk to each other

      #define NODEID        2    // The unique identifier of this node

      #define RECEIVER      1    // The recipient of packets

       

      //Match frequency to the hardware version of the radio on your Feather

      //#define FREQUENCY     RF69_433MHZ

      //#define FREQUENCY     RF69_868MHZ

      #define FREQUENCY     RF69_915MHZ

      #define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!

      #define IS_RFM69HCW   true // set to 'true' if you are using an RFM69HCW module

       

      //*********************************************************************************************

      #define SERIAL_BAUD   115200

       

      #define RFM69_CS      10

      #define RFM69_IRQ     2

      #define RFM69_IRQN    0  // Pin 2 is IRQ 0!

      #define RFM69_RST     9

       

      #define LED           13  // onboard blinky

       

       

      int16_t packetnum = 0;  // packet counter, we increment per xmission

       

      RFM69 radio = RFM69(RFM69_CS, RFM69_IRQ, IS_RFM69HCW, RFM69_IRQN);

       

      void setup() {

        while (!Serial); // wait until serial console is open, remove if not tethered to computer

        Serial.begin(SERIAL_BAUD);

       

        Serial.println("Arduino RFM69HCW Transmitter");

       

        // Hard Reset the RFM module

        pinMode(RFM69_RST, OUTPUT);

        digitalWrite(RFM69_RST, HIGH);

        delay(100);

        digitalWrite(RFM69_RST, LOW);

        delay(100);

       

        // Initialize radio

        radio.initialize(FREQUENCY,NODEID,NETWORKID);

        if (IS_RFM69HCW) {

          radio.setHighPower();    // Only for RFM69HCW & HW!

        }

        radio.setPowerLevel(31); // power output ranges from 0 (5dBm) to 31 (20dBm)

       

        radio.encrypt(ENCRYPTKEY);

       

        pinMode(LED, OUTPUT);

        Serial.print("\nTransmitting at ");

        Serial.print(FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);

        Serial.println(" MHz");

      }

       

       

      void loop() {

        delay(1000);  // Wait 1 second between transmits, could also 'sleep' here!

         

        char radiopacket[20] = "Hello World #";

        //itoa(packetnum++, radiopacket+13, 10);

        Serial.print("Sending "); Serial.println(radiopacket);

        /*******************************************/

        //CRASHES AT THE LINE BELOW

      /*******************************************/

        if (radio.sendWithRetry(RECEIVER, radiopacket, strlen(radiopacket))) { //Crashes Here

          Serial.println("OK");

          Blink(LED, 50, 3); //blink LED 3 times, 50ms between blinks

        }

       

        radio.receiveDone(); //put radio in RX mode

        Serial.flush(); //make sure all serial data is clocked out before sleeping the MCU

      }

       

      void Blink(byte PIN, byte DELAY_MS, byte loops)

      {

        for (byte i=0; i<loops; i++)

        {

          digitalWrite(PIN,HIGH);

          delay(DELAY_MS);

          digitalWrite(PIN,LOW);

          delay(DELAY_MS);

        }

      }

       

       

      I get in the console:

       

      Arduino RFM69HCW Transmitter

       

       

      Transmitting at 915 MHz

      Sending Hello World #

      ▒*B0100000063f694

       

      Could anyone shed some light on why I would be getting a generic error with this code? Thanks!

       

      (Attached is the library I am currently using)