enc28j60 ETH and second SPI device - second not working...

Hi guys!

Problem as in topic. I have ethernet shield based on enc28j60 wich is using standard 11,12 and 13 SPI pins and 10 as CS. I also have second shield with radio transciever nRF24L01+ that is using SPI pins 11,12,13 and 8,9 as CS and CSN.

Every shield is working with arduino, but when I put them together, upload code for eth, then eth is working, but when I put them together and upload code for nRF it is not working and I have no idea why. This is probably issue with my ETH shield, but I cannot find schematics for it. It has printout "Arduino Ethernet Shield V1.1" on top and small "Flamingo EDA (c) 2009" on bottom.

Does anybody have schematic for this eth shield or know how to make it work together with more SPI devices?

That looks workable. You must learn to juggle the SS pins. My rule is: only one SS pin is active (LOW) at a time. I take the previous device SS pin HIGH (inactive) before the next SS pin LOW (active). Something like this code snippet:

void loop()
  digitalWrite(10,HIGH); // disable ethernet SPI
  digitalWrite(8,LOW); // enable radio SPI
   // do radio stuff
   digitalWrite(8,HIGH); // disable radio SPI
   digitalWrite(10,LOW); // enable ethernet SPI
   // do ethernet stuff

What is CSN?

CSN = Chip Select Not but this is not important.

When make small tower: Arduino + Eth Shield + nRF Shield and then upload sketch for nRF it does not work. O fourse that I know to put pin 10 to high but that gives me nothing and I have no idea what is going on... It looks like enc is interferencing SPI.

Does the ethernet shield have a microSD slot on it?

When you try the radio sketch only (with the ethernet shield conected tho), are you using something like this?

void setup()
   pinMode(10,OUTPUT); // this is a must for Uno. This is pin 53 on the Mega.
   digitalWrite(10,HIGH); // again, pin 10 on the Uno, 53 on the Mega.
   pinMode(8,OUTPUT); // this is a must
   // do radio setup

Shield does not have SD slot.

I am making manually pin 10 HIGH to disable ETH Shield so yes, I am using this: pinMode(10,OUTPUT); digitalWrite(10,HIGH); in setup but enabling nRF should be done by RF24 library.

Maybe if you posted a link to the radio and the shield you have for it, that might help.

This schematic is not from my eth shield, but as I've noticed it is very similar (the same pins are in use): http://www.nuelectronics.com/estore/images/nustore/projects/ethshield_schematic.jpg

About nRF shield -> it is just this module: http://iteadstudio.com/store/index.php?main_page=product_info&products_id=53 mounted on universal shield PCB.

Libraries that are working for me separately: - EtherCard -> https://github.com/maniacbug/RF24/ - nRF24 -> https://github.com/jcw/ethercard both for Arduino 1.0

These are the connection instructions on the link you posted. You did not follow these, did you?

Connect the module pins to Arduino as below:

CS - D8 , CSN – D9 , SCK – D10 , MOSI – D11 , MISO – D12 , IRQ – D13

It should be SCK - D13

I don't know where the IRQ pin should go, but pin 13 is the SPI SCK pin on the Uno. And D10 is the SS for the ethernet shield.

Just checking everything.

IRQ is optional, rest of pins are connected correctly. Don't you understand that if I make setup arduino + nRF then it is working, but when I make setup arduino + eth + nRF it does not. Looks like ethernet shield is making sometning strange with SPI pins (on physical layer becouse we are talking about situation when I have only nRF code uploaded wich is working).

---edit--- Problem found! As I expected it lays in wrong desing of my ETH Shield. There is buffer made from AND gates 74HCT08D that are only two-state. To make it work with more SPI devices it has to be replaced with 3-state buffer 74AHC125D. More details about this operation here: http://john.crouchley.com/blog/archives/662