Pages: [1]   Go Down
Author Topic: Cable Select PIN held HIGH on Ethernet Shield?  (Read 506 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Howdy!

We've been working on a project called RiderScan for some months now using an Arduino Mega 2560, an Ethernet shield and various other components from Adafruit (Forum post Here: http://forums.adafruit.com/viewtopic.php?f=25&t=22139 )

We ran into a problem with the SPI bus that I was hoping someone might have some insight into how to solve.. Right now we have 3 different components that want to use the SPI bus; the Ethernet Shield, an RFID reader breakout board and the Adafruit Wave shield's SD card. I can get the Wave shield SD card and the RFID reader to work together on the SPI well, the board will scan targets and Wave shield will render voice files in response. However when we actually try to invoke the Ethernet shield to send packets to a server or try to sync with a time server, the system always locks up.

My partner found in documentation that the Cable Select PIN might be the problem - in that when one invokes the Ethernet Shield, it will peg it's Cable Select PIN (#10) High and keep it there - thus hogging the SPI bus and preventing anything else from using it. The Ethernet Shield can complete it's task, so it may actually be after the network task is complete the Ethernet Shield isn't freeing-up the SPI bus. When the Wave shield or RFID card tries to invoke the SPI again, two Cable Select PINs would be set high and the system locks up.

I've tried a number of methods to get around this, including stopping and starting the SPI bus after each network operation, trying to use the SD card slot on the Ethernet shield itself - both leading to the same demise. It seems that I can't use anything else on the SPI other than the Ethernet shield - but I think it more likely that we're missing something...

Has anyone experienced this or know how to make the Ethernet Shield play nice with other peripherals on the SPI?

Thanks!

Kris
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12483
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


There are threads describing the same/similar problems. The trick is that you disables all SPI devices except the one you are addressing.

Easiest way is write three functions, something like: (code not tested)
Code:
EnableEthernet()
{
  digitalWrite(SSRFID, HIGH);
  digitalWrite(SSWAVE, HIGH);
  digitalWrite(SSETHER, LOW);
}
EnableRFID()
{
  digitalWrite(SSETHER, HIGH);
  digitalWrite(SSWAVE, HIGH);
  digitalWrite(SSRFID, LOW);
}
EnableWave()
{
  digitalWrite(SSETHER, HIGH);
  digitalWrite(SSRFID, HIGH);
  digitalWrite(SSWAVE, LOW);
}
These will disable all SPI devices before you do the wanted SPI operations.

HOpes this helpes,
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

robtillaart,

Thank you!! smiley

I'll give that a try and see how it works.

Much appreciated. smiley

Kris
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

robtillaart,

THANK YOU!

This method worked perfectly. smiley

Much appreciate the help!

Cheers,

Kris
Logged

Pages: [1]   Go Up
Jump to: