Wiznet 5100 Shield plus multiple SPI devices (again)

Hi,

I've done the due diligence and tried to find an answer to my question in this forum, but...

I've picked up half a project using four quadrature demodulators on the SPI bus and I've been asked to make the whole thing Ethernet based. So I've got a Wiznet 5100 shield on a Mega2560 and it works perfectly. Obviously the shield is SPI based.

This worries me. I've got control of the quadmods so bus contention won't be an issue there, but the operation of the Ethernet is completely beyond my control insofar as incoming messages can occur at any time. Still it works ok.

The quadmods have their SS asserted followed by SPI.transfer then deasserted as required. I assume that I'm going to have to work out how to ensure that bus contention doesn't occur by modifying the Ethernet source (which I have) to allow negotiation with the other devices (I will also be using the SD card).

What I can't seem to find is anyone else discussing the need to mod the Ethernet library. Am I missing something? Have I failed to understand the operation of the SPI bus?

Thanks

John

I assume that I'm going to have to work out how to ensure that bus contention doesn't occur by modifying the Ethernet source

No, as long as you don't call any Ethernet method the library won't use the SPI bus. If you call an Ethernet method while any of your other devices CS pin is low, it's definitely your fault.

Have I failed to understand the operation of the SPI bus?

I guess you didn't understand the operation of the WizNet5100 or the Ethernet library. The complete TCP/IP stuff is done inside the W5100, a buffering of incoming packets is also done in the chip. So there's no interrupt (or something equivalent) that may take over the SPI bus at any time (I guess that were your thoughts).

You understood my (flawed) thinking perfectly. Another great answer. Cheers. I can get on and worry about something else now.