I have been trying for ages to work this problem out and can't figure it out. I have two nrf24 transceivers, one connected to the raspberry pi and the other connected to an Arduino. My code for the Arduino is written using the maniacbug rf24 library and the raspberry pi is using a modified version of that (I don't remember which one but i think it was Stanely-something-or-other). When I ran my code, Before it would give me erroneous feed back and the addresses where something like 0xffffffffffff (i dont remember the count but it was f repeating). The wiring here was done as per: . I then rewired as it was suggested on this page http://www.raspberrypi.org/forums/viewtopic.php?t=17061&p=350040 and it looked like
RPi GPIO9 (Pin 21) to RF Module Pin 7 ( MISO )
RPi GPIO10 (Pin 19) to RF Module Pin 6 ( MOSI )
RPi GPIO 11 (Pin 23) to RF Module Pin 5 ( SCK )
RPi GPIO8 (Pin 24) to RF Module Pin 3 ( CE )
RPi GPIO 25 (Pin 22) to RF Module Pin 4 ( CSN )
RPI 3.3V (Pin 17) to RF Module Pin 2 ( VCC/3.3V )
RPi Gnd (Pin 25) to RF Module Pin 1 (GND)
How ever now, Eveything is zeroed out instead of repeating f. and I am not getting any output (before it gave me really big numbers, the max for unsigned log i believe). I also ran the example code and same things.
This Is my radio data:
SPI device = /dev/spidev0.0
SPI speed = 8000000
CE GPIO = 25
STATUS = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1 = 0x0000000000 0x0000000000
RX_ADDR_P2-5 = 0x00 0x00 0x00 0x00
TX_ADDR = 0x0000000000
RX_PW_P0-6 = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA = 0x00
EN_RXADDR = 0x00
RF_CH = 0x00
RF_SETUP = 0x00
CONFIG = 0x00
DYNPD/FEATURE = 0x00 0x00
Data Rate = 1MBPS
Model = nRF24L01
CRC Length = Disabled
PA Power = PA_MIN
this was taken from the rpi_hub example
What Am I doing wrong? should I wire it a different way?
Edit: Here is the code. Sorry it took so long, I had everything working on two arduinos so I thought the raspberry pi would be fine. turns out it isnt =/
#include "../costumLibraries/RF24/librf24-rpi/librf24/RF24.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <string>
#include <getopt.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include <ctime>
// Command Line: g++ -Wall -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -L../librf24/ -lrf24 -pthread *.cpp -o remote
using namespace std;
RF24 radio("/dev/spidev0.0",8000000 , 25); //spi device, speed and CSN,only CSN is NEEDED in RPI
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup(void){
//Prepare the radio module
printf("\nPreparing interface\n");
radio.begin();
radio.setRetries( 15, 15);
radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
// radio.startListening();
radio.printDetails();
cout<<"good"<<endl;
}
int main( int argc, char ** argv){
string choice;
// time_t timer;
int choiceVal;
setup();
while(choice != "quit"){
cout<<">";
cin>>choice;
cout<<endl;
choiceVal = atoi(choice.c_str());
if(choice!="quit"){
radio.write(&choiceVal, sizeof(int));
printf("\n\rRecieved and sent %i",choiceVal);
radio.startListening();
unsigned long started_waiting_at = time(NULL);
bool timeout = false;
while ( ! radio.available() && ! timeout )
if (time(NULL) - started_waiting_at > 200 )
timeout = true;
// Describe the results
if ( timeout )
{
printf("Failed, response timed out.\n\r");
}
bool done = false;
while (!done){
// Fetch the payload, and see if this was the last one.
done = radio.read( &choiceVal, sizeof(int) );
printf("recieved: %i",choiceVal);
delay(20);
}
radio.stopListening();
}
}
}