sending structs, need clarification on some things.

Hi all. I am working on a robot project and need some clarification on some things before i can get back to it.

  1. was answered thanks. ( what was (byte*) doing.
    2.am i sending this wrong if so how because every example i have checked out and all the searching and the help from PaulS points to this working.
    i have the same structs on both side i am sending and receiving them exact same. how ever i am getting bad data on the RX side.
    now i should mention the radio settings work fine all examples work with them so i know it's not hardware. also they would fail and not print there output on good send.

here is the output on the TX side

23.00,41.00,59.00
25.00,49.00,51.00
27.00,48.00,58.00
38.00,42.00,57.00
5.00,41.00,53.00

here is the output on the RX side

0.00,0.00,0.00,0
0.00,0.00,0.00,0
0.00,0.00,0.00,0
0.00,0.00,0.00,0
0.00,0.00,0.00,0

here are the sketches i am using
TX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  //radio.setPayloadSize(12 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
typedef struct myBuff{
  float imuRoll;
  float imuPitch;
  float imuYaw;
 }myBuff;
myBuff StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  /////////////////////////////////////////////////////////  
  StructBuff.imuRoll  = random(1,40);                          //
  StructBuff.imuPitch = random(41,50);                    //Temp Values
  StructBuff.imuYaw   = random(51,60);                    //
                  //
  /////////////////////////////////////////////////////////

   TransStruct();
   radio.startListening();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){

  radio.stopListening();
  bool ok = radio.write((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
    //printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+

void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.println();
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,9);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  //radio.setPayloadSize(12 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
typedef struct myBuff{
  float imuRoll;
  float imuPitch;
  float imuYaw;
 }myBuff;
myBuff StructBuff;

//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  
   RecStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){

  radio.startListening();
  bool ok = radio.read((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
//    printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
  delay(10);
 
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+


void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.println(); 
}

Cyric:
how ever i am getting bad data on the RX side.

You ought to be checking for received messages using radio.available() rather than trying to read regardless.

You should zero out the receive buffer before you do the read, so that you know that what you see afterwards really did come from the radio. (Otherwise you could just be looking at garbage you left in the buffer.)

If you can't get the struct transmission working then replace that with some dummy code to send a fixed string and then print out what you received for comparison. Do you receive one message per message sent? Does it have the right length? Does the content bear any relation to what was sent?

So i made static values and flushed the buffer and now i get this
TX

1.01,22.02,-32.99
1.01,22.02,-32.99
1.01,22.02,-32.99
1.01,22.02,-32.99

RX

-0.00,-0.00,-0.00
-0.00,-0.00,-0.00
-0.00,-0.00,-0.00

my TX code

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  //radio.setPayloadSize(12 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
typedef struct myBuff{
  float imuRoll;
  float imuPitch;
  float imuYaw;
 }myBuff;
myBuff StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  /////////////////////////////////////////////////////////  
  StructBuff.imuRoll  = 1.01;                          //
  StructBuff.imuPitch = 22.02;                    //Temp Values
  StructBuff.imuYaw   = -32.99;                    //
                  //
  /////////////////////////////////////////////////////////

   TransStruct();
   radio.startListening();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){

  radio.stopListening();
  bool ok = radio.write((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
    //printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
    uint8_t flush_tx();
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+

void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.println();
  uint8_t flush_tx();
}

RX code

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,9);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  //radio.setPayloadSize(12 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
typedef struct myBuff{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
myBuff;
myBuff StructBuff;

//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  radio.startListening();
    RecStruct();
   }

//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){

  radio.startListening();
  bool ok = radio.read((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
  //    printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
    uint8_t flush_rx();
  delay(10);

}

//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+


void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.println(); 
  uint8_t flush_rx();
}

i have changed the payload size and converted the struct to a regular struct with no luck. i can do it with unions and convert from floats and chars to bytes into an output array and send them i was just under the impression i could just use 1 struct and toss that across the link to the other one. anyone know if this is true or not?

You should be able to, post your code, how do you set the new payload size, if its not the exact size of the struct then you may have extra padding, or fragmented data.

Also, there is some more that can't be right ( RX sketch ).

RF24.h:
/**

  • Start listening on the pipes opened for reading.
  • Be sure to call openReadingPipe() first. Do not call write() while
  • in this mode, without first calling stopListening(). Call
  • isAvailable() to check for incoming traffic, and read() to get it.
    */

You call startListening twice at the start of every iteration of 'loop' ( once in RecStruct ). And I see no mention of 'isAvailable()' in your sketch.

Your TX sketch calls openReadingPipe, will openWritingPipe not suffice.

Your RX code does the same ( but opposite ).

i made the changes and out the radio calls for stop and listen into the setup like they had them in there examples and i flushed the buffers but when i added the radio.available() it worked. sort of. i only get MAX 4 loops and some times 1 or even 0 loops then i reset the RX and retry max 4 but most times less. here is my code also it's slow as hell when it does send a couple sets across like 2 sec or so.. Mirf on the other hand is sending it fine so i think i might just use RF24 to setup the radios and Mirf for Transmitting/Receiving.
(resetting TX side never seems to do any good)
TX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(20 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.stopListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct StructBuff_t {
  String GPS;  
  float imuRoll;
  float imuPitch;
  float imuYaw;
  unsigned int AP;
}
StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************

void loop()
{
float roll = random(-150,150);
float pitch = random(-150,150);
float yaw = random(0,360);
String gps = "This is my RF test";
unsigned int ap = random(0,75);

  StuffStructBuff(roll,pitch,yaw,ap,gps);  
   TransStruct();
 }
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){
  bool ok = radio.write((byte *) &StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
    //printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
   uint8_t flush_tx();
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+

void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.print(",");
  Serial.print(StructBuff.AP);
  Serial.println();
  Serial.print(StructBuff.GPS);
  Serial.println();
  uint8_t flush_tx();
}
void StuffStructBuff(float inRoll, float inPitch, float inYaw, unsigned int inAP, String inGPS){//**Working**
  StructBuff.imuRoll = inRoll;  
  StructBuff.imuPitch = inPitch;  
  StructBuff.imuYaw = inYaw;  
  StructBuff.AP = inAP;  
  StructBuff.GPS= inGPS;    
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(20 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.startListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct StructBuff_t {
  String GPS;  
  float imuRoll;
  float imuPitch;
  float imuYaw;
  unsigned int AP;
}
StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
    RecStruct();
    }

//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){
  if ( radio.available() )
    {
  bool ok = radio.read((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
  //    printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
    uint8_t flush_rx();
    }
  delay(10);

}

//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.print(",");
  Serial.print(StructBuff.AP);
  Serial.println();
  Serial.print(StructBuff.GPS);
  Serial.println();
  uint8_t flush_rx();
}

OutPut on RX Side

-143.00,-101.00,113.00,8
This is my RF test
-127.00,-41.00,0.00,65
This is my RF test
-147.00,19.00,189.00,32
This is my RF test
-34.00,85.00,97.00,26
This is my RF test

Cyric:

struct StructBuff_t {

String GPS; 
  float imuRoll;
  float imuPitch;
  float imuYaw;
  unsigned int AP;
}
StructBuff;

That's never going to work, because the String class is just a wrapper class which holds the actual string content in a memory buffer allocated from the heap. The String field in the struct will just contain a pointer to the memory buffer, and not the message content. Of course, sending a pointer from one Arduino to another is utterly ... ahem ... pointless.

Additionally, use of the String class exposes you to a bug in the memory allocation library which causes memory corruption, possibly rendering your whole sketch unstable.

If you need to send character data within the message, do it by including a fixed size char array in the struct.

But for the moment I'll repeat my suggestion that you step back from the problem and replace the code sending this struct with code that just sends a hard-coded string, and prove that you can send and receive that reliably before you start trying to figure out why your struct doesn't work.

ahh so the locking up is result of Strings? ok ill make a char array i guess and see how it goes. i love RF24s radio control so i would love to use it.

So i took out everything unneeded and setup just a float struct to transmit and added the Start/Stop listining to the setup and flush the buffers on the TX side on fails and RX side on a sucess or fail to make sure i am always geting fresh data on the RX side. I still run into a prob with it only transmitting like the first 1 or 2 or so packets and then stops if i reset RX i "might" get a packet to take. here is my code so far.

TX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(14 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.stopListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct imuBuff_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  //////////////////////////////  
  imuBuff.imuRoll  = 31.99;   //
  imuBuff.imuPitch = -150.82; //Temp Values
  imuBuff.imuYaw   = 3.60;    //
  //////////////////////////////
  TransStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){

  bool ok = radio.write((byte *) &imuBuff, sizeof(imuBuff));
  if (ok) 
    printbuffs();
  else  
    printf("failed.\n\r");
  uint8_t flush_tx();
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println();
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(14 * sizeof(byte));
  radio.setChannel(2);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.startListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct IMU_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  RecStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){
  if ( radio.available() )
  {
    bool ok = radio.read((byte *)&imuBuff, sizeof(imuBuff));
    if (ok) 
      printbuffs();
    else  
      printf("failed.\n\r");
      uint8_t flush_tx();  
}
  delay(10);

}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println(); 
  uint8_t flush_rx();
}

Output RX side

31.99,-150.82,3.60

but just the first packet most of the time.

This code on the tx side appears to declare a function 'flush_tx()' which is never defined or used. It appears on the receiver side too. You probably want to get rid of that.

You are explicitly setting the payload size, channel, CRC options. I suggest you don't bother. At best, these will make no difference - at worst, they will introduce errors.

I would have suggested that when setting the payload size you should set it to the actual size of the structure you're sending rather than to a hard-coded size which is assumed to be the same, but I have already suggested that you don't set the payload size.

You are not setting the retry count and retry interval. I suggest you do:

  radio.setPALevel(RF24_PA_HIGH);
  radio.setRetries(15, 15); // set the number of retries and interval between retries to the maximum

You are sending packets at a huge rate. I suggest you throttle this down to e.g. once per second.

(If you change the sender radio settings, remember to update the receiver settings to match.)

You don't clear the receiver buffer before doing the receive, so you will never know whether data you're seeing was actually received, or is garbage left behind from a previous message.

You don't clear the receiver buffer before doing the receive, so you will never know whether data you're seeing was actually received, or is garbage left behind from a previous message.

thought that i was with the flush(). but i read they were not accessible to users they were hardware calls. so how do i go about flushing the buffer?

You might want to consider looking over Bill Porter's excellent EasyTransfer library. He uses a similar method of using defined structures for both the sender and receiver and includes error detection in the packets sent and received. He has versions for both using serial and I2C buss transfers, and there is something in his cover sheet about using simple RF links?

So it may not be a complete replacement for what you are doing, but you may certainly learn a lot by checking out his source code.

Lefty

Cyric:
so how do i go about flushing the buffer?

imuBuff.imuRoll = 0;
imuBuff.imuPitch = 0;
imuBuff.imuYaw= 0;

PeterH:

Cyric:
so how do i go about flushing the buffer?

imuBuff.imuRoll = 0;

imuBuff.imuPitch = 0;
imuBuff.imuYaw= 0;

smacks head on keyboard.

%100 fail now

TX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
//radio.setCRCLength(RF24_CRC_16);
//radio.setPayloadSize(14 * sizeof(byte));
//radio.setChannel(2);
  radio.setAutoAck(true);
  radio.setRetries(5,1000);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.stopListening();
  radio.printDetails();

  //**************End Transiever (NRF24L01) config**************
}  
struct imuBuff_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  //////////////////////////////  
  imuBuff.imuRoll  = 31.99;   //
  imuBuff.imuPitch = -150.82; //Temp Values
  imuBuff.imuYaw   = 3.60;    //
  //////////////////////////////
  TransStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){

  bool ok = radio.write((byte *) &imuBuff, sizeof(imuBuff));
  if (ok) 
    printbuffs();
  else  
    printf("failed.\n\r");
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println();
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
//radio.setCRCLength(RF24_CRC_16);
//radio.setPayloadSize(14 * sizeof(byte));
//radio.setChannel(2);
  radio.setAutoAck(true);
  radio.setRetries(5,1000);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.startListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct IMU_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  imuBuff.imuRoll = 0;
  imuBuff.imuPitch = 0;
  imuBuff.imuYaw= 0;
  RecStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){
  if ( radio.available() )
  {
    bool ok = radio.read((byte *)&imuBuff, sizeof(imuBuff));
    if (ok) 
      printbuffs();
    else  
      printf("failed.\n\r");
     }
  delay(10);

}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println(); 
}

Cyric:
%100 fail now

Failing how? Does the transmit return success? Does the receive trigger once per transmitted packet? Does it return success? Does the received packet contain what you expected?

I'd suggest slowing the transmission down from 10ms (100Hz) to 1000ms (1Hz).

Have you successfully run the example sketches such as PingPair that come with the RF24 library? This would prove that you are using the correct SPI and CE/CS pins and that the hardware was working. (Out of a batch of nRF24L01+, I had several duds.)

Where did these values come from?

radio.setRetries(5,1000);

I checked my hardware after i was just gunna say yeah i can use the examples and noticed the connector i made was not holding tight to the NRF so i swaped out for a new one on my UNO and ran ping and worked fine. changing delay(10) will fail transmit/rec both even (11) or no delay. the 5,1000 was from trying to achieve less fail by telling it not to retransmit more than 5 times and wait 1 sec in between tries.

TX (uno)

Now sending 87...ok...Got response 87, round-trip delay: 24
Now sending 1112...ok...Got response 1112, round-trip delay: 22
Now sending 2135...ok...Got response 2135, round-trip delay: 21
Now sending 3158...ok...Got response 3158, round-trip delay: 21
Now sending 4179...ok...Got response 4179, round-trip delay: 23
Now sending 5202...ok...Got response 5202, round-trip delay: 23

RX(Mega2560)

Got payload 87...Sent response.
Got payload 1112...Sent response.
Got payload 2135...Sent response.
Got payload 3158...Sent response.
Got payload 4179...Sent response.
Got payload 5202...Sent response.

so i got excited and tried the old code.
but when i got back to the previous TX/RX code it is choppy send/rec and some fails. also if i chage it to even 11ms much less 1000 it is %100 fail agin.
Full code as it sits.

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
 // radio.setCRCLength(RF24_CRC_16);
//  radio.setPayloadSize(14 * sizeof(byte));
//  radio.setChannel(80);
  radio.setAutoAck(true);
//  radio.setRetries(15,15);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.stopListening();
  radio.printDetails();

  //**************End Transiever (NRF24L01) config**************
}  
struct imuBuff_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  //////////////////////////////  
  imuBuff.imuRoll  = 31.99;   //
  imuBuff.imuPitch = -150.82; //Temp Values
  imuBuff.imuYaw   = 3.60;    //
  //////////////////////////////
  TransStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){

  bool ok = radio.write((byte *) &imuBuff, sizeof(imuBuff));
  if (ok) 
    printbuffs();
  else  
    printf("failed.\n\r");
  delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println();
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,9);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setDataRate(RF24_2MBPS);
//  radio.setCRCLength(RF24_CRC_16);
 // radio.setPayloadSize(14 * sizeof(byte));
 // radio.setChannel(80);
  radio.setAutoAck(true);
  //radio.setRetries(15,15);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.startListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct IMU_t{
  float imuRoll;
  float imuPitch;
  float imuYaw;
}
imuBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
  imuBuff.imuRoll = 0;
  imuBuff.imuPitch = 0;
  imuBuff.imuYaw= 0;
  RecStruct();
}
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){
  if ( radio.available() )
  {
    bool ok = radio.read((byte *)&imuBuff, sizeof(imuBuff));
    if (ok) 
      printbuffs();
    else  
      printf("failed.\n\r");
     }
  delay(10);

}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(imuBuff.imuRoll);
  Serial.print(",");
  Serial.print(imuBuff.imuPitch);
  Serial.print(",");
  Serial.print(imuBuff.imuYaw);
  Serial.println(); 
}

