RFM22B
Tests with HOPE RFM22B (V2.0) Transceiver Module
and Porting arduino-Software for the following communication-methods:
- RF22: unaddressed, unreliable messages
- RF22Datagram: addressed, unreliable messages
- RF22ReliableDatagram: addressed, reliable, retransmitted, acknowledged messages.
- RF22Router: multi hop delivery from source node to destination node via 0 or more intermediate nodes
- RF22Mesh: multi hop delivery with automatic route discovery and rediscovery.
Info
Images
RFM22-Module:

RFM22 with mbed:

RFM22 with LPCmini:

Features (from HopeRF-Homepage)
- Frequency Range: 433/868/915MHz ISM bands
- Sensitivity = –121 dBm
- Output power range:+20 dBm Max
- Low Power Consumption
- Data Rate = 0.123 to 256 kbps
- FSK, GFSK, and OOK modulation
- Power Supply = 1.8 to 3.6 V
- Ultra low power shutdown mode
- Digital RSSI
- Wake-up timer
- Auto-frequency calibration (AFC)
- Power-on-reset (POR)
- Antenna diversity and TR switch control
- Configurable packet handler
- Preamble detector
- TX and RX 64 byte FIFOs
- Low battery detector
- Temperature sensor and 8-bit ADC
- –40 to +85 °C temperature range
- Integrated voltage regulators
- Frequency hopping capability
- On-chip crystal tuning
- 14-PIN DIP & 16-PIN SMD package
- Low cost
Available at Sparkfun and many others: http://www.sparkfun.com/products/10153
Problems
There are two Versions of the Module
- RFM22B-S1
- RFM22B-S2
 They have different oscilators and they seem to have different frequency-errors.
 I combined a -S1 and a -S2 and used 869.50 Hz on one module.  I had to adjust the frequency on the other to 869.49 Hz  to get a working communication! Maybe the AFC could solve this, but I didn't test this yet.
