Sharing SPI bus wth ethernet shield

Hi all

Has anyone experience of using the SPI bus for the ethernet shield (W5100) and another SPI device? Are the ethernet and SPI libraries robust in releasing CS when they can?

I want to also connect an NRF24L01 transceiver and use the ethernet to do some remote logging and control.



You can always do the SPI transfers using other pins and just bit bang them, there is no need to use the dedicated hardware.

Here is some idea of the code to use on any GPIO:-

void spiWrite(byte data){ 
  shiftOut(MOSI, SCK, MSBFIRST, data); // send to spi output

byte spiRead(){
  byte value=0;
  for(int i = 0; i<8; i++){
    value = value << 1; // shift up for next byte read
    value |= ( digitalRead(MISO) & 0x1); // add the next bit to the value
      digitalWrite(SCK,LOW);  // put clock low at the end
  return value;

There’s a known problem with the Wiznet modules not releasing the MISO line when deselected.

I don’t remember, offhand, whether it’s a bug in the chip design or the module design. This matters because not all Ethernet shields use the module (the Adafruit ones I have do, but some have the 5100 chip right on the shield).

I think I’ve seen some postings indicating some people have worked around this, but I haven’t pursued it because I haven’t been hit by the problem in the projects I’ve done so far.

It's a chip flaw. They added an enable pin to do what it's supposed to do when you take CS inactive.

Some shields drive this line in conjunction with CS so that the shield behaves correctly (i.e. takes MISO hi-Z).


I was able to find a work around for this problem.

All you need to do is tie your CS for the secondary SPI device to to the PROG jumper (or place where a jumper should be) on the ethernet shield. This effectively shuts off the SPI interface on the WIZNET and pulls MISO into a high impedance state.

The prog jumper has two pins, you will want to connect to the one that is not tied to ground.

I hope this helps.


Thanks for the great info and ideas. I've ordered some of the radio modules and will report back on progress once I have them.

Best regards