TX

failed.
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
failed.
31.99,-150.82,3.60
failed.
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
failed.
31.99,-150.82,3.60
31.99,-150.82,3.60
failed.
failed.
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
failed.
31.99,-150.82,3.60
31.99,-150.82,3.60
failed.
failed.
failed.
31.99,-150.82,3.60

RX

31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60
31.99,-150.82,3.60

So it seems you know the hardware is sound, and it is capable of sending and receiving reliably.

As the next step, I suggest you make the radio settings in your sketches identical to the ones in the demo that worked.

I'm skeptical about your changes to the retry interval given this comment in the header:

  /**
   * Set the number and delay of retries upon failed submit
   *
   * @param delay How long to wait between each retry, in multiples of 250us,
   * max is 15.  0 means 250us, 15 means 4000us.
   * @param count How many retries before giving up, max 15
   */
 void setRetries(uint8_t delay, uint8_t count);

had never used .setRetries it before and saw it in a demo and looked it up on github had not saw the last statement about 15 max.

i did setup the radios like the pingpair example and they failed %100 of the time. it's a packet size issue so i had to change the packets and if i dont have * sizeof(byte) in there it fails. so as it stands only thing that works for the following sketchs is. SetpayloadSize(20 * sizeof(byte)); {anything above 20 works so 21 22 23 24}

TX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

RF24 radio(48,49);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setRetries(15,15);
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(24 * sizeof(byte));
  radio.setChannel(100);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0E1LL);
  radio.openWritingPipe(0xF0F0F0F0D2LL);
  radio.stopListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct StructBuff_t {
  float imuRoll;
  float imuPitch;
  float imuYaw;
  unsigned int AP;
}
StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************

void loop()
{
float roll = random(-150,150);
float pitch = random(-150,150);
float yaw = random(0,360);
unsigned int ap = random(0,75);

  StuffStructBuff(roll,pitch,yaw,ap);  
   TransStruct();
 }
//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void TransStruct(){
  bool ok = radio.write((byte *) &StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
    //printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
   delay(10);
}
//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+

void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.print(",");
  Serial.print(StructBuff.AP);
  Serial.println();
 }
void StuffStructBuff(float inRoll, float inPitch, float inYaw, unsigned int inAP){//**Working**
  StructBuff.imuRoll = inRoll;  
  StructBuff.imuPitch = inPitch;  
  StructBuff.imuYaw = inYaw;  
  StructBuff.AP = inAP;  
}

RX

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(8,9);
void setup(){
  Serial.begin(57600); 
  //**************Start Transiever (NRF24L01) config**************
  printf_begin();
  printf("\n\rRadio Setup\n\r");
  radio.begin();
  radio.setRetries(15,15);
  radio.setDataRate(RF24_2MBPS);
  radio.setCRCLength(RF24_CRC_16);
  radio.setPayloadSize(24 * sizeof(byte));
  radio.setChannel(100);
  radio.setAutoAck(true);
  radio.openReadingPipe(1,0xF0F0F0F0D2LL);
  radio.openWritingPipe(0xF0F0F0F0E1LL);
  radio.startListening();
  radio.printDetails();
  //**************End Transiever (NRF24L01) config**************
}  
struct StructBuff_t {
  float imuRoll;
  float imuPitch;
  float imuYaw;
  unsigned int AP;
}
StructBuff;
//**************************************************
//************* Start Main Loop section ************
//**************************************************
void loop()
{
    RecStruct();
    }

