Optimized High Speed NRF24L01+ Driver Class Documenation  V1.0
TMRh20 2014 - Optimized Fork of NRF24L01+ Driver
Raspberry Pi

RF24 supports a variety of Linux based devices via various drivers. Some boards like RPi can utilize multiple methods to drive the GPIO and SPI functionality.


Potential PreConfiguration

If SPI is not already enabled, load it on boot:

sudo raspi-config

A. Update the tool via the menu as required
B. Select Advanced and enable the SPI kernel module
C. Update other software and libraries

sudo apt-get update
sudo apt-get upgrade



Build Options

The default build on Raspberry Pi utilizes the included BCM2835 driver from http://www.airspayce.com/mikem/bcm2835

  1. sudo make install -B

Build using the MRAA library from http://iotdk.intel.com/docs/master/mraa/index.html
MRAA is not included. See the MRAA platform page for more information.

  1. Install, and build MRAA
    git clone https://github.com/intel-iot-devkit/mraa.git
    cd mraa
    mkdir build
    cd build
    cmake .. -DBUILDSWIGNODE=OFF
    sudo make install
  2. Complete the install
    nano /etc/ld.so.conf
    Add the line
    /usr/local/lib/arm-linux-gnueabihf
    Run
    sudo ldconfig
  3. Install RF24, using MRAA
    ./configure --driver=MRAA
    sudo make install -B
    See the gettingstarted example for an example of pin configuration

Build using SPIDEV

  1. Make sure that spi device support is enabled and /dev/spidev<a>.<b> is present
  2. Install RF24, using SPIDEV
    ./configure --driver=SPIDEV
    sudo make install -B
  3. See the gettingstarted example for an example of pin configuration


Connections and Pin Configuration

Using pin 15/GPIO 22 for CE, pin 24/GPIO8 (CE0) for CSN

Can use either RPi CE0 or CE1 pins for radio CSN.
Choose any RPi output pin for radio CE pin.

BCM2835 Constructor:

RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS0, BCM2835_SPI_SPEED_8MHZ);
or
RF24 radio(RPI_V2_GPIO_P1_15,BCM2835_SPI_CS1, BCM2835_SPI_SPEED_8MHZ);
RPi B+:
RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_24, BCM2835_SPI_SPEED_8MHZ);
or
RF24 radio(RPI_BPLUS_GPIO_J8_15,RPI_BPLUS_GPIO_J8_26, BCM2835_SPI_SPEED_8MHZ);
General:
RF24 radio(22,0);
or
RF24 radio(22,1);

See the gettingstarted example for an example of pin configuration

See http://www.airspayce.com/mikem/bcm2835/index.html for BCM2835 class documentation.

MRAA Constructor:

RF24 radio(15,0);

See http://iotdk.intel.com/docs/master/mraa/rasppi.html

SPI_DEV Constructor

RF24 radio(22,0);

In general, use

RF24 radio(<ce_pin>, <a>*10+<b>);

for proper SPIDEV constructor to address correct spi device at /dev/spidev<a>.<b>

See http://pi.gadgetoid.com/pinout

Pins:

PIN NRF24L01 RPI RPi -P1 Connector
1 GND rpi-gnd (25)
2 VCC rpi-3v3 (17)
3 CE rpi-gpio22 (15)
4 CSN rpi-gpio8 (24)
5 SCK rpi-sckl (23)
6 MOSI rpi-mosi (19)
7 MISO rpi-miso (21)
8 IRQ - -



Based on the arduino lib from J. Coliz mania.nosp@m.cbug.nosp@m.@ymai.nosp@m.l.co.nosp@m.m
the library was berryfied by Purinda Gunasekara purin.nosp@m.da@g.nosp@m.mail..nosp@m.com
then forked from github stanleyseow/RF24 to https://github.com/jscrane/RF24-rpi
Network lib also based on https://github.com/farconada/RF24Network