[Solved] Question about ICSP and SPI

I’m working on

and I had stacked these shield and after 2 days digging, I resolved SPI SS problem
but it’s not clear…

The WiFi shield and the MP3 Player Shield both uses 11, 12, 13 for SPI communication.
but I can’t find any connection from D11, D12, D13 on the WiFi shield itself and schematic (see blue box in the picture)
but there is connections between ICSP pins. (see red box in the picture)

Please look at picture I attached.

Does WiFi shield not use D11, D12, D13 ??
But It seems that the wifi shield library sets up D11, D12, D13 pins as MISO, MOSI, SCLK.

How is that possible?

wifi_shield.png

Wifi connects at the ICSP header, MP3 shield connects at the female headers.

Yes, WiFi shield seems to be connected to arduino through ICSP…

but spi_drv.cpp of WiFi library shows following …

pinMode(SCK, OUTPUT);
pinMode(MOSI, OUTPUT);
pinMode(SS, OUTPUT);
pinMode(SLAVESELECT, OUTPUT);
pinMode(SLAVEREADY, INPUT);
pinMode(WIFILED, OUTPUT);

And… “pins_arduino.h” defines SCK, MOSI

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  const static uint8_t SS   = 53;
  const static uint8_t MOSI = 51;
  const static uint8_t MISO = 50;
  const static uint8_t SCK  = 52;
#else
  const static uint8_t SS   = 10;
  const static uint8_t MOSI = 11;
  const static uint8_t MISO = 12;
  const static uint8_t SCK  = 13;
#endif

https://code.google.com/p/arduino/source/browse/trunk/hardware/arduino/cores/arduino/pins_arduino.h

That means SPI driver in WiFi shield library defines pin number 10 ~ 13 (I’m using UNO)
but hardware connection is ICSP pins.

If your last post is a question, then the SPI data lines are duplicated on the ICSP pins. On the Uno, the ICSP pins are connected to D11-D13, and on the Mega, the ICSP pins are connected to D50-D52.

The hardware connection could be made from either set of pins. Most newer shields use the ICSP pins to maintain SPI compatibility with the Mega and the Leonardo.

To: SurferTim

Yes, I think there is connection between D11 ~ D13 and ICSP.
But the Schematic of wifi shield doesn't show the connection between them.
I attached image in my first post and marked it with blue box.

Why the author of the schematic didn't draw a line
between ICSP and D11~D13 if they are connected ?

They do not need to be connected on the Wifi shield, only on the Arduino. The wifi shield and the ethernet shield use the ICSP pins for SPI data lines. The ethernet shield does not use D11-D13 either. Nothing connected to those pins.

// SurferTim

Ah ha... I understood.
Thank you for your kindness. It's really helpful.