//**************************************************
//************* END Main Loop section***************
//**************************************************
//-+-+-+>>>> Start Struct Transmit section<<<<<<-+-+-+
void RecStruct(){
  if ( radio.available() )
    {
  bool ok = radio.read((byte *)&StructBuff, sizeof(StructBuff));
  if (ok) 
    printbuffs();
  //    printf("ok...\n\r"); 
  else  
    printf("failed.\n\r");
    }
  delay(10);

}

//-+-+-+>>>> END Struct Transmit section<<<<<<-+-+-+
void printbuffs(){
  Serial.print(StructBuff.imuRoll);
  Serial.print(",");
  Serial.print(StructBuff.imuPitch);
  Serial.print(",");
  Serial.print(StructBuff.imuYaw);
  Serial.print(",");
  Serial.print(StructBuff.AP);
  Serial.println();

}

TX output

-127.00,-41.00,0.00,65
failed.
-23.00,79.00,160.00,37
failed.
failed.
-34.00,85.00,97.00,26
failed.
-71.00,-101.00,99.00,21
failed.
35.00,95.00,308.00,16
failed.
58.00,94.00,28.00,65
failed.
-128.00,16.00,189.00,74
failed.

RX

-127.00,-41.00,0.00,65
-23.00,79.00,160.00,37
-34.00,85.00,97.00,26
-71.00,-101.00,99.00,21
35.00,95.00,308.00,16
58.00,94.00,28.00,65
-128.00,16.00,189.00,74

so size of the struct is 20 it seems. as for the timing man it's slow bout 1.5 updates per sec was hoping for 3 or 4 per sec.

The send failures suggest that your radio connection may be marginal and not working reliably with the bigger payload sizes. You could try reducing the data rate and increasing the power levels on both sides. (I seem to remember that your earlier code already did this without success, but I'm not sure.)

When setting the payload size I suggest you use sizeof(StructBuff) rather than hard-coding the size.

You're filling the buffer the hard way. Wouldn't it be easier to just assign values to the fields directly?

StructBuff.imuRoll = random(-150,150);
StructBuff.imuPitch = random(-150,150);
StructBuff.imuYaw = random(0,360);
StructBuff.AP = random(0,75);

I'm at a loss to explain why the transmission is taking so long. You could put code in to measure the elapsed time for the call to radio.write() and see if the delay is happening there? I don't see any other sources of delay except the serial output so I would have expected it to run much more frequently than that, unless you've added delays you haven't shown us.