nRF905 Configuration & Use

I have spent far too much of today trying to get two nRF905s talking. My main focus today was to get the two configured correctly. My application is to have one nRF905 in a start gun at a race and one attached to the timer to receive the start signal from the gun. I only need to send a very limited (5-10) number of discrete pieces of data so a one byte payload is plenty. I’m not sending time values, just states. Currently, I am using two Arduino Unos and level shifters for outputs (nRF905 are 3.3v).

I read through the datasheet (link below) and understand the configuration options and what I want.
I have compiled a configuration (below) of bytes. In essence, it sets the frequency to suit Australia, sets power, TX and RX address size, payload size, RX address (0xABBADCCD) and CRC settings. I am confident in the settings I have chosen.

0x7F,0x0F,0x44,0x01,0x01,0xAB,0xBA,0xDC,0xCD,0x5B

I am using the library from Electrodragon (link below) which I found simpler and easier to understand than Zak Kemble’s library (link below). I did manage to get the two radios communicating with the ping example with Zak’s library. The TX and RX examples in Electrodragon’s library did not work (after addressing the compile error previously mentioned here) however. I attributed this to incorrect (and inconsistent) configurations. I have checked briefly over the configuration part of the library and it is what I would expect it to be.

So, my problem. I wrote a sketch to set the configuration and read it back to serial to check on the computer. And naturally it returns the wrong (existing) configuration. I can’t figure out why it isn’t writing the configuration.
Covered so far:

  • When the library initializes the chip, it puts it in the Standby and SPI programming mode (in 8.2 on Datasheet). SPI communication is said to work in any state though. I have also tried Powered off State.
  • The instruction to write configuration inlcudes which byte to start from, I have checked the library and it’s set to start from byte 0, as expected.
    I haven’t seen anything else in the datasheet about putting the chip in a certain state to set the config settings. Any thoughts on why this isn’t working for me. Help appreciated. I hope I’ve provided plenty of info.

Config Sketch:

#include <NRF905.h>
#include <SPI.h>

#define CONF_LEN         10
#define NRF905_CSN       10
unsigned char read_config_buf[CONF_LEN];
unsigned char write_config_buf[CONF_LEN] = {0x7F,0x0F,0x44,0x01,0x01,0xAB,0xBA,0xDC,0xCD,0x5B};

void setup() {
    Serial.begin(9600);
    pinMode(NRF905_CSN, OUTPUT);
    nrf905 = NRF905(NRF905_CSN);
    nrf905.init();
    
    //digitalWrite(3, LOW); //Power Down Mode (still accepts SPI)
    
    nrf905.write_config(write_config_buf);
    nrf905.read_config(read_config_buf);
    
    //Print out desired Config
    Serial.print("Desired Config {");
    for(int i=0; i<10; i++) {
        Serial.print(write_config_buf[i],HEX);
        Serial.print(' ');
    }Serial.println("}");
    
    //Print out chip Config
    Serial.print("Chip Config {");
    for(int i=0; i<10; i++) {
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }Serial.println("}");
}

void loop()
{
    delay(50);
}

Datasheet: http://www.electrodragon.com/w/images/7/74/Product_Specification_nRF905_v1.5.pdf
Electrodragon Library: http://www.electrodragon.com/w/NRF905
Zak Kemble’s library: http://blog.zakkemble.co.uk/nrf905-avrarduino-librarydriver/

I know only the nrf24L01 and the nrf905 uses even more Arduino pins !
The only things I can suggest are

(1) that your configuration differs considerably from the standard configuration in the data sheet. My first instinct would be to make a single change from the default to say RX_ADDRESS byte 0 and see if it accepts that and progress from there.

(2) The second thing could be to do some activity between your read and write attempts (say setting CSN HIGH, then LOW) to see if there is a problem in the implementation of these library functions:

nrf905.write_config();
nrf905.read_config();

respecting this from the data sheet:

9.2 SPI Instruction Set
The available commands used on the SPI are shown below. Whenever CSN is set low the interface
expects an instruction. Every new instruction must be started by a high to low transition on CSN.

Thanks for your response.

  1. I tried sending it the same config with a slightly different RX address and got a most interesting outcome… The first two bytes have changed, or shifted left… Does not repeat a left shift running it again.
Previous Config {F 1 0 0 0 80 80 C0 C0 0 }
Desired Config  {F 1 0 0 0 82 80 C0 C0 0 }
Chip Config     {1 0 0 0 0 80 80 C0 C0 0 }

There must be something to that. I’ll keep looking into it. I also noted, that after writing the above config, if I went and wrote my desired config in the previous post, it would change the resultant config back to what it was previously. So clearly, it is writing to it, I’m just not sure how…

Previous Config {1 0 0 0 0 80 80 C0 C0 0 }
Desired Config  {7F F 44 1 1 AB BA DC CD 5B }
Chip Config     {F 1 0 0 0 80 80 C0 C0 0 }
  1. The library does deal with the CSN pin correctly, pulling to LOW before the instruction, then HIGH after. I did also add to the start (shown commented) a digital write HIGh of CSN to ensure there is a HIGH to LOW transition.
void NRF905::write_config(unsigned char *conf_buf)
{
	digitalWrite(CSN,LOW);						// Spi enable for write a spi command
	/** send write configuration command */
	SPI.transfer(WC);
	for (int i=0;i<10;i++)	// Write configration words
	{
	   SPI.transfer(conf_buf[i]);
	}
	digitalWrite(CSN,HIGH);					// Disable Spi
}

Thanks for your help. I’ll keep having a play…