By activating AFC, both modules can use the same frequency as expected!-> Added activation of AFC to library.
Now it works perfect
Connecting
| FRM22-PIN | Connect to | 
|---|---|
| ANT | a simple 8cm (868MHz) wire for testing | 
| RX_ANT | GPIO1 | 
| TX_ANT | GPIO0 | 
| VCC | Vout(3.3V) | 
| GND | GND | 
| GPIO0 | TX_ANT | 
| GPIO1 | RX_ANT | 
| GPIO2 | |
| SDN | GND | 
| NIRQ | Interrupt (p15) | 
| NSEL | Chip-Select (p14) | 
| SCK | SPI-SCK (p13) | 
| SDI | SPI-MOSI(p11) | 
| SDO | SPI-MISO(p12) | 
Software
- Original Software for arduino (c) by Mike McCauley
- Software under Open Source Licensing GPL V2 - see http://www.open.com.au/mikem/arduino/RF22/
- Port to mbed by Karl Zweimueller
- Library:
Import libraryRF22
Library for HopeRF RFM22 / RFM22B transceiver module ported to mbed. Original Software from Mike McCauley (mikem@open.com.au) . See http://www.open.com.au/mikem/arduino/RF22/
Test program for ReliableDatagram Receive
main.c
#include "mbed.h"
#include <RF22.h>
#include <RF22ReliableDatagram.h>
// Sample programm for ReliableDatagramm Receiving
// Uses address 2 and receives from Sender
// See notebook http://mbed.org/users/charly/notebook/rfm22/ for connecting RFM22 to mbed
Serial pc(USBTX, USBRX);
//RF22ReliableDatagram (uint8_t thisAddress, PinName slaveSelectPin, PinName mosi, PinName miso, PinName sclk, PinName interrupt)
RF22ReliableDatagram rf22(0,p14,p11,p12,p13,p15);
float frequency = 869.50;           // frequency 
const uint8_t sender_adress = 1;        // address of sender
const uint8_t receiver_adress =2;       // address of receiver
void receive_loop() {
    while (1) {
        uint8_t buf[RF22_MAX_MESSAGE_LEN];
        uint8_t len = sizeof(buf);
        //boolean recvfromAck(uint8_t* buf, uint8_t* len, uint8_t* from = NULL, uint8_t* to = NULL, uint8_t* id = NULL, uint8_t* flags = NULL);
        if (rf22.recvfromAck(buf, &len)) {
            pc.printf("got message: >%s<\n\r",(char*)buf);
        }
    }
}
int main() {
    pc.baud(115200);
    pc.printf("\n\rConnected to mbed\n\r");
    pc.printf ("RF22-Test-Reliable-Receive V1.0\n\r");
    // initialize the device
    if (!rf22.init())
        pc.printf("RF22 init failed\n\r");
    // set to 19.2 KB
    if (!rf22.setModemConfig(RF22::GFSK_Rb19_2Fd9_6))
        pc.printf("setModemConfig failed");
    if (!rf22.setFrequency(frequency))
        pc.printf("setFrequency failed");
    // Code for receiving
    pc.printf("I am receiving with address %i ...\n\r",receiver_adress);
    rf22.setThisAddress(receiver_adress);     // receiver-adress
    receive_loop();             // start receiving
}
Test program for ReliableDatagram Send
main.c
#include "mbed.h"
#include <RF22.h>
#include <RF22ReliableDatagram.h>
// Sample programm for ReliableDatagramm Sending
// Uses address 1 and sends to RF22 with address 2
// See notebook http://mbed.org/users/charly/notebook/rfm22/ for connecting RFM22 to mbed
Serial pc(USBTX, USBRX);
//RF22ReliableDatagram (uint8_t thisAddress, PinName slaveSelectPin, PinName mosi, PinName miso, PinName sclk, PinName interrupt)
RF22ReliableDatagram rf22(0,p14,p11,p12,p13,p15);
float frequency = 869.50;           // frequency 
const uint8_t sender_adress = 1;        // address of sender
const uint8_t receiver_adress =2;       // address of receiver
int   counter = 0;                      // messagecounter
// send messages forever
void send_loop() {
    uint8_t data[32] = "";
    while (1) {
        sprintf((char*)data,"Message-Nr:     %d",counter++);
        //sendtoWait(uint8_t* buf, uint8_t len, uint8_t address);
        pc.printf("\n\rStart sending ... ");
        if (rf22.sendtoWait(data, sizeof(data), receiver_adress)) {
            pc.printf("Send to %i ACK: >>%s<< ", receiver_adress,(char*)data);
        } else {
            pc.printf("Send to %i NOTACK: >>%s<< ", receiver_adress,(char*)data);
        }
        pc.printf("sleeping 2 seconds...  ");
        wait(2);  // Wait 2 Seconds
    }
}
int main() {
    pc.baud(115200);
    pc.printf("\n\rConnected to mbed\n\r");
    pc.printf ("RF22-Test-Reliable-Send V1.0\n\r");
    // initialize the device
    if (!rf22.init())
        pc.printf("RF22 init failed\n\r");
    // set to 19.2 KB
    if (!rf22.setModemConfig(RF22::GFSK_Rb19_2Fd9_6))
        pc.printf("setModemConfig failed");
    if (!rf22.setFrequency(frequency))
        pc.printf("setFrequency failed");
    // Code for sending
    pc.printf("I am sending with address %i to adress %i ...\n\r",sender_adress,receiver_adress  );
    rf22.setThisAddress(sender_adress);     // sender-adress
    send_loop();                // start sending
}
...
History
16.1.2012: Got first version of software working. Communication with RF22-Class on a mbed and a LPCmini with two RFM22B-modules works!
13.2.2012 Ported RF22Datagramm and RF22ReliableDatagramm classes for point to point communication - Quick and dirty! Works between mbed and LPCmini
21.2.2012 Got AFC working (Module RFM22B-S1 and -S2 can communicate without the need to adjust frequency)
13.3.2013 Updated Library to latest version of original Code of Mike
TODO: ... Beautify Ported Code
14 comments on RFM22B:
Please log in to post comments.

 
 
Sparkfun also has a handy breakout board for the RFM22B-S2 that would be a bit easier to solder pins on for use in a breadboard.