RFM12b troubleshooting

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am using RFM12b with mega328p with jcw's library. I have a demo program from examples provided within the library.

#include 
 #include  
#include 
 RF12 RF12; 
void setup() { 
Serial.begin(9600);
 Serial.print("\n[rf12serial]"); 
rf12_config(); } 
void loop() { 
if (Serial.available()) RF12.send(Serial.read()); 
if (RF12.poll()) Serial.print(RF12.read()); }

I get no data from my serial port except the "[rf12serial]". i have tested f12_canSend(void) and rf12_recvDone(void) with no success. Moreover, I changed the initialization using rf12_easyInit(uint8_t secs) and rf12_spi_init() but still got nothing. The hardware connection seems good and I have wired according to these schematics.
http://jeelabs.org/2009/02/10/rfm12b-library-for-arduino/
How can I find the problem? Is there a kind of signaling on a specific pin so I can trace it and find the bug? or is there a kind of debugging process you have used?

Thanks a lot for sharing your experience.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you need to use Arduino Specifically or can you use AVR as well...

Have you tried this: http://www.das-labor.org/wiki/RFM12_library/en

I too am having problems with RFM12B for the past month or so... it works, then suddenly stops working and then works again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can also use a simple C for just testing my hardware.
What are the signal levels on MISO/MOSI/SCK/RESET when in operation measured by a DC voltmeter?
Do you have simple program like above in the library mentioned?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

at the moment, I am working on getting the same ready, I need a simple Serial Interface over Radio - maybe I will have some code working tomorrow by this time for you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I2C is almost easy to debug, you just need to to read TWSR and see the datasheet to know what is going on. Is there a same process for debugging SPI? Is there a specific signaling or debugging process you have used?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the rf12_config() function expects that you already have all the RF module's settings saved in the EEPROM.

try:

rf12_initialize(2, RF12_433MHZ, 33);

2 is the NODE ID, should be greater than 0 and less than 200 I think
33 is the GROUP ID, only the nodes in the same group can talk
the second argument is the frequency band

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had success with this example today. PingPong Example
I have removed the LED code, but you should un-comment that code and put LEDs there to see the process in action. helps in debugging.

You have to have both the Ports library and the RFM12 Library, else modify the Led codes to normal arduino codes.

This example requires MilliTimer, which is defined in the Ports Library, so you will need it in the end, though it was giving me a few errors and I modified the library files and commented the error lines.

//>>> The latest version of this code can be found at https://github.com/jcw/ !!

// Demo of a sketch which sends and receives packets
// 2010-05-17  http://opensource.org/licenses/mit-license.php
// $Id: pingPong.pde 7763 2011-12-11 01:28:16Z jcw $

// with thanks to Peter G for creating a test sketch and pointing out the issue
// see http://news.jeelabs.org/2010/05/20/a-subtle-rf12-detail/

#include 
#include 

Port leds (1);
MilliTimer sendTimer;
char payload[] = "Hello";
byte needToSend;

static void sendLed (byte on) {
    leds.mode(OUTPUT);
    leds.digiWrite(on);
}

static void receiveLed (byte on) {
    leds.mode2(OUTPUT);
    leds.digiWrite2(!on); // inverse, because LED is tied to VCC
}

void setup () {
    Serial.begin(9600);
    Serial.println(9600);
    Serial.println("Send and Receive...");
    rf12_initialize(2, RF12_433MHZ, 33);
}

void loop () {
    if (rf12_recvDone() && rf12_crc == 0) {
        //receiveLed(1);
        Serial.print("OK ");
        for (byte i = 0; i < rf12_len; ++i)
            Serial.print(rf12_data[i]);
        Serial.println();
        delay(100); // otherwise led blinking isn't visible
        //receiveLed(0);
    }
    
    if (sendTimer.poll(2000))
        needToSend = 1;

    if (needToSend && rf12_canSend()) {
        needToSend = 0;
        
        //sendLed(1);
        rf12_sendStart(0, payload, sizeof payload);
        delay(100); // otherwise led blinking isn't visible
        //sendLed(0);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Same code on both sides, only the NODE ID was different and the message/payload was "Hello" on one side and "World" on the other.