So i have these components:
- Arduino Mega ADK
- Arduino WiFi Shield
- Gameduino 2 (Scroll down for Pins)
And im trying to stack them on top of each other. However i had to place the SCK, MISO, MOSI pins of the Gameduino at pin 50-52 (Where they are located).
The shields worked fine individually, all of the example codes worked terrific.
Then i attempted to stack the Gameduino 2 Display at the top of the Wifi Shield (Pin 50-52 still used for SPI)
At first, it didnt work, until i set Slave Select for Wifi before the initializing function for GD2 Library.
void setup() {
pinMode(SSWiFi, OUTPUT);
digitalWrite(SSWiFi, HIGH);
GD.begin();
:
: <so on>
}
But, As soon as i use any of the functions (my normal tests uses WiFi.status() ) of the WiFi library, The screen stops completely.
When reading a bit in the Wifi Library code i found:
uint8_t WiFiDrv::getConnectionStatus()
{
WAIT_FOR_SLAVE_SELECT();
// Send Command
SpiDrv::sendCmd(GET_CONN_STATUS_CMD, PARAM_NUMS_0);
//Wait the reply elaboration
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _data = -1;
uint8_t _dataLen = 0;
SpiDrv::waitResponseCmd(GET_CONN_STATUS_CMD, PARAM_NUMS_1, &_data, &_dataLen);
SpiDrv::spiSlaveDeselect();
return _data;
}
What i can get from this, The Wifi Library should handle the SPI by itself, but i dont know how their solution for multiple stacking of shields would be. (Long time googlin' hasnt helped at all).
The slave selects that exists are: GPU select, SD Select on Gameduino2; SD Select and SS WiFi on the Arduino WiFi Shield.
Basically my questions are:
- How does the WiFi library handle the SPI and How do you use it with other Shields?
- Is my SPI Setup strange in any kind of manner?
- (Having the WiFi shield be connected to ICSP Header, and the Gameduino on Megas SPI Pin 50-53 )*
- How does WiFi shield handle SPI on Mega ADK when its not even connected to the 50-53 pins.
In theory the setup should work. as no pins are colliding, both shields worked individually, when stacked the Display Worked when not using the Wifi.
Any kind of input would be gladly appritiated