nRF24L01 and RF24Network error

I've managed to get these devices talking to each other and working with the RF24Network library.

I have a transmitter unit that is sending my data fine, up to a point.

After some period of time, as little as a minute if sending every 1 second, the receiver stops getting the data and I just get a stdout output, via printf, of:-

*** WARNING *** Invalid Address 0177777

Has anyone come across this and have any idea what the issue could be.

I'm sending a set of 4 data items consisting of 12 bytes, 2 ints and 2 longs.

struct payload_t{
int var1;
int var2;
long var3;
long var4;
}

The sending node is 1. The receiving node is 0. All they are currently doing is acting as transmit/receive respectively, although the network.update() function does do data retransmit in the background if there were other nodes and network traffic about, which there isn't in this instance.

I'm getting the data back out fine at the other end, and then transferring it via ethernet and a GET into a database on an internet site.

Like I say, it works fine for a period and then goes awry.

I just had a though as to whether this could be anything to do with the Wiznet5100 issue over not releasing the SPI bus properly?

I don't seem to be having any issues on a transmitting node that doesn't have an Ethernet shield.

A friend of mine is developing in parallel and he has seen the same error after a period of receiving.

EDIT: It looks like I have a clone of V5 of the Ethernet shield. It does look like it works OK as it happily receives data from the nRF and posts it to a webpage for insertion into a database. This happens about 50-60 times before it fails with the address error.

An update.

This issue seemed to be related to the nRF module itself being assigned an incorrect Node address.

After much head scratching I thought it might be something to do with timing, between the nRF relinquishing SPI and the Ethernet shield accessing. SS voltage drop/rise conflicts so that the SPI was still active for a cycle or two when the Ethernet started transferring data. I was guessing that the node settings were being corrupted somehow.

Anyway, I tidied up my demo sketch and inserted a delay between going from nRF to Ethernet and back again. This seemed to cure the problem when I set to 50ms and I gradually worked my way back, splitting 50% each time, through 25ms and 12ms.

Finally I tried no delay and it stills eems to be OK at the moment, so it could have been something dirty in my code after all.

Anyway, it looks like I have a handle on it for now, so thought I'd update here in case anyone else has the same problem and tries to troubleshoot.

I have an Ethernet shield and nRF24L01 radio on the breadboard - and can get each to work separately, but when I try to mix the code into one sketch - nothing works. I don't want to leave the desktop on to just send a few values to COSM, and thought I would try the Ethernet shield. I have tried with both of my shields - A new version 5, and and old Adafruit shield with Wiznet daughter board, both exhibit the same problem.

I am using the COSM Ethernet shield library and the RF24 Network library. I am thinking that since both share the same buss - that I need to shut the Wiznet chip down while trying to talk to the rf24, and visa versa - but so far am stumped.

I was wondering if you could share your code - I am completely stuck trying to get this to work....

For device that works with SPI you've got on it an CS pin that means ChipSelect or CSN chip not select. This pin must bu set to LOW to 'talk' to the device.

So from, may be you need to create for each device 2 functions :

For the NRF :

void EnableNRF() { digitalWrite(cs_NRF_Pin, LOW); delay(50); }
void DisableNrf() { digitalWrite(cs_NRF_Pin, HIGH); delay(50); }

And for the ethernet :

void EnableEthernet() { digitalWrite(cs_Ethernet_Pin, LOW); delay(50); }
void DisableEthernet() {digitalWrite(cs_Ethernet_Pin, HIGH); delay(50); }

May be the value of delay can bed reduced. But this is the idea of using multiple SPI devices on the same board.

I just look about the Nrf24 library from Maniacbug, each function is ok considering 'Freeing' the device. (look at the code).

May be you need to write only the Ethernet part.

You must also look at the SPI speed for the ethernet device, the Nrf (still in the code) works with theses parameters :

void RF24::csn(int mode)
{
  // Minimum ideal SPI bus speed is 2x data rate
  // If we assume 2Mbs data rate and 16Mhz clock, a
  // divider of 4 is the minimum we want.
  // CLK:BUS 8Mhz:2Mhz, 16Mhz:4Mhz, or 20Mhz:5Mhz
#ifdef ARDUINO
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);
  SPI.setClockDivider(SPI_CLOCK_DIV4);
#endif
  digitalWrite(csn_pin,mode);
}

May be the trouble starts from here if it's different from ethernet one.

Hope it can helps you.
Best Regards

add : Another would be to use an arduino pro mini that works very well with Nrf24 and create an small protocol to exchange datas with tx/rx pins with the board that own ethernet shield.