| 1 | # Linux Installation |
| 2 | |
| 3 | @tableofcontents |
| 4 | |
| 5 | Generic Linux devices are supported via SPIDEV, PiGPIO, MRAA, RPi native via BCM2835, or using LittleWire. |
| 6 | |
| 7 | @note The SPIDEV option should work with most Linux systems supporting spi userspace device. |
| 8 | |
| 9 | |
| 10 | ### Automatic Installation (New) |
| 11 | |
| 12 | Using CMake: (See the [instructions using CMake](using_cmake.md) for more information and options) |
| 13 | |
| 14 | 1. Download the install.sh file from [https://github.com/nRF24/.github/blob/main/installer/install.sh](https://github.com/nRF24/.github/blob/main/installer/install.sh) |
| 15 | ```shell |
| 16 | wget https://raw.githubusercontent.com/nRF24/.github/main/installer/install.sh |
| 17 | ``` |
| 18 | 2. Make it executable |
| 19 | ```shell |
| 20 | chmod +x install.sh |
| 21 | ``` |
| 22 | 3. Run it and choose your options |
| 23 | ```shell |
| 24 | ./install.sh |
| 25 | ``` |
| 26 | |
| 27 | @warning |
| 28 | `SPIDEV` is now always selected as the default driver because |
| 29 | all other Linux drivers are being removed in the future. |
| 30 | See [RF24 issue #971](https://github.com/nRF24/RF24/issues/971) for rationale. |
| 31 | |
| 32 | It will also ask to install a python package named [pyRF24](https://github.com/nRF24/pyRF24). |
| 33 | This is not the same as the traditionally provided python wrappers because the pyRF24 package can be |
| 34 | used independent of the C++ installed libraries. For more information on this newer python |
| 35 | package, please check out [the pyRF24 documentation](https://nrf24.github.io/pyRF24/). |
| 36 | 4. Try an example from one of the libraries |
| 37 | ```shell |
| 38 | cd ~/rf24libs/RF24/examples_linux |
| 39 | ``` |
| 40 | |
| 41 | Edit the gettingstarted example, to set your pin configuration |
| 42 | ```shell |
| 43 | nano gettingstarted.cpp |
| 44 | ``` |
| 45 | |
| 46 | Build the examples. Remember to set the `RF24_DRIVER` option according to the one that was |
| 47 | selected during the scripted install. |
| 48 | ```shell |
| 49 | mkdir build && cd build |
| 50 | cmake .. -D RF24_DRIVER=SPIDEV |
| 51 | make |
| 52 | ``` |
| 53 | |
| 54 | Run the example |
| 55 | ```shell |
| 56 | sudo ./gettingstarted |
| 57 | ``` |
| 58 | |
| 59 | See the [instructions using CMake](using_cmake.md) for more information and options |
| 60 | |
| 61 | ## Automated Install (Deprecated - 32 bit only) |
| 62 | |
| 63 | **Designed & Tested on RPi** - Defaults to SPIDEV on devices supporting it |
| 64 | |
| 65 | 1. Install prerequisites if there are any (pigpio, MRAA, LittleWire libraries, setup SPI device etc) |
| 66 | 2. Download the install.sh file from [http://tmrh20.github.io/RF24Installer/RPi/install.sh](http://tmrh20.github.io/RF24Installer/RPi/install.sh) |
| 67 | ```shell |
| 68 | wget http://tmrh20.github.io/RF24Installer/RPi/install.sh |
| 69 | ``` |
| 70 | 3. Make it executable |
| 71 | ```shell |
| 72 | chmod +x install.sh |
| 73 | ``` |
| 74 | 4. Run it and choose your options |
| 75 | ```shell |
| 76 | ./install.sh |
| 77 | ``` |
| 78 | |
| 79 | @warning |
| 80 | `SPIDEV` is now always selected as the default driver because |
| 81 | all other Linux drivers are being removed in the future. |
| 82 | See [RF24 issue #971](https://github.com/nRF24/RF24/issues/971) for rationale. |
| 83 | |
| 84 | 5. Run an example from one of the libraries |
| 85 | ```shell |
| 86 | cd rf24libs/RF24/examples_linux |
| 87 | ``` |
| 88 | Edit the gettingstarted example, to set your pin configuration |
| 89 | ```shell |
| 90 | nano gettingstarted.cpp |
| 91 | make |
| 92 | sudo ./gettingstarted |
| 93 | ``` |
| 94 | |
| 95 | ## Manual Install (Deprecated - 32 bit only) |
| 96 | |
| 97 | 1. Install prerequisites if there are any (pigpio, MRAA, LittleWire libraries, setup SPI device etc) |
| 98 | @note See the [MRAA](http://iotdk.intel.com/docs/master/mraa/index.html) documentation for more info on installing MRAA |
| 99 | 2. Make a directory to contain the RF24 and possibly RF24Network lib and enter it |
| 100 | ```shell |
| 101 | mkdir ~/rf24libs |
| 102 | cd ~/rf24libs |
| 103 | ``` |
| 104 | 3. Clone the RF24 repo |
| 105 | ```shell |
| 106 | git clone https://github.com/tmrh20/RF24.git RF24 |
| 107 | ``` |
| 108 | 4. Change to the new RF24 directory |
| 109 | ```shell |
| 110 | cd RF24 |
| 111 | ``` |
| 112 | 5. Configure build environment using the command: |
| 113 | ```shell |
| 114 | ./configure |
| 115 | ``` |
| 116 | It automatically detects device and build environment. |
| 117 | |
| 118 | @warning |
| 119 | `SPIDEV` is now always selected as the default driver because |
| 120 | all other Linux drivers are being removed in the future. |
| 121 | See [RF24 issue #971](https://github.com/nRF24/RF24/issues/971) for rationale. |
| 122 | |
| 123 | For overriding automatic detections, use command-line arguments, see |
| 124 | ```shell |
| 125 | ./configure --help |
| 126 | ``` |
| 127 | for description. |
| 128 | 6. Build the library, and run an example file |
| 129 | ```shell |
| 130 | make |
| 131 | sudo make install |
| 132 | ``` |
| 133 | ```shell |
| 134 | cd examples_linux |
| 135 | ``` |
| 136 | Edit the gettingstarted example, to set your pin configuration |
| 137 | ```shell |
| 138 | ano gettingstarted.cpp |
| 139 | make |
| 140 | sudo ./gettingstarted |
| 141 | ``` |
| 142 | |
| 143 | ### Build using SPIDEV (Deprecated - 32 bit only) |
| 144 | |
| 145 | 1. Make sure that spi device support is enabled and /dev/spidev\<a\>.\<b\> is present |
| 146 | 2. Manual Install using SPIDEV: |
| 147 | ```shell |
| 148 | ./configure --driver=SPIDEV |
| 149 | make |
| 150 | sudo make install |
| 151 | ``` |
| 152 | 3. See the gettingstarted example for an example of pin configuration |