Please explain:SPI uses pin 11->13 on the uno and pins 50->52 on the Mega

Hi
I'm not an electronics engineer and as such I completely fail to understand the statement: "Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega." found on this page Ethernet - Arduino Reference
I mean pins 50 to 52 are not connected to the shield. So how can these pins be used by the shield?
Does this mean I can not use pins 50, 51, and 52 of the mega when I use SPI?
As pins 11, 12 and 13 on the mega are PWM pins are pins 50 51 and 52 PWM pins? (as to the documentation not) http://arduino.cc/en/Main/ArduinoBoardMega2560
if pins 11, 12 and 13 are PWM pins and replaced by 50, 51 and 52 do I lose the PWM functionality?

I searched the forum but I didn't find an answer I could understand, I guess I miss some basic information to get to understand this.
Anyone willing to fill the gap?
Best regards
Jantje

I completely fail to understand the statement

It is not really necessary to understand it. It is a fact that you must respect. Like Ohms law or gravity.

I mean pins 50 to 52 are not connected to the shield. So how can these pins be used by the shield?

Not directly, but indirectly, through the ICSP header, they are.

Does this mean I can not use pins 50, 51, and 52 of the mega when I use SPI?

You are using them. For SPI. You can't also use them for other purposes.

As pins 11, 12 and 13 on the mega are PWM pins are pins 50 51 and 52 PWM pins?

No.

if pins 11, 12 and 13 are PWM pins and replaced by 50, 51 and 52 do I lose the PWM functionality?

I don't understand the possible cause and effect you have outlined here. The ethernet shield on the Mega does not use pins 11 to 13. Therefore, there is no loss of PWM functionality.

Hi Jantje,

I was confused by this when I started out as well, hopefully this will help.

The CPU chips that the Arduino (ATMega328) and Mega (ATMega2560) support SPI in the hardware itself. The SPI library just accesses this hardware.

For whatever reason, on the basic chip the SPI pins are on 11-13, but on the Mega they're on 50-52. It was probably a tough decision for the Arduino team to move the physical pins on the Mega so shields that use SPI would work with both boards, but my guess is they went with keeping the pins in the same order so programming is easier.

I ran into this problem myself; I had a regular Ethernet board and couldn't get it to work with the Mega. After wasting a couple of days I came across this web page

http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/

which explains it better than I can.

I hope this helps, good luck!

Chris

Chris, Paul
Thanks for the quick reply.
With the link to the old way from Chris and the answers to my questions from Paul It all makes sense now.
I never really understood what these extra SPI pins were for. I guess I understand that now XD
As I see it now: On the uno pins 11,12 and 13 are connected to the SPI pins
on the mega pins 50, 51, 52 are connected to the SI pins.
The newer version of the Ethernet shield ( the one not needing the hack) uses the SPI pins and does not directly connect to pins 11, 12 and 13.
Therefore: if I use a mega with an Ethernet shield only pin 1O is in use. I can use the pins 11,12 and 13 for something else. XD
If this is true I may not need the PCB on which I have been working for more than a week now. :astonished:

Best regards
Jantje

If this is true

It is.

Hi,

I would like to join this topic about SPI. Have Uno and Meda2560 boards with touch 2,4" TFT incl. SD card. Touch & display works OK on both boards without any modification of library, but SD card initializes only on Uno, on Mega fails. As I googled out it is due to SPI and "software SPI" should be used on Mega2560. But didn't find any "for me clear example" how-to :frowning:

Any help appreciated.
Thanks

As I googled out it is due to SPI and "software SPI" should be used on Mega2560.

I'm not sure where you read that, but it is wrong. It the SD card IS connected to the SPI pins, correctly, the device will initialize just fine.