[help] Ethernet shield + RF905

Dear guys,

I have a problem with my small project. I want to make an E-health remote sensor platform. I used RF905 Z-wave transmission to send data between two Arduino UNO modules. I bought Ethernet Shield for Arduino (DFRduino) and there is small - big problem. When I try to send data, receiver get nothing, only empty bits. What is wrong? Does Ethernet Shield and RF905 use the same pins on the same time? Do you have any solutions on it ?

Greetings from Poland,
Kasia

They both use the SPI bus, so they do use three pins in common. The MOSI, MISO and SCK are common. The slave select needs to be different. That is the CSN pin on the nRF905 and D10 on the ethernet shield. How do you have them connected?

I connected Ethernet Shield to Arduino Uno and nRF905 to Ethernet Shield as it was in datasheets.

Now nRF905 is connected to Ethernet Shield like here:

If I understand you good - I need to change CSN pin from D10 to other free digital port and after that change it also in the library of nRF905 ?

podbirdm:
If I understand you good - I need to change CSN pin from D10 to other free digital port and after that change it also in the library of nRF905 ?

Yes. But that is not all. There is a specific way you must initialize each device. Like if you want to test your nRF905, the only thing you need to do is disable the w5100 SPI in setup.

void setup() {
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);

  // rest of your setup
}

OK so what I did :

  1. I used example code NRF905 for transmitter and receiver. Communication was working without Ethernet Shield.

  2. I found function on file : nrf905.cpp :

NRF905::NRF905(int css)
{
    TXEN=5;
    TRX_CE=4;
    PWR=3;
    CSN=css;
    AM=9;
    DR=8;
    CD=7;
}
  1. After that I edited the code of receiver:
void setup()
{
    pinMode(10,OUTPUT); 
    digitalWrite(10, HIGH);
    
    pinMode(6,OUTPUT);
    nrf905=NRF905(6);

   .... //other configuration functions
}

I moved pin CSN of nRF905 from D10 to D6 on Ethernet Shield and I disabled pin D10 in program.
So I made what you said - but it still does not work, the receiver connected to Ethernet Shield gets only empty bits..
Where did I make a mistake ?
I did not add any code for Ethernet Shield. Should I add something like library or maybe some part of setup ?

No need to add the include file for the ethernet shield if you are not using it. Disabling the w5100 SPI should disable the SPI interface on it.

However, that is not a Arduino ethernet shield. It is from DFRobot. I found a schematic, but it is not like the Arduino model.

http://www.dfrobot.com/wiki/images/5/52/Ethernet_shield_SCH.png

I'm not sure what difference is in the circuit boards.

Thank you for the answer. I found a few solutions on the Internet but thay did not solve my problem.

The problem is when I connect two MOSI pins together on the same time - even if I disable SS pin of ethernet shield, I do not receive any data packets on other Arduino UNO module.
Strange thing.

Even on Arduino page I found diagram like that:

but it does not work correctly in my case.

That diagram is correct. That is exactly how it should work.

If that were my ethernet shield, I would perform a simple test to see if the w5100 is releasing the MISO line. That would be the only situation where that would cause a failure of the SPI bus.

Remove the nRF905 connections to the Arduino/shield.

Compile and upload this code.

void setup() {
  // disable the w5100 SPI
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
}

void loop() {
}

Then use a 1K resistor with one lead connected to D12 (MISO) and the other lead connected alternately to 5v and Gnd. Check the voltage on D12 with a voltmeter. It should change depending on where the other lead of the resistor is connected. If it doesn't show close to 0v when the lead is connected to Gnd, and close to 5v when connected to 5v, the w5100 is not releasing the MISO line. That would be bad!

edit: You might try that same test on D11 (MOSI) to see if there is a problem there.

I checked it - but it works correctly..
Any others ideas ?

Check D13 (SCK) the same way. Since you are not connecting anything to D2 (maybe w5100 INT), I can't think of anything else that would cause that fail, but that would be with an Arduino ethernet shield. I rechecked that schematic, and if it the the correct shield, there should be no problem.

At this point, I would check all Arduino pins that connect to the nRF905 the same way, just to insure none of those pins are "stuck" by the ethernet shield. D3, D4, D5, D7, D8, D9.

edit: One more check. Where did you get the library for the nRF905? A link to that site/page would be good.
And posting your code would be most helpful.

I used 0,8k resistor I get measurements like that:

between D13 and GND = 0V
between D13 and 5V = 1.3V
between D12 and GND = 0V
between D12 and 5V = 4.6V
between D11 and GND = 0V
between D11 and 5V = 0V
between D10 and GND = 4.65V
between D10 and 5v = 0V
between D9…3 and GND = 0V
between D9…3 and 5V = 0V

Now I am using standard example code for nRF905 from website:
http://www.electrodragon.com/w/index.php?title=NRF905_Transceiver_433MHz-Wireless_Module

I changed it like you said and now main program for receiver is looking like :

#include <NRF905.h>
#include <SPI.h>
#define BUF_LEN          32
#define CONF_LEN         10

unsigned char rx_buf[BUF_LEN]= {0};
unsigned char read_config_buf[CONF_LEN];
unsigned char rx_address[4]= {10,0,0,1};

void putstring(unsigned char *str)
{
    while(*str){
        Serial.write(*str++);
    }
}

void setup()
{
    char i;
    pinMode(10,OUTPUT);
    digitalWrite(10,HIGH);
    pinMode(6,OUTPUT);
    nrf905=NRF905(6);
    nrf905.init(); 

    nrf905.write_config(US); 	
    nrf905.read_config(read_config_buf);
    Serial.begin(9600);
    
    /** test configuration */
    for(i=0; i<CONF_LEN; i++){
        Serial.print(read_config_buf[i],HEX);
        Serial.print(' ');
    }
    
}

void loop()
{
    nrf905.RX(rx_buf);
    putstring(rx_buf);
    delay(1000);
}