Pages: [1]   Go Down
Author Topic: Using two shields together  (Read 613 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I plan on buying and setting up an Arduino Ethernet, a Gamedunio and an Input Shield together, however since the Ardunio only has a small number of input pins, I am concerned the three items won't work together.

Could someone please tell me if these will work together, and if not how I can make them work or where I can find alternatives to the above items?

Thanks,

theg

P.S.: Apologies if this is in the wrong forum, I wasn't entirely sure where I should post this.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Ethernet and Gameduino both use SPI.  While it is possible to use multiple devices on the same SPI bus each one needs its own Chip Select signal.  You may need to do some hacking around hardware wise to re-route different pins to use as the CS pins for the different modules.

Then there's the libraries.

Seldom do people write libraries that use SPI that are friendly towards each other.  Getting the software to work with those two might be a bit of a mare.

The input shield is just buttons and pots attached to digital and analog inputs, so should work fine with the others.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

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

Hi theg,

I did not use an Arduino Ethernet, but I recently used a close configuration.
I pluged a Ethernet shield and a Gameduino shied on an Arduino Mega 1280, and both shields work very fine together.

I assume that in your and my case, the SPI bus handling is the same.
The SPI bus is shared by the Ethernet W5100 chip, the SD card chip and the Gameduino chip.
Your application has just to handle their selection when needed through different CS (chip select) pins:
Code:
#define ETHERNETSHIELD_SDCARD_CS  4  // CS of the SD card chip
#define ETHERNETSHIELD_W5100_CS  10  // CS of the Wiznet W5100 ethernet chip
#define GAMEDUINO_CS  9  // CS of the Gameduino chip

The CS enabling or disabling is already handled by the Gameduino library, but doesn't seem handled by the Arduino Ethernet library (I did not have time to check directly in the library)
In my case I had to enable the Gameduino CS before the Ethernet connection and to disable it after the Ethernet disconnection.
Here is the simple code sample to select the Ethernet chip:
Code:
pinMode(ETHERNETSHIELD_W5100_CS, OUTPUT);
digitalWrite(ETHERNETSHIELD_W5100_CS, LOW); // select the Wiznet W5100 ethernet chip

WARNING
For non Arduino Ethernet users, the Ethernet shield using the ICSP header, it must be the bottom shield in the Arduino shield stack
For Arduino Mega 1280 users, the SPI connection is specific: See http://answers.gameduino.com/question/46/mega-2560-compatibility.

I hope this could help you.
Franck Durand
Logged

Pages: [1]   Go Up
Jump to: