Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,110 Views

Attempting to control an RFM69HCW RF board

Jump to solution

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

# include //get it here: https://www.github.com/lowpowerlab/rfm69

# include

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

// *********** 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

{

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)

1 Solution
idata
Community Manager
104 Views

I have figured out the issue! It was an Arduino side issue with declaring the SCK pin. I removed the part of the code that defined pin 13 and that set pin 13 to output. Works flawlessly now. Not sure why this code worked on my uno and not the galileo but it was a simple fix! Thanks

View solution in original post

4 Replies
idata
Community Manager
104 Views

Hi Geeky121,

 

 

This specific error message has been reported before in the community. I found a couple of threads you might find useful since they provide several suggestions you can try. There are also references to threads where this happens on the Edison that you should check as well.

 

 

The links are the following:

 

/message/404359# 404359 https://communities.intel.com/message/404359# 404359

 

/message/361232# 361232 https://communities.intel.com/message/361232# 361232

 

Try the suggestions posted and let us know your results.

 

 

-Sergio

 

FTinetti
Honored Contributor I
104 Views

Hi Sergio,

Intel Corporation wrote:

Hi Geeky121,

 

 

This specific error message has been reported before in the community. I found a couple of threads you might find useful since they provide several suggestions you can try. There are also references to threads where this happens on the Edison that you should check as well.

 

 

The links are the following:

 

/message/404359# 404359 https://communities.intel.com/message/404359# 404359

 

/message/361232# 361232 https://communities.intel.com/message/361232# 361232

 

Try the suggestions posted and let us know your results.

 

 

-Sergio

I think it's not the case, because every time I've seen that kind of error ("garbage" tends to have different values) has been because the Serial Monitor is not correctly set (well... different from what Galileo is expecting...) and the Serial Monitor does not work at all. In this case, several Serial.println work ok:

Arduino RFM69HCW Transmitter

Transmitting at 915 MHz

Sending Hello World #

▒*B0100000063f694

Unfortunately, I don't have any RFM69HCW to experiment with...

Fernando.

idata
Community Manager
105 Views

I have figured out the issue! It was an Arduino side issue with declaring the SCK pin. I removed the part of the code that defined pin 13 and that set pin 13 to output. Works flawlessly now. Not sure why this code worked on my uno and not the galileo but it was a simple fix! Thanks

View solution in original post

idata
Community Manager
104 Views

Hi Geeky121,

 

 

Thank you for letting us know you managed to solve the issue and for providing your solution. Hopefully it'll help other users who run into the same issue.

 

 

-Sergio

 

Reply